Skip to content

Commit 981d74a

Browse files
committed
Test suite update and bug fixes.
Changes: * Bug fix for not found toolset version in vcTests.py * Re-work sdk list tests in vcTests.py when run on machine that may not have sdks installed (no msvc or older msvc). Potential future problem lurking as the gap between supported sdk versions grows with future releases. * Update the tolerance for precompiled header "fast enough" in msvc.py. This test, more than others, has a tendency to fail when run in a virtual machine on Windows. * Explicity run "foo.exe" instead of "foo" in vs-14.3-exec.py. A recent change in VS2022 appears to create a "foo" folder which causes the test to fail.
1 parent a42bc77 commit 981d74a

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

SCons/Tool/MSCommon/vcTests.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,14 @@ def runTest(self) -> None:
215215

216216
class Data:
217217

218-
HAVE_MSVC = True if MSCommon.vc.msvc_default_version() else False
218+
DEFAULT_VERSION = MSCommon.vc.msvc_default_version()
219+
220+
if DEFAULT_VERSION:
221+
HAVE_MSVC = True
222+
DEFAULT_VERSION_DEF = MSCommon.msvc_version_components(DEFAULT_VERSION)
223+
else:
224+
HAVE_MSVC = False
225+
DEFAULT_VERSION_DEF = None
219226

220227
INSTALLED_VCS_COMPONENTS = MSCommon.vc.get_installed_vcs_components()
221228

@@ -230,11 +237,11 @@ def _msvc_toolset_notfound_list(cls, toolset_seen, toolset_list):
230237
if len(comps) != 3:
231238
continue
232239
# full versions only
240+
ival = int(comps[-1])
233241
nloop = 0
234242
while nloop < 10:
235-
ival = int(comps[-1])
236243
if ival == 0:
237-
ival = 1000000
244+
ival = 100000
238245
ival -= 1
239246
version = '{}.{}.{:05d}'.format(comps[0], comps[1], ival)
240247
if version not in toolset_seen:
@@ -310,10 +317,18 @@ def test_valid_vcver(self) -> None:
310317
version_def = MSCommon.msvc_version_components(symbol)
311318
for msvc_uwp_app in (True, False):
312319
sdk_list = MSCommon.vc.msvc_sdk_versions(version=symbol, msvc_uwp_app=msvc_uwp_app)
313-
if Data.HAVE_MSVC and version_def.msvc_vernum >= 14.0:
320+
if version_def.msvc_vernum < 14.0:
321+
# version < VS2015
322+
# does not accept sdk version argument
323+
self.assertFalse(sdk_list, "SDK list is not empty for msvc version {}".format(repr(symbol)))
324+
elif Data.HAVE_MSVC and Data.DEFAULT_VERSION_DEF.msvc_vernum >= 14.0:
325+
# version >= VS2015 and default_version >= VS2015
326+
# no guarantee test is valid: compatible sdks may not be installed as version gap grows
314327
self.assertTrue(sdk_list, "SDK list is empty for msvc version {}".format(repr(symbol)))
315328
else:
316-
self.assertFalse(sdk_list, "SDK list is not empty for msvc version {}".format(repr(symbol)))
329+
# version >= VS2015 and default_version < VS2015
330+
# skip test: version is not installed; compatible windows sdks may not be installed
331+
pass
317332

318333
def test_valid_vcver_toolsets(self) -> None:
319334
for symbol in MSCommon.vc._VCVER:

test/MSVC/msvc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116

117117
# TODO: Reevaluate if having this part of the test makes sense any longer
118118
# using precompiled headers should be faster
119-
limit = slow*0.90
119+
limit = slow
120120
if fast >= limit:
121121
print("Using precompiled headers was not fast enough:")
122122
print("slow.obj: %.3fs" % slow)

test/MSVS/vs-14.3-exec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
program=[test.get_msvs_executable(msvs_version)],
105105
arguments=['foo.sln', '/build', 'Release'])
106106

107-
test.run(program=test.workpath('sub dir', 'foo'), stdout="foo.c\n")
107+
test.run(program=test.workpath('sub dir', 'foo.exe'), stdout="foo.c\n")
108108
test.validate_msvs_file(test.workpath('sub dir', 'foo.vcxproj.user'))
109109

110110

0 commit comments

Comments
 (0)