summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2010-06-05 03:18:15 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2010-06-05 03:18:15 (GMT)
commitddbf45ad4b1086ac6493c0d3649310945d85313a (patch)
treed626936fe75e669a137228cf72137030cba2e47b
parent87bd27f06c0e23fedb66c4c5a46b564c1ce88ce7 (diff)
downloadSCons-ddbf45ad4b1086ac6493c0d3649310945d85313a.zip
SCons-ddbf45ad4b1086ac6493c0d3649310945d85313a.tar.gz
SCons-ddbf45ad4b1086ac6493c0d3649310945d85313a.tar.bz2
Re-enable tests on non win32 platforms.
This should alter the HOST_ARCH for these tests on non-x86 platforms to x86 and therefore run.
-rw-r--r--QMTest/TestSConsMSVS.py45
-rw-r--r--test/MSVS/vs-6.0-clean.py10
-rw-r--r--test/MSVS/vs-6.0-files.py11
-rw-r--r--test/MSVS/vs-6.0-variant_dir.py9
-rw-r--r--test/MSVS/vs-7.0-clean.py9
-rw-r--r--test/MSVS/vs-7.0-files.py6
-rw-r--r--test/MSVS/vs-7.0-variant_dir.py6
-rw-r--r--test/MSVS/vs-7.1-clean.py9
-rw-r--r--test/MSVS/vs-7.1-files.py6
-rw-r--r--test/MSVS/vs-7.1-variant_dir.py6
-rw-r--r--test/MSVS/vs-8.0-clean.py9
-rw-r--r--test/MSVS/vs-8.0-files.py6
-rw-r--r--test/MSVS/vs-8.0-variant_dir.py6
-rw-r--r--test/MSVS/vs-8.0-x64-files.py7
14 files changed, 79 insertions, 66 deletions
diff --git a/QMTest/TestSConsMSVS.py b/QMTest/TestSConsMSVS.py
index ac10cd3..ffba6d2 100644
--- a/QMTest/TestSConsMSVS.py
+++ b/QMTest/TestSConsMSVS.py
@@ -19,6 +19,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
+import platform
from TestSCons import *
from TestSCons import __all__
@@ -164,7 +165,8 @@ Package=<3>
'''
SConscript_contents_6_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='6.0')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='6.0',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test.c']
testincs = ['sdk.h']
@@ -284,7 +286,8 @@ expected_vcprojfile_7_0 = """\
"""
SConscript_contents_7_0 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.0')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='7.0',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -407,7 +410,8 @@ expected_vcprojfile_7_1 = """\
"""
SConscript_contents_7_1 = """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.1')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='7.1',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -539,7 +543,8 @@ expected_vcprojfile_8_0 = """\
SConscript_contents_8_0 = """\
env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0',
CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'])
+ CPPPATH=['inc1', 'inc2'],
+ HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -660,6 +665,38 @@ print "self._msvs_versions =", str(SCons.Tool.MSCommon.query_versions())
finally:
os.environ['SCONSFLAGS'] = save_sconsflags or ''
return result
+
+ def get_vs_host_arch(self):
+ """ Get an MSVS, SDK , and/or MSVS acceptable platform arch
+ """
+
+ # Dict to 'canonalize' the arch
+ _ARCH_TO_CANONICAL = {
+ "x86": "x86",
+ "amd64": "amd64",
+ "i386": "x86",
+ "emt64": "amd64",
+ "x86_64": "amd64",
+ "itanium": "ia64",
+ "ia64": "ia64",
+ }
+
+ host_platform = platform.machine()
+ # TODO(2.5): the native Python platform.machine() function returns
+ # '' on all Python versions before 2.6, after which it also uses
+ # PROCESSOR_ARCHITECTURE.
+ if not host_platform:
+ host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '')
+
+
+ try:
+ host = _ARCH_TO_CANONICAL[host_platform]
+ except KeyError, e:
+ # Default to x86 for all other platforms
+ host = 'x86'
+
+
+ return host
# Local Variables:
# tab-width:4
diff --git a/test/MSVS/vs-6.0-clean.py b/test/MSVS/vs-6.0-clean.py
index 8db5189..052acae 100644
--- a/test/MSVS/vs-6.0-clean.py
+++ b/test/MSVS/vs-6.0-clean.py
@@ -34,10 +34,9 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
+
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['6.0']
@@ -50,7 +49,8 @@ expected_dswfile = TestSConsMSVS.expected_dswfile_6_0
test.write('SConstruct', """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='6.0')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='6.0',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test.c']
testincs = ['sdk.h']
@@ -72,7 +72,7 @@ env.MSVSSolution(target = 'Test.dsw',
slnguid = '{SLNGUID}',
projects = [p],
variant = 'Release')
-""")
+"""%{'HOST_ARCH':host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-6.0-files.py b/test/MSVS/vs-6.0-files.py
index 41b579b..b6ac4f0 100644
--- a/test/MSVS/vs-6.0-files.py
+++ b/test/MSVS/vs-6.0-files.py
@@ -33,24 +33,19 @@ import TestSConsMSVS
import sys
-test = TestSConsMSVS.TestSConsMSVS()
-
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['6.0']
-
expected_dspfile = TestSConsMSVS.expected_dspfile_6_0
expected_dswfile = TestSConsMSVS.expected_dswfile_6_0
SConscript_contents = TestSConsMSVS.SConscript_contents_6_0
-
-test.write('SConstruct', SConscript_contents)
+test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments="Test.dsp")
diff --git a/test/MSVS/vs-6.0-variant_dir.py b/test/MSVS/vs-6.0-variant_dir.py
index 71ed3ac..02bc7e5 100644
--- a/test/MSVS/vs-6.0-variant_dir.py
+++ b/test/MSVS/vs-6.0-variant_dir.py
@@ -35,15 +35,12 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
+host_arch = test.get_vs_host_arch()
+
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['6.0']
-
-
expected_dspfile = TestSConsMSVS.expected_dspfile_6_0
expected_dswfile = TestSConsMSVS.expected_dswfile_6_0
SConscript_contents = TestSConsMSVS.SConscript_contents_6_0
@@ -55,7 +52,7 @@ test.write('SConstruct', """\
SConscript('src/SConscript', variant_dir='build')
""")
-test.write(['src', 'SConscript'], SConscript_contents)
+test.write(['src', 'SConscript'], SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-7.0-clean.py b/test/MSVS/vs-7.0-clean.py
index a646218..0bb4d62 100644
--- a/test/MSVS/vs-7.0-clean.py
+++ b/test/MSVS/vs-7.0-clean.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.0']
@@ -50,7 +48,8 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_0
test.write('SConstruct', """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.0')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='7.0',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -72,7 +71,7 @@ env.MSVSSolution(target = 'Test.sln',
slnguid = '{SLNGUID}',
projects = [p],
variant = 'Release')
-""")
+"""%{'HOST_ARCH':host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-7.0-files.py b/test/MSVS/vs-7.0-files.py
index d63b3c8..62d08dc 100644
--- a/test/MSVS/vs-7.0-files.py
+++ b/test/MSVS/vs-7.0-files.py
@@ -36,10 +36,8 @@ import sys
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.0']
@@ -52,7 +50,7 @@ SConscript_contents = TestSConsMSVS.SConscript_contents_7_0
-test.write('SConstruct', SConscript_contents)
+test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments="Test.vcproj")
diff --git a/test/MSVS/vs-7.0-variant_dir.py b/test/MSVS/vs-7.0-variant_dir.py
index c9c1ec2..878a969 100644
--- a/test/MSVS/vs-7.0-variant_dir.py
+++ b/test/MSVS/vs-7.0-variant_dir.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.0']
@@ -56,7 +54,7 @@ test.write('SConstruct', """\
SConscript('src/SConscript', variant_dir='build')
""")
-test.write(['src', 'SConscript'], SConscript_contents)
+test.write(['src', 'SConscript'], SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-7.1-clean.py b/test/MSVS/vs-7.1-clean.py
index 7357b30..bd657a8 100644
--- a/test/MSVS/vs-7.1-clean.py
+++ b/test/MSVS/vs-7.1-clean.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.1']
@@ -50,7 +48,8 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_7_1
test.write('SConstruct', """\
-env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='7.1')
+env=Environment(platform='win32', tools=['msvs'],
+ MSVS_VERSION='7.1',HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -72,7 +71,7 @@ env.MSVSSolution(target = 'Test.sln',
slnguid = '{SLNGUID}',
projects = [p],
variant = 'Release')
-""")
+"""%{'HOST_ARCH':host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-7.1-files.py b/test/MSVS/vs-7.1-files.py
index 4fa0627..1df10f4 100644
--- a/test/MSVS/vs-7.1-files.py
+++ b/test/MSVS/vs-7.1-files.py
@@ -36,10 +36,8 @@ import sys
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.1']
@@ -52,7 +50,7 @@ SConscript_contents = TestSConsMSVS.SConscript_contents_7_1
-test.write('SConstruct', SConscript_contents)
+test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments="Test.vcproj")
diff --git a/test/MSVS/vs-7.1-variant_dir.py b/test/MSVS/vs-7.1-variant_dir.py
index 78afa8a..98640e3 100644
--- a/test/MSVS/vs-7.1-variant_dir.py
+++ b/test/MSVS/vs-7.1-variant_dir.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['7.1']
@@ -56,7 +54,7 @@ test.write('SConstruct', """\
SConscript('src/SConscript', variant_dir='build')
""")
-test.write(['src', 'SConscript'], SConscript_contents)
+test.write(['src', 'SConscript'], SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-8.0-clean.py b/test/MSVS/vs-8.0-clean.py
index 2ac258c..249d8a4 100644
--- a/test/MSVS/vs-8.0-clean.py
+++ b/test/MSVS/vs-8.0-clean.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['8.0']
@@ -52,7 +50,8 @@ expected_vcprojfile = TestSConsMSVS.expected_vcprojfile_8_0
test.write('SConstruct', """\
env=Environment(platform='win32', tools=['msvs'], MSVS_VERSION='8.0',
CPPDEFINES=['DEF1', 'DEF2',('DEF3','1234')],
- CPPPATH=['inc1', 'inc2'])
+ CPPPATH=['inc1', 'inc2'],
+ HOST_ARCH='%(HOST_ARCH)s')
testsrc = ['test1.cpp', 'test2.cpp']
testincs = ['sdk.h']
@@ -74,7 +73,7 @@ env.MSVSSolution(target = 'Test.sln',
slnguid = '{SLNGUID}',
projects = [p],
variant = 'Release')
-""")
+"""%{'HOST_ARCH': host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-8.0-files.py b/test/MSVS/vs-8.0-files.py
index cb3dead..11dfd35 100644
--- a/test/MSVS/vs-8.0-files.py
+++ b/test/MSVS/vs-8.0-files.py
@@ -36,10 +36,8 @@ import sys
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['8.0']
@@ -52,7 +50,7 @@ SConscript_contents = TestSConsMSVS.SConscript_contents_8_0
-test.write('SConstruct', SConscript_contents)
+test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments="Test.vcproj")
diff --git a/test/MSVS/vs-8.0-variant_dir.py b/test/MSVS/vs-8.0-variant_dir.py
index a27cfaf..e5b8c43 100644
--- a/test/MSVS/vs-8.0-variant_dir.py
+++ b/test/MSVS/vs-8.0-variant_dir.py
@@ -34,10 +34,8 @@ import sys
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['8.0']
@@ -56,7 +54,7 @@ test.write('SConstruct', """\
SConscript('src/SConscript', variant_dir='build')
""")
-test.write(['src', 'SConscript'], SConscript_contents)
+test.write(['src', 'SConscript'], SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments=".")
diff --git a/test/MSVS/vs-8.0-x64-files.py b/test/MSVS/vs-8.0-x64-files.py
index 97afcae..cfad019 100644
--- a/test/MSVS/vs-8.0-x64-files.py
+++ b/test/MSVS/vs-8.0-x64-files.py
@@ -36,10 +36,9 @@ import sys
import TestSConsMSVS
test = TestSConsMSVS.TestSConsMSVS()
+host_arch = test.get_vs_host_arch()
+
-if sys.platform != 'win32':
- msg = "Skipping Visual Studio test on non-Windows platform '%s'\n" % sys.platform
- test.skip_test(msg)
# Make the test infrastructure think we have this version of MSVS installed.
test._msvs_versions = ['8.0']
@@ -59,7 +58,7 @@ SConscript_contents = SConscript_contents.replace('\'Release\'', '\'Release|x64\
-test.write('SConstruct', SConscript_contents)
+test.write('SConstruct', SConscript_contents%{'HOST_ARCH': host_arch})
test.run(arguments="Test.vcproj")