diff options
author | Steven Knight <knight@baldmt.com> | 2003-01-14 03:28:41 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-01-14 03:28:41 (GMT) |
commit | ac081d1e052317f3cd08de9ec301c3686006ae80 (patch) | |
tree | 04769935688bf84f49ff0d054ba708f224e26901 /test | |
parent | 46149b06d894f20fc7eb0cd433aee188b369b17c (diff) | |
download | SCons-ac081d1e052317f3cd08de9ec301c3686006ae80.zip SCons-ac081d1e052317f3cd08de9ec301c3686006ae80.tar.gz SCons-ac081d1e052317f3cd08de9ec301c3686006ae80.tar.bz2 |
Fix bug removing symbolic links. (Steve Leblanc)
Diffstat (limited to 'test')
-rw-r--r-- | test/option-c.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/option-c.py b/test/option-c.py index 5d1a714..22523bd 100644 --- a/test/option-c.py +++ b/test/option-c.py @@ -47,6 +47,16 @@ 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') +import os +if hasattr(os, 'symlink'): + def symlink1(env, target, source): + # symlink to a file that exists + os.symlink(str(source[0]), str(target[0])) + env.Command(target = 'symlink1', source = 'foo1.in', action = symlink1) + def symlink2(env, target, source): + # force symlink to a file that doesn't exist + os.symlink('does_not_exist', str(target[0])) + env.Command(target = 'symlink2', source = 'foo1.in', action = symlink2) """ % python) test.write('foo1.in', "foo1.in\n") @@ -93,6 +103,10 @@ test.fail_test(test.read(test.workpath('foo2.xxx')) != "foo2.in\n") test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n") test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n") +if hasattr(os, 'symlink'): + test.fail_test(not os.path.islink(test.workpath('symlink1'))) + test.fail_test(not os.path.islink(test.workpath('symlink2'))) + test.run(arguments = '-c foo2.xxx', stdout = test.wrap_stdout("Removed foo2.xxx\n")) @@ -101,13 +115,16 @@ 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") -test.run(arguments = '-c .', - stdout = test.wrap_stdout("Removed foo1.out\nRemoved foo2.out\nRemoved foo3.out\n")) +test.run(arguments = '-c .') test.fail_test(os.path.exists(test.workpath('foo1.out'))) test.fail_test(os.path.exists(test.workpath('foo2.out'))) test.fail_test(os.path.exists(test.workpath('foo3.out'))) +if hasattr(os, 'symlink'): + test.fail_test(os.path.islink(test.workpath('symlink1'))) + test.fail_test(os.path.islink(test.workpath('symlink2'))) + test.run(arguments = 'foo1.out foo2.out foo3.out') expect = test.wrap_stdout("""Removed foo1.out |