summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-07-07 17:41:07 (GMT)
committerJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-07-07 17:41:07 (GMT)
commit88c534e242abcb17c721ceffd976397cf8d4c097 (patch)
treedd8df88e5cbb83aecb21b65d44e793ba8db9085a
parente8faf157450ec575d743108624645bb8207c4a00 (diff)
downloadSCons-88c534e242abcb17c721ceffd976397cf8d4c097.zip
SCons-88c534e242abcb17c721ceffd976397cf8d4c097.tar.gz
SCons-88c534e242abcb17c721ceffd976397cf8d4c097.tar.bz2
Minor update to msvc exceptions and rework new unit tests.
-rw-r--r--SCons/Tool/MSCommon/MSVC/Exceptions.py15
-rw-r--r--SCons/Tool/MSCommon/MSVC/Policy.py5
-rw-r--r--SCons/Tool/MSCommon/__init__.py1
-rw-r--r--SCons/Tool/MSCommon/vc.py5
-rw-r--r--test/MSVC/MSVC_NOTFOUND_POLICY.py138
-rw-r--r--test/MSVC/MSVC_SCRIPTERROR_POLICY.py80
-rw-r--r--test/MSVC/MSVC_TOOLSET_VERSION.py27
7 files changed, 165 insertions, 106 deletions
diff --git a/SCons/Tool/MSCommon/MSVC/Exceptions.py b/SCons/Tool/MSCommon/MSVC/Exceptions.py
index a12b3c6..7b24a2b 100644
--- a/SCons/Tool/MSCommon/MSVC/Exceptions.py
+++ b/SCons/Tool/MSCommon/MSVC/Exceptions.py
@@ -25,27 +25,32 @@
Exceptions for Microsoft Visual C/C++.
"""
+# reminder: add exceptions to MSCommon if necessary
+
class VisualCException(Exception):
pass
class MSVCInternalError(VisualCException):
pass
+class MSVCUserError(VisualCException):
+ pass
+
class MSVCScriptExecutionError(VisualCException):
pass
-class MSVCVersionNotFound(VisualCException):
+class MSVCVersionNotFound(MSVCUserError):
pass
-class MSVCSDKVersionNotFound(VisualCException):
+class MSVCSDKVersionNotFound(MSVCUserError):
pass
-class MSVCToolsetVersionNotFound(VisualCException):
+class MSVCToolsetVersionNotFound(MSVCUserError):
pass
-class MSVCSpectreLibsNotFound(VisualCException):
+class MSVCSpectreLibsNotFound(MSVCUserError):
pass
-class MSVCArgumentError(VisualCException):
+class MSVCArgumentError(MSVCUserError):
pass
diff --git a/SCons/Tool/MSCommon/MSVC/Policy.py b/SCons/Tool/MSCommon/MSVC/Policy.py
index 9b7025e..fe8da31 100644
--- a/SCons/Tool/MSCommon/MSVC/Policy.py
+++ b/SCons/Tool/MSCommon/MSVC/Policy.py
@@ -45,6 +45,7 @@ from ..common import (
)
from .Exceptions import (
+ MSVCArgumentError,
MSVCVersionNotFound,
MSVCScriptExecutionError,
)
@@ -141,7 +142,7 @@ def _msvc_notfound_policy_lookup(symbol):
repr(symbol),
', '.join([repr(s) for s in MSVC_NOTFOUND_POLICY_EXTERNAL.keys()])
)
- raise ValueError(err_msg)
+ raise MSVCArgumentError(err_msg)
return notfound_policy_def
@@ -225,7 +226,7 @@ def _msvc_scripterror_policy_lookup(symbol):
repr(symbol),
', '.join([repr(s) for s in MSVC_SCRIPTERROR_POLICY_EXTERNAL.keys()])
)
- raise ValueError(err_msg)
+ raise MSVCArgumentError(err_msg)
return scripterror_policy_def
diff --git a/SCons/Tool/MSCommon/__init__.py b/SCons/Tool/MSCommon/__init__.py
index 8396e17..0640bce 100644
--- a/SCons/Tool/MSCommon/__init__.py
+++ b/SCons/Tool/MSCommon/__init__.py
@@ -58,6 +58,7 @@ from .MSVC.Policy import msvc_get_scripterror_policy # noqa: F401
from .MSVC.Exceptions import VisualCException # noqa: F401
from .MSVC.Exceptions import MSVCInternalError # noqa: F401
+from .MSVC.Exceptions import MSVCUserError # noqa: F401
from .MSVC.Exceptions import MSVCScriptExecutionError # noqa: F401
from .MSVC.Exceptions import MSVCVersionNotFound # noqa: F401
from .MSVC.Exceptions import MSVCSDKVersionNotFound # noqa: F401
diff --git a/SCons/Tool/MSCommon/vc.py b/SCons/Tool/MSCommon/vc.py
index 68b8f08..27a254b 100644
--- a/SCons/Tool/MSCommon/vc.py
+++ b/SCons/Tool/MSCommon/vc.py
@@ -64,6 +64,7 @@ from . import MSVC
from .MSVC.Exceptions import (
VisualCException,
+ MSVCUserError,
MSVCArgumentError,
MSVCToolsetVersionNotFound,
)
@@ -86,10 +87,10 @@ class NoVersionFound(VisualCException):
class BatchFileExecutionError(VisualCException):
pass
-class MSVCScriptNotFound(VisualCException):
+class MSVCScriptNotFound(MSVCUserError):
pass
-class MSVCUseSettingsError(VisualCException):
+class MSVCUseSettingsError(MSVCUserError):
pass
diff --git a/test/MSVC/MSVC_NOTFOUND_POLICY.py b/test/MSVC/MSVC_NOTFOUND_POLICY.py
index b6084db..e9ed4a6 100644
--- a/test/MSVC/MSVC_NOTFOUND_POLICY.py
+++ b/test/MSVC/MSVC_NOTFOUND_POLICY.py
@@ -25,75 +25,117 @@
Test the msvc not found policy construction variable and functions.
"""
-import sys
import TestSCons
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- test.skip_test("Not win32 platform. Skipping test\n")
-
test.skip_if_not_msvc()
+import textwrap
+
# Test global functions with valid symbols
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_notfound_policy
-from SCons.Tool.MSCommon import msvc_get_notfound_policy
-DefaultEnvironment(tools=[])
-for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
- for policy in [symbol, symbol.upper(), symbol.lower()]:
- old_policy = msvc_set_notfound_policy(policy)
- cur_policy = msvc_get_notfound_policy()
-if msvc_set_notfound_policy(None) != msvc_get_notfound_policy():
- raise RuntimeError()
-""")
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_notfound_policy
+ from SCons.Tool.MSCommon import msvc_get_notfound_policy
+ DefaultEnvironment(tools=[])
+ for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
+ for policy in [symbol, symbol.upper(), symbol.lower()]:
+ old_policy = msvc_set_notfound_policy(policy)
+ cur_policy = msvc_get_notfound_policy()
+ if msvc_set_notfound_policy(None) != msvc_get_notfound_policy():
+ raise RuntimeError()
+ """
+))
test.run(arguments='-Q -s', stdout='')
# Test global function with invalid symbol
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_notfound_policy
-DefaultEnvironment(tools=[])
-msvc_set_notfound_policy('Undefined')
-""")
-test.run(arguments='-Q -s', status=2, stderr=r"^.* Value specified for MSVC_NOTFOUND_POLICY.+", match=TestSCons.match_re_dotall)
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_notfound_policy
+ DefaultEnvironment(tools=[])
+ msvc_set_notfound_policy('Undefined')
+ """
+))
+test.run(arguments='-Q -s', status=2, stderr=None)
+expect = "MSVCArgumentError: Value specified for MSVC_NOTFOUND_POLICY is not supported: 'Undefined'."
+test.must_contain_all(test.stderr(), expect)
# Test construction variable with valid symbols
-test.write('SConstruct', """\
-env_list = []
-DefaultEnvironment(tools=[])
-for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
- for policy in [symbol, symbol.upper(), symbol.lower()]:
- env = Environment(MSVC_NOTFOUND_POLICY=policy, tools=['msvc'])
- env_list.append(env)
-""")
+test.write('SConstruct', textwrap.dedent(
+ """
+ env_list = []
+ DefaultEnvironment(tools=[])
+ for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
+ for policy in [symbol, symbol.upper(), symbol.lower()]:
+ env = Environment(MSVC_NOTFOUND_POLICY=policy, tools=['msvc'])
+ env_list.append(env)
+ """
+))
test.run(arguments='-Q -s', stdout='')
# Test construction variable with invalid symbol
-test.write('SConstruct', """\
-env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Undefined', tools=['msvc'])
-""")
-test.run(arguments='-Q -s', status=2, stderr=r"^.* Value specified for MSVC_NOTFOUND_POLICY.+", match=TestSCons.match_re_dotall)
+test.write('SConstruct', textwrap.dedent(
+ """
+ env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Undefined', tools=['msvc'])
+ """
+))
+test.run(arguments='-Q -s', status=2, stderr=None)
+expect = "MSVCArgumentError: Value specified for MSVC_NOTFOUND_POLICY is not supported: 'Undefined'."
+test.must_contain_all(test.stderr(), expect)
+
+# Test environment construction with global policy
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_notfound_policy
+ msvc_set_notfound_policy('Exception')
+ env = Environment(MSVC_VERSION='12.9', tools=['msvc'])
+ """
+))
+test.run(arguments='-Q -s', status=2, stderr=None)
+expect = "MSVCVersionNotFound: MSVC version '12.9' was not found."
+test.must_contain_all(test.stderr(), expect)
+
+# Test environment construction with construction variable
+test.write('SConstruct', textwrap.dedent(
+ """
+ env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Error', tools=['msvc'])
+ """
+))
+test.run(arguments='-Q -s', status=2, stderr=None)
+expect = "MSVCVersionNotFound: MSVC version '12.9' was not found."
+test.must_contain_all(test.stderr(), expect)
# Test environment construction with global policy
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_notfound_policy
-msvc_set_notfound_policy('Exception')
-env = Environment(MSVC_VERSION='12.9', tools=['msvc'])
-""")
-test.run(arguments='-Q -s', status=2, stderr=r"^.* MSVC version '12.9' was not found.+", match=TestSCons.match_re_dotall)
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_notfound_policy
+ msvc_set_notfound_policy('Warning')
+ env = Environment(MSVC_VERSION='12.9', tools=['msvc'])
+ """
+))
+test.run(arguments="-Q -s --warn=visual-c-missing .", status=0, stderr=None)
+expect = "scons: warning: MSVC version '12.9' was not found."
+test.must_contain_all(test.stderr(), expect)
# Test environment construction with construction variable
-test.write('SConstruct', """\
-env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Error', tools=['msvc'])
-""")
-test.run(arguments='-Q -s', status=2, stderr=r"^.* MSVC version '12.9' was not found.+", match=TestSCons.match_re_dotall)
+test.write('SConstruct', textwrap.dedent(
+ """
+ env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Warning', tools=['msvc'])
+ """
+))
+test.run(arguments="-Q -s --warn=visual-c-missing .", status=0, stderr=None)
+expect = "scons: warning: MSVC version '12.9' was not found."
+test.must_contain_all(test.stderr(), expect)
# Test environment construction with construction variable (override global)
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_notfound_policy
-msvc_set_notfound_policy('Exception')
-env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Ignore', tools=['msvc'])
-""")
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_notfound_policy
+ msvc_set_notfound_policy('Exception')
+ env = Environment(MSVC_VERSION='12.9', MSVC_NOTFOUND_POLICY='Ignore', tools=['msvc'])
+ """
+))
test.run(arguments='-Q -s', stdout='')
test.pass_test()
diff --git a/test/MSVC/MSVC_SCRIPTERROR_POLICY.py b/test/MSVC/MSVC_SCRIPTERROR_POLICY.py
index a02a7fc..b616db8 100644
--- a/test/MSVC/MSVC_SCRIPTERROR_POLICY.py
+++ b/test/MSVC/MSVC_SCRIPTERROR_POLICY.py
@@ -25,14 +25,10 @@
Test the msvc script error policy construction variable and functions.
"""
-import sys
import TestSCons
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- test.skip_test("Not win32 platform. Skipping test\n")
-
test.skip_if_not_msvc()
import textwrap
@@ -45,36 +41,44 @@ from SCons.Tool.MSCommon.vc import (
default_msvc_vernum = float(get_msvc_version_numeric(get_installed_vcs()[0]))
# Test global functions with valid symbols
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_scripterror_policy
-from SCons.Tool.MSCommon import msvc_get_scripterror_policy
-DefaultEnvironment(tools=[])
-for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
- for policy in [symbol, symbol.upper(), symbol.lower()]:
- old_policy = msvc_set_scripterror_policy(policy)
- cur_policy = msvc_get_scripterror_policy()
-if msvc_set_scripterror_policy(None) != msvc_get_scripterror_policy():
- raise RuntimeError()
-""")
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_scripterror_policy
+ from SCons.Tool.MSCommon import msvc_get_scripterror_policy
+ DefaultEnvironment(tools=[])
+ for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
+ for policy in [symbol, symbol.upper(), symbol.lower()]:
+ old_policy = msvc_set_scripterror_policy(policy)
+ cur_policy = msvc_get_scripterror_policy()
+ if msvc_set_scripterror_policy(None) != msvc_get_scripterror_policy():
+ raise RuntimeError()
+ """
+))
test.run(arguments='-Q -s', stdout='')
# Test global function with invalid symbol
-test.write('SConstruct', """\
-from SCons.Tool.MSCommon import msvc_set_scripterror_policy
-DefaultEnvironment(tools=[])
-msvc_set_scripterror_policy('Undefined')
-""")
-test.run(arguments='-Q -s', status=2, stderr=r"^.* Value specified for MSVC_SCRIPTERROR_POLICY.+", match=TestSCons.match_re_dotall)
+test.write('SConstruct', textwrap.dedent(
+ """
+ from SCons.Tool.MSCommon import msvc_set_scripterror_policy
+ DefaultEnvironment(tools=[])
+ msvc_set_scripterror_policy('Undefined')
+ """
+))
+test.run(arguments='-Q -s', status=2, stderr=None)
+expect = "MSVCArgumentError: Value specified for MSVC_SCRIPTERROR_POLICY is not supported: 'Undefined'."
+test.must_contain_all(test.stderr(), expect)
# Test construction variable with valid symbols
-test.write('SConstruct', """\
-env_list = []
-DefaultEnvironment(tools=[])
-for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
- for policy in [symbol, symbol.upper(), symbol.lower()]:
- env = Environment(MSVC_SCRIPTERROR_POLICY=policy, tools=['msvc'])
- env_list.append(env)
-""")
+test.write('SConstruct', textwrap.dedent(
+ """
+ env_list = []
+ DefaultEnvironment(tools=[])
+ for symbol in ['Error', 'Exception', 'Warn', 'Warning', 'Ignore', 'Suppress']:
+ for policy in [symbol, symbol.upper(), symbol.lower()]:
+ env = Environment(MSVC_SCRIPTERROR_POLICY=policy, tools=['msvc'])
+ env_list.append(env)
+ """
+))
test.run(arguments='-Q -s', stdout='')
if default_msvc_vernum >= 14.1:
@@ -87,7 +91,9 @@ if default_msvc_vernum >= 14.1:
env = Environment(MSVC_SCRIPT_ARGS=['-thisdoesnotexist=somevalue'], MSVC_SCRIPTERROR_POLICY='Undefined', tools=['msvc'])
"""
))
- test.run(arguments='-Q -s', status=2, stderr=r"^.* Value specified for MSVC_SCRIPTERROR_POLICY.+", match=TestSCons.match_re_dotall)
+ test.run(arguments='-Q -s', status=2, stderr=None)
+ expect = "MSVCArgumentError: Value specified for MSVC_SCRIPTERROR_POLICY is not supported: 'Undefined'."
+ test.must_contain_all(test.stderr(), expect)
# Test environment construction with construction variable (override global)
test.write('SConstruct', textwrap.dedent(
@@ -109,7 +115,9 @@ if default_msvc_vernum >= 14.1:
env = Environment(MSVC_SCRIPT_ARGS=['-thisdoesnotexist=somevalue'], tools=['msvc'])
"""
))
- test.run(arguments='-Q -s', status=2, stderr=r"^.* vc script errors detected.+", match=TestSCons.match_re_dotall)
+ test.run(arguments='-Q -s', status=2, stderr=None)
+ expect = "MSVCScriptExecutionError: vc script errors detected:"
+ test.must_contain_all(test.stderr(), expect)
# Test environment construction with construction variable
test.write('SConstruct', textwrap.dedent(
@@ -118,7 +126,9 @@ if default_msvc_vernum >= 14.1:
env = Environment(MSVC_SCRIPT_ARGS=['-thisdoesnotexist=somevalue'], MSVC_SCRIPTERROR_POLICY='Error', tools=['msvc'])
"""
))
- test.run(arguments='-Q -s', status=2, stderr=r"^.* vc script errors detected.+", match=TestSCons.match_re_dotall)
+ test.run(arguments='-Q -s', status=2, stderr=None)
+ expect = "MSVCScriptExecutionError: vc script errors detected:"
+ test.must_contain_all(test.stderr(), expect)
# Test environment construction with global policy
test.write('SConstruct', textwrap.dedent(
@@ -130,7 +140,8 @@ if default_msvc_vernum >= 14.1:
"""
))
test.run(arguments='-Q -s', status=0, stderr=None)
- test.fail_test(test.stderr().lstrip().split('\n')[0].strip() != "scons: warning: vc script errors detected:")
+ expect = "scons: warning: vc script errors detected:"
+ test.must_contain_all(test.stderr(), expect)
# Test environment construction with construction variable
test.write('SConstruct', textwrap.dedent(
@@ -140,7 +151,8 @@ if default_msvc_vernum >= 14.1:
"""
))
test.run(arguments='-Q -s', status=0, stderr=None)
- test.fail_test(test.stderr().lstrip().split('\n')[0].strip() != "scons: warning: vc script errors detected:")
+ expect = "scons: warning: vc script errors detected:"
+ test.must_contain_all(test.stderr(), expect)
test.pass_test()
diff --git a/test/MSVC/MSVC_TOOLSET_VERSION.py b/test/MSVC/MSVC_TOOLSET_VERSION.py
index 2e59d46..ac6cd62 100644
--- a/test/MSVC/MSVC_TOOLSET_VERSION.py
+++ b/test/MSVC/MSVC_TOOLSET_VERSION.py
@@ -25,14 +25,10 @@
Test the MSVC_TOOLSET_VERSION construction variable.
"""
-import sys
import TestSCons
test = TestSCons.TestSCons()
-if sys.platform != 'win32':
- test.skip_test("Not win32 platform. Skipping test\n")
-
test.skip_if_not_msvc()
import textwrap
@@ -60,7 +56,7 @@ default_version = installed_versions[0]
GE_VS2017_versions = [v for v in installed_versions if v.msvc_vernum >= 14.1]
LT_VS2017_versions = [v for v in installed_versions if v.msvc_vernum < 14.1]
-LT_VS2015_versions = [v for v in installed_versions if v.msvc_vernum < 14.0]
+LT_VS2015_versions = [v for v in LT_VS2017_versions if v.msvc_vernum < 14.0]
if GE_VS2017_versions:
# VS2017 and later for toolset argument
@@ -96,7 +92,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: multiple toolset version declarations: MSVC_TOOLSET_VERSION={} and MSVC_SCRIPT_ARGS='-vcvars_ver={}':".format(
repr(supported.msvc_verstr), supported.msvc_verstr
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
# msvc_toolset_version does not exist (hopefully)
missing_toolset_version = supported.msvc_verstr + '9.99999'
@@ -106,10 +102,11 @@ if GE_VS2017_versions:
env = Environment(MSVC_VERSION={}, MSVC_TOOLSET_VERSION={}, tools=['msvc'])
""".format(repr(supported.msvc_version), repr(missing_toolset_version))
))
- expect = r"^.*MSVCToolsetVersionNotFound: MSVC_TOOLSET_VERSION {} not found for MSVC_VERSION {}.+".format(
+ test.run(arguments='-Q -s', status=2, stderr=None)
+ expect = "MSVCToolsetVersionNotFound: MSVC_TOOLSET_VERSION {} not found for MSVC_VERSION {}:".format(
repr(missing_toolset_version), repr(supported.msvc_version)
)
- test.run(arguments='-Q -s', status=2, stderr=expect, match=TestSCons.match_re_dotall)
+ test.must_contain_all(test.stderr(), expect)
# msvc_toolset_version is invalid (format)
invalid_toolset_version = supported.msvc_verstr + '9.99999.99999'
@@ -123,7 +120,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: MSVC_TOOLSET_VERSION ({}) format is not supported:".format(
repr(invalid_toolset_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
# msvc_toolset_version is invalid (version greater than msvc version)
invalid_toolset_vernum = round(supported.msvc_vernum + 0.1, 1)
@@ -138,7 +135,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: MSVC_TOOLSET_VERSION ({}) constraint violation: toolset version {} > {} MSVC_VERSION:".format(
repr(invalid_toolset_version), repr(invalid_toolset_version), repr(supported.msvc_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
# msvc_toolset_version is invalid (version less than 14.0)
invalid_toolset_version = '12.0'
@@ -152,7 +149,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: MSVC_TOOLSET_VERSION ({}) constraint violation: toolset version {} < '14.0' VS2015:".format(
repr(invalid_toolset_version), repr(invalid_toolset_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
# 14.0 toolset is invalid (toolset version != 14.0)
invalid_toolset_version = '14.00.00001'
@@ -166,7 +163,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: MSVC_TOOLSET_VERSION ({}) constraint violation: toolset version {} != '14.0':".format(
repr(invalid_toolset_version), repr(invalid_toolset_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
if supported == default_version:
msvc_version_list = ['None', repr(supported.msvc_version)]
@@ -211,7 +208,7 @@ if GE_VS2017_versions:
expect = "MSVCArgumentError: Unsupported msvc version {}:".format(
repr(invalid_msvc_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
if LT_VS2017_versions:
# VS2015 and earlier for toolset argument error
@@ -229,7 +226,7 @@ if LT_VS2017_versions:
expect = "MSVCArgumentError: MSVC_TOOLSET_VERSION ({}) constraint violation: MSVC_VERSION {} < '14.1' VS2017:".format(
repr(unsupported.msvc_verstr), repr(unsupported.msvc_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
# msvc_toolset_versions returns None for versions that don't support toolsets
test.write('SConstruct', textwrap.dedent(
@@ -259,7 +256,7 @@ if LT_VS2015_versions:
expect = "MSVCArgumentError: MSVC_SCRIPT_ARGS ('-vcvars_ver={}') constraint violation: MSVC_VERSION {} < '14.0' VS2015:".format(
unsupported.msvc_verstr, repr(unsupported.msvc_version)
)
- test.fail_test(test.stderr().split('\n')[0].strip() != expect)
+ test.must_contain_all(test.stderr(), expect)
test.pass_test()