scons, tests: Fix occasional linking error
authorAndreas Sandberg <andreas.sandberg@arm.com>
Wed, 13 Dec 2017 14:29:39 +0000 (14:29 +0000)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Wed, 13 Dec 2017 23:57:08 +0000 (23:57 +0000)
There are some cases where scons incorrectly adds the same object
multiple times to the linker command line. This seems to be caused by
the test's source list being updated in place when determining test
framework dependencies. Fix this by explicitly copying the source list
and manipulate the copy.

Without this change, the following command fails:
scons ./build/ARM/unittests.opt/base/pixeltest.xml

Whereas this command succeeds:
scons ./build/ARM/base/pixeltest.opt

Change-Id: I642efdf9d62a5478e49ba51efe1a3a5ba453e21f
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jack Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/6641
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
src/SConscript

index a98fbc433d9af1d422985c0662b8867ce7e100d7..1c53160d2fa0b1bc35c1c3bbf66897d39deb3a84 100755 (executable)
@@ -1092,7 +1092,7 @@ def makeEnv(env, label, objsfx, strip=False, disable_partial=False, **kwargs):
     gtestlib_sources = Source.all.with_tag('gtest lib')
     gtest_out_dir = Dir(new_env['BUILDDIR']).Dir('unittests.%s' % label)
     for test in GTest.all:
-        test_sources = test.sources
+        test_sources = list(test.sources)
         if not test.skip_lib:
             test_sources += gtestlib_sources
         for f in test.filters: