summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-22 00:47:35 (GMT)
committerWilliam Blevins <wblevins001@gmail.com>2016-09-22 00:47:35 (GMT)
commitbea6d372a175aff23d05b6a513c2df53aaa6fa87 (patch)
treed5758880a84cd3c2e72e409c6d62783d01edec0e /test
parent88eb753eb8e65721368beb2fc1247312e2a5ab4c (diff)
downloadSCons-bea6d372a175aff23d05b6a513c2df53aaa6fa87.zip
SCons-bea6d372a175aff23d05b6a513c2df53aaa6fa87.tar.gz
SCons-bea6d372a175aff23d05b6a513c2df53aaa6fa87.tar.bz2
Fixed the YACC tests.
Diffstat (limited to 'test')
-rw-r--r--test/YACC/YACC-fixture/.exclude_tests1
-rw-r--r--test/YACC/YACC-fixture/aaa.y2
-rw-r--r--test/YACC/YACC-fixture/bbb.yacc2
-rw-r--r--test/YACC/YACC-fixture/ccc.yy2
-rw-r--r--test/YACC/YACC-fixture/ddd.ym2
-rw-r--r--test/YACC/YACC-fixture/myyacc.py13
-rw-r--r--test/YACC/YACC.py25
-rw-r--r--test/YACC/YACCCOM-fixture/.exclude_tests1
-rw-r--r--test/YACC/YACCCOM-fixture/myyacc.py7
-rw-r--r--test/YACC/YACCCOM.py16
-rw-r--r--test/YACC/YACCCOMSTR.py16
-rw-r--r--test/YACC/YACCFLAGS-fixture/.exclude_tests1
-rw-r--r--test/YACC/YACCFLAGS-fixture/myyacc.py17
-rw-r--r--test/YACC/YACCFLAGS.py22
-rw-r--r--test/YACC/YACCHFILESUFFIX.py4
-rw-r--r--test/YACC/YACCHXXFILESUFFIX.py4
-rw-r--r--test/YACC/YACCVCGFILESUFFIX.py4
-rw-r--r--test/YACC/shared-fixture/.exclude_tests1
-rw-r--r--test/YACC/shared-fixture/aaa.y2
-rw-r--r--test/YACC/shared-fixture/bbb.yacc2
20 files changed, 65 insertions, 79 deletions
diff --git a/test/YACC/YACC-fixture/.exclude_tests b/test/YACC/YACC-fixture/.exclude_tests
new file mode 100644
index 0000000..f12c4d0
--- /dev/null
+++ b/test/YACC/YACC-fixture/.exclude_tests
@@ -0,0 +1 @@
+myyacc.py
diff --git a/test/YACC/YACC-fixture/aaa.y b/test/YACC/YACC-fixture/aaa.y
new file mode 100644
index 0000000..dab6e40
--- /dev/null
+++ b/test/YACC/YACC-fixture/aaa.y
@@ -0,0 +1,2 @@
+aaa.y
+YACC
diff --git a/test/YACC/YACC-fixture/bbb.yacc b/test/YACC/YACC-fixture/bbb.yacc
new file mode 100644
index 0000000..ca4ab73
--- /dev/null
+++ b/test/YACC/YACC-fixture/bbb.yacc
@@ -0,0 +1,2 @@
+bbb.yacc
+YACC
diff --git a/test/YACC/YACC-fixture/ccc.yy b/test/YACC/YACC-fixture/ccc.yy
new file mode 100644
index 0000000..c7ec552
--- /dev/null
+++ b/test/YACC/YACC-fixture/ccc.yy
@@ -0,0 +1,2 @@
+ccc.yacc
+YACC
diff --git a/test/YACC/YACC-fixture/ddd.ym b/test/YACC/YACC-fixture/ddd.ym
new file mode 100644
index 0000000..c8962be
--- /dev/null
+++ b/test/YACC/YACC-fixture/ddd.ym
@@ -0,0 +1,2 @@
+ddd.yacc
+YACC
diff --git a/test/YACC/YACC-fixture/myyacc.py b/test/YACC/YACC-fixture/myyacc.py
new file mode 100644
index 0000000..c2e1abf
--- /dev/null
+++ b/test/YACC/YACC-fixture/myyacc.py
@@ -0,0 +1,13 @@
+import getopt
+import sys
+cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:', [])
+output = None
+opt_string = ''
+for opt, arg in cmd_opts:
+ if opt == '-o': output = open(arg, 'wb')
+ else: opt_string = opt_string + ' ' + opt
+for a in args:
+ contents = open(a, 'rb').read()
+ output.write(contents.replace(b'YACC', b'myyacc.py'))
+output.close()
+sys.exit(0)
diff --git a/test/YACC/YACC.py b/test/YACC/YACC.py
index 59067f3..3fc1f7c 100644
--- a/test/YACC/YACC.py
+++ b/test/YACC/YACC.py
@@ -41,25 +41,7 @@ else:
test = TestSCons.TestSCons()
-
-
-test.write('myyacc.py', """
-import getopt
-import sys
-cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:', [])
-output = None
-opt_string = ''
-for opt, arg in cmd_opts:
- if opt == '-o': output = open(arg, 'wb')
- else: opt_string = opt_string + ' ' + opt
-for a in args:
- contents = open(a, 'rb').read()
- output.write(contents.replace('YACC', 'myyacc.py'))
-output.close()
-sys.exit(0)
-""")
-
-
+test.dir_fixture('YACC-fixture')
test.write('SConstruct', """
env = Environment(YACC = r'%(_python_)s myyacc.py', tools=['default', 'yacc'])
@@ -69,11 +51,6 @@ env.CXXFile(target = 'ccc', source = 'ccc.yy')
env.CFile(target = 'ddd', source = 'ddd.ym')
""" % locals())
-test.write('aaa.y', "aaa.y\nYACC\n")
-test.write('bbb.yacc', "bbb.yacc\nYACC\n")
-test.write('ccc.yy', "ccc.yacc\nYACC\n")
-test.write('ddd.ym', "ddd.yacc\nYACC\n")
-
test.run(arguments = '.', stderr = None)
test.must_match('aaa.c', "aaa.y\nmyyacc.py\n")
diff --git a/test/YACC/YACCCOM-fixture/.exclude_tests b/test/YACC/YACCCOM-fixture/.exclude_tests
new file mode 100644
index 0000000..f12c4d0
--- /dev/null
+++ b/test/YACC/YACCCOM-fixture/.exclude_tests
@@ -0,0 +1 @@
+myyacc.py
diff --git a/test/YACC/YACCCOM-fixture/myyacc.py b/test/YACC/YACCCOM-fixture/myyacc.py
new file mode 100644
index 0000000..1502800
--- /dev/null
+++ b/test/YACC/YACCCOM-fixture/myyacc.py
@@ -0,0 +1,7 @@
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in [l for l in infile.readlines() if l != b'/*yacc*/\n']:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/YACC/YACCCOM.py b/test/YACC/YACCCOM.py
index 4e43676..70ffa72 100644
--- a/test/YACC/YACCCOM.py
+++ b/test/YACC/YACCCOM.py
@@ -34,17 +34,8 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('myyacc.py', """
-import sys
-outfile = open(sys.argv[1], 'wb')
-for f in sys.argv[2:]:
- infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
+test.dir_fixture('YACCCOM-fixture')
test.write('SConstruct', """
env = Environment(tools=['default', 'yacc'],
@@ -53,9 +44,6 @@ env.CFile(target = 'aaa', source = 'aaa.y')
env.CFile(target = 'bbb', source = 'bbb.yacc')
""" % locals())
-test.write('aaa.y', "aaa.y\n/*yacc*/\n")
-test.write('bbb.yacc', "bbb.yacc\n/*yacc*/\n")
-
test.run(arguments = '.')
test.must_match('aaa.c', "aaa.y\n")
diff --git a/test/YACC/YACCCOMSTR.py b/test/YACC/YACCCOMSTR.py
index eaf3fde..344b715 100644
--- a/test/YACC/YACCCOMSTR.py
+++ b/test/YACC/YACCCOMSTR.py
@@ -35,17 +35,8 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('myyacc.py', """
-import sys
-outfile = open(sys.argv[1], 'wb')
-for f in sys.argv[2:]:
- infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('shared-fixture')
+test.dir_fixture('YACCCOM-fixture')
test.write('SConstruct', """
env = Environment(tools=['default', 'yacc'],
@@ -55,9 +46,6 @@ env.CFile(target = 'aaa', source = 'aaa.y')
env.CFile(target = 'bbb', source = 'bbb.yacc')
""" % locals())
-test.write('aaa.y', "aaa.y\n/*yacc*/\n")
-test.write('bbb.yacc', "bbb.yacc\n/*yacc*/\n")
-
test.run(stdout = test.wrap_stdout("""\
Yaccing aaa.c from aaa.y
Yaccing bbb.c from bbb.yacc
diff --git a/test/YACC/YACCFLAGS-fixture/.exclude_tests b/test/YACC/YACCFLAGS-fixture/.exclude_tests
new file mode 100644
index 0000000..f12c4d0
--- /dev/null
+++ b/test/YACC/YACCFLAGS-fixture/.exclude_tests
@@ -0,0 +1 @@
+myyacc.py
diff --git a/test/YACC/YACCFLAGS-fixture/myyacc.py b/test/YACC/YACCFLAGS-fixture/myyacc.py
new file mode 100644
index 0000000..ffd9031
--- /dev/null
+++ b/test/YACC/YACCFLAGS-fixture/myyacc.py
@@ -0,0 +1,17 @@
+import getopt
+import sys
+cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:I:x', [])
+output = None
+opt_string = ''
+i_arguments = ''
+for opt, arg in cmd_opts:
+ if opt == '-o': output = open(arg, 'wb')
+ elif opt == '-I': i_arguments = i_arguments + ' ' + arg
+ else: opt_string = opt_string + ' ' + opt
+for a in args:
+ contents = open(a, 'rb').read()
+ contents = contents.replace(b'YACCFLAGS', opt_string.encode())
+ contents = contents.replace(b'I_ARGS', i_arguments.encode())
+ output.write(contents)
+output.close()
+sys.exit(0)
diff --git a/test/YACC/YACCFLAGS.py b/test/YACC/YACCFLAGS.py
index f0b698b..b3f86fe 100644
--- a/test/YACC/YACCFLAGS.py
+++ b/test/YACC/YACCFLAGS.py
@@ -43,27 +43,7 @@ test = TestSCons.TestSCons()
test.subdir('in')
-
-
-test.write('myyacc.py', """
-import getopt
-import sys
-cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:I:x', [])
-output = None
-opt_string = ''
-i_arguments = ''
-for opt, arg in cmd_opts:
- if opt == '-o': output = open(arg, 'wb')
- elif opt == '-I': i_arguments = i_arguments + ' ' + arg
- else: opt_string = opt_string + ' ' + opt
-for a in args:
- contents = open(a, 'rb').read()
- contents = contents.replace('YACCFLAGS', opt_string)
- contents = contents.replace('I_ARGS', i_arguments)
- output.write(contents)
-output.close()
-sys.exit(0)
-""")
+test.dir_fixture('YACCFLAGS-fixture')
test.write('SConstruct', """
env = Environment(YACC = r'%(_python_)s myyacc.py',
diff --git a/test/YACC/YACCHFILESUFFIX.py b/test/YACC/YACCHFILESUFFIX.py
index 8801aea..f205473 100644
--- a/test/YACC/YACCHFILESUFFIX.py
+++ b/test/YACC/YACCHFILESUFFIX.py
@@ -47,11 +47,11 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*yacc*/\\n']:
outfile.write(l)
outfile.close()
base, ext = os.path.splitext(args[0])
-open(base+'.hsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
+open(base+'.hsuffix', 'wb').write((" ".join(sys.argv)+'\\n').encode())
sys.exit(0)
""")
diff --git a/test/YACC/YACCHXXFILESUFFIX.py b/test/YACC/YACCHXXFILESUFFIX.py
index 6664356..6418189 100644
--- a/test/YACC/YACCHXXFILESUFFIX.py
+++ b/test/YACC/YACCHXXFILESUFFIX.py
@@ -47,11 +47,11 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*yacc*/\\n']:
outfile.write(l)
outfile.close()
base, ext = os.path.splitext(args[0])
-open(base+'.hxxsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
+open(base+'.hxxsuffix', 'wb').write((" ".join(sys.argv)+'\\n').encode())
sys.exit(0)
""")
diff --git a/test/YACC/YACCVCGFILESUFFIX.py b/test/YACC/YACCVCGFILESUFFIX.py
index 0327d8a..5306076 100644
--- a/test/YACC/YACCVCGFILESUFFIX.py
+++ b/test/YACC/YACCVCGFILESUFFIX.py
@@ -49,12 +49,12 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
+ for l in [l for l in infile.readlines() if l != b'/*yacc*/\\n']:
outfile.write(l)
outfile.close()
if vcg:
base, ext = os.path.splitext(args[0])
- open(base+'.vcgsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
+ open(base+'.vcgsuffix', 'wb').write((" ".join(sys.argv)+'\\n').encode())
sys.exit(0)
""")
diff --git a/test/YACC/shared-fixture/.exclude_tests b/test/YACC/shared-fixture/.exclude_tests
new file mode 100644
index 0000000..f12c4d0
--- /dev/null
+++ b/test/YACC/shared-fixture/.exclude_tests
@@ -0,0 +1 @@
+myyacc.py
diff --git a/test/YACC/shared-fixture/aaa.y b/test/YACC/shared-fixture/aaa.y
new file mode 100644
index 0000000..f7f4cc7
--- /dev/null
+++ b/test/YACC/shared-fixture/aaa.y
@@ -0,0 +1,2 @@
+aaa.y
+/*yacc*/
diff --git a/test/YACC/shared-fixture/bbb.yacc b/test/YACC/shared-fixture/bbb.yacc
new file mode 100644
index 0000000..b3c856f
--- /dev/null
+++ b/test/YACC/shared-fixture/bbb.yacc
@@ -0,0 +1,2 @@
+bbb.yacc
+/*yacc*/