summaryrefslogtreecommitdiffstats
path: root/test/Java
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-13 01:20:25 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-13 01:20:25 (GMT)
commit0316ad1681b00b0c948f329db9c1eeedf709545b (patch)
treeefe474bbdd3dd8d74e1b4420e949b9dba54adb83 /test/Java
parent91e275f3e1f334a15e4a338e9317d6f2078fc7df (diff)
downloadSCons-0316ad1681b00b0c948f329db9c1eeedf709545b.zip
SCons-0316ad1681b00b0c948f329db9c1eeedf709545b.tar.gz
SCons-0316ad1681b00b0c948f329db9c1eeedf709545b.tar.bz2
swap using wrapper.py fixture to wrapper_with_args.py. The fixture swap missed that java tests wrapper was different. Also mode rb/wb changes, and switch to must_match with mode='r'
Diffstat (limited to 'test/Java')
-rw-r--r--test/Java/JAR.py12
-rw-r--r--test/Java/JAVAC.py6
-rw-r--r--test/Java/JAVAH.py11
-rw-r--r--test/Java/RMIC.py14
4 files changed, 23 insertions, 20 deletions
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index 98dfa38..a87b272 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -43,9 +43,9 @@ while args:
else:
break
args = args[1:]
-outfile = open(out, 'wb')
+outfile = open(out, 'w')
for file in args:
- infile = open(file, 'rb')
+ infile = open(file, 'r')
for l in infile.readlines():
if l[:7] != '/*jar*/':
outfile.write(l)
@@ -88,7 +88,7 @@ line 3
test.write('myjar2.py', r"""
import sys
-f=open(sys.argv[2], 'wb')
+f=open(sys.argv[2], 'w')
f.write(" ".join(sys.argv[1:]))
f.write("\n")
f.close()
@@ -124,14 +124,14 @@ where_jar = test.java_where_jar()
-test.file_fixture('wrapper.py')
+test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'jar'],
JAVAC = r'%(where_javac)s',
JAR = r'%(where_jar)s')
jar = foo.Dictionary('JAR')
-bar = foo.Clone(JAR = r'%(_python_)s wrapper.py ' + jar)
+bar = foo.Clone(JAR = r'%(_python_)s wrapper_with_args.py ' + jar)
foo.Java(target = 'classes', source = 'com/sub/foo')
bar.Java(target = 'classes', source = 'com/sub/bar')
foo.Jar(target = 'foo', source = 'classes/com/sub/foo')
@@ -229,7 +229,7 @@ public class Example6
test.run(arguments = '.')
-expected_wrapper_out = "wrapper.py %(where_jar)s cf bar.jar classes/com/sub/bar\n"
+expected_wrapper_out = "wrapper_with_args.py %(where_jar)s cf bar.jar classes/com/sub/bar\n"
expected_wrapper_out = expected_wrapper_out.replace('/', os.sep)
test.must_match('wrapper.out',
expected_wrapper_out % locals())
diff --git a/test/Java/JAVAC.py b/test/Java/JAVAC.py
index 06b1969..da42fc6 100644
--- a/test/Java/JAVAC.py
+++ b/test/Java/JAVAC.py
@@ -51,8 +51,8 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
- outfile = open(file[:-5] + '.class', 'wb')
+ infile = open(file, 'r')
+ outfile = open(file[:-5] + '.class', 'w')
for l in infile.readlines():
if l[:9] != '/*javac*/':
outfile.write(l)
@@ -73,7 +73,7 @@ line 3
test.run(arguments = '.', stderr = None)
-test.must_match('test1.class', "test1.java\nline 3\n")
+test.must_match('test1.class', "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index f647b03..589a822 100644
--- a/test/Java/JAVAH.py
+++ b/test/Java/JAVAH.py
@@ -41,7 +41,7 @@ while args:
outdir = args[1]
args = args[1:]
elif a == '-o':
- outfile = open(args[1], 'wb')
+ outfile = open(args[1], 'w')
args = args[1:]
elif a == '-classpath':
args = args[1:]
@@ -51,7 +51,7 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
+ infile = open(file, 'r')
for l in infile.readlines():
if l[:9] != '/*javah*/':
outfile.write(l)
@@ -105,7 +105,7 @@ if java_version:
if test.javac_is_gcj:
test.skip_test('Test not valid for gcj (gnu java); skipping test(s).\n')
-test.file_fixture('wrapper.py')
+test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'javah', 'install'],
@@ -115,7 +115,7 @@ jv = %(java_version)s
if jv:
foo['JAVAVERSION'] = jv
javah = foo.Dictionary('JAVAH')
-bar = foo.Clone(JAVAH = r'%(_python_)s wrapper.py ' + javah)
+bar = foo.Clone(JAVAH = r'%(_python_)s wrapper_with_args.py ' + javah)
foo.Java(target = 'class1', source = 'com/sub/foo')
bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar')
foo_classes = foo.Java(target = 'class3', source = 'src')
@@ -282,7 +282,8 @@ class Private {
test.run(arguments = '.')
-test.fail_test(test.read('wrapper.out') != "wrapper.py %(where_javah)s -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n" % locals())
+test.must_match('wrapper.out', "wrapper_with_args.py %(where_javah)s -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n" % locals(),
+ mode='r')
test.must_exist(['outdir1', 'com_sub_foo_Example1.h'])
test.must_exist(['outdir1', 'com_other_Example2.h'])
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py
index 5f5decd..e94fda6 100644
--- a/test/Java/RMIC.py
+++ b/test/Java/RMIC.py
@@ -49,8 +49,8 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
- outfile = open(os.path.join(outdir, file[:-5] + '.class'), 'wb')
+ infile = open(file, 'r')
+ outfile = open(os.path.join(outdir, file[:-5] + '.class'), 'w')
for l in infile.readlines():
if l[:8] != '/*rmic*/':
outfile.write(l)
@@ -71,7 +71,7 @@ line 3
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read(['outdir', 'test1.class']) != "test1.java\nline 3\n")
+test.must_match(['outdir', 'test1.class'], "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
@@ -111,7 +111,7 @@ if java_version.count('.') == 1:
# Note, how we allow simple version strings like "5" and
# "6" to successfully pass this test.
if curver < (1, 8):
- test.file_fixture('wrapper.py')
+ test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'rmic'],
@@ -124,7 +124,7 @@ foo.RMIC(target = 'outdir1',
JAVACLASSDIR = 'class1')
rmic = foo.Dictionary('RMIC')
-bar = foo.Clone(RMIC = r'%(_python_)s wrapper.py ' + rmic)
+bar = foo.Clone(RMIC = r'%(_python_)s wrapper_with_args.py ' + rmic)
bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar')
# XXX This is kind of a Python brute-force way to do what Ant
# does with its "excludes" attribute. We should probably find
@@ -321,7 +321,9 @@ public class Example4 extends UnicastRemoteObject implements Hello {
test.run(arguments = '.')
- test.fail_test(test.read('wrapper.out') != "wrapper.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic)
+ test.must_match('wrapper.out',
+ "wrapper_with_args.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic,
+ mode='r')
test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class'))
test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class'))