diff options
author | Bastien Nocera <hadess@hadess.net> | 2021-02-16 17:33:09 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2021-02-16 17:33:09 +0100 |
commit | e4a0471ad9a35820126ef2d836f117d58b949e58 (patch) | |
tree | 02f05ebe37eac63d94a497301e71425878b63c3f | |
parent | 7a502a217586bb254b0b34545d0510104c9bc6db (diff) | |
download | gnome-bluetooth-e4a0471ad9a35820126ef2d836f117d58b949e58.tar.gz |
tests: Run tests under Valgrind if requested
VALGRIND=1 meson test
will run the tests under Valgrind and print out all the output from the
memory leak detection tool.
-rwxr-xr-x | tests/integration-test | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/integration-test b/tests/integration-test index d0eaa188..ea7e8368 100755 --- a/tests/integration-test +++ b/tests/integration-test @@ -143,6 +143,10 @@ class Tests(dbusmock.DBusTestCase): (cls.p_mock, cls.obj_bluez) = cls.spawn_server_template( 'bluez5', {}, stdout=subprocess.PIPE) + cls.exec_path = [sys.argv[0]] + if os.getenv('VALGRIND') != None: + cls.exec_path = ['valgrind'] + cls.exec_path + @classmethod def tearDownClass(cls): cls.p_mock.stdout.close() @@ -158,8 +162,10 @@ class Tests(dbusmock.DBusTestCase): # Get the calling function's name test_name = inspect.stack()[1][3] # And run the test with the same name in the OopTests class in a separate process - out = subprocess.run([sys.argv[0], 'OopTests.' + test_name], capture_output=True) + out = subprocess.run(self.exec_path + ['OopTests.' + test_name], capture_output=True) self.assertEqual(out.returncode, 0, "Running test " + test_name + " failed:" + out.stderr.decode('UTF-8')) + if os.getenv('VALGRIND') != None: + print(out.stderr.decode('UTF-8')) def test_no_adapters(self): self.run_test_process() |