summaryrefslogtreecommitdiff
path: root/test/builderrors.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-10-02 03:15:32 +0000
committerSteven Knight <knight@baldmt.com>2001-10-02 03:15:32 +0000
commit321aa365f5770b70be13631f717be8ecfeaf70f2 (patch)
tree683c28579fef2fe9a942693357dd5ca9a46e2514 /test/builderrors.py
parent97446895b5e0d92057123a962f45856009ff6bb9 (diff)
downloadscons-321aa365f5770b70be13631f717be8ecfeaf70f2.tar.gz
Handle build errors.
Diffstat (limited to 'test/builderrors.py')
-rw-r--r--test/builderrors.py84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/builderrors.py b/test/builderrors.py
new file mode 100644
index 00000000..d11ab242
--- /dev/null
+++ b/test/builderrors.py
@@ -0,0 +1,84 @@
+
+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.subdir('one', 'two', 'three')
+
+test.write('build.py', r"""
+import sys
+exitval = int(sys.argv[1])
+if exitval == 0:
+ contents = open(sys.argv[3], 'r').read()
+ file = open(sys.argv[2], 'w')
+ file.write(contents)
+ file.close()
+sys.exit(exitval)
+""")
+
+test.write(['one', 'SConstruct'], """
+B0 = Builder(name = 'B0', action = "python ../build.py 0 %(target)s %(source)s")
+B1 = Builder(name = 'B1', action = "python ../build.py 1 %(target)s %(source)s")
+env = Environment(BUILDERS = [B0, B1])
+env.B1(target = 'f1.out', source = 'f1.in')
+env.B0(target = 'f2.out', source = 'f2.in')
+env.B0(target = 'f3.out', source = 'f3.in')
+""")
+
+test.write(['one', 'f1.in'], "one/f1.in\n")
+test.write(['one', 'f2.in'], "one/f2.in\n")
+test.write(['one', 'f3.in'], "one/f3.in\n")
+
+test.run(chdir = 'one', arguments = "f1.out f2.out f3.out",
+ stderr = "scons: *** [f1.out] Error 1\n")
+
+test.fail_test(os.path.exists(test.workpath('f1.out')))
+test.fail_test(os.path.exists(test.workpath('f2.out')))
+test.fail_test(os.path.exists(test.workpath('f3.out')))
+
+test.write(['two', 'SConstruct'], """
+B0 = Builder(name = 'B0', action = "python ../build.py 0 %(target)s %(source)s")
+B1 = Builder(name = 'B1', action = "python ../build.py 1 %(target)s %(source)s")
+env = Environment(BUILDERS = [B0, B1])
+env.B0(target = 'f1.out', source = 'f1.in')
+env.B1(target = 'f2.out', source = 'f2.in')
+env.B0(target = 'f3.out', source = 'f3.in')
+""")
+
+test.write(['two', 'f1.in'], "two/f1.in\n")
+test.write(['two', 'f2.in'], "two/f2.in\n")
+test.write(['two', 'f3.in'], "two/f3.in\n")
+
+test.run(chdir = 'two', arguments = "f1.out f2.out f3.out",
+ stderr = "scons: *** [f2.out] Error 1\n")
+
+test.fail_test(test.read(['two', 'f1.out']) != "two/f1.in\n")
+test.fail_test(os.path.exists(test.workpath('f2.out')))
+test.fail_test(os.path.exists(test.workpath('f3.out')))
+
+test.write(['three', 'SConstruct'], """
+B0 = Builder(name = 'B0', action = "python ../build.py 0 %(target)s %(source)s")
+B1 = Builder(name = 'B1', action = "python ../build.py 1 %(target)s %(source)s")
+env = Environment(BUILDERS = [B0, B1])
+env.B0(target = 'f1.out', source = 'f1.in')
+env.B0(target = 'f2.out', source = 'f2.in')
+env.B1(target = 'f3.out', source = 'f3.in')
+""")
+
+test.write(['three', 'f1.in'], "three/f1.in\n")
+test.write(['three', 'f2.in'], "three/f2.in\n")
+test.write(['three', 'f3.in'], "three/f3.in\n")
+
+test.run(chdir = 'three', arguments = "f1.out f2.out f3.out",
+ stderr = "scons: *** [f3.out] Error 1\n")
+
+test.fail_test(test.read(['three', 'f1.out']) != "three/f1.in\n")
+test.fail_test(test.read(['three', 'f2.out']) != "three/f2.in\n")
+test.fail_test(os.path.exists(test.workpath('f3.out')))
+
+test.pass_test()