summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Oberbrunner <garyo@oberbrunner.com>2012-12-22 18:44:03 (GMT)
committerGary Oberbrunner <garyo@oberbrunner.com>2012-12-22 18:44:03 (GMT)
commit121bb2f745edeb13139ee512c6a5ea402c4d17e6 (patch)
tree9ac06cb38d20319138a8e58bbbe5713f2c014904
parent480db6f087a0cbee844ed4368f627a72f3451091 (diff)
parent239a4bf92af5eb85ab9322610f46d0f6798f4d4b (diff)
downloadSCons-121bb2f745edeb13139ee512c6a5ea402c4d17e6.zip
SCons-121bb2f745edeb13139ee512c6a5ea402c4d17e6.tar.gz
SCons-121bb2f745edeb13139ee512c6a5ea402c4d17e6.tar.bz2
Merging pull request #62 from Dirk Baechle: fixes for MinGW tests
-rw-r--r--QMTest/TestSCons.py22
-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.py7
-rw-r--r--test/MSVC/PCHSTOP-errors.py7
-rw-r--r--test/MSVC/TARGET_ARCH.py5
-rw-r--r--test/MSVC/batch-longlines.py5
-rw-r--r--test/MSVC/embed-manifest.py6
-rw-r--r--test/MSVC/hierarchical.py8
-rw-r--r--test/MSVC/msvc.py5
-rw-r--r--test/MSVC/multiple-pdb.py6
-rw-r--r--test/MSVC/pch-spaces-subdir.py5
-rw-r--r--test/MSVC/pdb-VariantDir-path.py6
-rw-r--r--test/MSVC/pdb-manifest.py6
-rw-r--r--test/MSVC/query_vcbat.py6
-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
31 files changed, 178 insertions, 140 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index ea18757..b015637 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -976,6 +976,28 @@ SConscript( sconscript )
return libs
+ def skip_if_not_msvc(self, check_platform=True):
+ """ Check whether we are on a Windows platform and skip the
+ test if not. This check can be omitted by setting
+ check_platform to False.
+ Then, for a win32 platform, additionally check
+ whether we have a MSVC toolchain installed
+ in the system, and skip the test if none can be
+ found (=MinGW is the only compiler available).
+ """
+ if check_platform:
+ if sys.platform != 'win32':
+ msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
+ self.skip_test(msg)
+ return
+
+ try:
+ import SCons.Tool.MSCommon as msc
+ if not msc.msvc_exists():
+ msg = "No MSVC toolchain found...skipping test\n"
+ self.skip_test(msg)
+ except:
+ pass
def checkLogAndStdout(self, checks, results, cached,
logfile, sconf_dir, sconstruct,
diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py
index 83f8c93..601ec3b 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 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..7ada153 100644
--- a/test/IDL/midl.py
+++ b/test/IDL/midl.py
@@ -25,15 +25,12 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
#####
# 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..6015fec 100644
--- a/test/MSVC/PCH-source.py
+++ b/test/MSVC/PCH-source.py
@@ -31,16 +31,11 @@ up in both the env.PCH() and the env.Program() source list.
Issue 2505: http://scons.tigris.org/issues/show_bug.cgi?id=2505
"""
-import sys
-
import TestSCons
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
-
+test.skip_if_not_msvc()
test.write('SConstruct', """\
env = Environment(tools=['msvc', 'mslink'])
diff --git a/test/MSVC/PCHSTOP-errors.py b/test/MSVC/PCHSTOP-errors.py
index a460283..aa14a3f 100644
--- a/test/MSVC/PCHSTOP-errors.py
+++ b/test/MSVC/PCHSTOP-errors.py
@@ -29,17 +29,12 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
import re
-import sys
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
-
-
+test.skip_if_not_msvc()
SConstruct_path = test.workpath('SConstruct')
diff --git a/test/MSVC/TARGET_ARCH.py b/test/MSVC/TARGET_ARCH.py
index d6d8b43..1df28d0 100644
--- a/test/MSVC/TARGET_ARCH.py
+++ b/test/MSVC/TARGET_ARCH.py
@@ -29,15 +29,12 @@ Test the ability to configure the $TARGET_ARCH construction variable.
"""
import TestSCons
-import sys
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.write('SConstruct', """
env_64 = Environment(tools=['default', 'msvc'],
diff --git a/test/MSVC/batch-longlines.py b/test/MSVC/batch-longlines.py
index 5a04295..ef7233b 100644
--- a/test/MSVC/batch-longlines.py
+++ b/test/MSVC/batch-longlines.py
@@ -30,14 +30,11 @@ Verify operation of Visual C/C++ batch builds with long lines.
Only runs on Windows.
"""
-import sys
import TestSCons
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
_python_ = TestSCons._python_
diff --git a/test/MSVC/embed-manifest.py b/test/MSVC/embed-manifest.py
index 92f36a2..13f1def 100644
--- a/test/MSVC/embed-manifest.py
+++ b/test/MSVC/embed-manifest.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify that manifest files get embedded correctly in EXEs and DLLs
"""
-import sys
-
import TestSCons
_exe = TestSCons._exe
@@ -38,9 +36,7 @@ _lib = TestSCons._lib
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.write('SConstruct', """\
env=Environment(WINDOWS_EMBED_MANIFEST=True)
diff --git a/test/MSVC/hierarchical.py b/test/MSVC/hierarchical.py
index f130806..0b19483 100644
--- a/test/MSVC/hierarchical.py
+++ b/test/MSVC/hierarchical.py
@@ -28,17 +28,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify use of Visual Studio with a hierarchical build.
"""
-import sys
-
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
-
-
+test.skip_if_not_msvc()
test.subdir('src', 'build', 'out')
diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py
index 106aed9..c68fb45 100644
--- a/test/MSVC/msvc.py
+++ b/test/MSVC/msvc.py
@@ -29,16 +29,13 @@ Verify basic invocation of Microsoft Visual C/C++, including use
of a precompiled header with the $CCFLAGS variable.
"""
-import sys
import time
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
#####
# Test the basics
diff --git a/test/MSVC/multiple-pdb.py b/test/MSVC/multiple-pdb.py
index 0e8caa3..78805e3 100644
--- a/test/MSVC/multiple-pdb.py
+++ b/test/MSVC/multiple-pdb.py
@@ -33,17 +33,13 @@ $TARGET variable (and implicitly $SOURCE), using the original specified
list(s).
"""
-import sys
-
import TestSCons
_exe = TestSCons._exe
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.write('SConstruct', """\
env = Environment(PDB = '${TARGET.base}.pdb')
diff --git a/test/MSVC/pch-spaces-subdir.py b/test/MSVC/pch-spaces-subdir.py
index 991627f..3a65b44 100644
--- a/test/MSVC/pch-spaces-subdir.py
+++ b/test/MSVC/pch-spaces-subdir.py
@@ -28,16 +28,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify PCH works if variant dir has spaces in its name
"""
-import sys
import time
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
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..838487c 100644
--- a/test/MSVC/pdb-VariantDir-path.py
+++ b/test/MSVC/pdb-VariantDir-path.py
@@ -28,17 +28,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify that .pdb files get put in a variant_dir correctly.
"""
-import sys
-
import TestSCons
_exe = TestSCons._exe
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.subdir('src')
diff --git a/test/MSVC/pdb-manifest.py b/test/MSVC/pdb-manifest.py
index d70989f..e06fe0c 100644
--- a/test/MSVC/pdb-manifest.py
+++ b/test/MSVC/pdb-manifest.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify that .pdb files work correctly in conjunction with manifest files.
"""
-import sys
-
import TestSCons
_exe = TestSCons._exe
@@ -38,9 +36,7 @@ _lib = TestSCons._lib
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.write('SConstruct', """\
env = Environment()
diff --git a/test/MSVC/query_vcbat.py b/test/MSVC/query_vcbat.py
index a662008..328345d 100644
--- a/test/MSVC/query_vcbat.py
+++ b/test/MSVC/query_vcbat.py
@@ -23,15 +23,11 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import sys
-
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
#####
# 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..925a323 100644
--- a/test/Win32/win32pathmadness.py
+++ b/test/Win32/win32pathmadness.py
@@ -31,15 +31,12 @@ inconsistent about which case is used for the drive letter.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-import sys
import TestCmd
import os.path
test = TestSCons.TestSCons(match=TestCmd.match_re)
-if sys.platform != 'win32':
- msg = "Skipping Windows path tests on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test.skip_if_not_msvc()
test.subdir('src', 'build', 'include', 'src2')
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)