diff options
Diffstat (limited to 'test/option-c.py')
-rw-r--r-- | test/option-c.py | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/test/option-c.py b/test/option-c.py index 060ebfb..5d1a714 100644 --- a/test/option-c.py +++ b/test/option-c.py @@ -127,12 +127,46 @@ test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n") test.writable('.', 0) f = open(test.workpath('foo1.out')) - test.run(arguments = '-c foo1.out', stdout = test.wrap_stdout("scons: Could not remove 'foo1.out': Permission denied\n")) - test.fail_test(not os.path.exists(test.workpath('foo1.out'))) - f.close() +test.writable('.', 1) + +test.subdir('subd') +test.write(['subd', 'foon.in'], "foon.in\n") +test.write('aux1.x', "aux1.x\n") +test.write('aux2.x', "aux2.x\n") +test.write('SConstruct', """ +B = Builder(action = r'%s build.py $TARGETS $SOURCES') +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'foo1.out', source = 'foo1.in') +env.B(target = 'foo2.out', source = 'foo2.xxx') +env.B(target = 'foo2.xxx', source = 'foo2.in') +env.B(target = 'foo3.out', source = 'foo3.in') +Clean('foo2.xxx', ['aux1.x']) +Clean('foo2.xxx', ['aux2.x']) +Clean('.', ['subd']) +""" % python) + +expect = test.wrap_stdout("""Removed foo2.xxx +Removed aux1.x +Removed aux2.x +""") +test.run(arguments = '-c foo2.xxx', stdout=expect) +test.fail_test(test.read(test.workpath('foo1.out')) != "foo1.in\n") +test.fail_test(os.path.exists(test.workpath('foo2.xxx'))) +test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n") +test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n") + +expect = test.wrap_stdout("""Removed foo1.out +Removed foo2.out +Removed foo3.out +Removed %s +Removed directory subd +""" % os.path.join('subd','foon.in')) +test.run(arguments = '-c .', stdout=expect) +test.fail_test(os.path.exists(test.workpath('subdir', 'foon.in'))) +test.fail_test(os.path.exists(test.workpath('subdir'))) test.pass_test() |