diff options
author | Daniel <dmoody256@gmail.com> | 2018-08-12 02:51:45 (GMT) |
---|---|---|
committer | Daniel <dmoody256@gmail.com> | 2018-08-12 02:51:45 (GMT) |
commit | 1e8ed8f10e9930e9a7352431b41c949b90ee0912 (patch) | |
tree | dd7ebad7e3d94c313aa826b7271044afc43c234c /test | |
parent | a2180c7415581bd10011b9b8eb1a3a35ec16f4b4 (diff) | |
parent | 24b6b03075dcb36dfc44a00c156699ff65660747 (diff) | |
download | SCons-1e8ed8f10e9930e9a7352431b41c949b90ee0912.zip SCons-1e8ed8f10e9930e9a7352431b41c949b90ee0912.tar.gz SCons-1e8ed8f10e9930e9a7352431b41c949b90ee0912.tar.bz2 |
Merge remote-tracking branch 'origin/master' into MSVSTestDoesntCheckForCL
Diffstat (limited to 'test')
-rw-r--r-- | test/Docbook/basic/xinclude/xinclude.py | 2 | ||||
-rw-r--r-- | test/Docbook/dependencies/xinclude/xinclude.py | 2 | ||||
-rw-r--r-- | test/Java/RMIC.py | 4 | ||||
-rw-r--r-- | test/Repository/RMIC.py | 4 | ||||
-rw-r--r-- | test/SConscript/must_exist.py | 122 | ||||
-rw-r--r-- | test/option-f.py | 9 | ||||
-rw-r--r-- | test/option/warn-missing-sconscript.py | 11 |
7 files changed, 147 insertions, 7 deletions
diff --git a/test/Docbook/basic/xinclude/xinclude.py b/test/Docbook/basic/xinclude/xinclude.py index 302c777..9b22c13 100644 --- a/test/Docbook/basic/xinclude/xinclude.py +++ b/test/Docbook/basic/xinclude/xinclude.py @@ -44,7 +44,7 @@ test.dir_fixture('image') # Normal invocation test.run() test.must_exist(test.workpath('manual_xi.xml')) -test.must_contain(test.workpath('manual_xi.xml'),'<para>This is an included text.') +test.must_contain(test.workpath('manual_xi.xml'),'<para>This is an included text.', mode='r') # Cleanup diff --git a/test/Docbook/dependencies/xinclude/xinclude.py b/test/Docbook/dependencies/xinclude/xinclude.py index 115163c..c3d9e25 100644 --- a/test/Docbook/dependencies/xinclude/xinclude.py +++ b/test/Docbook/dependencies/xinclude/xinclude.py @@ -44,7 +44,7 @@ test.dir_fixture('image') # Normal invocation test.run() test.must_exist(test.workpath('manual_xi.xml')) -test.must_contain(test.workpath('manual_xi.xml'),'<para>This is an included text.') +test.must_contain(test.workpath('manual_xi.xml'),'<para>This is an included text.', mode='r') # Change included file test.write('include.txt', 'This is another text.') diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py index b29a466..19e799e 100644 --- a/test/Java/RMIC.py +++ b/test/Java/RMIC.py @@ -108,6 +108,10 @@ if java_version.count('.') == 1: # If it's 1.8 or higher, we skip the further RMIC test # because we'll get warnings about the deprecated API... # it's just not state-of-the-art anymore. +# Recent java versions (9 and greater) are back to being +# marketed as a simple version, but java_where_javac() will +# still return a dotted version, like 10.0. If this changes, +# will need to rework this rule. # Note, how we allow simple version strings like "5" and # "6" to successfully pass this test. if curver < (1, 8): diff --git a/test/Repository/RMIC.py b/test/Repository/RMIC.py index e08c716..433890f 100644 --- a/test/Repository/RMIC.py +++ b/test/Repository/RMIC.py @@ -51,6 +51,10 @@ if java_version.count('.') == 1: # If it's 1.8 or higher, we skip the further RMIC test # because we'll get warnings about the deprecated API... # it's just not state-of-the-art anymore. +# Recent java versions (9 and greater) are back to being +# marketed as a simple version, but java_where_javac() will +# still return a dotted version, like 10.0. If this changes, +# will need to rework this rule. # Note, how we allow simple version strings like "5" and # "6" to successfully pass this test. if curver >= (1, 8): diff --git a/test/SConscript/must_exist.py b/test/SConscript/must_exist.py new file mode 100644 index 0000000..3faf0ce --- /dev/null +++ b/test/SConscript/must_exist.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +''' +Test handling of must_exist flag and global setting requiring the +file to exist in an SConscript call +''' + +import os +import TestSCons + +test = TestSCons.TestSCons() + +# catch the exception if is raised, send it on as a warning +# this gives us traceability of the line responsible +SConstruct_path = test.workpath('SConstruct') +test.write(SConstruct_path, """\ +import SCons +from SCons.Warnings import _warningOut +import sys + +# 1. call should succeed with deprecation warning +try: + SConscript('missing/SConscript') +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +# 2. call should succeed with warning +try: + SConscript('missing/SConscript') +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +# 3. call should raise exception +try: + SConscript('missing/SConscript', must_exist=True) +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +# 4. call should succeed with warning +try: + SConscript('missing/SConscript', must_exist=False) +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +SCons.Script.set_missing_sconscript_error() +# 5. with system setting changed, should raise exception +try: + SConscript('missing/SConscript') +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +# 6. must_exist=False overrides system setting, should emit warning +try: + SConscript('missing/SConscript', must_exist=False) +except SCons.Errors.UserError as e: + if _warningOut: + _warningOut(e) +""") + +# we should see two exceptions as "Fatal" and +# and see four warnings, the first having the depr message +# need to build the path in the expected msg in an OS-agnostic way +missing = os.path.normpath('missing/SConscript') +warn1 = """ +scons: warning: Calling missing SConscript without error is deprecated. +Transition by adding must_exist=0 to SConscript calls. +Missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 7) + +warn2 = """ +scons: warning: Ignoring missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 13) + +err1 = """ +scons: warning: Fatal: missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 22) + +warn3 = """ +scons: warning: Ignoring missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 25) + +err2 = """ +scons: warning: Fatal: missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 35) + +warn4 = """ +scons: warning: Ignoring missing SConscript '{}' +""".format(missing) + test.python_file_line(SConstruct_path, 38) + +expect_stderr = warn1 + warn2 + err1 + warn3 + err2 + warn4 +test.run(arguments = ".", stderr = expect_stderr) +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/option-f.py b/test/option-f.py index 21afacb..46e2686 100644 --- a/test/option-f.py +++ b/test/option-f.py @@ -97,9 +97,12 @@ test.run(arguments = '-f Build2 -f SConscript .', stdout=expect) test.run(arguments = '-f no_such_file .', stdout = test.wrap_stdout("scons: `.' is up to date.\n"), stderr = None) -test.fail_test(not test.match_re(test.stderr(), """ -scons: warning: Ignoring missing SConscript 'no_such_file' -""" + TestSCons.file_expr)) +expect = """ +scons: warning: Calling missing SConscript without error is deprecated. +Transition by adding must_exist=0 to SConscript calls. +Missing SConscript 'no_such_file'""" +stderr = test.stderr() +test.must_contain_all(test.stderr(), expect) test.pass_test() diff --git a/test/option/warn-missing-sconscript.py b/test/option/warn-missing-sconscript.py index 4f1f8bd..492131b 100644 --- a/test/option/warn-missing-sconscript.py +++ b/test/option/warn-missing-sconscript.py @@ -51,16 +51,23 @@ test.write("foo.c",""" """) expect = r""" -scons: warning: Ignoring missing SConscript 'no_such_file' +scons: warning: Calling missing SConscript without error is deprecated. +Transition by adding must_exist=0 to SConscript calls. +Missing SConscript 'no_such_file' """ + TestSCons.file_expr +# this is the old message: +#expect = r""" +#scons: warning: Ignoring missing SConscript 'no_such_file' +"" + TestSCons.file_expr + test.run(arguments = '--warn=missing-sconscript .', stderr = expect) test.run(arguments = '--warn=no-missing-sconscript .', stderr = "") test.run(arguments = 'WARN=missing-sconscript .', stderr = expect) -test.run(arguments = 'WARN=no-missing-sconscript .') +test.run(arguments = 'WARN=no-missing-sconscript .', stderr = "") test.pass_test() |