From a4e14b9311ea4bbda2bf245f72361e37854f8623 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sun, 5 Nov 2017 09:08:49 -0700 Subject: [PATCH] Build gtest output paths correctly Currently, when the run_tests function is called twice from the the same scons script (that is, the script has more than one unit test binary to register), the GTEST_OUTPUT environment variable becomes malformed. This is because the string to add is added to a list instead of just being appended as a string. The result is that while all the test output binaries are expected to go to BUILD_DIR/test_out, in these cases they go deep down underneath that directory. Here are the unexpected paths in an unmodified testing run: out/linux/x86_64/debug/test_out/:xml: out/linux/x86_64/debug/test_out/:xml:/home out/linux/x86_64/debug/test_out/:xml:/home/mats out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64 out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug/test_out out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug/test_out/unittest.xml out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug/test_out/stacktests.xml out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug/test_out/cbortests.xml out/linux/x86_64/debug/test_out/:xml:/home/mats/iotivity.work/out/linux/x86_64/debug/test_out/provisiontests.xml The :xml: is intended as a tag used to signal gtest, it is never supposed to be part of the real filesystem path. Note fix was already proposed as part of https://gerrit.iotivity.org/gerrit/#/c/22275/ but since it's a distinct error with a very simple fix, wanted to get it pushed through by itself while that one is under consideration. Change-Id: I05c57d54034686a7c77c783eab758e7f501e86ea Signed-off-by: Mats Wichmann (cherry picked from commit 0d010e4b64ff853fefb6e55038e6ecaa072fc760) --- tools/scons/RunTest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/scons/RunTest.py b/tools/scons/RunTest.py index 1cd516c839..54c3aaebd8 100644 --- a/tools/scons/RunTest.py +++ b/tools/scons/RunTest.py @@ -34,8 +34,7 @@ def run_test(env, xml_file, test, test_targets = ['test']): if not os.path.isdir(result_dir): os.makedirs(result_dir) - # Dump test report in XML format to the results directory. - env.AppendENVPath('GTEST_OUTPUT', ['xml:' + result_dir]) + env.AppendENVPath('GTEST_OUTPUT', 'xml:' + result_dir, delete_existing=0) # Make sure the Google Test libraries are in the dynamic # linker/loader path. -- GitLab