diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-05-19 23:14:50 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2020-05-19 23:14:50 (GMT) |
commit | 97bc344bcb78a8cfbea0e5417b7b461f1d066ce7 (patch) | |
tree | 012946f639bec59381b90c5035af69dfed250511 | |
parent | a1a47b77666e20e391ebbf81053caf0154a93093 (diff) | |
download | SCons-97bc344bcb78a8cfbea0e5417b7b461f1d066ce7.zip SCons-97bc344bcb78a8cfbea0e5417b7b461f1d066ce7.tar.gz SCons-97bc344bcb78a8cfbea0e5417b7b461f1d066ce7.tar.bz2 |
extract fake gcc and link python scripts to fixture. We'll use these for CompilationDatabase tests
-rw-r--r-- | test/CPPFLAGS.py | 57 | ||||
-rw-r--r-- | test/fixture/mygcc.py | 17 | ||||
-rw-r--r-- | test/fixture/mylink_win32.py | 0 |
3 files changed, 21 insertions, 53 deletions
diff --git a/test/CPPFLAGS.py b/test/CPPFLAGS.py index 4c656a1..78d28e8 100644 --- a/test/CPPFLAGS.py +++ b/test/CPPFLAGS.py @@ -32,68 +32,19 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -# Writing this to accomodate both our in-line tool chain and the +# Writing this to accommodate both our in-line tool chain and the # MSVC command lines is too hard, and will be completely unnecessary # some day when we separate our tests. Punt for now. if sys.platform == 'win32': test.skip_test('Skipping on win32.\n') - - if sys.platform == 'win32': - - test.write('mylink.py', r""" -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a[0] != '/': - break - args.pop(0) - if a[:5] == '/OUT:': out = a[5:] -with open(out, 'w') as ofp, open(args[0], 'r') as ifp: - for l in ifp.readlines(): - if l[:5] != '#link': - ofp.write(l) -sys.exit(0) -""") - + test.file_fixture('mylink_win32.py', 'mylink.py') else: + test.file_fixture('mylink.py') - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:s:') -for opt, arg in opts: - if opt == '-o': out = arg -with open(out, 'w') as ofp: - for f in args: - with open(f, 'r') as ifp: - for l in ifp.readlines(): - if l[:5] != '#link': - ofp.write(l) -sys.exit(0) -""") - -test.write('mygcc.py', r""" -import getopt -import os -import sys -compiler = sys.argv[1] -clen = len(compiler) + 1 -opts, args = getopt.getopt(sys.argv[2:], 'co:xf:K:') -for opt, arg in opts: - if opt == '-o': out = arg - elif opt == '-x': - with open('mygcc.out', 'a') as f: - f.write(compiler + "\n") -with open(out, 'w') as ofp, open(args[0], 'r') as ifp: - for l in ifp.readlines(): - if l[:clen] != '#' + compiler: - ofp.write(l) -sys.exit(0) -""") +test.file_fixture('mygcc.py') test.write('SConstruct', """ diff --git a/test/fixture/mygcc.py b/test/fixture/mygcc.py new file mode 100644 index 0000000..76634cb --- /dev/null +++ b/test/fixture/mygcc.py @@ -0,0 +1,17 @@ + +import getopt +import os +import sys +compiler = sys.argv[1] +clen = len(compiler) + 1 +opts, args = getopt.getopt(sys.argv[2:], 'co:xf:K:') +for opt, arg in opts: + if opt == '-o': out = arg + elif opt == '-x': + with open('mygcc.out', 'a') as f: + f.write(compiler + "\n") +with open(out, 'w') as ofp, open(args[0], 'r') as ifp: + for l in ifp.readlines(): + if l[:clen] != '#' + compiler: + ofp.write(l) +sys.exit(0) diff --git a/test/fixture/mylink_win32.py b/test/fixture/mylink_win32.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixture/mylink_win32.py |