diff options
author | Steven Knight <knight@baldmt.com> | 2001-11-29 06:29:22 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-11-29 06:29:22 (GMT) |
commit | 94888b28d673f05360670ad3eeac836b5260e44a (patch) | |
tree | 3bffd52edc3e68463a13c59d24b975ed63a19641 /test/CC.py | |
parent | b88f3951d7ec14f464438d4bd6af6ee95b872888 (diff) | |
download | SCons-94888b28d673f05360670ad3eeac836b5260e44a.zip SCons-94888b28d673f05360670ad3eeac836b5260e44a.tar.gz SCons-94888b28d673f05360670ad3eeac836b5260e44a.tar.bz2 |
More NT portability in the tests.
Diffstat (limited to 'test/CC.py')
-rw-r--r-- | test/CC.py | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -25,24 +25,31 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import string import sys import TestSCons python = sys.executable +if sys.platform == 'win32': + _exe = '.exe' +else: + _exe = '' + test = TestSCons.TestSCons() -test.write("ccwrapper.py", +test.write("wrapper.py", """import os import string import sys -open('%s', 'wb').write("ccwrapper.py\\n") -os.system(string.join(["cc"] + sys.argv[1:], " ")) -""" % test.workpath('ccwrapper.out')) +open('%s', 'wb').write("wrapper.py\\n") +os.system(string.join(sys.argv[1:], " ")) +""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ foo = Environment() -bar = Environment(CC = r'%s ccwrapper.py') +cc = foo.Dictionary('CC') +bar = Environment(CC = r'%s wrapper.py ' + cc) foo.Program(target = 'foo', source = 'foo.c') bar.Program(target = 'bar', source = 'bar.c') """ % python) @@ -68,12 +75,12 @@ main(int argc, char *argv[]) """) -test.run(arguments = 'foo') +test.run(arguments = 'foo' + _exe) -test.fail_test(os.path.exists(test.workpath('ccwrapper.out'))) +test.fail_test(os.path.exists(test.workpath('wrapper.out'))) -test.run(arguments = 'bar') +test.run(arguments = 'bar' + _exe) -test.fail_test(test.read('ccwrapper.out') != "ccwrapper.py\n") +test.fail_test(test.read('wrapper.out') != "wrapper.py\n") test.pass_test() |