summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIbrahim Esmat <iesmat@microsoft.com>2017-07-26 21:24:10 -0700
committerIbrahim Esmat <iesmat@microsoft.com>2017-07-26 21:24:10 -0700
commit3fc5c0fefbeca6d5eb249091266a31c1b3b31814 (patch)
tree18cbdaedbfd588e2e35ba7e298362813d49d19a0 /test
parent73289b7368a875f2a007b79c7263009868020c49 (diff)
downloadscons-3fc5c0fefbeca6d5eb249091266a31c1b3b31814.tar.gz
Fix MSVC_UWP_APP test to take into account the MSVC_VERSION.
The test should take into account if the MSVC_VERSION is less than 14.0 (VS2015) and check that the LIBPATH doesn't include the store paths.
Diffstat (limited to 'test')
-rw-r--r--test/MSVC/MSVC_UWP_APP.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/test/MSVC/MSVC_UWP_APP.py b/test/MSVC/MSVC_UWP_APP.py
index 2521ad6f..6d335675 100644
--- a/test/MSVC/MSVC_UWP_APP.py
+++ b/test/MSVC/MSVC_UWP_APP.py
@@ -30,17 +30,23 @@ the desired effect.
"""
import TestSCons
+import SCons.Tool.MSCommon.vc as msvc
def AreVCStoreLibPathsInLIBPATH(output):
+ libpath = None
+ msvc_version = None
lines = output.splitlines()
for line in lines:
if 'env[ENV][LIBPATH]=' in line:
idx_eq = line.find('=')
libpath = line[idx_eq + 1:]
+ elif 'env[MSVC_VERSION]=' in line:
+ idx_eq = line.find('=')
+ msvc_version = line[idx_eq + 1:]
- if not libpath:
- # Couldn't find the libpath in the output
- return (False, False)
+ if not libpath or not msvc_version:
+ # Couldn't find the libpath or msvc version in the output
+ return (False, False, None)
libpaths = libpath.lower().split(';')
(vclibstore_path_present, vclibstorerefs_path_present) = (False, False)
@@ -56,7 +62,7 @@ def AreVCStoreLibPathsInLIBPATH(output):
elif r'vc\lib\store' in path:
vclibstore_path_present = True
- return (vclibstore_path_present, vclibstorerefs_path_present)
+ return (vclibstore_path_present, vclibstorerefs_path_present, msvc_version)
_python_ = TestSCons._python_
@@ -77,21 +83,37 @@ else:
env = Environment(tools=['default', 'msvc'], variables=help_vars)
# Print the ENV LIBPATH to stdout
print('env[ENV][LIBPATH]=%s' % env.get('ENV').get('LIBPATH'))
+print('env[MSVC_VERSION]=%s' % env.get('MSVC_VERSION'))
""")
+installed_msvc_versions = msvc.cached_get_installed_vcs()
+# MSVC guaranteed to be at least one version on the system or else skip_if_not_msvc() function
+# would have skipped the test
+greatest_msvc_version_on_system = installed_msvc_versions[0]
+maj, min = msvc.msvc_version_to_maj_min(greatest_msvc_version_on_system)
+
+# We always use the greatest MSVC version installed on the system
+
# Test setting MSVC_UWP_APP is '1' (True)
test.run(arguments = "MSVC_UWP_APP=1")
-(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout())
-test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False))
+(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout())
+test.fail_test(msvc_version != greatest_msvc_version_on_system)
+# VS2015+
+if maj >= 14:
+ test.fail_test((vclibstore_path_present is False) or (vclibstorerefs_path_present is False))
+else:
+ test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True))
# Test setting MSVC_UWP_APP is '0' (False)
test.run(arguments = "MSVC_UWP_APP=0")
-(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout())
+(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout())
+test.fail_test(msvc_version != greatest_msvc_version_on_system)
test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True))
# Test not setting MSVC_UWP_APP
test.run(arguments = "")
-(vclibstore_path_present, vclibstorerefs_path_present) = AreVCStoreLibPathsInLIBPATH(test.stdout())
+(vclibstore_path_present, vclibstorerefs_path_present, msvc_version) = AreVCStoreLibPathsInLIBPATH(test.stdout())
+test.fail_test(msvc_version != greatest_msvc_version_on_system)
test.fail_test((vclibstore_path_present is True) or (vclibstorerefs_path_present is True))
test.pass_test()