From f798e03e18de2c8ca684e08ecec28a9d3d90ce32 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Tue, 23 Feb 2021 08:35:34 +0100 Subject: #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. --- tests/run-tests.py | 13 ++++++++++--- 1 file 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']) -- cgit v1.2.3-18-g5258