diff options
author | Steven Knight <knight@baldmt.com> | 2005-08-12 22:08:38 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-08-12 22:08:38 (GMT) |
commit | 6beaa4ad39345e2e4f00006b3afca5e9e9ee9ebe (patch) | |
tree | 6117b2ff614672e0d687fd97ede7bddc2ea9ef59 /test | |
parent | 3cd29a71c3bdb7beb08bc69043b837990f648be1 (diff) | |
download | SCons-6beaa4ad39345e2e4f00006b3afca5e9e9ee9ebe.zip SCons-6beaa4ad39345e2e4f00006b3afca5e9e9ee9ebe.tar.gz SCons-6beaa4ad39345e2e4f00006b3afca5e9e9ee9ebe.tar.bz2 |
Enhance EnsureSConsVersion() to take revision numbers, too. (Amir Szekely)
Diffstat (limited to 'test')
-rw-r--r-- | test/EnsurePythonVersion.py (renamed from test/EnsureVersion.py) | 75 | ||||
-rw-r--r-- | test/EnsureSConsVersion.py | 126 | ||||
-rw-r--r-- | test/LINK/LINKFLAGS.py | 9 | ||||
-rw-r--r-- | test/LINK/SHLINKFLAGS.py | 9 |
4 files changed, 146 insertions, 73 deletions
diff --git a/test/EnsureVersion.py b/test/EnsurePythonVersion.py index 0abe082..af59b52 100644 --- a/test/EnsureVersion.py +++ b/test/EnsurePythonVersion.py @@ -28,75 +28,20 @@ import TestSCons test = TestSCons.TestSCons() -import SCons -if SCons.__version__ == "__VERSION__": - - test.write('SConstruct', """ -import sys -EnsurePythonVersion(0,0) -sys.exit(0) -""") - - test.run() - - test.write('SConstruct', """ -import sys -EnsurePythonVersion(2000,0) -sys.exit(0) -""") - - test.run(status=2) - -else: - test.write('SConstruct', """ -import sys -env = Environment() -EnsurePythonVersion(0,0) -env.EnsureSConsVersion(0,0) -sys.exit(0) -""") - - test.run() - - test.write('SConstruct', """ -import sys -env = Environment() -EnsurePythonVersion(0,0) -env.EnsureSConsVersion(1,0) -sys.exit(0) -""") - - test.run(status=2) - - test.write('SConstruct', """ -import sys -env = Environment() +test.write('SConstruct', """\ EnsurePythonVersion(0,0) -env.EnsureSConsVersion(2,0) -sys.exit(0) +Exit(0) """) - test.run(status=2) - - test.write('SConstruct', """ -import sys -env = Environment() -env.EnsurePythonVersion(0,0) -EnsureSConsVersion(2000,0) -sys.exit(0) -""") - - test.run(status=2) +test.run() - test.write('SConstruct', """ -import sys +test.write('SConstruct', """\ EnsurePythonVersion(2000,0) -EnsureSConsVersion(2000,0) -sys.exit(0) +Exit(0) """) - test.run(status=2) +test.run(status=2) test.write('SConstruct', """\ import sys @@ -106,7 +51,7 @@ except AttributeError: pass sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n' EnsurePythonVersion(1,3) -sys.exit(0) +Exit(0) """) test.run() @@ -119,7 +64,7 @@ except AttributeError: pass sys.version = '2.3+ (#0, Feb 24 2003, 19:13:11)\\n' EnsurePythonVersion(2,2) -sys.exit(0) +Exit(0) """) test.run() @@ -132,7 +77,7 @@ except AttributeError: pass sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n' EnsurePythonVersion(2,3) -sys.exit(0) +Exit(0) """) test.run() @@ -145,7 +90,7 @@ except AttributeError: pass sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n' EnsurePythonVersion(2,4) -sys.exit(0) +Exit(0) """) test.run(status=2) diff --git a/test/EnsureSConsVersion.py b/test/EnsureSConsVersion.py new file mode 100644 index 0000000..287dfa7 --- /dev/null +++ b/test/EnsureSConsVersion.py @@ -0,0 +1,126 @@ +#!/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__" + +import TestSCons + +test = TestSCons.TestSCons() + +import SCons + +if SCons.__version__ != "__VERSION__": + + test.write('SConstruct', """\ +env = Environment() +env.EnsureSConsVersion(0,0) +Exit(0) +""") + + test.run() + + test.write('SConstruct', """\ +env = Environment() +env.EnsureSConsVersion(1,0) +Exit(0) +""") + + test.run(status=2) + + test.write('SConstruct', """\ +env = Environment() +env.EnsureSConsVersion(2,0) +Exit(0) +""") + + test.run(status=2) + + test.write('SConstruct', """\ +EnsureSConsVersion(2000,0) +Exit(0) +""") + + test.run(status=2) + + + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,33) +""") + +test.run() + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,33,0) +""") + +test.run() + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,33,1) +""") + +test.run() + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,33,2) +""") + +test.run() + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,33,3) +""") + +test.run(status=2) + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(0,34) +""") + +test.run(status=2) + +test.write('SConstruct', """\ +import SCons +SCons.__version__ = '0.33.2' +EnsureSConsVersion(1,0) +""") + +test.run(status=2) + + + +test.pass_test() diff --git a/test/LINK/LINKFLAGS.py b/test/LINK/LINKFLAGS.py index 047ddc7..9a6ef1c 100644 --- a/test/LINK/LINKFLAGS.py +++ b/test/LINK/LINKFLAGS.py @@ -39,13 +39,14 @@ test.write("wrapper.py", import string import sys open('%s', 'wb').write("wrapper.py\\n") -os.system(string.join(sys.argv[1:], " ")) +args = filter(lambda s: s != 'fake_link_flag', sys.argv[1:]) +os.system(string.join(args, " ")) """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ foo = Environment() -link = foo.subst("$LINK") -bar = Environment(LINK = '', LINKFLAGS = r'%s wrapper.py ' + link) +bar = Environment(LINK = foo.subst(r'%s wrapper.py $LINK'), + LINKFLAGS = foo.subst('$LINKFLAGS fake_link_flag')) foo.Program(target = 'foo', source = 'foo.c') bar.Program(target = 'bar', source = 'bar.c') """ % python) @@ -73,7 +74,7 @@ main(int argc, char *argv[]) test.run(arguments = 'foo' + _exe) -test.fail_test(os.path.exists(test.workpath('wrapper.out'))) +test.must_not_exist(test.workpath('wrapper.out')) test.run(arguments = 'bar' + _exe) diff --git a/test/LINK/SHLINKFLAGS.py b/test/LINK/SHLINKFLAGS.py index 88e2442..c9ecf21 100644 --- a/test/LINK/SHLINKFLAGS.py +++ b/test/LINK/SHLINKFLAGS.py @@ -40,13 +40,14 @@ test.write("wrapper.py", import string import sys open('%s', 'wb').write("wrapper.py\\n") -os.system(string.join(sys.argv[1:], " ")) +args = filter(lambda s: s != 'fake_shlink_flag', sys.argv[1:]) +os.system(string.join(args, " ")) """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ foo = Environment() -bar = Environment(SHLINK = '', - SHLINKFLAGS = foo.subst(r'%s wrapper.py $SHLINK $SHLINKFLAGS')) +bar = Environment(SHLINK = foo.subst(r'%s wrapper.py $SHLINK'), + SHLINKFLAGS = foo.subst('$SHLINKFLAGS fake_shlink_flag')) foo.SharedLibrary(target = 'foo', source = 'foo.c') bar.SharedLibrary(target = 'bar', source = 'bar.c') """ % python) @@ -75,7 +76,7 @@ test() test.run(arguments = lib_ + 'foo' + _shlib) -test.fail_test(os.path.exists(test.workpath('wrapper.out'))) +test.must_not_exist(test.workpath('wrapper.out')) test.run(arguments = lib_ + 'bar' + _shlib) |