summaryrefslogtreecommitdiffstats
path: root/test/Java
diff options
context:
space:
mode:
Diffstat (limited to 'test/Java')
-rw-r--r--test/Java/JAR.py26
-rw-r--r--test/Java/JAVAC.py12
-rw-r--r--test/Java/JAVAH.py19
-rw-r--r--test/Java/RMIC.py16
4 files changed, 38 insertions, 35 deletions
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index 98dfa38..476bfcd 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)
@@ -64,9 +64,9 @@ test1.class
line 3
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments='.', stderr=None)
-test.must_match('test1.jar', "test1.class\nline 3\n")
+test.must_match('test1.jar', "test1.class\nline 3\n", mode='r')
if os.path.normcase('.class') == os.path.normcase('.CLASS'):
@@ -82,13 +82,13 @@ test2.CLASS
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.jar', "test2.CLASS\nline 3\n")
+ test.must_match('test2.jar', "test2.CLASS\nline 3\n", mode='r')
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()
@@ -106,7 +106,7 @@ env.Jar(target = 'classes.jar', source = [ 'testdir/bar.class',
""" % locals())
test.subdir('testdir')
-test.write([ 'testdir', 'bar.class' ], 'foo')
+test.write(['testdir', 'bar.class'], 'foo')
test.write('foo.mf',
"""Manifest-Version : 1.0
blah
@@ -115,7 +115,7 @@ test.write('foo.mf',
""")
test.run(arguments='classes.jar')
test.must_match('classes.jar',
- 'cvfm classes.jar foo.mf -C testdir bar.class\n')
+ 'cvfm classes.jar foo.mf -C testdir bar.class\n', mode='r')
@@ -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,10 +229,10 @@ 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())
+ expected_wrapper_out % locals(), mode='r')
test.must_exist('foo.jar')
test.must_exist('bar.jar')
diff --git a/test/Java/JAVAC.py b/test/Java/JAVAC.py
index 06b1969..aaaa8f5 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)
@@ -71,9 +71,9 @@ test1.java
line 3
""")
-test.run(arguments = '.', stderr = None)
+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'):
@@ -89,9 +89,9 @@ test2.JAVA
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.class', "test2.JAVA\nline 3\n")
+ test.must_match('test2.class', "test2.JAVA\nline 3\n", mode='r')
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index f647b03..f07ebb9 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)
@@ -70,9 +70,9 @@ test1.java
line 3
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments='.', stderr=None)
-test.must_match('test1.h', "test1.java\nline 3\n")
+test.must_match('test1.h', "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
@@ -88,9 +88,9 @@ test2.JAVA
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.h', "test2.JAVA\nline 3\n")
+ test.must_match('test2.h', "test2.JAVA\nline 3\n", mode='r')
where_javac, java_version = test.java_where_javac()
@@ -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..b29a466 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'):
@@ -89,7 +89,7 @@ line 3
test.run(arguments = '.', stderr = None)
- test.fail_test(test.read(['outdir', 'test2.class']) != "test2.JAVA\nline 3\n")
+ test.must_match(['outdir', 'test2.class'], "test2.JAVA\nline 3\n", mode='r')
where_javac, java_version = test.java_where_javac()
where_rmic = test.java_where_rmic()
@@ -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'))