diff options
author | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
commit | dd9bbc79353ae90b2402c16b1613dad4e502d250 (patch) | |
tree | 42f857f72bb4dcab6d876d1f9c73e0a1dd70d8c2 /test | |
parent | 57fcbbc5d24fb16f988e4fe3294d5d49abef8e2a (diff) | |
download | SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.zip SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.gz SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.bz2 |
Merged revisions 1441-1539 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1441 | stevenknight | 2006-04-22 23:06:53 -0400 (Sat, 22 Apr 2006) | 1 line
0.96.D397 - The scons command, branch 0.96.91.
........
r1442 | stevenknight | 2006-04-27 00:45:12 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D398 - The scons command, branch 0.96.92.
........
r1443 | stevenknight | 2006-04-27 00:49:25 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D399 - Taskmaster clean-ups in anticipation of refactoring speedups.
........
r1450 | stevenknight | 2006-05-02 00:04:55 -0400 (Tue, 02 May 2006) | 1 line
0.96.D400 - Fix VC+++ 2005 Express detection. (Atul Varma) Fix parsing Intel C compiler Li
........
r1451 | stevenknight | 2006-05-02 01:14:24 -0400 (Tue, 02 May 2006) | 1 line
0.96.D401 - Enhance ParseConfig() to understand -arch and -isysroot options. (Gary Oberbrun
........
r1458 | stevenknight | 2006-05-02 23:21:04 -0400 (Tue, 02 May 2006) | 1 line
0.96.D402 - Make strfunction handling consistent. (David Gruener)
........
r1459 | stevenknight | 2006-05-02 23:37:08 -0400 (Tue, 02 May 2006) | 1 line
0.96.D403 - Comment out the test of CVS checkout from the old tigris.org repository.
........
r1460 | stevenknight | 2006-05-03 23:47:54 -0400 (Wed, 03 May 2006) | 1 line
0.96.D404 - Preserve white space in display Action string. (David Gruener)
........
r1461 | stevenknight | 2006-05-04 09:16:15 -0400 (Thu, 04 May 2006) | 1 line
0.96.D405 - Add MergeFlags() and AddFlags() methods. (Greg Noel) Support recognizing compi
........
r1462 | stevenknight | 2006-05-04 23:46:53 -0400 (Thu, 04 May 2006) | 1 line
0.96.D406 - Fix stack trace when ParseFlags has a null string.
........
r1464 | stevenknight | 2006-05-05 17:21:27 -0400 (Fri, 05 May 2006) | 1 line
0.96.D408 - Fix the string displayed by InstallAs() when called through the default construc
........
r1465 | stevenknight | 2006-05-05 18:30:28 -0400 (Fri, 05 May 2006) | 1 line
0.96.D409 - Fix test/ParseConfig.py, broken in the previous checkin by ParseFlags() changes.
........
r1466 | stevenknight | 2006-05-05 20:42:35 -0400 (Fri, 05 May 2006) | 1 line
0.96.D407 - Avoid recursive calls to main() in SConf test programs. (Karol Pietrzak)
........
r1467 | stevenknight | 2006-05-06 00:27:21 -0400 (Sat, 06 May 2006) | 1 line
0.96.D410 - Catch errors from commands that ParseConfig() calls. (John Pye)
........
r1468 | stevenknight | 2006-05-06 10:55:38 -0400 (Sat, 06 May 2006) | 1 line
0.96.D411 - Significant taskmaster speedup by using reference counts, not list manipulation.
........
r1469 | stevenknight | 2006-05-06 18:38:02 -0400 (Sat, 06 May 2006) | 1 line
0.96.D413 - TeX improvements.
........
r1471 | stevenknight | 2006-05-07 09:07:58 -0400 (Sun, 07 May 2006) | 2 lines
Delete properties interfering with clean .jpg checkout.
........
r1472 | stevenknight | 2006-05-07 09:23:54 -0400 (Sun, 07 May 2006) | 1 line
0.96.D412 - Windows portability fixes for two tests and ParseConfig() execution.
........
r1473 | stevenknight | 2006-05-07 09:30:11 -0400 (Sun, 07 May 2006) | 1 line
0.96.D414 - Various man page and documentation updates.
........
r1474 | stevenknight | 2006-05-07 23:53:12 -0400 (Sun, 07 May 2006) | 1 line
0.96.D415 - Initial infrastructure for executing tests under QMTest. (Stefan Seefeld)
........
r1476 | stevenknight | 2006-05-09 00:03:47 -0400 (Tue, 09 May 2006) | 1 line
0.96.D416 - Fix QMTest infrastructure to avoid listing directories with no tests and to find
........
r1477 | stevenknight | 2006-05-16 06:47:51 -0400 (Tue, 16 May 2006) | 1 line
0.96.D417 - Fix Alias turning Entries into Nodes or Dirs too soon.
........
r1478 | stevenknight | 2006-05-17 08:32:58 -0400 (Wed, 17 May 2006) | 1 line
0.96.D418 - Next QMTest changes (including fixing copyrights).
........
r1479 | stevenknight | 2006-05-18 05:07:06 -0400 (Thu, 18 May 2006) | 1 line
0.96.D419 - Fix DVIPDF tests after recent changes.
........
r1497 | stevenknight | 2006-05-23 08:47:01 -0400 (Tue, 23 May 2006) | 1 line
0.96.D420 - Better error message when trying to build a file from an unknown sufix. (Gary O
........
r1498 | stevenknight | 2006-05-23 09:38:52 -0400 (Tue, 23 May 2006) | 1 line
0.96.D421 - Suppress duplicate entries in latest TeX patch. (Joel B. Mohler)
........
r1499 | stevenknight | 2006-05-23 22:00:06 -0400 (Tue, 23 May 2006) | 1 line
0.96.D422 - Add tests for tuple variable expansion. (Gary Oberbrunner)
........
r1515 | stevenknight | 2006-06-12 06:44:24 -0400 (Mon, 12 Jun 2006) | 1 line
0.96.D423 - More QMTest work: start giving runtest.py its own tests, more functionality for
........
r1517 | stevenknight | 2006-06-21 07:34:30 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D424 - Move test/Configure.py and test/Options.py to avoid confusion with similarly-nam
........
r1518 | stevenknight | 2006-06-21 12:40:37 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D425 - Change the QMTest infrastructure to use File naming, not Python. Rename tests w
........
r1533 | stevenknight | 2006-07-23 20:10:08 -0400 (Sun, 23 Jul 2006) | 1 line
0.96.D426 - Fix ramifications of changing when Node disambiguation happens.
........
r1535 | stevenknight | 2006-07-24 06:40:43 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1534" from
http://scons.tigris.org/svn/scons/trunk
........
r1536 | stevenknight | 2006-07-24 21:45:40 -0400 (Mon, 24 Jul 2006) | 2 lines
Remove svnmerge-integrated property to start over.
........
r1538 | stevenknight | 2006-07-24 21:51:32 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1440" from
http://scons.tigris.org/svn/scons/trunk
........
Diffstat (limited to 'test')
28 files changed, 1440 insertions, 134 deletions
diff --git a/test/Alias/Dir-order.py b/test/Alias/Dir-order.py new file mode 100644 index 0000000..8f1388d --- /dev/null +++ b/test/Alias/Dir-order.py @@ -0,0 +1,43 @@ +#!/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__" + +""" +Validate that calling Dir() for a string after we've used it as an +Alias() expansion works. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +Alias('afoo', 'foo') +f = Dir('foo') +""") + +test.run(arguments = '.') + +test.pass_test() diff --git a/test/CVS.py b/test/CVS.py index 79257df..3002ee7 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -276,23 +276,23 @@ test.must_match(['work3', 'all'], mode='r') # Test CVS checkouts from a remote server (Tigris.org). -test.subdir(['work4']) - -test.write(['work4', 'SConstruct'], """\ -import os -env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) -# We used to use the SourceForge server, but SourceForge has restrictions -# that make them deny access on occasion. Leave the incantation here -# in case we need to use it again some day. -#cvs = env.CVS(':pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons') -cvs = env.CVS(':pserver:anoncvs@cvs.tigris.org:/cvs') -env.SourceCode('.', cvs) -env.Install('install', 'scons/SConstruct') -""") - -test.run(chdir = 'work4', arguments = '.') - -test.must_exist(test.workpath('work4', 'install', 'SConstruct')) +#test.subdir(['work4']) +# +#test.write(['work4', 'SConstruct'], """\ +#import os +#env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) +## We used to use the SourceForge server, but SourceForge has restrictions +## that make them deny access on occasion. Leave the incantation here +## in case we need to use it again some day. +##cvs = env.CVS(':pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons') +#cvs = env.CVS(':pserver:anoncvs@cvs.tigris.org:/cvs') +#env.SourceCode('.', cvs) +#env.Install('install', 'scons/SConstruct') +#""") +# +#test.run(chdir = 'work4', arguments = '.') +# +#test.must_exist(test.workpath('work4', 'install', 'SConstruct')) test.pass_test() diff --git a/test/Configure.py b/test/Configure/Configure.py index 2512907..41c858b 100644 --- a/test/Configure.py +++ b/test/Configure/Configure.py @@ -224,10 +224,10 @@ if not (r1 and r2 and r3 and r4 and r5 and r6): """ % (lib,lib)) test.run(chdir=work_dir) - checkLogAndStdout(["Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", - "Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", + checkLogAndStdout(["Checking for C library %s... " % lib, + "Checking for C library None... ", + "Checking for C library %s... " % lib, + "Checking for C library None... ", "Checking for C header file math.h... ", "Checking for C++ header file vector... "], ["yes"]*6, @@ -238,10 +238,10 @@ if not (r1 and r2 and r3 and r4 and r5 and r6): test.run(chdir=work_dir) - checkLogAndStdout(["Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", - "Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", + checkLogAndStdout(["Checking for C library %s... " % lib, + "Checking for C library None... ", + "Checking for C library %s... " % lib, + "Checking for C library None... ", "Checking for C header file math.h... ", "Checking for C++ header file vector... "], ["yes"]*6, @@ -253,10 +253,10 @@ if not (r1 and r2 and r3 and r4 and r5 and r6): # same should be true for TargetSignatures('content') test.run(chdir=work_dir, arguments='target_signatures_content=1 --config=force') - checkLogAndStdout(["Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", - "Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", + checkLogAndStdout(["Checking for C library %s... " % lib, + "Checking for C library None... ", + "Checking for C library %s... " % lib, + "Checking for C library None... ", "Checking for C header file math.h... ", "Checking for C++ header file vector... "], ["yes"]*6, @@ -266,10 +266,10 @@ if not (r1 and r2 and r3 and r4 and r5 and r6): test, "config.log", ".sconf_temp", "SConstruct") test.run(chdir=work_dir, arguments='target_signatures_content=1') - checkLogAndStdout(["Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", - "Checking for main() in C library %s... " % lib, - "Checking for main() in C library None... ", + checkLogAndStdout(["Checking for C library %s... " % lib, + "Checking for C library None... ", + "Checking for C library %s... " % lib, + "Checking for C library None... ", "Checking for C header file math.h... ", "Checking for C++ header file vector... "], ["yes"]*6, @@ -299,7 +299,7 @@ if not (not r1 and not r2): test.run(chdir=work_dir) checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", - "Checking for main() in C library no_c_library_SAFFDG... "], + "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, [[((".c", NCR), (_obj, NCF))], [((".c", NCR), (_obj, NCR), (_exe, NCF))]], @@ -307,7 +307,7 @@ if not (not r1 and not r2): test.run(chdir=work_dir) checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", - "Checking for main() in C library no_c_library_SAFFDG... "], + "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, [[((".c", CR), (_obj, CF))], [((".c", CR), (_obj, CR), (_exe, CF))]], @@ -316,7 +316,7 @@ if not (not r1 and not r2): # 1.3 same should be true for TargetSignatures('content') test.run(chdir=work_dir, arguments='--config=force target_signatures_content=1') checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", - "Checking for main() in C library no_c_library_SAFFDG... "], + "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, [[((".c", NCR), (_obj, NCF))], [((".c", NCR), (_obj, NCR), (_exe, NCF))]], @@ -324,7 +324,7 @@ if not (not r1 and not r2): test.run(chdir=work_dir, arguments='target_signatures_content=1') checkLogAndStdout(["Checking for C header file no_std_c_header.h... ", - "Checking for main() in C library no_c_library_SAFFDG... "], + "Checking for C library no_c_library_SAFFDG... "], ["no"]*2, [[((".c", CR), (_obj, CF))], [((".c", CR), (_obj, CR), (_exe, CF))]], @@ -698,8 +698,8 @@ File "SConstruct", line 6, in ? """ % os.path.join(".sconf_temp", "conftest_0.c")) test.run(chdir=work_dir) - checkLogAndStdout( ["Checking for main() in C library %s... " % lib, - "Checking for main() in C library hopefullynolib... "], + checkLogAndStdout( ["Checking for C library %s... " % lib, + "Checking for C library hopefullynolib... "], ["yes", "no"], [[((".c", NCR), (_obj, NCR))], [((".c", NCR), (_obj, NCF))]], @@ -707,8 +707,8 @@ File "SConstruct", line 6, in ? oldLog = test.read(test.workpath(work_dir, 'config.log')) test.run(chdir=work_dir, arguments='-n') - checkLogAndStdout( ["Checking for main() in C library %s... " % lib, - "Checking for main() in C library hopefullynolib... "], + checkLogAndStdout( ["Checking for C library %s... " % lib, + "Checking for C library hopefullynolib... "], ["yes", "no"], [[((".c", CR), (_obj, CR))], [((".c", CR), (_obj, CF))]], @@ -842,9 +842,9 @@ Checking for C++ header file vector... yes Checking for C++ header file hopefullynocxx-header.h... no Checking for sin() in C library %(lib)s... yes Checking for sin() in C library hopefullynolib... no -Checking for main() in C library %(lib)s... yes -Checking for main() in C library %(lib)s... no -Checking for main() in C library hopefullynolib2... no +Checking for C library %(lib)s... yes +Checking for C library %(lib)s... no +Checking for C library hopefullynolib2... no """ % {'lib' : lib} expected_build_str = """\ diff --git a/test/DVIPDF/DVIPDF.py b/test/DVIPDF/DVIPDF.py index a140c3a..8db5785 100644 --- a/test/DVIPDF/DVIPDF.py +++ b/test/DVIPDF/DVIPDF.py @@ -131,13 +131,6 @@ This is the %s TeX file. \end """ - latex = r""" -\documentclass{letter} -\begin{document} -This is the %s LaTeX file. -\end{document} -""" - test.write('foo.tex', tex % 'foo.tex') test.write('xxx.tex', tex % 'xxx.tex') diff --git a/test/DVIPDF/makeindex.py b/test/DVIPDF/makeindex.py new file mode 100644 index 0000000..cfa235f --- /dev/null +++ b/test/DVIPDF/makeindex.py @@ -0,0 +1,71 @@ +#!/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() + + + +dvipdf = test.where_is('dvipdf') +tex = test.where_is('tex') + +if not dvipdf or not tex: + test.skip_test('Could not find dvipdf or text; skipping test(s).\n') + + + +test.write('SConstruct', """ +import os +env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) +dvipdf = env.Dictionary('DVIPDF') +env.PDF(target = 'foo.pdf', + source = env.DVI(target = 'foo.dvi', source = 'foo.tex')) +""") + +test.write('foo.tex', r""" +\documentclass{article} +\usepackage{makeidx} +\makeindex + +\begin{document} +\section{Test 1} +I would like to \index{index} this. + +\section{test 2} +I'll index \index{this} as well. + +\printindex +\end{document} +""") + +test.run(arguments = 'foo.pdf', stderr = None) + +test.must_exist(test.workpath('foo.pdf')) + + + +test.pass_test() diff --git a/test/Install/InstallAs.py b/test/Install/InstallAs.py index c4e88f6..4fe4bd0 100644 --- a/test/Install/InstallAs.py +++ b/test/Install/InstallAs.py @@ -56,7 +56,19 @@ test.write('file1.in', "file1.in\n") test.write('file2.in', "file2.in\n") test.write(['subdir', 'file3.in'], "subdir/file3.in\n") -test.run(arguments = '.') +install_file1_out = os.path.join('install', 'file1.out') +install_file2_out = os.path.join('install', 'file2.out') +install_file3_out = os.path.join('install', 'file3.out') + +subdir_file3_in = os.path.join('subdir', 'file3.in') + +expect = test.wrap_stdout("""\ +Install file: "file1.in" as "%(install_file1_out)s" +Install file: "file2.in" as "%(install_file2_out)s" +Install file: "%(subdir_file3_in)s" as "%(install_file3_out)s" +""" % locals()) + +test.run(arguments = '.', stdout=expect) test.fail_test(test.read(install_file1_out) != "file1.in\n") test.fail_test(test.read(install_file2_out) != "file2.in\n") diff --git a/test/Options.py b/test/Options/Options.py index bd827d1..bd827d1 100644 --- a/test/Options.py +++ b/test/Options/Options.py diff --git a/test/ParseConfig.py b/test/ParseConfig.py index 1ab27c4..55678fe 100644 --- a/test/ParseConfig.py +++ b/test/ParseConfig.py @@ -36,12 +36,13 @@ test = TestSCons.TestSCons() test_config1 = test.workpath('test-config1') test_config2 = test.workpath('test-config2') +test_config3 = test.workpath('test-config3') # 'abc' is supposed to be a static lib; it is included in LIBS as a # File node. # It used to be returned as the 'static_libs' output of ParseConfig. test.write(test_config1, """\ -print "-I/usr/include/fum -Ibar -X" +print "-I/usr/include/fum -Ibar -X -arch i386" print "-L/usr/fax -Lfoo -lxxx abc" """) @@ -49,6 +50,11 @@ test.write(test_config2, """\ print "-L foo -L lib_dir" """) +# This is like what wxWidgets does on OSX w/ Universal Binaries +test.write(test_config3, """\ +print "-L foo -L lib_dir -isysroot /tmp -arch ppc -arch i386" +""") + test.write('SConstruct', """ env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [], CCFLAGS = '') env.ParseConfig([r"%(python)s", r"%(test_config1)s", "--libs --cflags"]) @@ -70,15 +76,34 @@ print map(lambda x: str(x), env['LIBS']) print env['CCFLAGS'] """ % locals()) +test.write('SConstruct3', """ +env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [], CCFLAGS = '', + PYTHON = '%(python)s') +env.ParseConfig(r"$PYTHON %(test_config3)s --libs --cflags") +print env['CPPPATH'] +print env['LIBPATH'] +print map(lambda x: str(x), env['LIBS']) +print env['CCFLAGS'] +""" % locals()) + good_stdout = test.wrap_stdout(read_str = """\ ['/usr/include/fum', 'bar'] ['/usr/fax', 'foo', 'lib_dir'] ['xxx', 'abc'] -['-X'] +['-X', ('-arch', 'i386')] +""", build_str = "scons: `.' is up to date.\n") + +stdout3 = test.wrap_stdout(read_str = """\ +[] +['foo', 'lib_dir'] +[] +[('-isysroot', '/tmp'), ('-arch', 'ppc'), ('-arch', 'i386')] """, build_str = "scons: `.' is up to date.\n") test.run(arguments = ".", stdout = good_stdout) test.run(arguments = "-f SConstruct2 .", stdout = good_stdout) +test.run(arguments = "-f SConstruct3 .", stdout = stdout3) + test.pass_test() diff --git a/test/README b/test/README index cc27ffe..7c88b39 100644 --- a/test/README +++ b/test/README @@ -3,11 +3,10 @@ __COPYRIGHT__ This directory contains our end-to-end SCons tests. They are all meant to be run essentially standalone, with the exception -of the TestSCons.py module (and the TestCmd.py module it imports) that -is imported by each test. These modules are in the etc/ subdirectory, -and PYTHONPATH needs to be set up correctly so that the test script can -find them, and so that the SCons script itself can find the build engine -modules. +of the TestSCons.py module and the other modules imported by the various +tests. These modules are in the QMTest/ subdirectory, and PYTHONPATH +needs to be set up correctly so that the test scripts can find them, +and so that the SCons script itself can find the build engine modules. There is a wrapper script, runtest.py, that takes care of this for you, so the canonical invocation of a test is: @@ -17,9 +16,7 @@ so the canonical invocation of a test is: There is also a "runtest.py -a" option that will search the tree for all tests, and execute them. -Many of these tests have code for features that are not yet supported, -but which will be part of SCons IN THE CURRENT PLANNED RELEASE. These -are either: +Some of these tests have code for features that are not yet supported. commented out with a "#XXX" at the beginning of the line; @@ -27,13 +24,6 @@ are either: early call to test.pass_test(), which has a "#XXX" comment at the end of the line -The upshot is that you should be able to: - - egrep -l '#XXX' test/*.py - -and see a list of the tests we still have to make work in order to get -the next release out the door. - If you're trying to implement one of these features, DO NOT BLINDLY ASSUME THAT THE NEW CODE IN THE TEST IS CORRECT. It may have problems that have gone undiscovered due to the fact that the code testing the @@ -50,17 +40,9 @@ semblance of uniformity, here are the naming conventions for tests: keep this description reasonably short - Feature-01.py additional tests of specified - Feature-02.py feature - Feature-03.py - Feature-x.py test of specified feature using option x - Feature-x-01.py additional tests of specified - Feature-x-02.py feature using option x - Feature-x-03.py - -- Command line option tests take the form: option-x.py lower-case single-letter option diff --git a/test/TEX/bibliography.py b/test/TEX/bibliography.py new file mode 100644 index 0000000..6949a31 --- /dev/null +++ b/test/TEX/bibliography.py @@ -0,0 +1,210 @@ +#!/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__" + +""" +Validate that use of \bibliography in TeX source files causes SCons to +be aware of the necessary created bibliography files. + +Test configuration contributed by Christopher Drexler. +""" + +import string + +import TestSCons + +test = TestSCons.TestSCons() + +dvips = test.where_is('dvips') +bibtex = test.where_is('bibtex') + +if not dvips or not bibtex: + test.skip_test("Could not find dvips or bibtex; skipping test(s).\n") + +test.write('SConstruct', """\ +env = Environment(tools = ['tex', 'latex', 'dvips']) +env.PostScript('simple', 'simple.tex') +""") + +test.write('simple.tex', r""" +\documentclass[12pt]{book} + +\begin{document} + +\chapter{Chapter 1}\label{c:c1} + +Test test.\cite{Aloimonos88:AV} + +\section{Section 1}\label{s:c1s1} +Test test. + +\section{Section 2}\label{s:c1s2} +Test test. + +\chapter{Chapter 2}\label{c:c2} + +Test test.\cite{Ayache86:HAN} + +\section{Section 1}\label{s:c2s1} +Test test. + +\section{Section 2}\label{s:c2s2} +Test test. + +\bibliographystyle{plain} +\bibliography{simple} +\end{document} +""") + +test.write('simple.bib', r""" +@Article{Aloimonos88:AV, + Author = {Aloimonos,~J and Weiss,~I. and Bandyopadyay,~A.}, + Title = {Active Vision}, + Journal = ijcv, + Volume = 2, + Number = 3, + Pages = {333--356}, + year = 1988, +} + +@Article{Ayache86:HAN, + Author = {Ayache, N. and Faugeras, O. D.}, + Title = {HYPER: A new approach for the recognition and + positioning of 2D objects}, + Journal = pami, + Volume = 8, + Number = 1, + Pages = {44-54}, + year = 1986, +} +""") + +test.run(arguments = '.', stderr=None) + +test.must_exist(test.workpath('simple.aux')) +test.must_exist(test.workpath('simple.bbl')) +test.must_exist(test.workpath('simple.blg')) + +test.run(arguments = '-c .') + +x = "Could not remove 'simple.aux': No such file or directory" +test.fail_test(string.find(test.stdout(), x) != -1) + +test.must_not_exist(test.workpath('simple.aux')) +test.must_not_exist(test.workpath('simple.bbl')) +test.must_not_exist(test.workpath('simple.blg')) + +test.pass_test() + + + +# FUTURE: + +test.write('SConstruct', """\ +env = Environment(tools = ['tex', 'latex', 'dvips']) +env.PostScript('d00', 'd00.tex') +""") + +test.write('d00.tex', r""" +\documentclass[12pt]{book} + +\begin{document} +\include{d-toc} + +\include{d01} +\include{d02} +\include{d03} + +\include{d-lit} +\end{document} +""") + +test.write('d01.tex', r""" +\chapter{Chapter 1}\label{c:c1} + +Test test.\cite{Aloimonos88:AV} + +\section{Section 1}\label{s:c1s1} +Test test. + +\section{Section 2}\label{s:c1s2} +Test test. + +\section{Section 3}\label{s:c1s3} +Test test. + +\section{Section 4}\label{s:c1s4} +Test test. +""") + +test.write('d02.tex', r""" +\chapter{Chapter 2}\label{c:c2} + +Test test.\cite{Ayache86:HAN} + +\section{Section 1}\label{s:c2s1} +Test test. + +\section{Section 2}\label{s:c2s2} +Test test. + +\section{Section 3}\label{s:c2s3} +Test test. + +\section{Section 4}\label{s:c2s4} +Test test. +""") + +test.write('d03.tex', r""" +\chapter{Chapter 3}\label{c:c3} + +Test test. + +\section{Section 1}\label{s:c3s1} +Test test. + +\section{Section 2}\label{s:c3s2} +Test test. + +\section{Section 3}\label{s:c3s3} +Test test. + +\section{Section 4}\label{s:c3s4} +Test test. +""") + +test.write('d-lit.tex', r""" +\bibliographystyle{plain} +\bibliography{d00} +""") + +test.write('d-toc.tex', r""" +\tableofcontents +\clearpage +\listoffigures +\clearpage +\listoftables +\cleardoublepage +""") diff --git a/test/TEX/makeindex.py b/test/TEX/makeindex.py new file mode 100644 index 0000000..8f99284 --- /dev/null +++ b/test/TEX/makeindex.py @@ -0,0 +1,104 @@ +#!/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__" + +""" +Validate that use of \makeindex in TeX source files causes SCons to be +aware of the necessary created index files. + +Test configuration courtesy Joel B. Mohler. +""" + +import string + +import TestSCons + +test = TestSCons.TestSCons() + +pdflatex = test.where_is('pdflatex') +makeindex = test.where_is('makeindex') + +if not pdflatex or not makeindex: + test.skip_test("Could not find pdflatex or makeindex; skipping test(s).\n") + +test.write('SConstruct', """\ +PDF( "no_index.tex" ) +PDF( "simple.tex" ) +""") + +test.write('no_index.tex', r""" +\documentclass{article} + +\begin{document} +Nothing to see here, move along! +\end{document} +""") + +test.write('simple.tex', r""" +\documentclass{article} +\usepackage{makeidx} +\makeindex + +\begin{document} +\section{Test 1} +I would like to \index{index} this. + +\section{test 2} +I'll index \index{this} as well. + +\printindex +\end{document} +""") + +# Bleah, makeindex seems to print a bunch of diagnostic stuff on stderr, +# so we have to ignore it. +test.run(arguments = '.', stderr=None) + +test.must_exist(test.workpath('simple.aux')) +test.must_exist(test.workpath('simple.idx')) +test.must_exist(test.workpath('simple.ilg')) +test.must_exist(test.workpath('simple.ind')) + +test.must_exist(test.workpath('no_index.aux')) + +test.must_not_exist(test.workpath('no_index.idx')) +test.must_not_exist(test.workpath('no_index.ilg')) +test.must_not_exist(test.workpath('no_index.ind')) + +test.run(arguments = '-c .') + +x = "Could not remove 'no_index.aux': No such file or directory" +test.fail_test(string.find(test.stdout(), x) != -1) +x = "Could not remove 'simple.aux': No such file or directory" +test.fail_test(string.find(test.stdout(), x) != -1) + +test.must_not_exist(test.workpath('simple.aux')) +test.must_not_exist(test.workpath('simple.idx')) +test.must_not_exist(test.workpath('simple.ilg')) +test.must_not_exist(test.workpath('simple.ind')) + +test.must_not_exist(test.workpath('no_index.aux')) + +test.pass_test() diff --git a/test/_CPPINCFLAGS.py b/test/_CPPINCFLAGS.py new file mode 100644 index 0000000..b2f7826 --- /dev/null +++ b/test/_CPPINCFLAGS.py @@ -0,0 +1,55 @@ +#!/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 that we can expand $_CPPINCFLAGS correctly regardless of whether +the target is an entry, a directory, or a file. (Internally, this tests +that RDirs() is available to be called for each Node.FS type.) +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """\ +env=Environment(CPPPATH=['tmp'], INCPREFIX='-I') +d=Entry('foo.d') +e=Entry('foo.e') +f=File('foo.f') +print env.subst('$_CPPINCFLAGS', target=e, source=f) +print env.subst('$_CPPINCFLAGS', target=d, source=f) +print env.subst('$_CPPINCFLAGS', target=f, source=d) +""") + +expect = """\ +-Itmp +-Itmp +-Itmp +""" + +test.run(arguments = '-Q -q', stdout = expect) + +test.pass_test() diff --git a/test/dependency-cycle.py b/test/dependency-cycle.py index 1486c76..8d1275f 100644 --- a/test/dependency-cycle.py +++ b/test/dependency-cycle.py @@ -48,7 +48,7 @@ f1(void) """) test.run(arguments = ".", stderr=r""" -scons: \*\*\* Dependency cycle: .*foo1.* -> .*foo3.* -> .*foo2.* -> .*foo1.* -> \. +scons: \*\*\* Dependency cycle: .*foo1.* -> .*foo3.* -> .*foo2.* -> .*foo1.* .* """, status=2) diff --git a/test/option/taskmastertrace.py b/test/option/taskmastertrace.py index b1b8717..30faced 100644 --- a/test/option/taskmastertrace.py +++ b/test/option/taskmastertrace.py @@ -47,15 +47,16 @@ Taskmaster: '.': children: ['file.mid', 'file.out'] Taskmaster: 'file.mid': children: ['file.in'] - evaluating + evaluating file.mid Copy("file.mid", "file.in") Taskmaster: 'file.out': children: ['file.mid'] - evaluating + evaluating file.out Copy("file.out", "file.mid") Taskmaster: '.': children: ['SConstruct', 'file.in', 'file.mid', 'file.out'] - evaluating + evaluating . +Taskmaster: '.': already handled (executed) """) test.run(arguments='--taskmastertrace=- .', stdout=expect_stdout) @@ -80,13 +81,14 @@ Taskmaster: '.': children: ['file.mid', 'file.out'] Taskmaster: 'file.mid': children: ['file.in'] - evaluating + evaluating file.mid Taskmaster: 'file.out': children: ['file.mid'] - evaluating + evaluating file.out Taskmaster: '.': children: ['SConstruct', 'file.in', 'file.mid', 'file.out'] - evaluating + evaluating . +Taskmaster: '.': already handled (executed) """ test.must_match('trace.out', expect_trace) diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py new file mode 100644 index 0000000..6382cb1 --- /dev/null +++ b/test/runtest/baseline/combined.py @@ -0,0 +1,81 @@ + +#!/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 a combination of a passing test, failing test, and no-result +test with no argument on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_failing_test(['test', 'fail.py']) + +test.write_no_result_test(['test', 'no_result.py']) + +test.write_passing_test(['test', 'pass.py']) + +# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both +# have spaces at the end. + +expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream=scons_tdb.AegisBaselineStream test +--- TEST RESULTS ------------------------------------------------------------- + + test/fail.py : FAIL + + FAILING TEST STDOUT + + FAILING TEST STDERR + + test/no_result.py : NO_RESULT + + NO RESULT TEST STDOUT + + NO RESULT TEST STDERR + + test/pass.py : PASS + +--- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- + + test/no_result.py : NO_RESULT + + test/pass.py : PASS + + +--- STATISTICS --------------------------------------------------------------- + + 1 ( 33%) tests as expected + 1 ( 33%) tests unexpected PASS + 1 ( 33%) tests unexpected NO_RESULT +""" + +test.run(arguments = '--qmtest -b . test', stdout = expect) + +test.pass_test() diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py new file mode 100644 index 0000000..b650a8c --- /dev/null +++ b/test/runtest/baseline/fail.py @@ -0,0 +1,62 @@ +#!/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 how we handle a failing test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_failing_test(['test', 'fail.py']) + +# NOTE: The "test/fail.py : FAIL" line has spaces at the end. + +expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream=scons_tdb.AegisBaselineStream test/fail.py +--- TEST RESULTS ------------------------------------------------------------- + + test/fail.py : FAIL + + FAILING TEST STDOUT + + FAILING TEST STDERR + +--- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- + + None. + + +--- STATISTICS --------------------------------------------------------------- + + 1 (100%) tests as expected +""" + +test.run(arguments = '--qmtest -b . test/fail.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py new file mode 100644 index 0000000..dc2586d --- /dev/null +++ b/test/runtest/baseline/no_result.py @@ -0,0 +1,60 @@ +#!/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 how we handle a no-results test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_no_result_test(['test', 'no_result.py']) + +expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream=scons_tdb.AegisBaselineStream test/no_result.py +--- TEST RESULTS ------------------------------------------------------------- + + test/no_result.py : NO_RESULT + + NO RESULT TEST STDOUT + + NO RESULT TEST STDERR + +--- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- + + test/no_result.py : NO_RESULT + + +--- STATISTICS --------------------------------------------------------------- + + 1 (100%) tests unexpected NO_RESULT +""" + +test.run(arguments = '--qmtest -b . test/no_result.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py new file mode 100644 index 0000000..b32ecbe --- /dev/null +++ b/test/runtest/baseline/pass.py @@ -0,0 +1,58 @@ +#!/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 how we handle a passing test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_passing_test(['test', 'pass.py']) + +# NOTE: The "test/pass.py : PASS" line has spaces at the end. + +expect = r"""qmtest.py run --output baseline.qmr --format none --result-stream=scons_tdb.AegisBaselineStream test/pass.py +--- TEST RESULTS ------------------------------------------------------------- + + test/pass.py : PASS + +--- TESTS WITH UNEXPECTED OUTCOMES ------------------------------------------- + + test/pass.py : PASS + + +--- STATISTICS --------------------------------------------------------------- + + 1 (100%) tests unexpected PASS +""" + +test.run(arguments = '--qmtest -b . test/pass.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py new file mode 100644 index 0000000..1d86baa --- /dev/null +++ b/test/runtest/print_time.py @@ -0,0 +1,89 @@ +#!/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 a combination of a passing test, failing test, and no-result +test with no argument on the command line. +""" + +import TestCmd +import TestRuntest + +test = TestRuntest.TestRuntest(match = TestCmd.match_re) + +test.subdir('test') + +test.write_failing_test(['test', 'fail.py']) + +test.write_no_result_test(['test', 'no_result.py']) + +test.write_passing_test(['test', 'pass.py']) + +# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both +# have spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream --context print_time=1 test +--- TEST RESULTS ------------------------------------------------------------- + + test/fail.py : FAIL + + FAILING TEST STDOUT + + FAILING TEST STDERR + + Total execution time: \d+\.\d+ seconds + + test/no_result.py : NO_RESULT + + NO RESULT TEST STDOUT + + NO RESULT TEST STDERR + + Total execution time: \d+\.\d+ seconds + + test/pass.py : PASS + + Total execution time: \d+\.\d+ seconds + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + test/fail.py : FAIL + + test/no_result.py : NO_RESULT + + +--- STATISTICS --------------------------------------------------------------- + + 3 tests total + + 1 \( 33%\) tests PASS + 1 \( 33%\) tests FAIL + 1 \( 33%\) tests NO_RESULT +""" + +test.run(arguments = '--qmtest -t test', stdout = expect) + +test.pass_test() diff --git a/test/runtest/python.py b/test/runtest/python.py new file mode 100644 index 0000000..76eec7d --- /dev/null +++ b/test/runtest/python.py @@ -0,0 +1,80 @@ +#!/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 that the -P option lets us specify a Python version to use. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +mypython_py = test.workpath('mypython.py') +mypython_out = test.workpath('mypython.out') + +test.subdir('test') + +test.write_passing_test(['test', 'pass.py']) + +test.write(mypython_py, """\ +#!/usr/bin/env python +import os +import sys +import string +open(r'%s', 'a').write(string.join(sys.argv) + '\\n') +os.system(string.join([sys.executable] + sys.argv[1:])) +""" % mypython_out) + +test.chmod(mypython_py, 0755) + +# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both +# have spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream --context python=%(mypython_py)s test +--- TEST RESULTS ------------------------------------------------------------- + + test/pass.py : PASS + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + None. + + +--- STATISTICS --------------------------------------------------------------- + + 1 tests total + + 1 (100%%) tests PASS +""" % locals() + +test.run(arguments = '--qmtest -P %s test' % mypython_py, + stdout = expect) + +test.must_match(mypython_out, """\ +%s ./test/pass.py +""" % mypython_py) + +test.pass_test() diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py new file mode 100644 index 0000000..1640d94 --- /dev/null +++ b/test/runtest/simple/combined.py @@ -0,0 +1,83 @@ + +#!/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 a combination of a passing test, failing test, and no-result +test with no argument on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_failing_test(['test', 'fail.py']) + +test.write_no_result_test(['test', 'no_result.py']) + +test.write_passing_test(['test', 'pass.py']) + +# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both +# have spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream test +--- TEST RESULTS ------------------------------------------------------------- + + test/fail.py : FAIL + + FAILING TEST STDOUT + + FAILING TEST STDERR + + test/no_result.py : NO_RESULT + + NO RESULT TEST STDOUT + + NO RESULT TEST STDERR + + test/pass.py : PASS + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + test/fail.py : FAIL + + test/no_result.py : NO_RESULT + + +--- STATISTICS --------------------------------------------------------------- + + 3 tests total + + 1 ( 33%) tests PASS + 1 ( 33%) tests FAIL + 1 ( 33%) tests NO_RESULT +""" + +test.run(arguments = '--qmtest test', stdout = expect) + +test.pass_test() diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py new file mode 100644 index 0000000..ba2cc97 --- /dev/null +++ b/test/runtest/simple/fail.py @@ -0,0 +1,64 @@ +#!/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 how we handle a failing test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_failing_test(['test', 'fail.py']) + +# NOTE: The "test/fail.py : FAIL" line has spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream test/fail.py +--- TEST RESULTS ------------------------------------------------------------- + + test/fail.py : FAIL + + FAILING TEST STDOUT + + FAILING TEST STDERR + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + test/fail.py : FAIL + + +--- STATISTICS --------------------------------------------------------------- + + 1 tests total + + 1 (100%) tests FAIL +""" + +test.run(arguments = '--qmtest test/fail.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py new file mode 100644 index 0000000..7c9687e --- /dev/null +++ b/test/runtest/simple/no_result.py @@ -0,0 +1,62 @@ +#!/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 how we handle a no-results test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_no_result_test(['test', 'no_result.py']) + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream test/no_result.py +--- TEST RESULTS ------------------------------------------------------------- + + test/no_result.py : NO_RESULT + + NO RESULT TEST STDOUT + + NO RESULT TEST STDERR + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + test/no_result.py : NO_RESULT + + +--- STATISTICS --------------------------------------------------------------- + + 1 tests total + + 1 (100%) tests NO_RESULT +""" + +test.run(arguments = '--qmtest test/no_result.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py new file mode 100644 index 0000000..8dfc996 --- /dev/null +++ b/test/runtest/simple/pass.py @@ -0,0 +1,60 @@ +#!/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 how we handle a passing test specified on the command line. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest() + +test.subdir('test') + +test.write_passing_test(['test', 'pass.py']) + +# NOTE: The "test/pass.py : PASS" line has spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream test/pass.py +--- TEST RESULTS ------------------------------------------------------------- + + test/pass.py : PASS + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + None. + + +--- STATISTICS --------------------------------------------------------------- + + 1 tests total + + 1 (100%) tests PASS +""" + +test.run(arguments = '--qmtest test/pass.py', stdout = expect) + +test.pass_test() diff --git a/test/runtest/src.py b/test/runtest/src.py new file mode 100644 index 0000000..2f723b4 --- /dev/null +++ b/test/runtest/src.py @@ -0,0 +1,71 @@ +#!/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__" + +""" +Verify that we find tests under the src/ tree only if they end +with *Tests.py. +""" + +import TestRuntest + +test = TestRuntest.TestRuntest(verbose=1) + +test.subdir(['src'], + ['src', 'suite']) + +test.write_passing_test(['src', 'pass.py']) + +test.write_passing_test(['src', 'passTests.py']) + +test.write_passing_test(['src', 'suite', 'pass.py']) + +test.write_passing_test(['src', 'suite', 'passTests.py']) + +# NOTE: The "test/fail.py : FAIL" and "test/pass.py : PASS" lines both +# have spaces at the end. + +expect = r"""qmtest.py run --output results.qmr --format none --result-stream=scons_tdb.AegisChangeStream src +--- TEST RESULTS ------------------------------------------------------------- + + src/passTests.py : PASS + + src/suite/passTests.py : PASS + +--- TESTS THAT DID NOT PASS -------------------------------------------------- + + None. + + +--- STATISTICS --------------------------------------------------------------- + + 2 tests total + + 2 (100%) tests PASS +""" + +test.run(arguments = '--qmtest src', stdout = expect) + +test.pass_test() diff --git a/test/scan-once.py b/test/scan-once.py index c86eaa4..044e260 100644 --- a/test/scan-once.py +++ b/test/scan-once.py @@ -275,7 +275,9 @@ for k in fromdict.keys(): # When $TARGET is None, so $TARGET.attributes would throw an # exception. f = fromdict[k] - if SCons.Util.is_String(f) and string.find(f, "TARGET") == -1: + if SCons.Util.is_String(f) and \ + string.find(f, "TARGET") == -1 and \ + string.find(f, "SOURCE") == -1: todict[k] = env.subst(f) todict["CFLAGS"] = fromdict["CPPFLAGS"] + " " + \ string.join(map(lambda x: "-I" + x, env["CPPPATH"])) + " " + \ diff --git a/test/sconsign/script.py b/test/sconsign/script.py index 86f6292..9e0caa5 100644 --- a/test/sconsign/script.py +++ b/test/sconsign/script.py @@ -31,15 +31,41 @@ import time import TestCmd import TestSCons +class MyTestSCons(TestSCons.TestSCons): + # subclass with a method for running the sconsign script + def __init__(self, *args, **kw): + try: + script_dir = os.environ['SCONS_SCRIPT_DIR'] + except KeyError: + pass + else: + os.chdir(script_dir) + self.script_dir = os.getcwd() + apply(TestSCons.TestSCons.__init__, (self,)+args, kw) + self.my_kw = { + 'interpreter' : TestSCons.python, + } + def script_path(self, script): + return os.path.join(self.script_dir, script) + def set_sconsign(self, sconsign): + self.my_kw['program'] = sconsign + def run_sconsign(self, *args, **kw): + kw.update(self.my_kw) + return apply(self.run, args, kw) + +test = MyTestSCons(match = TestCmd.match_re) + # Check for the sconsign script before we instantiate TestSCons(), # because that will change directory on us. -if os.path.exists('sconsign.py'): +if os.path.exists(test.script_path('sconsign.py')): sconsign = 'sconsign.py' -elif os.path.exists('sconsign'): +elif os.path.exists(test.script_path('sconsign')): sconsign = 'sconsign' else: print "Can find neither 'sconsign.py' nor 'sconsign' scripts." - test.no_result(1) + test.no_result() + +test.set_sconsign(sconsign) def sort_match(test, lines, expect): lines = string.split(lines, '\n') @@ -53,23 +79,6 @@ def re_sep(*args): -class MyTestSCons(TestSCons.TestSCons): - # subclass with a method for running the sconsign script - def __init__(self, *args, **kw): - apply(TestSCons.TestSCons.__init__, (self,)+args, kw) - self.my_kw = { - 'interpreter' : TestSCons.python, - 'program' : sconsign, - } - def run_sconsign(self, *args, **kw): - kw.update(self.my_kw) - return apply(self.run, args, kw) - -test = MyTestSCons(match = TestCmd.match_re) - - - - test.subdir('work1', ['work1', 'sub1'], ['work1', 'sub2'], 'work2', ['work2', 'sub1'], ['work2', 'sub2']) diff --git a/test/strfunction.py b/test/strfunction.py index ef8c483..a0b2344 100644 --- a/test/strfunction.py +++ b/test/strfunction.py @@ -45,48 +45,69 @@ def strfunction(target, source, env): t = str(target[0]) s = str(source[0]) return "Building %%s from %%s" %% (t, s) + def func(target, source, env): t = str(target[0]) s = str(source[0]) open(t, 'w').write(open(s, 'r').read()) -funcaction = Action(func, strfunction=strfunction) -cmd = r"%s cat.py $SOURCE $TARGET" -cmdaction = Action(cmd, strfunction=strfunction) -list = [ r"%s cat.py $SOURCE .temp", r"%s cat.py .temp $TARGET" ] +func1action = Action(func, strfunction) +func2action = Action(func, strfunction=strfunction) + +cmd = r"%(python)s cat.py $SOURCE $TARGET" +cmd1action = Action(cmd, strfunction) +cmd2action = Action(cmd, strfunction=strfunction) + +list = [ r"%(python)s cat.py $SOURCE .temp", + r"%(python)s cat.py .temp $TARGET" ] listaction = Action(list, strfunction=strfunction) + lazy = '$LAZY' -lazyaction = Action(lazy, strfunction=strfunction) +lazy1action = Action(lazy, strfunction) +lazy2action = Action(lazy, strfunction=strfunction) + +targetaction = Action(func, '$TARGET') + dict = { '.cmd' : cmd, - '.cmdstr' : cmdaction, + '.cmdstr' : cmd2action, '.func' : func, - '.funcstr' : funcaction, + '.funcstr' : func2action, '.list' : list, '.liststr' : listaction, '.lazy' : lazy, - '.lazystr' : lazyaction, + '.lazystr' : lazy2action, } + env = Environment(BUILDERS = { 'Cmd' : Builder(action=cmd), - 'CmdStr' : Builder(action=cmdaction), + 'Cmd1Str' : Builder(action=cmd1action), + 'Cmd2Str' : Builder(action=cmd2action), 'Func' : Builder(action=func), - 'FuncStr' : Builder(action=funcaction), + 'Func1Str' : Builder(action=func1action), + 'Func2Str' : Builder(action=func2action), 'Lazy' : Builder(action=lazy), - 'LazyStr' : Builder(action=lazyaction), + 'Lazy1Str' : Builder(action=lazy1action), + 'Lazy2Str' : Builder(action=lazy2action), 'List' : Builder(action=list), 'ListStr' : Builder(action=listaction), + 'Target' : Builder(action=targetaction), 'Dict' : Builder(action=dict), }, - LAZY = r"%s cat.py $SOURCE $TARGET") + LAZY = r"%(python)s cat.py $SOURCE $TARGET") + env.Cmd('cmd.out', 'cmd.in') -env.CmdStr('cmdstr.out', 'cmdstr.in') +env.Cmd1Str('cmd1str.out', 'cmdstr.in') +env.Cmd2Str('cmd2str.out', 'cmdstr.in') env.Func('func.out', 'func.in') -env.FuncStr('funcstr.out', 'funcstr.in') +env.Func1Str('func1str.out', 'funcstr.in') +env.Func2Str('func2str.out', 'funcstr.in') env.Lazy('lazy.out', 'lazy.in') -env.LazyStr('lazystr.out', 'lazystr.in') +env.Lazy1Str('lazy1str.out', 'lazystr.in') +env.Lazy2Str('lazy2str.out', 'lazystr.in') env.List('list.out', 'list.in') env.ListStr('liststr.out', 'liststr.in') +env.Target('target.out', 'target.in') env.Dict('dict1.out', 'dict1.cmd') env.Dict('dict2.out', 'dict2.cmdstr') @@ -96,7 +117,7 @@ env.Dict('dict5.out', 'dict5.lazy') env.Dict('dict6.out', 'dict6.lazystr') env.Dict('dict7.out', 'dict7.list') env.Dict('dict8.out', 'dict8.liststr') -""" % (python, python, python, python)) +""" % locals()) test.write('func.in', "func.in\n") test.write('funcstr.in', "funcstr.in\n") @@ -106,6 +127,7 @@ test.write('lazy.in', "lazy.in\n") test.write('lazystr.in', "lazystr.in\n") test.write('list.in', "list.in\n") test.write('liststr.in', "liststr.in\n") +test.write('target.in', "target.in\n") test.write('dict1.cmd', "dict1.cmd\n") test.write('dict2.cmdstr', "dict2.cmdstr\n") @@ -116,27 +138,33 @@ test.write('dict6.lazystr', "dict6.lazystr\n") test.write('dict7.list', "dict7.list\n") test.write('dict8.liststr', "dict8.liststr\n") -test.run(arguments = '.', stdout=test.wrap_stdout("""\ -%s cat.py cmd.in cmd.out -Building cmdstr.out from cmdstr.in -%s cat.py dict1.cmd dict1.out +expect = test.wrap_stdout("""\ +%(python)s cat.py cmd.in cmd.out +Building cmd1str.out from cmdstr.in +Building cmd2str.out from cmdstr.in +%(python)s cat.py dict1.cmd dict1.out Building dict2.out from dict2.cmdstr func(["dict3.out"], ["dict3.func"]) Building dict4.out from dict4.funcstr -%s cat.py dict5.lazy dict5.out +%(python)s cat.py dict5.lazy dict5.out Building dict6.out from dict6.lazystr -%s cat.py dict7.list .temp -%s cat.py .temp dict7.out +%(python)s cat.py dict7.list .temp +%(python)s cat.py .temp dict7.out Building dict8.out from dict8.liststr Building dict8.out from dict8.liststr func(["func.out"], ["func.in"]) -Building funcstr.out from funcstr.in -%s cat.py lazy.in lazy.out -Building lazystr.out from lazystr.in -%s cat.py list.in .temp -%s cat.py .temp list.out +Building func1str.out from funcstr.in +Building func2str.out from funcstr.in +%(python)s cat.py lazy.in lazy.out +Building lazy1str.out from lazystr.in +Building lazy2str.out from lazystr.in +%(python)s cat.py list.in .temp +%(python)s cat.py .temp list.out Building liststr.out from liststr.in Building liststr.out from liststr.in -""") % (python, python, python, python, python, python, python, python)) +target.out +""" % locals()) + +test.run(arguments = '.', stdout=expect) test.pass_test() |