diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Command.py | 2 | ||||
-rw-r--r-- | test/Scanner.py | 12 | ||||
-rw-r--r-- | test/chdir.py | 11 | ||||
-rw-r--r-- | test/option/debug-findlibs.py | 5 | ||||
-rw-r--r-- | test/srcchange.py | 24 |
5 files changed, 25 insertions, 29 deletions
diff --git a/test/Command.py b/test/Command.py index 5266886..eddc1f5 100644 --- a/test/Command.py +++ b/test/Command.py @@ -65,7 +65,7 @@ def sub(env, target, source): t.close() return 0 -env = Environment(COPY_THROUGH_TEMP = "cp $SOURCE .tmp\\ncp .tmp $TARGET", +env = Environment(COPY_THROUGH_TEMP = "%(python)s build.py .tmp $SOURCE\\n%(python)s build.py $TARGET .tmp", EXPAND = "$COPY_THROUGH_TEMP") env.Command(target = 'f1.out', source = 'f1.in', action = buildIt) diff --git a/test/Scanner.py b/test/Scanner.py index 828d198..2814759 100644 --- a/test/Scanner.py +++ b/test/Scanner.py @@ -88,6 +88,7 @@ k2scan = env.Scanner(name = 'k2', ########################################################## # Test scanner as found automatically from the environment +# (backup_source_scanner) env = Environment() env.Append(SCANNERS = kscan) @@ -102,15 +103,14 @@ env2.Append(SCANNERS = [k2scan]) env2.Command('junk', 'junk.k2', r'%(python)s build.py $SOURCES $TARGET') ########################################################## -# Test specifying a specific source scanner for a Builder +# Test specifying a specific source scanner for a target Node -bar = env.Command('bar', 'bar.in', - r'%(python)s build.py $SOURCES $TARGET', - source_scanner=kscan) +bar = env.Command('bar', 'bar.in', r'%(python)s build.py $SOURCES $TARGET') +bar[0].source_scanner = kscan ########################################################## -# Test specifying a source scanner for an intermediary Builder to -# ensure that the right scanner gets used for the right nodes. +# Test specifying a source scanner for a Builder that gets +# automatically applied to targets generated from that Builder import string diff --git a/test/chdir.py b/test/chdir.py index e2d0894..9a77d75 100644 --- a/test/chdir.py +++ b/test/chdir.py @@ -91,8 +91,9 @@ other9_f19_in = test.workpath('other9', 'f19.in') test.write(cat_py, """\ import sys -ofp = open(sys.argv[1], 'w') -for ifp in map(open, sys.argv[2:]): +ofp = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + ifp = open(f, 'rb') ofp.write(ifp.read()) ofp.close """) @@ -223,7 +224,7 @@ test.must_match(['work1', 'sub23', 'f23.out'], "work1/sub23/f23.in\n") test.subdir('work2', ['work2', 'sub']) -work2 = test.workpath('work2') +work2 = repr(test.workpath('work2')) work2_sub_f1_out = test.workpath('work2', 'sub', 'f1.out') work2_sub_f2_out = test.workpath('work2', 'sub', 'f2.out') @@ -246,11 +247,11 @@ test.write(['work2', 'sub', 'f2.in'], "work2/sub/f2.in") expect = test.wrap_stdout("""\ os.chdir('sub') %(python)s %(cat_py)s f1.out f1.in -os.chdir('%(work2)s') +os.chdir(%(work2)s) os.chdir('sub') %(python)s %(cat_py)s .temp f2.in %(python)s %(cat_py)s f2.out .temp -os.chdir('%(work2)s') +os.chdir(%(work2)s) """ % locals()) test.run(chdir='work2', arguments='-n .', stdout=expect) diff --git a/test/option/debug-findlibs.py b/test/option/debug-findlibs.py index 4827ab0..b18841b 100644 --- a/test/option/debug-findlibs.py +++ b/test/option/debug-findlibs.py @@ -36,8 +36,9 @@ test.subdir('sub1', 'sub2') test.write('cat.py', """\ import sys -ofp = open(sys.argv[1], "w") -for ifp in map(open, sys.argv[2:]): +ofp = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + ifp = open(f, 'rb') ofp.write(ifp.read()) ofp.close() """) diff --git a/test/srcchange.py b/test/srcchange.py index 2188bcc..ef92aea 100644 --- a/test/srcchange.py +++ b/test/srcchange.py @@ -61,18 +61,19 @@ content_env=env.Copy() content_env.TargetSignatures('content') content_env.Command('revision.in', [], '%(python)s getrevision > $TARGET') content_env.AlwaysBuild('revision.in') -env.Precious('main.cpp') -env.Command('main.cpp', 'revision.in', SubRevision) -exe = env.Program('main.cpp') +env.Precious('main.c') +env.Command('main.c', 'revision.in', SubRevision) +exe = env.Program('main.c') env.Default(exe) """ % {'python':TestSCons.python}) -test.write('main.cpp', """\ -#include <iostream> +test.write('main.c', """\ +#include <stdio.h> int main(int argc, char *argv[]) { - std::cout << "Revision $REV$" << std::endl; + printf("Revision $REV$\\n"); + exit (0); } """) @@ -80,18 +81,11 @@ test.write('revnum.in', '3.2\n') prog = 'main' + TestSCons._exe -full_build=test.wrap_stdout("""\ -%(python)s getrevision > revision.in -subrevision(["main.cpp"], ["revision.in"]) -g++ -c -o main.o main.cpp -g++ -o main main.o -""" % {'python':TestSCons.python}) - light_build=test.wrap_stdout("""\ %(python)s getrevision > revision.in """ % {'python':TestSCons.python}) -test.run(arguments='.', stdout=full_build) +test.run(arguments='.') test.must_exist(prog) test.run(program=test.workpath(prog), stdout='Revision $REV: 3.2$\n') @@ -103,7 +97,7 @@ test.must_exist(prog) test.write('revnum.in', '3.3\n') -test.run(arguments='.', stdout=full_build) +test.run(arguments='.') test.must_exist(prog) test.run(program=test.workpath(prog), stdout='Revision $REV: 3.3$\n') |