Commits

Steven Knight  committed 4f71a2f

Add additional tests to provide more examples.

  • Participants
  • Parent commits d4e781b

Comments (0)

Files changed (19)

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/CCFLAGS.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+foo = Environment(CCFLAGS = '-DFOO')
+bar = Environment(CCFLAGS = '-DBAR')
+foo.Program(target = 'progfoo', source = 'prog.c')
+bar.Program(target = 'progbar', source = 'prog.c')
+""")
+
+test.write('prog.c', """
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+#ifdef FOO
+	printf("prog.c:  FOO\n");
+#endif
+#ifdef BAR
+	printf("prog.c:  BAR\n");
+#endif
+	exit (0);
+}
+""")
+
+
+test.run(arguments = 'progfoo progbar')
+
+test.run(program = test.workpath('progfoo'), stdout = "prog.c:  FOO\n")
+test.run(program = test.workpath('progbar'), stdout = "prog.c:  BAR\n")
+
+test.pass_test()

File test/CPPPATH.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/Command.py

+
+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('build.py', r"""
+import sys
+contents = open(sys.argv[2], 'r').read() + open(sys.argv[3], 'r').read()
+file = open(sys.argv[1], 'w')
+file.write(contents)
+file.close()
+""")
+
+test.write('SConstruct', """
+env = Environment()
+env.Command(target = 'f1.out', source = 'f1.in',
+		action = "python build.py %(target)s %(source)s")
+env.Command(target = 'f2.out', source = 'f2.in',
+		action = "python build.py temp2 %(source)s\npython build.py %(target)s temp2")
+env.Command(target = 'f3.out', source = 'f3.in',
+		action = ["python build.py temp3 %(source)s",
+			  "python build.py %(target)s temp3"])
+# Eventually, add ability to do execute Python code.
+""")
+
+test.write('f1.in', "f1.in\n")
+
+test.write('f2.in', "f2.in\n")
+
+test.write('f3.in', "f3.in\n")
+
+test.run(arguments = '.')
+
+test.fail_test(test.read('f1.out') != "f1.in\n")
+test.fail_test(test.read('f2.out') != "f2.in\n")
+test.fail_test(test.read('f3.out') != "f3.in\n")
+
+test.pass_test()

File test/Depends.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.subdir('subdir')
+
+test.write('build.py', r"""
+import sys
+contents = open(sys.argv[2], 'r').read() + open(sys.argv[3], 'r').read()
+file = open(sys.argv[1], 'w')
+file.write(contents)
+file.close()
+""")
+
+test.write('SConstruct', """
+Foo = Builder(name = "Foo",
+	  action = "python build.py %(target)s %(source)s subdir/foo.dep")
+Bar = Builder(name = "Bar",
+	  action = "python build.py %(target)s %(source)s subdir/bar.dep")
+env = Environment(BUILDERS = [Foo, Bar])
+env.Depends(target = ['f1.out', 'f2.out'], source = 'subdir/foo.dep')
+env.Depends(target = 'f3.out', source = 'subdir/bar.dep')
+env.Foo(target = 'f1.out', source = 'f1.in')
+env.Foo(target = 'f2.out', source = 'f2.in')
+env.Bar(target = 'f3.out', source = 'f3.in')
+SConscript('subdir/SConscript')
+""")
+
+test.write(['subdir', 'SConscript'], """
+env.Depends(target = 'f4.out', source = 'bar.dep')
+env.Foo(target = 'f4.out', source = 'f4.in')
+""")
+
+test.write('f1.in', "f1.in\n")
+
+test.write('f2.in', "f2.in\n")
+
+test.write(['subdir', 'f4.in'], "subdir/f4.in\n")
+
+test.write(['subdir', 'foo.dep'], "subdir/foo.dep 1\n")
+
+test.write(['subdir', 'bar.dep'], "subdir/bar.dep 1\n")
+
+test.run(arguments = '.')
+
+test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 1\n")
+test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 1\n")
+test.fail_test(test.read('f3.out') != "f3.in\nsubdir/bar.dep 1\n")
+test.fail_test(test.read('subdir', 'f4.out') !=
+					"subdir/f4.in\nsubdir/bar.dep 1\n")
+
+test.write(['subdir', 'foo.dep'], "subdir/foo.dep 2\n")
+
+test.write(['subdir', 'bar.dep'], "subdir/bar.dep 2\n")
+
+test.run(arguments = '.')
+
+test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 2\n")
+test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 2\n")
+test.fail_test(test.read('f3.out') != "f3.in\nsubdir/bar.dep 2\n")
+test.fail_test(test.read('subdir', 'f4.out') !=
+					"subdir/f4.in\nsubdir/bar.dep 2\n")
+
+test.write(['subdir', 'bar.dep'], "subdir/bar.dep 3\n")
+
+test.run(arguments = '.')
+
+test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 2\n")
+test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 2\n")
+test.fail_test(test.read('f3.out') != "f3.in\nsubdir/bar.dep 2\n")
+test.fail_test(test.read('subdir', 'f4.out') !=
+					"subdir/f4.in\nsubdir/bar.dep 3\n")
+
+test.pass_test()

File test/LIBPATH.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/LIBPREFIX.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/LIBS.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/LIBSUFFIX.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/LINK.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/LINKFLAGS.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()

File test/Library.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+env = Environment(LIBS = 'foo1 foo2 foo3')
+env.Library(target = 'foo1', source = 'f1.c')
+env.Library(target = 'foo2', source = 'f2a.c f2b.c f2c.c')
+env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
+env.Program(target = 'prog', source = 'prog.c')
+""")
+
+test.write('f1.c', """
+void
+f1(void)
+{
+	printf("f1.c\n");
+}
+""")
+
+test.write('f2a.c', """
+void
+f2a(void)
+{
+	printf("f2a.c\n");
+}
+""")
+
+test.write('f2b.c', """
+void
+f2b(void)
+{
+	printf("f2b.c\n");
+}
+""")
+
+test.write('f2c.c', """
+void
+f2c(void)
+{
+	printf("f2c.c\n");
+}
+""")
+
+test.write('f3a.c', """
+void
+f3a(void)
+{
+	printf("f3a.c\n");
+}
+""")
+
+test.write('f3b.c', """
+void
+f3b(void)
+{
+	printf("f3b.c\n");
+}
+""")
+
+test.write('f3c.c', """
+f3c(void)
+{
+	printf("f3c.c\n");
+}
+""")
+
+test.write('prog.c', """
+void f1(void);
+void f2a(void);
+void f2b(void);
+void f2c(void);
+void f3a(void);
+void f3b(void);
+void f3c(void);
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	f1();
+	f2a();
+	f2b();
+	f2c();
+	f3a();
+	f3b();
+	f3c();
+	printf("prog.c\n");
+}
+""")
+
+test.run(arguments = 'libfoo1.a libfoo2.a libfoo3.a')
+
+test.run(program = test.workpath('prog'),
+	stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n")
+
+test.pass_test()

File test/Object.py

+#!/usr/bin/env python
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test()	#XXX Short-circuit until this is supported.
+
+test.write('SConstruct', """
+f1 = env.Object(target = 'f1', source = 'f1.c')
+f2 = env.Object(target = 'f2', source = 'f2.c')
+f3 = env.Object(target = 'f3', source = 'f3.c')
+env.Program(target = 'prog1', source = 'f1.o f2.o f3.o prog.c')
+env.Program(target = 'prog2', source = [f1, f2, f3, 'prog.c'])
+env.Program(target = 'prog3', source = ['f1.o', f2, 'f3.o prog.c'])
+""")
+
+test.write('f1.c', """
+void
+f1(void)
+{
+	printf("f1.c\n");
+}
+""")
+
+test.write('f2.c', """
+void
+f2(void)
+{
+	printf("f2.c\n");
+}
+""")
+
+test.write('f3.c', """
+void
+f3(void)
+{
+	printf("f3.c\n");
+}
+""")
+
+test.write('prog.c', """
+extern void f1(void);
+extern void f2(void);
+extern void f3(void);
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	f1();
+	f2();
+	f3();
+	printf("prog.c\n");
+}
+""")
+
+stdout = "f1.c\nf2.c\nf3.c\nprog.c\n"
+
+test.run(arguments = 'prog1 prog2 prog3')
+
+test.run(program = test.workpath('prog1'), stdout = stdout)
+
+test.run(program = test.workpath('prog2'), stdout = stdout)
+
+test.run(program = test.workpath('prog3'), stdout = stdout)
+
+test.pass_test()

File test/Program.py

 
 import TestSCons
 
+#XXX Future:  be able to interpolate
+
 test = TestSCons.TestSCons()
 
 test.write('SConstruct', """
 env = Environment()
-env.Program(target = 'foo', source = 'foo.c')
+env.Program(target = 'foo1', source = 'f1.c')
+env.Program(target = 'foo2', source = 'f2a.c f2b.c f2c.c')
+#XXXenv.Program(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
 """)
 
-test.write('foo.c', """
+test.write('f1.c', """
 int
 main(int argc, char *argv[])
 {
 	argv[argc++] = "--";
-	printf("foo.c\n");
+	printf("f1.c\n");
 	exit (0);
 }
 """)
 
-test.run(arguments = 'foo')
+test.write('f2a.c', """
+void
+f2a(void)
+{
+	printf("f2a.c\n");
+}
+""")
 
-test.run(program = test.workpath('foo'), stdout = "foo.c\n")
+test.write('f2b.c', """
+void
+f2b(void)
+{
+	printf("f2b.c\n");
+}
+""")
+
+test.write('f2c.c', """
+extern void f2a(void);
+extern void f2b(void);
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	f2a();
+	f2b();
+	printf("f2c.c\n");
+	exit (0);
+}
+""")
+
+test.write('f3a.c', """
+void
+f3a(void)
+{
+	printf("f3a.c\n");
+}
+""")
+
+test.write('f3b.c', """
+void
+f3b(void)
+{
+	printf("f3b.c\n");
+}
+""")
+
+test.write('f3c.c', """
+extern void f3a(void);
+extern void f3b(void);
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	f3a();
+	f3b();
+	printf("f3c.c\n");
+	exit (0);
+}
+""")
+
+#XXXtest.run(arguments = '.')
+test.run(arguments = 'foo1 foo2')
+
+test.run(program = test.workpath('foo1'), stdout = "f1.c\n")
+test.run(program = test.workpath('foo2'), stdout = "f2a.c\nf2b.c\nf2c.c\n")
+#XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c\nf3c.c\n")
+
+#XXXtest.up_to_date(arguments = '.')
+
+test.write('f1.c', """
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	printf("f1.c X\n");
+	exit (0);
+}
+""")
+
+test.write('f3b.c', """
+void
+f3b(void)
+{
+	printf("f3b.c X\n");
+}
+""")
+
+#XXXtest.run(arguments = '.')
+test.run(arguments = 'foo1 foo2')
+
+test.run(program = test.workpath('foo1'), stdout = "f1.c X\n")
+test.run(program = test.workpath('foo2'), stdout = "f2a.c\nf2b.c\nf2c.c\n")
+#XXXtest.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c X\nf3c.c\n")
+
+#XXXtest.up_to_date(arguments = '.')
 
 test.pass_test()
+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.
+
+There is a wrapper script, runtest.py, that takes care of this for you,
+so the canonical invocation of a test is:
+
+	python runtest.py test/option-x.py
+
+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:
+
+	commented out with a "#XXX" at the beginning of the line;
+
+	short-circuited entirely by having the test pass via an
+	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/*.c
+
+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
+future feature couldn't be run yet!
+
+We're not going to be dogmatic about it, but so that there's some
+semblance of uniformity, here are the naming conventions for tests:
+
+    --	All tests end with a .py suffix.
+
+    --	General form:
+
+    		Feature.py	test of specified feature; try to
+				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
+
+		option--X.py	upper-case single-letter option
+				(extra hyphen so the file names will
+				be unique on case-insensitive systems)
+
+		option--lo.py	long option; abbreviate the long
+				option name to a few characters

File test/option-c.py

 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
+import os.path
 import TestSCons
-import string
-import sys
 
 test = TestSCons.TestSCons()
 
-test.write('SConstruct', "")
+test.pass_test()	#XXX Short-circuit until this is implemented.
 
-test.run(arguments = '-c',
-	 stderr = "Warning:  the -c option is not yet implemented\n")
+test.write('SConstruct', """
+env = Environment()
+Program(target = 'foo1', source = 'foo1.c')
+Program(target = 'foo2', source = 'foo2.c')
+Program(target = 'foo3', source = 'foo3.c')
+""")
 
-test.run(arguments = '--clean',
-	 stderr = "Warning:  the --clean option is not yet implemented\n")
+test.write('foo1.c', """
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	printf("foo1.c\n");
+	exit (0);
+}
+""")
 
-test.run(arguments = '--remove',
-	 stderr = "Warning:  the --remove option is not yet implemented\n")
+test.write('foo2.c', """
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	printf("foo2.c\n");
+	exit (0);
+}
+""")
+
+test.write('foo3.c', """
+int
+main(int argc, char *argv[])
+{
+	argv[argc++] = "--";
+	printf("foo3.c\n");
+	exit (0);
+}
+""")
+
+test.run(arguments = 'foo1 foo2 foo3')
+
+test.run(program = test.workpath('foo1'), stdout = "foo1.c\n")
+test.run(program = test.workpath('foo2'), stdout = "foo2.c\n")
+test.run(program = test.workpath('foo3'), stdout = "foo3.c\n")
+
+test.run(arguments = '-c foo1')
+
+test.fail_test(os.path.exists(test.workpath('foo1')))
+test.fail_test(not os.path.exists(test.workpath('foo2')))
+test.fail_test(not os.path.exists(test.workpath('foo3')))
+
+test.run(arguments = '--clean foo2')
+
+test.fail_test(os.path.exists(test.workpath('foo1')))
+test.fail_test(os.path.exists(test.workpath('foo2')))
+test.fail_test(not os.path.exists(test.workpath('foo3')))
+
+test.run(arguments = '--remove foo3')
+
+test.fail_test(os.path.exists(test.workpath('foo1')))
+test.fail_test(os.path.exists(test.workpath('foo2')))
+test.fail_test(os.path.exists(test.workpath('foo3')))
+
+test.run(arguments = 'foo1 foo2 foo3')
+
+test.run(program = test.workpath('foo1'), stdout = "foo1.c\n")
+test.run(program = test.workpath('foo2'), stdout = "foo2.c\n")
+test.run(program = test.workpath('foo3'), stdout = "foo3.c\n")
+
+test.run(arguments = '-c .')
+
+test.fail_test(os.path.exists(test.workpath('foo1')))
+test.fail_test(os.path.exists(test.workpath('foo2')))
+test.fail_test(os.path.exists(test.workpath('foo3')))
 
 test.pass_test()
  

File test/option-d.py

 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import TestSCons
-import string
-import sys
 
 test = TestSCons.TestSCons()
 
-test.write('SConstruct', "")
+test.pass_test()	#XXX Short-circuit until this is supported.
 
-test.run(arguments = '-d',
-	 stderr = "Warning:  the -d option is not yet implemented\n")
+test.subdir('subdir')
+
+test.write('SConstruct', """
+env = Environment()
+env.Program(target = 'aaa', source = 'aaa.c')
+env.Program(target = 'bbb', source = 'bbb.c')
+SConscript('subdir/SConscript')
+""")
+
+test.write(['subdir', 'SConscript'], """
+env = Environment()
+env.Program(target = 'ccc', source = 'ccc.c')
+env.Program(target = 'ddd', source = 'ddd.c')
+""")
+
+test.write('aaa.c', """
+int
+main(int argc, char *argv)
+{
+	argv[argc++] = "--";
+	printf("aaa.c\n");
+	exit (0);
+}
+""")
+
+test.write('bbb.c', """
+int
+main(int argc, char *argv)
+{
+	argv[argc++] = "--";
+	printf("bbb.c\n");
+	exit (0);
+}
+""")
+
+test.write(['subdir', 'ccc.c'], """
+int
+main(int argc, char *argv)
+{
+	argv[argc++] = "--";
+	printf("subdir/ccc.c\n");
+	exit (0);
+}
+""")
+
+test.write(['subdir', 'ddd.c'], """
+int
+main(int argc, char *argv)
+{
+	argv[argc++] = "--";
+	printf("subdir/ddd.c\n");
+	exit (0);
+}
+""")
+
+test.run(arguments = '-d .', stdout = """
+Target aaa: aaa.o
+Checking aaa
+  Checking aaa.o
+    Checking aaa.c
+  Rebuilding aaa.o: out of date.
+cc -c -o aaa.o aaa.c
+Rebuilding aaa: out of date.
+cc -o aaa aaa.o
+Target aaa.o: aaa.c
+Target bbb: bbb.o
+Checking bbb
+  Checking bbb.o
+    Checking bbb.c
+  Rebuilding bbb.o: out of date.
+cc -c -o bbb.o bbb.c
+Rebuilding bbb: out of date.
+cc -o bbb bbb.o
+Target bbb.o: bbb.c
+Target subdir/ccc/g: subdir/ccc.o
+Checking subdir/ccc/g
+  Checking subdir/ccc/g.o
+    Checking subdir/ccc/g.c
+  Rebuilding subdir/ccc/g.o: out of date.
+cc -c -o subdir/ccc/g.o subdir/ccc.c
+Rebuilding subdir/ccc/g: out of date.
+cc -o subdir/ccc/g subdir/ccc.o
+Target subdir/ccc/g.o: subdir/ccc.c
+Target subdir/ddd/g: subdir/ddd.o
+Checking subdir/ddd/g
+  Checking subdir/ddd/g.o
+    Checking subdir/ddd/g.c
+  Rebuilding subdir/ddd/g.o: out of date.
+cc -c -o subdir/ddd/g.o subdir/ddd.c
+Rebuilding subdir/ddd/g: out of date.
+cc -o subdir/ddd/g subdir/ddd.o
+Target subdir/ddd/g.o: subdir/ddd.c
+""")
+
+test.run(program = test.workpath('aaa'), stdout = "aaa.c\n")
+test.run(program = test.workpath('bbb'), stdout = "bbb.c\n")
+test.run(program = test.workpath('subdir/ccc'), stdout = "subdir/ccc.c\n")
+test.run(program = test.workpath('subdir/ddd'), stdout = "subdir/ddd.c\n")
 
 test.pass_test()
  

File test/option-i.py

 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
+import os.path
 import TestSCons
-import string
-import sys
 
 test = TestSCons.TestSCons()
 
-test.write('SConstruct', "")
+test.pass_test()	#XXX Short-circuit until this is supported.
 
-test.run(arguments = '-i',
-	 stderr = "Warning:  the -i option is not yet implemented\n")
+test.write('succeed.py', r"""
+import sys
+file = open(sys.argv[1], 'w')
+file.write("succeed.py: %s\n" % sys.argv[1])
+file.close()
+sys.exit(0)
+""")
 
-test.run(arguments = '--ignore-errors',
-	 stderr = "Warning:  the --ignore-errors option is not yet implemented\n")
+test.write('fail.py', r"""
+import sys
+sys.exit(1)
+""")
+
+test.write('SConstruct', """
+Succeed = Builder(name = "Succeed", action = "python succeed.py %(target)s")
+Fail = Builder(name = "Fail", action = "python fail.py %(target)s")
+env = Environment(BUILDERS = [Succeed, Fail])
+env.Fail(target = 'aaa.1', source = 'aaa.in')
+env.Succeed(target = 'aaa.out', source = 'aaa.1')
+env.Fail(target = 'bbb.1', source = 'bbb.in')
+env.Succeed(target = 'bbb.out', source = 'bbb.1')
+""")
+
+test.run(arguments = '.')
+
+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.1')))
+test.fail_test(os.path.exists(test.workpath('bbb.out')))
+
+test.run(arguments = '-i .')
+
+test.fail_test(os.path.exists(test.workpath('aaa.1')))
+test.fail_test(test.read('aaa.out') != "aaa.out\n")
+test.fail_test(os.path.exists(test.workpath('bbb.1')))
+test.fail_test(test.read('bbb.out') != "bbb.out\n")
+
+test.unlink("aaa.out")
+test.unlink("bbb.out")
+
+test.run(arguments = '--ignore-errors .')
+
+test.fail_test(os.path.exists(test.workpath('aaa.1')))
+test.fail_test(test.read('aaa.out') != "aaa.out\n")
+test.fail_test(os.path.exists(test.workpath('bbb.1')))
+test.fail_test(test.read('bbb.out') != "bbb.out\n")
 
 test.pass_test()
  

File test/option-k.py

 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
+import os.path
 import TestSCons
-import string
-import sys
 
 test = TestSCons.TestSCons()
 
-test.write('SConstruct', "")
+test.pass_test()	#XXX Short-circuit until this is supported.
 
-test.run(arguments = '-k',
-	 stderr = "Warning:  the -k option is not yet implemented\n")
+test.write('succeed.py', r"""
+import sys
+file = open(sys.argv[1], 'w')
+file.write("succeed.py: %s\n" % sys.argv[1])
+file.close()
+sys.exit(0)
+""")
 
-test.run(arguments = '--keep-going',
-	 stderr = "Warning:  the --keep-going option is not yet implemented\n")
+test.write('fail.py', r"""
+import sys
+sys.exit(1)
+""")
+
+test.write('SConstruct', """
+Succeed = Builder(name = "Succeed", action = "python succeed.py %(target)s")
+Fail = Builder(name = "Fail", action = "python fail.py %(target)s")
+env = Environment(BUILDERS = [Succeed, 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')
+""")
+
+test.run(arguments = '.')
+
+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.run(arguments = '-k .')
+
+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') != "bbb.out\n")
+
+test.unlink("bbb.out")
+
+test.run(arguments = '--keep-going .')
+
+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') != "bbb.out\n")
 
 test.pass_test()