From 30664716b8dd63de48ab40865c48db8580f4956b Mon Sep 17 00:00:00 2001 From: Pawel Tomulik Date: Mon, 21 Sep 2015 02:28:58 +0200 Subject: correct logic in VersionedLib*.py tests --- test/LINK/VersionedLib-VariantDir.py | 13 ++++++++----- test/LINK/VersionedLib-j2.py | 13 ++++++++----- test/LINK/VersionedLib-subdir.py | 17 ++++++++++------- test/LINK/VersionedLib.py | 15 ++++++++------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/test/LINK/VersionedLib-VariantDir.py b/test/LINK/VersionedLib-VariantDir.py index 7406a33..0a631b0 100644 --- a/test/LINK/VersionedLib-VariantDir.py +++ b/test/LINK/VersionedLib-VariantDir.py @@ -33,8 +33,11 @@ import os import sys import SCons.Platform +import SCons.Defaults +env = SCons.Defaults.DefaultEnvironment() platform = SCons.Platform.platform_default() +tool_list = SCons.Platform.DefaultToolList(platform, env) test = TestSCons.TestSCons() @@ -96,7 +99,7 @@ if sys.platform.find('irix') != -1: test.run(program = test.workpath('build/bin/main')) -if platform == 'posix': +if 'gnulink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', @@ -104,14 +107,14 @@ if platform == 'posix': 'libfoo.so.0.1.2', ] obj = 'foo.os' -elif platform == 'darwin': +elif 'applelink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.dylib', 'libfoo.0.1.2.dylib', ] obj = 'foo.os' -elif platform == 'cygwin': +elif 'cyglink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'cygfoo-0-1-2.dll', @@ -119,14 +122,14 @@ elif platform == 'cygwin': 'libfoo.dll.a', ] obj = 'foo.os' -elif platform == 'win32': +elif 'mslink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'foo.dll', 'foo.lib', ] obj = 'foo.obj' -elif platform == 'sunos': +elif 'sunlink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', diff --git a/test/LINK/VersionedLib-j2.py b/test/LINK/VersionedLib-j2.py index 6f37e54..249b54f 100644 --- a/test/LINK/VersionedLib-j2.py +++ b/test/LINK/VersionedLib-j2.py @@ -35,6 +35,7 @@ import os import sys import SCons.Platform +import SCons.Defaults test = TestSCons.TestSCons() @@ -63,7 +64,9 @@ env.SharedLibrary('foo', 'foo.c', SHLIBVERSION = '0.1.2') test.run(arguments = ['-j 2', '--tree=all']) +env = SCons.Defaults.DefaultEnvironment() platform = SCons.Platform.platform_default() +tool_list = SCons.Platform.DefaultToolList(platform, env) if platform == 'cygwin': # PATH is used to search for *.dll librarier (cygfoo-0-2-1.dll in our case) @@ -83,7 +86,7 @@ test.run(arguments = ['-c']) platform = SCons.Platform.platform_default() -if platform == 'posix': +if 'gnulink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', @@ -91,14 +94,14 @@ if platform == 'posix': 'libfoo.so.0.1.2', 'foo.os', ] -elif platform == 'darwin': +elif 'applelink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.dylib', 'libfoo.0.1.2.dylib', 'foo.os', ] -elif platform == 'cygwin': +elif 'cyglink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'cygfoo-0-1-2.dll', @@ -106,14 +109,14 @@ elif platform == 'cygwin': 'libfoo.dll.a', 'foo.os', ] -elif platform == 'win32': +elif 'mslink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'foo.dll', 'foo.lib', 'foo.obj', ] -elif platform == 'sunos': +elif 'sunlink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', diff --git a/test/LINK/VersionedLib-subdir.py b/test/LINK/VersionedLib-subdir.py index 15369ef..a2e141b 100644 --- a/test/LINK/VersionedLib-subdir.py +++ b/test/LINK/VersionedLib-subdir.py @@ -37,6 +37,7 @@ import os import sys import SCons.Platform +import SCons.Defaults test = TestSCons.TestSCons() @@ -58,11 +59,13 @@ int main() } """) +env = SCons.Defaults.DefaultEnvironment() platform = SCons.Platform.platform_default() +tool_list = SCons.Platform.DefaultToolList(platform, env) -if platform == 'darwin': +if 'applelink' in tool_list: subdir = 'blah.0.1.2.dylib.blah' -elif platform == 'cygwin': +elif 'cyglink' in tool_list: subdir = 'blah-0-1-2.dll.a.blah' else: subdir = 'blah.so.0.1.2.blah' @@ -90,7 +93,7 @@ if sys.platform.find('irix') != -1: test.run(program = test.workpath('main')) -if platform == 'posix': +if 'gnulink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', @@ -98,14 +101,14 @@ if platform == 'posix': 'libfoo.so.0.1.2', ] obj = 'foo.os' -elif platform == 'darwin': +elif 'applelink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.dylib', 'libfoo.0.1.2.dylib', ] obj = 'foo.os' -elif platform == 'cygwin': +elif 'cyglink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'cygfoo-0-1-2.dll', @@ -113,14 +116,14 @@ elif platform == 'cygwin': 'libfoo.dll.a', ] obj = 'foo.os' -elif platform == 'win32': +elif 'mslink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'foo.dll', 'foo.lib', ] obj = 'foo.obj' -elif platform == 'sunos': +elif 'sunlink' in tool_list: # All (?) the files we expect will get created in the current directory files = [ 'libfoo.so', diff --git a/test/LINK/VersionedLib.py b/test/LINK/VersionedLib.py index 360fa24..599c8aa 100644 --- a/test/LINK/VersionedLib.py +++ b/test/LINK/VersionedLib.py @@ -29,12 +29,13 @@ import sys import TestSCons import SCons.Platform +import SCons.Defaults -_exe = TestSCons._exe - +env = SCons.Defaults.DefaultEnvironment() platform = SCons.Platform.platform_default() +tool_list = SCons.Platform.DefaultToolList(platform, env) -if platform == 'posix': +if 'gnulink' in tool_list: test_plan = [ { 'libversion' : '2', @@ -73,7 +74,7 @@ if platform == 'posix': 'symlinks' : [ ('libtest.so', 'libtest.so.2.dfffa11'), ('libtest.so.2', 'libtest.so.2.dfffa11') ], }, ] -elif platform == 'darwin': +elif 'applelink' in tool_list: # All (?) the files we expect will get created in the current directory test_plan = [ { @@ -83,7 +84,7 @@ elif platform == 'darwin': 'symlinks' : [], }, ] -elif platform == 'cygwin': +elif 'cyglink' in tool_list: test_plan = [ { 'libversion' : '2', @@ -122,7 +123,7 @@ elif platform == 'cygwin': 'symlinks' : [ ('libtest.dll.a', 'libtest-2-dfffa11.dll.a') ], }, ] -elif platform == 'win32': +elif 'mslink' in tool_list: test_plan = [ { 'libversion' : '2.5.4', @@ -131,7 +132,7 @@ elif platform == 'win32': 'symlinks' : [], }, ] -elif platform == 'sunos': +elif 'sunlink' in tool_list: test_plan = [ { 'libversion' : '2', -- cgit v0.12