summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-12-28 05:31:39 (GMT)
committerSteven Knight <knight@baldmt.com>2002-12-28 05:31:39 (GMT)
commit474383d6f14d1594ad394c22afd837d1522175e9 (patch)
treed19629c2db3846ac88b80467547d5e89c15dcb37 /test
parent38d41c10db89f34f72a62d6ada1a4122d4a1cc3f (diff)
downloadSCons-474383d6f14d1594ad394c22afd837d1522175e9.zip
SCons-474383d6f14d1594ad394c22afd837d1522175e9.tar.gz
SCons-474383d6f14d1594ad394c22afd837d1522175e9.tar.bz2
Refactor FunctionAction objects to support -n and -s.
Diffstat (limited to 'test')
-rw-r--r--test/SetBuildSignatureType.py23
-rw-r--r--test/SetContentSignatureType.py28
-rw-r--r--test/SideEffect.py22
-rw-r--r--test/chained-build.py10
-rw-r--r--test/option-n.py19
-rw-r--r--test/scan-once.py6
-rw-r--r--test/sconsign.py3
-rw-r--r--test/timestamp-fallback.py14
8 files changed, 77 insertions, 48 deletions
diff --git a/test/SetBuildSignatureType.py b/test/SetBuildSignatureType.py
index b9dd080..2ec9773 100644
--- a/test/SetBuildSignatureType.py
+++ b/test/SetBuildSignatureType.py
@@ -32,7 +32,6 @@ test.write('SConstruct', """
env = Environment()
def copy1(env, source, target):
- print 'copy %s -> %s'%(str(source[0]), str(target[0]))
open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
def copy2(env, source, target):
@@ -50,7 +49,10 @@ SetBuildSignatureType('content')
test.write('foo.in', 'foo.in')
test.run(arguments='foo.out.out',
- stdout=test.wrap_stdout('copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n'))
+ stdout=test.wrap_stdout("""\
+copy2("foo.out", "foo.in")
+copy1("foo.out.out", "foo.out")
+"""))
test.run(arguments='foo.out.out',
stdout=test.wrap_stdout('scons: "foo.out.out" is up to date.\n'))
@@ -59,7 +61,6 @@ test.write('SConstruct', """
env = Environment()
def copy1(env, source, target):
- print 'copy %s -> %s'%(str(source[0]), str(target[0]))
open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
def copy2(env, source, target):
@@ -76,13 +77,15 @@ SetBuildSignatureType('content')
""")
test.run(arguments='foo.out.out',
- stdout=test.wrap_stdout('copy foo.in -> foo.out\nscons: "foo.out.out" is up to date.\n'))
+ stdout=test.wrap_stdout("""\
+copy2("foo.out", "foo.in")
+scons: "foo.out.out" is up to date.
+"""))
test.write('SConstruct', """
env = Environment()
def copy1(env, source, target):
- print 'copy %s -> %s'%(str(source[0]), str(target[0]))
open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
def copy2(env, source, target):
@@ -99,13 +102,14 @@ SetBuildSignatureType('build')
""")
test.run(arguments='foo.out.out',
- stdout=test.wrap_stdout('copy foo.out -> foo.out.out\n'))
+ stdout=test.wrap_stdout("""\
+copy1("foo.out.out", "foo.out")
+"""))
test.write('SConstruct', """
env = Environment()
def copy1(env, source, target):
- print 'copy %s -> %s'%(str(source[0]), str(target[0]))
open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
def copy2(env, source, target):
@@ -121,7 +125,10 @@ SetBuildSignatureType('build')
""")
test.run(arguments='foo.out.out',
- stdout=test.wrap_stdout('copy foo.in -> foo.out\ncopy foo.out -> foo.out.out\n'))
+ stdout=test.wrap_stdout("""\
+copy2("foo.out", "foo.in")
+copy1("foo.out.out", "foo.out")
+"""))
test.pass_test()
diff --git a/test/SetContentSignatureType.py b/test/SetContentSignatureType.py
index f9915ad..17fba2e 100644
--- a/test/SetContentSignatureType.py
+++ b/test/SetContentSignatureType.py
@@ -53,7 +53,12 @@ test.write('f4.in', "f4.in\n")
test.run(arguments = 'f1.out f3.out')
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f1.out" is up to date.\nscons: "f3.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+scons: "f1.out" is up to date.
+build("f2.out", "f2.in")
+scons: "f3.out" is up to date.
+build("f4.out", "f4.in")
+"""))
os.utime(test.workpath('f1.in'),
(os.path.getatime(test.workpath('f1.in')),
@@ -63,7 +68,12 @@ os.utime(test.workpath('f3.in'),
os.path.getmtime(test.workpath('f3.in'))+10))
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f2.out" is up to date.\nscons: "f4.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+build("f1.out", "f1.in")
+scons: "f2.out" is up to date.
+build("f3.out", "f3.in")
+scons: "f4.out" is up to date.
+"""))
test.write('SConstruct', """
def build(env, target, source):
@@ -86,7 +96,12 @@ test.write('f4.in', "f4.in\n")
test.run(arguments = 'f1.out f3.out')
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f1.out" is up to date.\nscons: "f3.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+scons: "f1.out" is up to date.
+build("f2.out", "f2.in")
+scons: "f3.out" is up to date.
+build("f4.out", "f4.in")
+"""))
os.utime(test.workpath('f1.in'),
(os.path.getatime(test.workpath('f1.in')),
@@ -110,7 +125,12 @@ env.B(target = 'f4.out', source = 'f4.in')
""")
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f1.out" is up to date.\nscons: "f2.out" is up to date.\nscons: "f3.out" is up to date.\nscons: "f4.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+scons: "f1.out" is up to date.
+scons: "f2.out" is up to date.
+scons: "f3.out" is up to date.
+scons: "f4.out" is up to date.
+"""))
test.pass_test()
diff --git a/test/SideEffect.py b/test/SideEffect.py
index 29acb83..2fdf90d 100644
--- a/test/SideEffect.py
+++ b/test/SideEffect.py
@@ -32,7 +32,6 @@ test = TestSCons.TestSCons()
test.write('SConstruct',
"""
def copy(source, target):
- print 'copy() < %s > %s' % (source, target)
open(target, "wb").write(open(source, "rb").read())
def build(env, source, target):
@@ -55,8 +54,8 @@ test.write('bar.in', 'bar.in\n')
test.write('blat.in', 'blat.in\n')
test.run(arguments = 'foo.out bar.out', stdout=test.wrap_stdout("""\
-copy() < foo.in > foo.out
-copy() < bar.in > bar.out
+build("foo.out", "foo.in")
+build("bar.out", "bar.in")
"""))
expect = """\
@@ -68,8 +67,8 @@ assert test.read('log.txt') == expect
test.write('bar.in', 'bar.in 2 \n')
test.run(arguments = 'log.txt', stdout=test.wrap_stdout("""\
-copy() < bar.in > bar.out
-copy() < blat.in > blat.out
+build("bar.out", "bar.in")
+build("blat.out", "blat.in")
"""))
expect = """\
@@ -83,8 +82,8 @@ assert test.read('log.txt') == expect
test.write('foo.in', 'foo.in 2 \n')
test.run(arguments = ".", stdout=test.wrap_stdout("""\
-copy() < foo.in > foo.out
-copy() < log.txt > log.out
+build("foo.out", "foo.in")
+build("log.out", "log.txt")
"""))
expect = """\
@@ -104,10 +103,10 @@ test.fail_test(os.path.exists(test.workpath('blat.out')))
test.fail_test(os.path.exists(test.workpath('log.txt')))
test.run(arguments = "-j 4 .", stdout=test.wrap_stdout("""\
-copy() < bar.in > bar.out
-copy() < blat.in > blat.out
-copy() < foo.in > foo.out
-copy() < log.txt > log.out
+build("bar.out", "bar.in")
+build("blat.out", "blat.in")
+build("foo.out", "foo.in")
+build("log.out", "log.txt")
"""))
expect = """\
@@ -123,7 +122,6 @@ import os.path
import os
def copy(source, target):
- print 'copy() < %s > %s' % (source, target)
open(target, "wb").write(open(source, "rb").read())
def build(env, source, target):
diff --git a/test/chained-build.py b/test/chained-build.py
index 94277fd..fc0d2d4 100644
--- a/test/chained-build.py
+++ b/test/chained-build.py
@@ -31,7 +31,6 @@ test = TestSCons.TestSCons()
test.write('SConstruct1', """
def build(env, target, source):
open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
- print "built %s"%target[0]
env=Environment(BUILDERS={'B' : Builder(action=build)})
env.B('foo.mid', 'foo.in')
@@ -40,7 +39,6 @@ env.B('foo.mid', 'foo.in')
test.write('SConstruct2', """
def build(env, target, source):
open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
- print "built %s"%target[0]
env=Environment(BUILDERS={'B' : Builder(action=build)})
env.B('foo.out', 'foo.mid')
@@ -49,9 +47,9 @@ env.B('foo.out', 'foo.mid')
test.write('foo.in', "foo.in")
test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
- stdout = test.wrap_stdout('built foo.mid\n'))
+ stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n'))
test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
- stdout = test.wrap_stdout('built foo.out\n'))
+ stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n'))
test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
stdout = test.wrap_stdout('scons: "foo.mid" is up to date.\n'))
@@ -61,9 +59,9 @@ test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
test.write('foo.in', "foo.in 2")
test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
- stdout = test.wrap_stdout('built foo.mid\n'))
+ stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n'))
test.run(arguments="--max-drift=0 -f SConstruct2 foo.out",
- stdout = test.wrap_stdout('built foo.out\n'))
+ stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n'))
test.run(arguments="--max-drift=0 -f SConstruct1 foo.mid",
stdout = test.wrap_stdout('scons: "foo.mid" is up to date.\n'))
diff --git a/test/option-n.py b/test/option-n.py
index c0ca611..ee21ae7 100644
--- a/test/option-n.py
+++ b/test/option-n.py
@@ -75,7 +75,10 @@ test.write('f3.in', "f3.in\n")
test.write(['src', 'f4.in'], "src/f4.in\n")
args = 'f1.out f2.out'
-expect = test.wrap_stdout("%s build.py f1.out\n%s build.py f2.out\n" % (python, python))
+expect = test.wrap_stdout("""\
+%s build.py f1.out
+%s build.py f2.out
+""" % (python, python))
test.run(arguments = args, stdout = expect)
test.fail_test(not os.path.exists(test.workpath('f1.out')))
@@ -117,30 +120,18 @@ test.run(arguments = '-c -n ' + args, stdout = expect)
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))
-# XXX Because Install is a function action, it doesn't know how
-# to print what's going on when -n is used. Following the
-# directions on the XXX lines below whenever that gets fixed.
#
install_f3_in = os.path.join('install', 'f3.in')
-# XXX Uncomment the next line and remove the one after it when we
-# fix the Install print during -n.
-#expect = test.wrap_stdout('Install file: "f3.in" as "%s"\n' % install_f3_in)
-expect = test.wrap_stdout('')
+expect = test.wrap_stdout('Install file: "f3.in" as "%s"\n' % install_f3_in)
test.run(arguments = '-n install', stdout = expect)
test.fail_test(os.path.exists(test.workpath('install', 'f3.in')))
-# XXX Remove the next line when we fix the Install print during -n.
-expect = test.wrap_stdout('Install file: "f3.in" as "%s"\n' % install_f3_in)
-
test.run(arguments = 'install', stdout = expect)
test.fail_test(not os.path.exists(test.workpath('install', 'f3.in')))
test.write('f3.in', "f3.in again\n")
-# XXX Remove the next line when we fix the Install print during -n.
-expect = test.wrap_stdout('')
-
test.run(arguments = '-n install', stdout = expect)
test.fail_test(not os.path.exists(test.workpath('install', 'f3.in')))
diff --git a/test/scan-once.py b/test/scan-once.py
index 19cb495..a1674e6 100644
--- a/test/scan-once.py
+++ b/test/scan-once.py
@@ -64,9 +64,12 @@ test.write('file1.s', 'file1.s\n')
test.run(arguments = '.',
stdout = test.wrap_stdout("""scanning file1.s for file2.s
+echo("file2.s", "file1.s")
create file2.s from file1.s
scanning file1.s for file2.s
+echo("file3.s", "file2.s")
create file3.s from file2.s
+echo("file4.s", "file3.s")
create file4.s from file3.s
"""))
@@ -75,8 +78,10 @@ test.write('file2.s', 'file2.s\n')
test.run(arguments = '.',
stdout = test.wrap_stdout("""scanning file1.s for file2.s
scanning file2.s for file3.s
+echo("file3.s", "file2.s")
create file3.s from file2.s
scanning file2.s for file3.s
+echo("file4.s", "file3.s")
create file4.s from file3.s
"""))
@@ -86,6 +91,7 @@ test.run(arguments = '.',
stdout = test.wrap_stdout("""scanning file1.s for file2.s
scanning file2.s for file3.s
scanning file3.s for file4.s
+echo("file4.s", "file3.s")
create file4.s from file3.s
"""))
diff --git a/test/sconsign.py b/test/sconsign.py
index 5978da3..6d88f79 100644
--- a/test/sconsign.py
+++ b/test/sconsign.py
@@ -74,7 +74,6 @@ os.chmod(sub1__sconsign, 0666)
test.write('SConstruct', """
def build1(target, source, env):
- print '%s->%s'%(str(source[0]), str(target[0]))
open(str(target[0]), 'wb').write(open(str(source[0]), 'rb').read())
return None
@@ -88,7 +87,7 @@ scons: warning: Ignoring corrupt .sconsign file: sub1..sconsign
.*
'''
-stdout = test.wrap_stdout('foo.in->sub1.foo.out\n')
+stdout = test.wrap_stdout('build1\("sub1/foo.out", "foo.in"\)\n')
test.write(sub1__sconsign, 'not:a:sconsign:file')
test.run(arguments = '.', stderr=stderr, stdout=stdout, status=2)
diff --git a/test/timestamp-fallback.py b/test/timestamp-fallback.py
index 749ee5b..3862ec4 100644
--- a/test/timestamp-fallback.py
+++ b/test/timestamp-fallback.py
@@ -67,7 +67,12 @@ test.write('f4.in', "f4.in\n")
test.run(arguments = 'f1.out f3.out')
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f1.out" is up to date.\nscons: "f3.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+scons: "f1.out" is up to date.
+build("f2.out", "f2.in")
+scons: "f3.out" is up to date.
+build("f4.out", "f4.in")
+"""))
os.utime(test.workpath('f1.in'),
(os.path.getatime(test.workpath('f1.in')),
@@ -77,7 +82,12 @@ os.utime(test.workpath('f3.in'),
os.path.getmtime(test.workpath('f3.in'))+10))
test.run(arguments = 'f1.out f2.out f3.out f4.out',
- stdout = test.wrap_stdout('scons: "f2.out" is up to date.\nscons: "f4.out" is up to date.\n'))
+ stdout = test.wrap_stdout("""\
+build("f1.out", "f1.in")
+scons: "f2.out" is up to date.
+build("f3.out", "f3.in")
+scons: "f4.out" is up to date.
+"""))
test.pass_test()