summaryrefslogtreecommitdiffstats
path: root/test/Java
diff options
context:
space:
mode:
Diffstat (limited to 'test/Java')
-rw-r--r--test/Java/JAR.py20
-rw-r--r--test/Java/JARCHDIR.py17
-rw-r--r--test/Java/JARFLAGS.py23
-rw-r--r--test/Java/JAVABOOTCLASSPATH.py17
-rw-r--r--test/Java/JAVACFLAGS.py9
-rw-r--r--test/Java/JAVACLASSPATH.py17
-rw-r--r--test/Java/JAVAH.py25
-rw-r--r--test/Java/JAVASOURCEPATH.py9
-rw-r--r--test/Java/Java-1.4.py33
-rw-r--r--test/Java/Java-1.5.py16
-rw-r--r--test/Java/Java-1.6.py16
-rw-r--r--test/Java/RMIC.py40
-rw-r--r--test/Java/RMICCOM.py6
-rw-r--r--test/Java/RMICCOMSTR.py6
-rw-r--r--test/Java/multi-step.py18
-rw-r--r--test/Java/no-JARCHDIR.py122
-rw-r--r--test/Java/source-files.py9
-rw-r--r--test/Java/swig-dependencies.py29
18 files changed, 205 insertions, 227 deletions
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index f0951c6..ee552f4 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -120,21 +120,11 @@ test.run(arguments='classes.jar')
test.must_match('classes.jar',
'cvfm classes.jar foo.mf -C testdir bar.class\n')
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('jar', ENV=ENV):
- where_jar = test.detect('JAR', 'jar', ENV=ENV)
-else:
- where_jar = test.where_is('jar')
-if not where_jar:
- test.skip_test("Could not find Java jar, skipping test(s).\n")
+
+
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
test.write("wrapper.py", """\
diff --git a/test/Java/JARCHDIR.py b/test/Java/JARCHDIR.py
index f7d9fca..a3f2ec4 100644
--- a/test/Java/JARCHDIR.py
+++ b/test/Java/JARCHDIR.py
@@ -40,21 +40,8 @@ import TestSCons
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('jar', ENV=ENV):
- where_jar = test.detect('JAR', 'jar', ENV=ENV)
-else:
- where_jar = test.where_is('jar')
-if not where_jar:
- test.skip_test("Could not find Java jar, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
diff --git a/test/Java/JARFLAGS.py b/test/Java/JARFLAGS.py
index 3939d98..03a222b 100644
--- a/test/Java/JARFLAGS.py
+++ b/test/Java/JARFLAGS.py
@@ -33,21 +33,10 @@ test = TestSCons.TestSCons()
test.subdir('src')
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('jar', ENV=ENV):
- where_jar = test.detect('JAR', 'jar', ENV=ENV)
-else:
- where_jar = test.where_is('jar')
-if not where_jar:
- test.skip_test("Could not find Java jar, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
+
test.write('SConstruct', """
env = Environment(tools = ['javac', 'jar'],
@@ -75,9 +64,9 @@ public class Example1
expect = test.wrap_stdout("""\
%(where_javac)s -d classes -sourcepath src src/Example1\.java
-%(where_jar)s cvf test.jar classes/src/Example1\.class
+%(where_jar)s cvf test.jar -C classes src/Example1\.class
.*
-adding: classes/src/Example1\.class.*
+adding: src/Example1\.class.*
""" % locals())
expect = string.replace(expect, '/', os.sep)
diff --git a/test/Java/JAVABOOTCLASSPATH.py b/test/Java/JAVABOOTCLASSPATH.py
index 7723224..5962b94 100644
--- a/test/Java/JAVABOOTCLASSPATH.py
+++ b/test/Java/JAVABOOTCLASSPATH.py
@@ -38,21 +38,8 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('javah', ENV=ENV):
- where_javah = test.detect('JAVAH', 'javah', ENV=ENV)
-else:
- where_javah = test.where_is('javah')
-if not where_javah:
- test.skip_test("Could not find Java javah, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_javah = test.java_where_javah()
test.write('SConstruct', """
env = Environment(tools = ['javac', 'javah'],
diff --git a/test/Java/JAVACFLAGS.py b/test/Java/JAVACFLAGS.py
index 045fb7b..e287054 100644
--- a/test/Java/JAVACFLAGS.py
+++ b/test/Java/JAVACFLAGS.py
@@ -31,14 +31,7 @@ import TestSCons
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
test.subdir('src')
diff --git a/test/Java/JAVACLASSPATH.py b/test/Java/JAVACLASSPATH.py
index 0ae7dea..11f7c2c 100644
--- a/test/Java/JAVACLASSPATH.py
+++ b/test/Java/JAVACLASSPATH.py
@@ -36,21 +36,8 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('javah', ENV=ENV):
- where_javah = test.detect('JAVAH', 'javah', ENV=ENV)
-else:
- where_javah = test.where_is('javah')
-if not where_javah:
- test.skip_test("Could not find Java javah, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_javah = test.java_where_javah()
test.write('SConstruct', """
env = Environment(tools = ['javac', 'javah'],
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index ecd3737..95abd33 100644
--- a/test/Java/JAVAH.py
+++ b/test/Java/JAVAH.py
@@ -24,9 +24,9 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import os
+import os.path
import string
-import sys
+
import TestSCons
_python_ = TestSCons._python_
@@ -95,21 +95,11 @@ line 3
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_javah = test.java_where_javah()
-if test.detect_tool('javah', ENV=ENV):
- where_javah = test.detect('JAVAH', 'javah', ENV=ENV)
-else:
- where_javah = test.where_is('javah')
-if not where_javah:
- test.skip_test("Could not find Java javah, skipping test(s).\n")
+if java_version:
+ java_version = repr(java_version)
@@ -125,6 +115,9 @@ test.write('SConstruct', """
foo = Environment(tools = ['javac', 'javah', 'install'],
JAVAC = r'%(where_javac)s',
JAVAH = r'%(where_javah)s')
+jv = %(java_version)s
+if jv:
+ foo['JAVAVERSION'] = jv
javah = foo.Dictionary('JAVAH')
bar = foo.Clone(JAVAH = r'%(_python_)s wrapper.py ' + javah)
foo.Java(target = 'class1', source = 'com/sub/foo')
diff --git a/test/Java/JAVASOURCEPATH.py b/test/Java/JAVASOURCEPATH.py
index 069e228..87e90ad 100644
--- a/test/Java/JAVASOURCEPATH.py
+++ b/test/Java/JAVASOURCEPATH.py
@@ -36,14 +36,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
test.write('SConstruct', """
env = Environment(tools = ['javac', 'javah'],
diff --git a/test/Java/Java-1.4.py b/test/Java/Java-1.4.py
index 3d3d47a..3c0e1ed 100644
--- a/test/Java/Java-1.4.py
+++ b/test/Java/Java-1.4.py
@@ -38,14 +38,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac('1.4')
@@ -234,10 +227,10 @@ public class NestedExample
{
public NestedExample()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
try {Thread.sleep(200);}
@@ -256,7 +249,7 @@ public class NestedExample
public static void main(String argv[])
{
- NestedExample e = new NestedExample();
+ new NestedExample();
}
}
""")
@@ -268,7 +261,7 @@ public class NestedExample
test.write(['src5', 'TestSCons.java'], """\
class TestSCons {
public static void main(String[] args) {
- Foo[] fooArray = new Foo[] { new Foo() };
+ new Foo();
}
}
@@ -355,12 +348,16 @@ def classes_must_match(dir, expect):
global failed
got = get_class_files(test.workpath(dir))
if expect != got:
- sys.stderr.write("Expected the following class files in '%s':\n" % dir)
- for c in expect:
- sys.stderr.write(' %s\n' % c)
- sys.stderr.write("Got the following class files in '%s':\n" % dir)
- for c in got:
- sys.stderr.write(' %s\n' % c)
+ missing = set(expect) - set(got)
+ if missing:
+ sys.stderr.write("Missing the following class files from '%s':\n" % dir)
+ for c in missing:
+ sys.stderr.write(' %s\n' % c)
+ unexpected = set(got) - set(expect)
+ if unexpected:
+ sys.stderr.write("Found the following unexpected class files in '%s':\n" % dir)
+ for c in unexpected:
+ sys.stderr.write(' %s\n' % c)
failed = 1
def classes_must_not_exist(dir, expect):
diff --git a/test/Java/Java-1.5.py b/test/Java/Java-1.5.py
index 4ac3d96..f6d93c7 100644
--- a/test/Java/Java-1.5.py
+++ b/test/Java/Java-1.5.py
@@ -38,15 +38,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-ENV['PATH'] = '/usr/lib/jvm/java-1.5.0-sun-1.5.0.11/bin' + os.pathsep + os.environ['PATH']
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac('1.5')
@@ -235,10 +227,10 @@ public class NestedExample
{
public NestedExample()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
try {Thread.sleep(200);}
@@ -257,7 +249,7 @@ public class NestedExample
public static void main(String argv[])
{
- NestedExample e = new NestedExample();
+ new NestedExample();
}
}
""")
diff --git a/test/Java/Java-1.6.py b/test/Java/Java-1.6.py
index f2b629a..5bd8e2f 100644
--- a/test/Java/Java-1.6.py
+++ b/test/Java/Java-1.6.py
@@ -38,15 +38,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-ENV['PATH'] = '/usr/lib/jvm/java-6-sun-1.6.0.00/bin' + os.pathsep + os.environ['PATH']
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac('1.6')
@@ -235,10 +227,10 @@ public class NestedExample
{
public NestedExample()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
- Thread t = new Thread() {
+ new Thread() {
public void start()
{
try {Thread.sleep(200);}
@@ -257,7 +249,7 @@ public class NestedExample
public static void main(String argv[])
{
- NestedExample e = new NestedExample();
+ new NestedExample();
}
}
""")
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py
index 2ab1804..f9721c2 100644
--- a/test/Java/RMIC.py
+++ b/test/Java/RMIC.py
@@ -92,21 +92,8 @@ line 3
test.fail_test(test.read(['outdir', 'test2.class']) != "test2.JAVA\nline 3\n")
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping non-simulated test(s).\n")
-
-if test.detect_tool('rmic', ENV=ENV):
- where_rmic = test.detect('RMIC', 'rmic', ENV=ENV)
-else:
- where_rmic = test.where_is('rmic')
-if not where_rmic:
- test.skip_test("Could not find Java rmic, skipping non-simulated test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_rmic = test.java_where_rmic()
test.write("wrapper.py", """\
import os
@@ -319,15 +306,20 @@ 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.fail_test(not os.path.exists(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Skel.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Skel.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class')))
-
-test.fail_test(not os.path.exists(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Skel.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Stub.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Skel.class')))
-test.fail_test(not os.path.exists(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Stub.class')))
+test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class'))
+test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class'))
+test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Stub.class'))
+test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Stub.class'))
+
+# We used to check for _Skel.class files as well, but they're not
+# generated by default starting with Java 1.5, and they apparently
+# haven't been needed for a while. Don't bother looking, even if we're
+# running Java 1.4. If we think they're needed but they don't exist
+# the test.up_to_date() call below will detect it.
+#test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Skel.class'))
+#test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Skel.class'))
+#test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Skel.class'))
+#test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Skel.class'))
test.up_to_date(arguments = '.')
diff --git a/test/Java/RMICCOM.py b/test/Java/RMICCOM.py
index ed5e0d6..e8a5655 100644
--- a/test/Java/RMICCOM.py
+++ b/test/Java/RMICCOM.py
@@ -40,9 +40,9 @@ test.subdir('src')
-out_file1 = os.path.join('out', 'file1', 'class_Skel.class')
-out_file2 = os.path.join('out', 'file2', 'class_Skel.class')
-out_file3 = os.path.join('out', 'file3', 'class_Skel.class')
+out_file1 = os.path.join('out', 'file1', 'class_Stub.class')
+out_file2 = os.path.join('out', 'file2', 'class_Stub.class')
+out_file3 = os.path.join('out', 'file3', 'class_Stub.class')
diff --git a/test/Java/RMICCOMSTR.py b/test/Java/RMICCOMSTR.py
index 5a451eb..a92bac5 100644
--- a/test/Java/RMICCOMSTR.py
+++ b/test/Java/RMICCOMSTR.py
@@ -41,9 +41,9 @@ test.subdir('src')
-out_file1 = os.path.join('out', 'file1', 'class_Skel.class')
-out_file2 = os.path.join('out', 'file2', 'class_Skel.class')
-out_file3 = os.path.join('out', 'file3', 'class_Skel.class')
+out_file1 = os.path.join('out', 'file1', 'class_Stub.class')
+out_file2 = os.path.join('out', 'file2', 'class_Stub.class')
+out_file3 = os.path.join('out', 'file3', 'class_Stub.class')
diff --git a/test/Java/multi-step.py b/test/Java/multi-step.py
index d185b4d..9cac759 100644
--- a/test/Java/multi-step.py
+++ b/test/Java/multi-step.py
@@ -33,22 +33,8 @@ import TestSCons
test = TestSCons.TestSCons()
-# This test requires javac and swig
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('javah', ENV=ENV):
- where_javah = test.detect('JAVAH', 'javah', ENV=ENV)
-else:
- where_javah = test.where_is('javah')
-if not where_javah:
- test.skip_test("Could not find Java javah, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
+where_javah = test.java_where_javah()
swig = test.where_is('swig')
if not swig:
diff --git a/test/Java/no-JARCHDIR.py b/test/Java/no-JARCHDIR.py
new file mode 100644
index 0000000..795689c
--- /dev/null
+++ b/test/Java/no-JARCHDIR.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify the Jar() behavior when we have no JARCHDIR set (it should
+automatically use the classdir that was deduced from the Java() call)
+and when we explicity set it to None (it should not use the Java()
+classdir attribute at all).
+"""
+
+import string
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
+test.subdir('src')
+
+
+
+test.write(['src', 'a.java'], """\
+package foo.bar;
+public class a {}
+""")
+
+test.write(['src', 'b.java'], """\
+package foo.bar;
+public class b {}
+""")
+
+
+
+test.write('SConstruct', """\
+env = Environment(tools = ['javac', 'jar'],
+ JAVAC = r'%(where_javac)s',
+ JAR = r'%(where_jar)s')
+
+jar = env.Jar('x.jar', env.Java(target = 'classes', source = 'src'))
+""" % locals())
+
+test.run(arguments = '.')
+
+
+
+test.run(program = where_jar, arguments = 'tf x.jar')
+
+expect = """\
+foo/bar/a.class
+foo/bar/b.class
+"""
+
+if string.find(test.stdout(), expect) == -1:
+ print "Did not find expected string in standard output."
+ print "Expected =========================================================="
+ print expect
+ print "Output ============================================================"
+ print test.stdout()
+ test.fail_test()
+
+
+
+test.run(arguments = '-c')
+
+
+
+test.write('SConstruct', """\
+env = Environment(tools = ['javac', 'jar'],
+ JAVAC = r'%(where_javac)s',
+ JAR = r'%(where_jar)s',
+ JARCHDIR = None)
+
+jar = env.Jar('x.jar', env.Java(target = 'classes', source = 'src'))
+""" % locals())
+
+test.run(arguments = '.')
+
+
+
+test.run(program = where_jar, arguments = 'tf x.jar')
+
+expect = """\
+classes/foo/bar/a.class
+classes/foo/bar/b.class
+"""
+
+if string.find(test.stdout(), expect) == -1:
+ print "Did not find expected string in standard output."
+ print "Expected =========================================================="
+ print expect
+ print "Output ============================================================"
+ print test.stdout()
+ test.fail_test()
+
+
+
+test.pass_test()
diff --git a/test/Java/source-files.py b/test/Java/source-files.py
index 8d2506f..63d1d92 100644
--- a/test/Java/source-files.py
+++ b/test/Java/source-files.py
@@ -35,14 +35,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
+where_javac, java_version = test.java_where_javac()
test.write('SConstruct', """
diff --git a/test/Java/swig-dependencies.py b/test/Java/swig-dependencies.py
index 8df5e09..5477a2d 100644
--- a/test/Java/swig-dependencies.py
+++ b/test/Java/swig-dependencies.py
@@ -34,29 +34,14 @@ import TestSCons
test = TestSCons.TestSCons()
-ENV = test.java_ENV()
-
-if test.detect_tool('javac', ENV=ENV):
- where_javac = test.detect('JAVAC', 'javac', ENV=ENV)
-else:
- where_javac = test.where_is('javac')
-if not where_javac:
- test.skip_test("Could not find Java javac, skipping test(s).\n")
-
-if test.detect_tool('javah', ENV=ENV):
- where_javah = test.detect('JAVAH', 'javah', ENV=ENV)
-else:
- where_javah = test.where_is('javah')
-if not where_javah:
- test.skip_test("Could not find Java javah, skipping test(s).\n")
-
-if test.detect_tool('jar', ENV=ENV):
- where_jar = test.detect('JAR', 'jar', ENV=ENV)
-else:
- where_jar = test.where_is('jar')
-if not where_jar:
- test.skip_test("Could not find Java jar, skipping test(s).\n")
+swig = test.where_is('swig')
+if not swig:
+ test.skip_test('Can not find installed "swig", skipping test.\n')
+
+where_javac, java_version = test.java_where_javac()
+where_javah = test.java_where_javah()
+where_jar = test.java_where_jar()
test.subdir(['foo'],
['java'],