summaryrefslogtreecommitdiff
path: root/test/option-k.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-09-17 00:48:57 +0000
committerSteven Knight <knight@baldmt.com>2004-09-17 00:48:57 +0000
commit8f74c71eb3b45e68bc9d90e5049353c73c0d228a (patch)
tree306c4ddad8653168dd858a7f5cfe551f3b2bd47a /test/option-k.py
parent205bce15b461669f84830ec57ca19c7377f2a528 (diff)
downloadscons-8f74c71eb3b45e68bc9d90e5049353c73c0d228a.tar.gz
Fix -k sometimes trying to link executables even when library builds fail.
Diffstat (limited to 'test/option-k.py')
-rw-r--r--test/option-k.py80
1 files changed, 61 insertions, 19 deletions
diff --git a/test/option-k.py b/test/option-k.py
index 8950f5f8..45c31d2b 100644
--- a/test/option-k.py
+++ b/test/option-k.py
@@ -32,6 +32,10 @@ python = TestSCons.python
test = TestSCons.TestSCons()
+test.subdir('work1', 'work2')
+
+
+
test.write('succeed.py', r"""
import sys
file = open(sys.argv[1], 'wb')
@@ -45,43 +49,81 @@ import sys
sys.exit(1)
""")
-test.write('SConstruct', """
-Succeed = Builder(action = r'%s succeed.py $TARGETS')
-Fail = Builder(action = r'%s fail.py $TARGETS')
+test.write(['work1', 'SConstruct'], """\
+Succeed = Builder(action = r'%s ../succeed.py $TARGETS')
+Fail = Builder(action = r'%s ../fail.py $TARGETS')
env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
env.Fail(target = 'aaa.1', source = 'aaa.in')
env.Succeed(target = 'aaa.out', source = 'aaa.1')
env.Succeed(target = 'bbb.out', source = 'bbb.in')
""" % (python, python))
-test.write('aaa.in', "aaa.in\n")
-test.write('bbb.in', "bbb.in\n")
+test.write(['work1', 'aaa.in'], "aaa.in\n")
+test.write(['work1', 'bbb.in'], "bbb.in\n")
-test.run(arguments = 'aaa.out bbb.out',
+test.run(chdir = 'work1',
+ arguments = 'aaa.out bbb.out',
stderr = 'scons: *** [aaa.1] Error 1\n',
status = 2)
-test.fail_test(os.path.exists(test.workpath('aaa.1')))
-test.fail_test(os.path.exists(test.workpath('aaa.out')))
-test.fail_test(os.path.exists(test.workpath('bbb.out')))
+test.must_not_exist(test.workpath('work1', 'aaa.1'))
+test.must_not_exist(test.workpath('work1', 'aaa.out'))
+test.must_not_exist(test.workpath('work1', 'bbb.out'))
-test.run(arguments = '-k aaa.out bbb.out',
+test.run(chdir = 'work1',
+ arguments = '-k aaa.out bbb.out',
stderr = 'scons: *** [aaa.1] Error 1\n',
status = 2)
-test.fail_test(os.path.exists(test.workpath('aaa.1')))
-test.fail_test(os.path.exists(test.workpath('aaa.out')))
-test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
+test.must_not_exist(test.workpath('work1', 'aaa.1'))
+test.must_not_exist(test.workpath('work1', 'aaa.out'))
+test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n")
-test.unlink("bbb.out")
+test.unlink(['work1', 'bbb.out'])
-test.run(arguments = '--keep-going aaa.out bbb.out',
+test.run(chdir = 'work1',
+ arguments = '--keep-going aaa.out bbb.out',
stderr = 'scons: *** [aaa.1] Error 1\n',
status = 2)
-test.fail_test(os.path.exists(test.workpath('aaa.1')))
-test.fail_test(os.path.exists(test.workpath('aaa.out')))
-test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
+test.must_not_exist(test.workpath('work1', 'aaa.1'))
+test.must_not_exist(test.workpath('work1', 'aaa.out'))
+test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n")
+
+
+
+test.write(['work2', 'SConstruct'], """\
+Succeed = Builder(action = r'%s ../succeed.py $TARGETS')
+Fail = Builder(action = r'%s ../fail.py $TARGETS')
+env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
+env.Fail('aaa.out', 'aaa.in')
+env.Succeed('bbb.out', 'aaa.out')
+env.Succeed('ccc.out', 'ccc.in')
+env.Succeed('ddd.out', 'ccc.in')
+""" % (python, python))
+
+test.write(['work2', 'aaa.in'], "aaa.in\n")
+test.write(['work2', 'ccc.in'], "ccc.in\n")
+
+test.run(chdir = 'work2',
+ arguments = '-k .',
+ status = 2,
+ stderr = None,
+ stdout = """\
+scons: Reading SConscript files ...
+scons: done reading SConscript files.
+scons: Building targets ...
+%s ../fail.py aaa.out
+%s ../succeed.py ccc.out
+%s ../succeed.py ddd.out
+scons: done building targets (errors occurred during build).
+""" % (python, python, python))
+
+test.must_not_exist(['work2', 'aaa.out'])
+test.must_not_exist(['work2', 'bbb.out'])
+test.must_match(['work2', 'ccc.out'], "succeed.py: ccc.out\n")
+test.must_match(['work2', 'ddd.out'], "succeed.py: ddd.out\n")
+
+
test.pass_test()
-