summaryrefslogtreecommitdiffstats
path: root/tests/run-tests.py
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2021-02-23 08:35:34 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-02-23 10:53:00 +0100
commitf798e03e18de2c8ca684e08ecec28a9d3d90ce32 (patch)
tree45e9c1e4681cf4240e4eac73a6275c8b3a80dd15 /tests/run-tests.py
parenta46b69b5903d02e39f3ee5347a6ce6cc439c76b4 (diff)
#915 Add Valgrind to python tests
ogServer has some memory bugs we want to solve and avoid in the future. Run ogServer with Valgrind to help us find those errors.
Diffstat (limited to 'tests/run-tests.py')
-rwxr-xr-xtests/run-tests.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 17f6c64..840bf5e 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-import subprocess, glob, os
+import subprocess, glob, time, os
sql_data = "INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '192.168.56.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES ('pc2', '192.168.2.1', '0800270E6501', 1, 1, 0, 0, 0, 0, '192.168.56.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif'), ('pc2', '192.168.2.2', '0800270E6502', 1, 1, 0, 0, 0, 0, '192.168.56.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif');"
@@ -30,12 +30,19 @@ if os.path.isfile('../ogserver') is not True:
print('You need to build the ogserver binary to run these tests :-)')
exit()
+if os.path.isfile('/usr/bin/valgrind') is not True:
+ print('You need valgrind to run these tests :-)')
+ exit()
+
start_mysql();
-subprocess.Popen(['../ogserver -f config/ogserver.json'], shell=True)
+subprocess.Popen(['valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=./valgrind-out.log ../ogserver -f config/ogserver.json'], shell=True)
+
+print("Waiting 5 seconds for daemon to be read...")
+time.sleep(5)
subprocess.run('python3 -m unittest discover -s units -v', shell=True)
stop_mysql();
-subprocess.run(['pkill', 'ogserver'])
+subprocess.run(['pkill', '-f', 'valgrind'])