diff options
Diffstat (limited to 'test')
29 files changed, 207 insertions, 71 deletions
diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py index 024cea3..2cc99e3 100644 --- a/test/AS/ASFLAGS.py +++ b/test/AS/ASFLAGS.py @@ -35,10 +35,12 @@ _exe = TestSCons._exe if sys.platform == 'win32': - + import SCons.Tool.MSCommon as msc + o = ' -x' - o_c = ' -x' + if not msc.msvc_exists(): + o_c = ' -x -c' test.write('mylink.py', r""" import sys @@ -95,7 +97,6 @@ sys.exit(0) else: o = ' -x' - o_c = ' -x -c' test.write('mylink.py', r""" diff --git a/test/AS/ASPPFLAGS.py b/test/AS/ASPPFLAGS.py index f8e70a9..731413e 100644 --- a/test/AS/ASPPFLAGS.py +++ b/test/AS/ASPPFLAGS.py @@ -35,10 +35,12 @@ _exe = TestSCons._exe if sys.platform == 'win32': + import SCons.Tool.MSCommon as msc o = ' -x' - o_c = ' -x' + if not msc.msvc_exists(): + o_c = ' -x -c' test.write('mylink.py', r""" import sys diff --git a/test/AS/as-live.py b/test/AS/as-live.py index 0f7ec38..801eeca 100644 --- a/test/AS/as-live.py +++ b/test/AS/as-live.py @@ -47,8 +47,14 @@ x86 = (sys.platform == 'win32' or sys.platform.find('linux') != -1) if not x86: test.skip_test("skipping as test on non-x86 platform '%s'\n" % sys.platform) - - +namelbl = "name" +testccc = """ccc = aaa.Clone(CPPPATH=['.']) +ccc.Program(target = 'ccc', source = ['ccc.S', 'ccc_main.c']) +""" +if sys.platform == "win32": + namelbl = "_name" + testccc = "" + test.write("wrapper.py", """\ import os import sys @@ -59,32 +65,31 @@ os.system(cmd) test.write('SConstruct', """\ aaa = Environment() -bbb = aaa.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('as')) -ccc = aaa.Clone(CPPPATH=['.']) aaa.Program(target = 'aaa', source = ['aaa.s', 'aaa_main.c']) +bbb = aaa.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('as')) bbb.Program(target = 'bbb', source = ['bbb.s', 'bbb_main.c']) -ccc.Program(target = 'ccc', source = ['ccc.S', 'ccc_main.c']) +%(testccc)s """ % locals()) test.write('aaa.s', """ .file "aaa.s" .data .align 4 -.globl name -name: +.globl %(namelbl)s +%(namelbl)s: .ascii "aaa.s" .byte 0 -""") +""" % locals()) test.write('bbb.s', """\ .file "bbb.s" .data .align 4 -.globl name -name: +.globl %(namelbl)s +%(namelbl)s: .ascii "bbb.s" .byte 0 -""") +""" % locals()) test.write('ccc.h', """\ #define STRING "ccc.S" @@ -162,21 +167,21 @@ test.run() test.run(program = test.workpath('aaa'), stdout = "aaa_main.c aaa.s\n") test.run(program = test.workpath('bbb'), stdout = "bbb_main.c bbb.s\n") -test.run(program = test.workpath('ccc'), stdout = "ccc_main.c ccc.S\n") - -test.must_match('wrapper.out', "wrapper.py: bbb.s\n") -test.write("ccc.h", """\ -#define STRING "ccc.S 2" -""") - -test.run() -test.run(program = test.workpath('ccc'), stdout = "ccc_main.c ccc.S 2\n") +if sys.platform != "win32": + test.run(program = test.workpath('ccc'), stdout = "ccc_main.c ccc.S\n") + + test.must_match('wrapper.out', "wrapper.py: bbb.s\n") + + test.write("ccc.h", """\ + #define STRING "ccc.S 2" + """) + + test.run() + test.run(program = test.workpath('ccc'), stdout = "ccc_main.c ccc.S 2\n") test.unlink('wrapper.out') - - test.pass_test() # Local Variables: diff --git a/test/CC/CC.py b/test/CC/CC.py index dd93674..73dc4e6 100644 --- a/test/CC/CC.py +++ b/test/CC/CC.py @@ -69,7 +69,7 @@ while args: args = args[2:] continue args = args[1:] - if a[0] != '/': + if not a[0] in '-/': if not inf: inf = a continue diff --git a/test/CC/CCFLAGS.py b/test/CC/CCFLAGS.py index e273bfd..069b429 100644 --- a/test/CC/CCFLAGS.py +++ b/test/CC/CCFLAGS.py @@ -27,12 +27,18 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import sys import TestSCons +_obj = TestSCons._obj + if sys.platform == 'win32': - _obj = '.obj' - fooflags = '/nologo -DFOO' - barflags = '/nologo -DBAR' + import SCons.Tool.MSCommon as msc + + if not msc.msvc_exists(): + fooflags = '-DFOO' + barflags = '-DBAR' + else: + fooflags = '/nologo -DFOO' + barflags = '/nologo -DBAR' else: - _obj = '.o' fooflags = '-DFOO' barflags = '-DBAR' diff --git a/test/CC/CFLAGS.py b/test/CC/CFLAGS.py index d5efa1a..6ea87ad 100644 --- a/test/CC/CFLAGS.py +++ b/test/CC/CFLAGS.py @@ -41,14 +41,19 @@ test.run(arguments = '.') test.must_not_contain_any_line(test.stdout(), ["-xyz"]) test.must_contain_all_lines(test.stdout(), ["-abc"]) +_obj = TestSCons._obj # Test passing CFLAGS to C compiler by actually compiling programs if sys.platform == 'win32': - _obj = '.obj' - fooflags = '/nologo -DFOO' - barflags = '/nologo -DBAR' + import SCons.Tool.MSCommon as msc + + if not msc.msvc_exists(): + fooflags = '-DFOO' + barflags = '-DBAR' + else: + fooflags = '/nologo -DFOO' + barflags = '/nologo -DBAR' else: - _obj = '.o' fooflags = '-DFOO' barflags = '-DBAR' diff --git a/test/IDL/midl.py b/test/IDL/midl.py index f5c864f..0322483 100644 --- a/test/IDL/midl.py +++ b/test/IDL/midl.py @@ -35,6 +35,11 @@ if sys.platform != 'win32': msg = "Skipping test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + ##### # Test the basics diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py index f97040a..de56c2c 100644 --- a/test/LINK/SHLINKCOMSTR.py +++ b/test/LINK/SHLINKCOMSTR.py @@ -29,6 +29,7 @@ Test that the $SHLINKCOMSTR construction variable allows you to customize the displayed linker string for programs using shared libraries. """ +import sys import TestSCons _python_ = TestSCons._python_ @@ -90,24 +91,24 @@ Linking shared test3.dll from test1.obj test2.obj test.must_match('test3.dll', "test1.c\ntest2.c\n") - -# Now test an actual compile and link. Since MS Windows -# resets the link actions, this could fail even if the above -# test passed. -test.write('SConstruct', """ -env = Environment(CXXCOMSTR = 'Compiling $TARGET ...', - SHLINKCOMSTR = 'Shared-Linking $TARGET ...') -env.SharedLibrary('test', 'test.cpp') -""") -test.write('test.cpp', """ -int i; -""") - -test.run() -if ("Shared-Linking" not in test.stdout()): - test.fail_test() - - +if sys.platform == "win32": + import SCons.Tool.MSCommon as msc + if msc.msvc_exists(): + # Now test an actual compile and link. Since MS Windows + # resets the link actions, this could fail even if the above + # test passed. + test.write('SConstruct', """ + env = Environment(CXXCOMSTR = 'Compiling $TARGET ...', + SHLINKCOMSTR = 'Shared-Linking $TARGET ...') + env.SharedLibrary('test', 'test.cpp') + """) + test.write('test.cpp', """ + int i; + """) + + test.run() + if ("Shared-Linking" not in test.stdout()): + test.fail_test() test.pass_test() diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py index 1b28458..aed451e 100644 --- a/test/Libs/LIBPREFIXES.py +++ b/test/Libs/LIBPREFIXES.py @@ -30,6 +30,9 @@ import TestSCons if sys.platform == 'win32': _lib = '.lib' + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + _lib = '.a' else: _lib = '.a' diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py index 3d00a8a..5639228 100644 --- a/test/Libs/LIBS.py +++ b/test/Libs/LIBS.py @@ -30,6 +30,9 @@ import sys if sys.platform == 'win32': _exe = '.exe' bar_lib = 'bar.lib' + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + bar_lib = 'libbar.a' else: _exe = '' bar_lib = 'libbar.a' diff --git a/test/Libs/LIBSUFFIXES.py b/test/Libs/LIBSUFFIXES.py index 4426e60..13baeab 100644 --- a/test/Libs/LIBSUFFIXES.py +++ b/test/Libs/LIBSUFFIXES.py @@ -30,6 +30,9 @@ import TestSCons if sys.platform == 'win32': lib_ = '' + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + lib_ = 'lib' else: lib_ = 'lib' diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py index 4e8dbdb..4804f5f 100644 --- a/test/Libs/SharedLibraryIxes.py +++ b/test/Libs/SharedLibraryIxes.py @@ -37,6 +37,16 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ import sys isWindows = sys.platform == 'win32' +isMingw = False +if isWindows: + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + # We can't seem to find any MSVC version, so we assume + # that MinGW is installed instead. Accordingly, we use the + # standard gcc/g++ conventions for lib prefixes and suffixes + # in the following... + isWindows = False + isMingw = True env = Environment() @@ -69,8 +79,8 @@ foo_obj = env.SharedObject(source='foo.c') prog_obj = env.SharedObject(source='prog.c') # -# The following functions define all the different way that one can -# use link againt a shared library. +# The following functions define all the different ways that one can +# use to link against a shared library. # def nodeInSrc(source, lib, libname): return (source+lib, '') @@ -91,17 +101,19 @@ def nameInLib(source, lib, libname): # provide the full name of the library since scons can not know # which of the non-standard extension to use. # - # Note that this is not necessarally SHLIBPREFIX and + # Note that this is not necessarily SHLIBPREFIX and # SHLIBSUFFIX. These are the ixes of the target library, not the - # ixes of the library that we are linking againt. + # ixes of the library that we are linking against. return (source, libname) -libmethods = [ - nodeInSrc, pathInSrc, nodeInLib, pathInLib, - nameInLib ] +libmethods = [nodeInSrc, pathInSrc, nodeInLib, pathInLib] +# We skip the nameInLib test for MinGW...it would fail, due to +# the Tool's internal naming conventions +if not isMingw: + libmethods.extend([nameInLib]) def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw): - '''Build a target using a given builder while linking againt a given + '''Build a target using a given builder while linking against a given library using a specified method for linking against the library.''' # On Windows, we have to link against the .lib file. @@ -110,6 +122,14 @@ def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw): if str(l)[-4:] == '.lib': lib = [l] break + # If we use MinGW and create a SharedLibrary, we get two targets: a DLL, + # and the import lib created by the "--out-implib" parameter. We always + # want to link against the second one, in order to prevent naming issues + # for the linker command line... + if isMingw and len(lib) > 1: + lib = lib[1:] + + # Apply the naming method to be tested and call the specified Builder. (source, LIBS) = method(source, lib, libname) #build = builder(target=target, source=source, LIBS=LIBS, **kw) kw = kw.copy() diff --git a/test/MSVC/PCH-source.py b/test/MSVC/PCH-source.py index df6d6b1..c3c0f2e 100644 --- a/test/MSVC/PCH-source.py +++ b/test/MSVC/PCH-source.py @@ -41,6 +41,10 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
+import SCons.Tool.MSCommon as msc
+if not msc.msvc_exists():
+ msg = "No MSVC toolchain found...skipping test\n"
+ test.skip_test(msg)
test.write('SConstruct', """\
env = Environment(tools=['msvc', 'mslink'])
diff --git a/test/MSVC/PCHSTOP-errors.py b/test/MSVC/PCHSTOP-errors.py index a460283..d3ffc70 100644 --- a/test/MSVC/PCHSTOP-errors.py +++ b/test/MSVC/PCHSTOP-errors.py @@ -39,6 +39,10 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) SConstruct_path = test.workpath('SConstruct') diff --git a/test/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py index d6d8b43..8b1c39d 100644 --- a/test/MSVC/TARGET_ARCH.py +++ b/test/MSVC/TARGET_ARCH.py @@ -39,6 +39,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + test.write('SConstruct', """ env_64 = Environment(tools=['default', 'msvc'], TARGET_ARCH = 'amd64') diff --git a/test/MSVC/batch-longlines.py b/test/MSVC/batch-longlines.py index 5a04295..a5786fa 100644 --- a/test/MSVC/batch-longlines.py +++ b/test/MSVC/batch-longlines.py @@ -39,6 +39,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
+import SCons.Tool.MSCommon as msc
+if not msc.msvc_exists():
+ msg = "No MSVC toolchain found...skipping test\n"
+ test.skip_test(msg)
+
_python_ = TestSCons._python_
for i in xrange(1,200):
diff --git a/test/MSVC/embed-manifest.py b/test/MSVC/embed-manifest.py index 92f36a2..286c2c7 100644 --- a/test/MSVC/embed-manifest.py +++ b/test/MSVC/embed-manifest.py @@ -42,6 +42,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
+import SCons.Tool.MSCommon as msc
+if not msc.msvc_exists():
+ msg = "No MSVC toolchain found...skipping test\n"
+ test.skip_test(msg)
+
test.write('SConstruct', """\
env=Environment(WINDOWS_EMBED_MANIFEST=True)
env.Append(CCFLAGS = '/MD')
diff --git a/test/MSVC/hierarchical.py b/test/MSVC/hierarchical.py index f130806..72e5813 100644 --- a/test/MSVC/hierarchical.py +++ b/test/MSVC/hierarchical.py @@ -38,6 +38,10 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) test.subdir('src', 'build', 'out') diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py index 106aed9..d98ffbe 100644 --- a/test/MSVC/msvc.py +++ b/test/MSVC/msvc.py @@ -40,6 +40,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + ##### # Test the basics diff --git a/test/MSVC/multiple-pdb.py b/test/MSVC/multiple-pdb.py index 0e8caa3..8e86639 100644 --- a/test/MSVC/multiple-pdb.py +++ b/test/MSVC/multiple-pdb.py @@ -45,6 +45,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + test.write('SConstruct', """\ env = Environment(PDB = '${TARGET.base}.pdb') env.Program('test1.cpp') diff --git a/test/MSVC/pch-spaces-subdir.py b/test/MSVC/pch-spaces-subdir.py index 991627f..2b66a55 100644 --- a/test/MSVC/pch-spaces-subdir.py +++ b/test/MSVC/pch-spaces-subdir.py @@ -39,6 +39,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + test.write('Main.cpp', """\ #include "Precompiled.h" diff --git a/test/MSVC/pdb-VariantDir-path.py b/test/MSVC/pdb-VariantDir-path.py index 796c36e..899208e 100644 --- a/test/MSVC/pdb-VariantDir-path.py +++ b/test/MSVC/pdb-VariantDir-path.py @@ -40,6 +40,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + test.subdir('src') test.write('SConstruct', """\ diff --git a/test/MSVC/pdb-manifest.py b/test/MSVC/pdb-manifest.py index d70989f..46189ac 100644 --- a/test/MSVC/pdb-manifest.py +++ b/test/MSVC/pdb-manifest.py @@ -42,6 +42,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + test.write('SConstruct', """\ env = Environment() diff --git a/test/MSVC/query_vcbat.py b/test/MSVC/query_vcbat.py index a662008..f07f780 100644 --- a/test/MSVC/query_vcbat.py +++ b/test/MSVC/query_vcbat.py @@ -33,6 +33,11 @@ if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test\n" + test.skip_test(msg) + ##### # Test the basics diff --git a/test/MSVS/CPPPATH-Dirs.py b/test/MSVS/CPPPATH-Dirs.py index fad2507..45ec846 100644 --- a/test/MSVS/CPPPATH-Dirs.py +++ b/test/MSVS/CPPPATH-Dirs.py @@ -41,6 +41,10 @@ if sys.platform != 'win32': msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
test.skip_test(msg)
+import SCons.Tool.MSCommon as msc
+if not msc.msvs_exists():
+ msg = "No MSVS toolchain found...skipping test\n"
+ test.skip_test(msg)
SConscript_contents = """\
env = Environment()
diff --git a/test/Win32/mingw.py b/test/Win32/mingw.py index 3385422..6b23314 100644 --- a/test/Win32/mingw.py +++ b/test/Win32/mingw.py @@ -63,7 +63,7 @@ env=Environment(tools=['mingw']) assert env['CC'] == 'gcc' env.StaticLibrary('static', 'static.cpp') env.SharedLibrary('shared', 'shared.cpp') -env.SharedLibrary('cshared', ['cshared.c', 'cshared.def']) +env.SharedLibrary('cshared', ['cshared.c', 'cshared.def'], WINDOWS_INSERT_DEF=1) env.Program('test', ['test.cpp', env.RES('resource.rc', CPPPATH=['header'])], LIBS=['static', 'shared', 'cshared'], LIBPATH=['.']) """) @@ -151,7 +151,8 @@ test.run(arguments='test.exe', stderr='.*') test.fail_test(test.stdout().find('cshared.def') == -1) test.fail_test(test.stdout().find('-Wl,--output-def,cshared.def') != -1) # ensure the target def got generated for the shared.dll: -test.fail_test(not os.path.exists(test.workpath('shared.def'))) +test.fail_test(not os.path.exists(test.workpath('cshared.def'))) +test.fail_test(os.path.exists(test.workpath('shared.def'))) test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2001 resource.rc\n') # ensure that modifying the header causes the resource to be rebuilt: diff --git a/test/Win32/win32pathmadness.py b/test/Win32/win32pathmadness.py index dd04ec4..fe6373d 100644 --- a/test/Win32/win32pathmadness.py +++ b/test/Win32/win32pathmadness.py @@ -41,6 +41,11 @@ if sys.platform != 'win32': msg = "Skipping Windows path tests on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) +import SCons.Tool.MSCommon as msc +if not msc.msvc_exists(): + msg = "No MSVC toolchain found...skipping test'\n" + test.skip_test(msg) + test.subdir('src', 'build', 'include', 'src2') test.write('src/SConstruct', """ diff --git a/test/long-lines/live.py b/test/long-lines/live.py index e8b4a38..5618f55 100644 --- a/test/long-lines/live.py +++ b/test/long-lines/live.py @@ -42,6 +42,14 @@ if sys.platform == 'win32': arflag = ' /LIBPATH:' + test.workpath() linkflag_init = '/LIBPATH:' + test.workpath() linkflag = ' /LIBPATH:' + test.workpath() + import SCons.Tool.MSCommon as msc + if not msc.msvc_exists(): + lib_shared_dll = 'shared.dll' + lib_static_lib = 'libstatic.a' + arflag_init = 'r' + arflag = 'o' + linkflag_init = '-L' + test.workpath() + linkflag = ' -L' + test.workpath() elif sys.platform == 'cygwin': lib_static_lib = 'libstatic.a' lib_shared_dll ='shared.dll' diff --git a/test/sconsign/script/dblite.py b/test/sconsign/script/dblite.py index 289c78b..0daf8bf 100644 --- a/test/sconsign/script/dblite.py +++ b/test/sconsign/script/dblite.py @@ -35,6 +35,9 @@ import TestSConsign test = TestSConsign.TestSConsign(match = TestSConsign.match_re) +_exe = TestSConsign._exe +_obj = TestSConsign._obj + CC = test.detect('CC', norm=1) LINK = test.detect('LINK', norm=1) if LINK is None: LINK = CC @@ -57,12 +60,12 @@ test.subdir('sub1', 'sub2') # canonicalized to use / as the separator. sub1_hello_c = 'sub1/hello.c' -sub1_hello_obj = 'sub1/hello.obj' +sub1_hello_obj = 'sub1/hello%s' % _obj test.write('SConstruct', """ SConsignFile('my_sconsign') Decider('timestamp-newer') -env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') +env1 = Environment() env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') @@ -110,34 +113,38 @@ sig_re = r'[0-9a-fA-F]{32}' date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' if sys.platform == 'win32': - manifest = r""" + import SCons.Tool.MSCommon as msc + if msc.msvc_exists(): + manifest = r""" embedManifestExeCheck\(target, source, env\)""" + else: + manifest = '' else: manifest = '' expect = r"""=== sub1: -hello.exe: %(sig_re)s \d+ \d+ +hello%(_exe)s: %(sig_re)s \d+ \d+ %(sub1_hello_obj)s: %(sig_re)s \d+ \d+ %(LINK)s: None \d+ \d+ %(sig_re)s \[.*%(manifest)s\] -hello.obj: %(sig_re)s \d+ \d+ +hello%(_obj)s: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: None \d+ \d+ %(CC)s: None \d+ \d+ %(sig_re)s \[.*\] """ % locals() expect_r = """=== sub1: -hello.exe: %(sig_re)s '%(date_re)s' \d+ +hello%(_exe)s: %(sig_re)s '%(date_re)s' \d+ %(sub1_hello_obj)s: %(sig_re)s '%(date_re)s' \d+ %(LINK)s: None '%(date_re)s' \d+ %(sig_re)s \[.*%(manifest)s\] -hello.obj: %(sig_re)s '%(date_re)s' \d+ +hello%(_obj)s: %(sig_re)s '%(date_re)s' \d+ %(sub1_hello_c)s: None '%(date_re)s' \d+ %(CC)s: None '%(date_re)s' \d+ %(sig_re)s \[.*\] """ % locals() -common_flags = '-e hello.exe -e hello.obj -d sub1' +common_flags = '-e hello%(_exe)s -e hello%(_obj)s -d sub1' % locals() test.run_sconsign(arguments = "%s my_sconsign" % common_flags, stdout = expect) |