summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2012-12-18 21:27:01 +0100
committerDirk Baechle <dl9obn@darc.de>2012-12-18 21:27:01 +0100
commit6cede4390b5abb1424e9b79f159cb9567f28bd9c (patch)
tree572754fc81a9a5239eee054407aa455ca8de5af4
parent84d3d7f420f14bf33bea7f4cfc583118731da93f (diff)
downloadscons-6cede4390b5abb1424e9b79f159cb9567f28bd9c.tar.gz
- fixes for MinGW under Windows, mainly skipping MSVS-specific tests
-rw-r--r--src/engine/SCons/Tool/mingw.py3
-rw-r--r--test/AS/ASFLAGS.py7
-rw-r--r--test/AS/ASPPFLAGS.py4
-rw-r--r--test/AS/as-live.py49
-rw-r--r--test/CC/CC.py2
-rw-r--r--test/CC/CCFLAGS.py14
-rw-r--r--test/CC/CFLAGS.py13
-rw-r--r--test/IDL/midl.py5
-rw-r--r--test/LINK/SHLINKCOMSTR.py37
-rw-r--r--test/Libs/LIBPREFIXES.py3
-rw-r--r--test/Libs/LIBS.py3
-rw-r--r--test/Libs/LIBSUFFIXES.py3
-rw-r--r--test/Libs/SharedLibraryIxes.py36
-rw-r--r--test/MSVC/PCH-source.py4
-rw-r--r--test/MSVC/PCHSTOP-errors.py4
-rw-r--r--test/MSVC/TARGET_ARCH.py5
-rw-r--r--test/MSVC/batch-longlines.py5
-rw-r--r--test/MSVC/embed-manifest.py5
-rw-r--r--test/MSVC/hierarchical.py4
-rw-r--r--test/MSVC/msvc.py5
-rw-r--r--test/MSVC/multiple-pdb.py5
-rw-r--r--test/MSVC/pch-spaces-subdir.py5
-rw-r--r--test/MSVC/pdb-VariantDir-path.py5
-rw-r--r--test/MSVC/pdb-manifest.py5
-rw-r--r--test/MSVC/query_vcbat.py5
-rw-r--r--test/MSVS/CPPPATH-Dirs.py4
-rw-r--r--test/Win32/mingw.py5
-rw-r--r--test/Win32/win32pathmadness.py5
-rw-r--r--test/long-lines/live.py8
-rw-r--r--test/sconsign/script/dblite.py23
30 files changed, 209 insertions, 72 deletions
diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py
index 83f8c930..601ec3b8 100644
--- a/src/engine/SCons/Tool/mingw.py
+++ b/src/engine/SCons/Tool/mingw.py
@@ -133,7 +133,7 @@ def generate(env):
# Most of mingw is the same as gcc and friends...
- gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4']
+ gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'gfortran', 'm4']
for tool in gnu_tools:
SCons.Tool.Tool(tool)(env)
@@ -168,6 +168,7 @@ def generate(env):
env['OBJSUFFIX'] = '.o'
env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.a'
+ env['PROGSUFFIX'] = '.exe'
def exists(env):
return find(env)
diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py
index 024cea31..2cc99e33 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 f8e70a93..731413e7 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 0f7ec380..801eecad 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 dd93674e..73dc4e6f 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 e273bfd7..069b4294 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 d5efa1a3..6ea87adb 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 f5c864f2..03224831 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 f97040a6..de56c2c8 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 1b284588..aed451e3 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 3d00a8a4..56392286 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 4426e603..13baeab9 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 4e8dbdb9..4804f5f5 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 df6d6b15..c3c0f2e3 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 a4602832..d3ffc70b 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 d6d8b43f..8b1c39d5 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 5a042952..a5786fad 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 92f36a2b..286c2c7a 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 f1308069..72e58133 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 106aed9e..d98ffbe4 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 0e8caa3a..8e866399 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 991627ff..2b66a554 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 796c36e5..899208ea 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 d70989f0..46189ac2 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 a6620086..f07f780b 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 fad25075..45ec846b 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 33854224..6b23314f 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 dd04ec4d..fe6373dd 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 e8b4a388..5618f55f 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 289c78be..0daf8bf3 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)