aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorAleksey Gurtovoy <agurtovoy@acm.org>2019-06-26 15:59:49 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2019-06-27 20:44:29 +0300
commit8ebe3d46bb3695118acb0dfe7a038b0ecfde4f77 (patch)
tree847881c225506178c7fd0bb0d3bdb46321530e4e /run_unittests.py
parent11248eb203e16dae6dc288d148b20b44fb0a5ac0 (diff)
downloadmeson-8ebe3d46bb3695118acb0dfe7a038b0ecfde4f77.zip
meson-8ebe3d46bb3695118acb0dfe7a038b0ecfde4f77.tar.gz
meson-8ebe3d46bb3695118acb0dfe7a038b0ecfde4f77.tar.bz2
Fix faling test_msvc_toolset_version test
VCToolsVersion is not always set, and MS docs recommend getting the info from a file
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 0749f07..6934bc3 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -996,8 +996,12 @@ class InternalTests(unittest.TestCase):
# TODO: ICL doesn't set this in the VSC2015 profile either
if cc.id == 'msvc' and int(''.join(cc.version.split('.')[0:2])) < 1910:
return
- self.assertIn('VCToolsVersion', os.environ)
- vctools_ver = os.environ['VCToolsVersion']
+ if 'VCToolsVersion' in os.environ:
+ vctools_ver = os.environ['VCToolsVersion']
+ else:
+ self.assertIn('VCINSTALLDIR', os.environ)
+ # See https://devblogs.microsoft.com/cppblog/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
+ vctools_ver = (Path(os.environ['VCINSTALLDIR']) / 'Auxiliary' / 'Build' / 'Microsoft.VCToolsVersion.default.txt').read_text()
self.assertTrue(vctools_ver.startswith(toolset_ver),
msg='{!r} does not start with {!r}'.format(vctools_ver, toolset_ver))