diff options
author | Daniel <dmoody256@gmail.com> | 2019-02-08 03:51:40 (GMT) |
---|---|---|
committer | Daniel <dmoody256@gmail.com> | 2019-02-08 03:51:40 (GMT) |
commit | 88621c322e1b7d1567419b176d8e99d44a135006 (patch) | |
tree | 004bfc65407347315f90257441040c7141176e68 /test | |
parent | 3454ffa352804f8371dd5822b207f03622b8e3b8 (diff) | |
parent | 9f090132091e56c123262106f3563142787c2fcf (diff) | |
download | SCons-88621c322e1b7d1567419b176d8e99d44a135006.zip SCons-88621c322e1b7d1567419b176d8e99d44a135006.tar.gz SCons-88621c322e1b7d1567419b176d8e99d44a135006.tar.bz2 |
Merge remote-tracking branch 'origin/master' into mingw_link_issue
Diffstat (limited to 'test')
-rw-r--r-- | test/Configure/option--config.py | 92 | ||||
-rw-r--r-- | test/M4/M4.py | 38 | ||||
-rw-r--r-- | test/MSVC/no_msvc.py | 51 | ||||
-rw-r--r-- | test/fixture/no_msvc/no_msvcs_sconstruct.py | 15 | ||||
-rw-r--r-- | test/fixture/no_msvc/no_regs_sconstruct.py | 7 | ||||
-rw-r--r-- | test/fixture/no_msvc/sconstest.skip | 0 |
6 files changed, 139 insertions, 64 deletions
diff --git a/test/Configure/option--config.py b/test/Configure/option--config.py index 1f40a80..80a8bcd 100644 --- a/test/Configure/option--config.py +++ b/test/Configure/option--config.py @@ -39,9 +39,9 @@ test = TestSCons.TestSCons() test.subdir('include') NCR = test.NCR # non-cached rebuild -CR = test.CR # cached rebuild (up to date) +CR = test.CR # cached rebuild (up to date) NCF = test.NCF # non-cached build failure -CF = test.CF # cached build failure +CF = test.CF # cached build failure SConstruct_path = test.workpath('SConstruct') @@ -70,36 +70,36 @@ scons: *** "%(conftest_0_c)s" is not yet built and cache is forced. test.run(arguments='--config=cache', status=2, stderr=expect) test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=force') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", NCR), (_obj, NCR))], - [((".c", NCR), (_obj, NCF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", NCR), (_obj, NCR))], + [((".c", NCR), (_obj, NCF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.write(['include', 'non_system_header1.h'], """ /* Another header */ @@ -107,20 +107,36 @@ test.write(['include', 'non_system_header1.h'], """ test.unlink(['include', 'non_system_header0.h']) test.run(arguments='--config=cache') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["yes", "no"], - [[((".c", CR), (_obj, CR))], - [((".c", CR), (_obj, CF))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["yes", "no"], + [[((".c", CR), (_obj, CR))], + [((".c", CR), (_obj, CF))]], + "config.log", ".sconf_temp", "SConstruct") test.run(arguments='--config=auto') -test.checkLogAndStdout( ["Checking for C header file non_system_header0.h... ", - "Checking for C header file non_system_header1.h... "], - ["no", "yes"], - [[((".c", CR), (_obj, NCF))], - [((".c", CR), (_obj, NCR))]], - "config.log", ".sconf_temp", "SConstruct") +test.checkLogAndStdout(["Checking for C header file non_system_header0.h... ", + "Checking for C header file non_system_header1.h... "], + ["no", "yes"], + [[((".c", CR), (_obj, NCF))], + [((".c", CR), (_obj, NCR))]], + "config.log", ".sconf_temp", "SConstruct") + +# Check the combination of --config=force and Decider('MD5-timestamp') +# On second run there was an issue where the decider would throw DeciderNeedsNode +# exception which the configure code didn't handle. +SConstruct_path = test.workpath('SConstruct') +test.write(SConstruct_path, """ +env = Environment() +env.Decider('MD5-timestamp') +conf = Configure(env) +conf.TryLink('int main(){return 0;}','.c') +env = conf.Finish() +""") +test.run(arguments='--config=force') +# On second run the sconsign is loaded and decider doesn't just indicate need to rebuild +test.run(arguments='--config=force') +test.must_not_contain(test.workpath('config.log'), "TypeError: 'NoneType' object is not callable", mode='r') test.pass_test() diff --git a/test/M4/M4.py b/test/M4/M4.py index 82c084c..1f5c679 100644 --- a/test/M4/M4.py +++ b/test/M4/M4.py @@ -36,8 +36,6 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - test.write('mym4.py', """ import sys contents = sys.stdin.read() @@ -60,23 +58,16 @@ line 3 test.run() -import sys - -if sys.platform == 'win32': - # Handle carriage returns. - test.must_match(test.workpath('aaa.x'), "line 1\r\nmym4.py\r\nline 3\r\n") -else: - test.must_match(test.workpath('aaa.x'), "line 1\nmym4.py\nline 3\n") - - +test.must_match(test.workpath('aaa.x'), os.linesep.join(["line 1", "mym4.py", "line 3", ""])) m4 = test.where_is('m4') -if m4: +if not m4: + test.skip_test('M4 not found found; skipping test.\n') - test.file_fixture('wrapper.py') +test.file_fixture('wrapper.py') - test.write('SConstruct', """ +test.write('SConstruct', """ DefaultEnvironment(tools=[]) foo = Environment(tools=['m4'], M4=r'%(m4)s', M4FLAGS='-DFFF=fff') @@ -87,23 +78,18 @@ foo.M4(target = 'foo.x', source = 'foo.x.m4') bar.M4(target = 'bar', source = 'bar.m4') """ % locals()) - test.write('foo.x.m4', "line 1\n" - "FFF\n" - "line 3\n") - - test.write('bar.m4', "line 1\n" - "BBB\n" - "line 3\n") +test.write('foo.x.m4', os.linesep.join(["line 1", "FFF", "line 3"])) - test.run(arguments = '.') +test.write('bar.m4', os.linesep.join(["line 1", "BBB", "line 3"])) - test.up_to_date(arguments = '.') +test.run(arguments = '.') +test.up_to_date(arguments = '.') - test.must_match('wrapper.out', "wrapper.py\n") +test.must_match('wrapper.out', "wrapper.py\n") - test.must_match('foo.x', "line 1\nfff\nline 3\n") +test.must_match('foo.x', os.linesep.join(["line 1", "fff", "line 3"])) - test.must_match('bar', "line 1\nbbb\nline 3\n") +test.must_match('bar', os.linesep.join(["line 1", "bbb", "line 3"])) test.pass_test() diff --git a/test/MSVC/no_msvc.py b/test/MSVC/no_msvc.py new file mode 100644 index 0000000..d1161c6 --- /dev/null +++ b/test/MSVC/no_msvc.py @@ -0,0 +1,51 @@ +#!/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 scons when no MSVCs are present. +""" + +import sys + +import TestSCons + +test = TestSCons.TestSCons() + +if sys.platform != 'win32': + test.skip_test("Not win32 platform. Skipping test\n") + +# test find_vc_pdir_vswhere by removing all other VS's reg keys +test.file_fixture('no_msvc/no_regs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s', stdout='') + +# test no msvc's +test.file_fixture('no_msvc/no_msvcs_sconstruct.py', 'SConstruct') +test.run(arguments='-Q -s') + +if 'MSVC_VERSION=None' not in test.stdout(): + test.fail_test() + +test.pass_test()
\ No newline at end of file diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct.py b/test/fixture/no_msvc/no_msvcs_sconstruct.py new file mode 100644 index 0000000..e0b59e6 --- /dev/null +++ b/test/fixture/no_msvc/no_msvcs_sconstruct.py @@ -0,0 +1,15 @@ +import SCons +import SCons.Tool.MSCommon + +def DummyVsWhere(msvc_version): + # not testing versions with vswhere, so return none + return None + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere + +env = SCons.Environment.Environment() + +print('MSVC_VERSION='+str(env.get('MSVC_VERSION')))
\ No newline at end of file diff --git a/test/fixture/no_msvc/no_regs_sconstruct.py b/test/fixture/no_msvc/no_regs_sconstruct.py new file mode 100644 index 0000000..3eeca94 --- /dev/null +++ b/test/fixture/no_msvc/no_regs_sconstruct.py @@ -0,0 +1,7 @@ +import SCons +import SCons.Tool.MSCommon + +for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + +env = SCons.Environment.Environment()
\ No newline at end of file diff --git a/test/fixture/no_msvc/sconstest.skip b/test/fixture/no_msvc/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixture/no_msvc/sconstest.skip |