diff options
author | Steven Knight <knight@baldmt.com> | 2003-04-30 15:35:30 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-04-30 15:35:30 (GMT) |
commit | 212d77d88aa4374ef13f2e6bc7edf3395ac9736c (patch) | |
tree | 464ca9fd18866613629e2381dfb6b93190a5e2e6 /test/option--max-drift.py | |
parent | 7ff542f3fb5b361087ef2738a82b5d849e005d45 (diff) | |
download | SCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.zip SCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.tar.gz SCons-212d77d88aa4374ef13f2e6bc7edf3395ac9736c.tar.bz2 |
Provide uniform access to (some) command-line options. (Anthony Roach)
Diffstat (limited to 'test/option--max-drift.py')
-rw-r--r-- | test/option--max-drift.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/option--max-drift.py b/test/option--max-drift.py index 4dacb4d..3b90b68 100644 --- a/test/option--max-drift.py +++ b/test/option--max-drift.py @@ -88,5 +88,46 @@ test.run(arguments = '--max-drift=-1 f1.out f2.out', scons: "f2.out" is up to date. """ % python)) +# Test that Set/GetOption('max_drift') works: +test.write('SConstruct', """ +assert GetOption('max_drift') == 2*24*60*60 +SetOption('max_drift', 1) +assert GetOption('max_drift') == 1 +""") + +test.run() + +test.write('SConstruct', """ +assert GetOption('max_drift') == 1 +SetOption('max_drift', 10) +assert GetOption('max_drift') == 1 +""") + +test.run(arguments='--max-drift=1') + +# Test that SetOption('max_drift') actually sets max_drift +# by mucking with the file timestamps to make SCons not realize the source has changed +test.write('SConstruct', """ +SetOption('max_drift', 0) +B = Builder(action = r'%s build.py $TARGETS $SOURCES') +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'foo.out', source = 'foo.in') +""" % python) + +test.write('foo.in', 'foo.in\n') + +atime = os.path.getatime(test.workpath('foo.in')) +mtime = os.path.getmtime(test.workpath('foo.in')) + +test.run() +test.fail_test(test.read('foo.out') != 'foo.in\n') + +test.write('foo.in', 'foo.in delta\n') +os.utime(test.workpath('foo.in'), (atime,mtime)) + +test.run() + +test.fail_test(test.read('foo.out') != 'foo.in\n') + test.pass_test() |