diff options
author | William Blevins <wblevins001@gmail.com> | 2017-03-01 01:42:59 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2017-03-01 01:42:59 (GMT) |
commit | 883c36995a2dc7d1b3c49e04b00aaf7af1dde4cd (patch) | |
tree | 53b71b445e3e933cdcfcae4c96498222afba9c14 | |
parent | 35308fb1e42a1999f47f82543af8c74ff59c6455 (diff) | |
download | SCons-883c36995a2dc7d1b3c49e04b00aaf7af1dde4cd.zip SCons-883c36995a2dc7d1b3c49e04b00aaf7af1dde4cd.tar.gz SCons-883c36995a2dc7d1b3c49e04b00aaf7af1dde4cd.tar.bz2 |
Additional fixture cleanup for test/AS directory.
-rw-r--r-- | test/AS/AS.py | 81 | ||||
-rw-r--r-- | test/AS/ASFLAGS.py | 109 | ||||
-rw-r--r-- | test/AS/ASPP.py | 81 | ||||
-rw-r--r-- | test/AS/ASPPFLAGS.py | 106 | ||||
-rw-r--r-- | test/AS/fixture/myas.py | 35 | ||||
-rw-r--r-- | test/AS/fixture/myas_args.py | 48 | ||||
-rw-r--r-- | test/AS/fixture/sconstest.skip | 0 |
7 files changed, 107 insertions, 353 deletions
diff --git a/test/AS/AS.py b/test/AS/AS.py index 6ccf0cb..380afe3 100644 --- a/test/AS/AS.py +++ b/test/AS/AS.py @@ -29,6 +29,7 @@ Verify the ability to set the $AS construction variable to a different assembler (a wrapper we create). """ +import os import sys import TestSCons @@ -38,84 +39,8 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() - - -if sys.platform == 'win32': - - test.write('mylink.py', r""" -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - if not a[0] in '/-': - break - args = args[1:] - if a[:5].lower() == '/out:': out = a[5:] -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import sys -args = sys.argv[1:] -inf = None -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - args = args[1:] - if not a[0] in "/-": - if not inf: - inf = a - continue - if a[:3] == '/Fo': out = a[3:] -infile = open(inf, 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") - -else: - - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'co:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mylink.py') +test.file_fixture(os.path.join('fixture', 'myas.py')) test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py index 56eb11b..79fde8c 100644 --- a/test/AS/ASFLAGS.py +++ b/test/AS/ASFLAGS.py @@ -24,6 +24,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import os import sys import TestSCons @@ -33,114 +34,22 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() _exe = TestSCons._exe +test.file_fixture('mylink.py') +test.file_fixture(os.path.join('fixture', 'myas_args.py')) +o = ' -x' +o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - o = ' -x' - o_c = ' -x' - if not msc.msvc_exists(): - o_c = ' -x -c' - - test.write('mylink.py', r""" -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - if not a[0] in '/-': - break - args = args[1:] - if a[:5].lower() == '/out:': out = a[5:] -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import sys -args = sys.argv[1:] -inf = None -optstring = '' -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - args = args[1:] - if not a[0] in '/-': - if not inf: - inf = a - continue - if a[:2] == '/c': - continue - if a[:3] == '/Fo': - out = a[3:] - continue - optstring = optstring + ' ' + a -infile = open(inf, 'rb') -outfile = open(out, 'wb') -outfile.write(optstring + "\n") -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") - -else: - - o = ' -x' - o_c = ' -x -c' - - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'co:x') -optstring = '' - -for opt, arg in opts: - if opt == '-o': out = arg - else: optstring = optstring + ' ' + opt - -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -outfile.write(bytearray(optstring + "\n",'utf-8')) - -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) - -sys.exit(0) -""") - - + if msc.msvc_exists(): + o_c = ' -x' test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - AS = r'%(_python_)s myas.py', ASFLAGS = '-x', - CC = r'%(_python_)s myas.py') + AS = r'%(_python_)s myas_args.py', ASFLAGS = '-x', + CC = r'%(_python_)s myas_args.py') env.Program(target = 'test1', source = 'test1.s') env.Program(target = 'test2', source = 'test2.S') env.Program(target = 'test3', source = 'test3.asm') diff --git a/test/AS/ASPP.py b/test/AS/ASPP.py index 22cc36a..18c067f 100644 --- a/test/AS/ASPP.py +++ b/test/AS/ASPP.py @@ -24,6 +24,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import os import sys import TestSCons @@ -33,84 +34,8 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() - - -if sys.platform == 'win32': - - test.write('mylink.py', r""" -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - if not a[0] in '/-': - break - args = args[1:] - if a[:5].lower() == '/out:': out = a[5:] -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import sys -args = sys.argv[1:] -inf = None -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - args = args[1:] - if not a[0] in "/-": - if not inf: - inf = a - continue - if a[:3] == '/Fo': out = a[3:] -infile = open(inf, 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") - -else: - - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'co:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mylink.py') +test.file_fixture(os.path.join('fixture', 'myas.py')) test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', diff --git a/test/AS/ASPPFLAGS.py b/test/AS/ASPPFLAGS.py index 460cfcb..254a458 100644 --- a/test/AS/ASPPFLAGS.py +++ b/test/AS/ASPPFLAGS.py @@ -24,6 +24,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import os import sys import TestSCons @@ -33,111 +34,22 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() _exe = TestSCons._exe +test.file_fixture('mylink.py') +test.file_fixture(os.path.join('fixture', 'myas_args.py')) +o = ' -x' +o_c = ' -x -c' if sys.platform == 'win32': import SCons.Tool.MSCommon as msc - o = ' -x' - o_c = ' -x' - if not msc.msvc_exists(): - o_c = ' -x -c' - - test.write('mylink.py', r""" -import sys -args = sys.argv[1:] -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - if not a[0] in '/-': - break - args = args[1:] - if a[:5].lower() == '/out:': out = a[5:] -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import sys -args = sys.argv[1:] -inf = None -optstring = '' -while args: - a = args[0] - if a == '-o': - out = args[1] - args = args[2:] - continue - args = args[1:] - if not a[0] in '/-': - if not inf: - inf = a - continue - if a[:2] == '/c': - continue - if a[:3] == '/Fo': - out = a[3:] - continue - optstring = optstring + ' ' + a -infile = open(inf, 'rb') -outfile = open(out, 'wb') -outfile.write(bytearray(optstring + "\n",'utf-8')) -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") - -else: - - o = ' -x' - - o_c = ' -x -c' - - test.write('mylink.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'o:') -for opt, arg in opts: - if opt == '-o': out = arg -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -for l in infile.readlines(): - if l[:5] != b'#link': - outfile.write(l) -sys.exit(0) -""") - - test.write('myas.py', r""" -import getopt -import sys -opts, args = getopt.getopt(sys.argv[1:], 'co:x') -optstring = '' -for opt, arg in opts: - if opt == '-o': out = arg - else: optstring = optstring + ' ' + opt -infile = open(args[0], 'rb') -outfile = open(out, 'wb') -outfile.write(bytearray(optstring + "\n",'utf-8')) -for l in infile.readlines(): - if l[:3] != b'#as': - outfile.write(l) -sys.exit(0) -""") - - + if msc.msvc_exists(): + o_c = ' -x' test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - ASPP = r'%(_python_)s myas.py', ASPPFLAGS = '-x', - CC = r'%(_python_)s myas.py') + ASPP = r'%(_python_)s myas_args.py', ASPPFLAGS = '-x', + CC = r'%(_python_)s myas_args.py') env.Program(target = 'test1', source = 'test1.spp') env.Program(target = 'test2', source = 'test2.SPP') """ % locals()) diff --git a/test/AS/fixture/myas.py b/test/AS/fixture/myas.py new file mode 100644 index 0000000..bffae78 --- /dev/null +++ b/test/AS/fixture/myas.py @@ -0,0 +1,35 @@ +import sys + +if sys.platform == 'win32': + args = sys.argv[1:] + inf = None + while args: + a = args[0] + if a == '-o': + out = args[1] + args = args[2:] + continue + args = args[1:] + if not a[0] in "/-": + if not inf: + inf = a + continue + if a[:3] == '/Fo': out = a[3:] + infile = open(inf, 'rb') + outfile = open(out, 'wb') + for l in infile.readlines(): + if l[:3] != b'#as': + outfile.write(l) + sys.exit(0) + +else: + import getopt + opts, args = getopt.getopt(sys.argv[1:], 'co:') + for opt, arg in opts: + if opt == '-o': out = arg + infile = open(args[0], 'rb') + outfile = open(out, 'wb') + for l in infile.readlines(): + if l[:3] != b'#as': + outfile.write(l) + sys.exit(0) diff --git a/test/AS/fixture/myas_args.py b/test/AS/fixture/myas_args.py new file mode 100644 index 0000000..c7ca315 --- /dev/null +++ b/test/AS/fixture/myas_args.py @@ -0,0 +1,48 @@ +import sys + +if sys.platform == 'win32': + args = sys.argv[1:] + inf = None + optstring = '' + while args: + a = args[0] + if a == '-o': + out = args[1] + args = args[2:] + continue + args = args[1:] + if not a[0] in '/-': + if not inf: + inf = a + continue + if a[:2] == '/c': + continue + if a[:3] == '/Fo': + out = a[3:] + continue + optstring = optstring + ' ' + a + infile = open(inf, 'rb') + outfile = open(out, 'wb') + outfile.write(bytearray(optstring + "\n",'utf-8')) + for l in infile.readlines(): + if l[:3] != b'#as': + outfile.write(l) + sys.exit(0) +else: + import getopt + opts, args = getopt.getopt(sys.argv[1:], 'co:x') + optstring = '' + + for opt, arg in opts: + if opt == '-o': out = arg + else: optstring = optstring + ' ' + opt + + infile = open(args[0], 'rb') + outfile = open(out, 'wb') + outfile.write(bytearray(optstring + "\n",'utf-8')) + + for l in infile.readlines(): + if l[:3] != b'#as': + outfile.write(l) + + sys.exit(0) diff --git a/test/AS/fixture/sconstest.skip b/test/AS/fixture/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/AS/fixture/sconstest.skip |