From ddd4181b39a0447c4d713dfc112c5472130dbbb0 Mon Sep 17 00:00:00 2001 From: Julian Kent Date: Wed, 21 Aug 2019 10:42:57 +0200 Subject: [PATCH] Don't run each functional test in a different process --- Tools/run-gtest-isolated.py | 54 --------------------------------- cmake/gtest/px4_add_gtest.cmake | 3 +- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100755 Tools/run-gtest-isolated.py diff --git a/Tools/run-gtest-isolated.py b/Tools/run-gtest-isolated.py deleted file mode 100755 index fe7290371d..0000000000 --- a/Tools/run-gtest-isolated.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -from sys import argv, stderr -from subprocess import call, check_output - - -def list_all_tests(bin_path): - out = check_output(['./' + bin_path,"--gtest_list_tests"]) - out = out.split("\n") - if len(out) > 1: - prefix = '' - tests_list = [] - for token in out: - if len(token) == 0: - continue - if token[-1] == '.': - prefix = token - continue - if token[0] == ' ' and token[1] == ' ' and len(token) > 0: - tests_list.append(''.join([prefix, token[2:]])) - continue - - return tests_list - - else: - return [] - - - -def run_tests(bin_path, tests_list, args): - for test in tests_list: - call_args = ['./' + bin_path, ' '.join(args), '--gtest_filter=*{}'.format(test)] - print(' '.join(call_args)) - result = call(call_args) - if result != 0: - return result - return 0 - - - -def main(): - if len(argv) >= 2: - try: - exit(run_tests(argv[1], list_all_tests(argv[1]), argv[2:])) - except: - print('Error with arguments "' + ' '.join(argv[1:]) + '"') - raise - print('Runs each gtest test in a difference process') - print('Usage: ' + argv[0] + ' path/to/gtest.bin [GTEST_OPTIONS]') - exit(1) - - -if __name__ == '__main__': - main() diff --git a/cmake/gtest/px4_add_gtest.cmake b/cmake/gtest/px4_add_gtest.cmake index f9d4f505ad..8507b0d2fc 100644 --- a/cmake/gtest/px4_add_gtest.cmake +++ b/cmake/gtest/px4_add_gtest.cmake @@ -111,8 +111,7 @@ function(px4_add_functional_gtest) add_test(NAME ${TESTNAME} # functional tests need to run in a new process for each test, # since they set up and tear down system components - COMMAND ${PX4_SOURCE_DIR}/Tools/run-gtest-isolated.py ${TESTNAME} - WORKING_DIRECTORY ${PX4_BINARY_DIR}) + COMMAND ${PX4_BINARY_DIR}/${TESTNAME}) # attach it to the unit test target add_dependencies(test_results ${TESTNAME})