summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-05-11 16:01:29 (GMT)
committerSteven Knight <knight@baldmt.com>2003-05-11 16:01:29 (GMT)
commit45cef3b045d2c7034f3886da630fb690db1b539a (patch)
tree1412246adbb8cb9daa678f109e8926705d96cb26
parent088746100c58e3bf3dd20a00d8328e635e6c0b24 (diff)
downloadSCons-45cef3b045d2c7034f3886da630fb690db1b539a.zip
SCons-45cef3b045d2c7034f3886da630fb690db1b539a.tar.gz
SCons-45cef3b045d2c7034f3886da630fb690db1b539a.tar.bz2
Portability fixes for various tests.
-rw-r--r--src/engine/SCons/Tool/JavaCommonTests.py5
-rw-r--r--src/engine/SCons/Tool/javah.py2
-rw-r--r--test/JAVAH.py17
-rw-r--r--test/RMIC.py4
4 files changed, 17 insertions, 11 deletions
diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py
index 1b5421c..2bb3be6 100644
--- a/src/engine/SCons/Tool/JavaCommonTests.py
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
@@ -23,6 +23,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os.path
import sys
import unittest
@@ -46,7 +47,7 @@ public class Foo
}
""")
- assert pkg_dir == 'com/sub/bar', pkg_dir
+ assert pkg_dir == os.path.join('com', 'sub', 'bar'), pkg_dir
assert classes == ['Foo'], classes
def test_inner_classes(self):
@@ -164,7 +165,7 @@ public class Example1 extends UnicastRemoteObject implements Hello {
}
""")
- assert pkg_dir == 'com/sub/foo', pkg_dir
+ assert pkg_dir == os.path.join('com', 'sub', 'foo'), pkg_dir
assert classes == ['Example1'], classes
if __name__ == "__main__":
diff --git a/src/engine/SCons/Tool/javah.py b/src/engine/SCons/Tool/javah.py
index 45fa4af..ccb62f2 100644
--- a/src/engine/SCons/Tool/javah.py
+++ b/src/engine/SCons/Tool/javah.py
@@ -56,7 +56,7 @@ def emit_java_headers(target, source, env):
try:
classdir = s.attributes.java_classdir
except:
- pass
+ classdir = '.'
classdir = SCons.Node.FS.default_fs.Dir(classdir).rdir()
if str(classdir) == '.':
c_ = None
diff --git a/test/JAVAH.py b/test/JAVAH.py
index beae7a9..e881bca 100644
--- a/test/JAVAH.py
+++ b/test/JAVAH.py
@@ -39,6 +39,12 @@ args = sys.argv[1:]
while args:
a = args[0]
if a == '-d':
+ outdir = args[1]
+ args = args[1:]
+ elif a == '-o':
+ outfile = open(args[1], 'wb')
+ args = args[1:]
+ elif a == '-classpath':
args = args[1:]
elif a == '-sourcepath':
args = args[1:]
@@ -47,7 +53,6 @@ while args:
args = args[1:]
for file in args:
infile = open(file, 'rb')
- outfile = open(file[:-5] + '.class', 'wb')
for l in infile.readlines():
if l[:9] != '/*javah*/':
outfile.write(l)
@@ -57,7 +62,7 @@ sys.exit(0)
test.write('SConstruct', """
env = Environment(tools = ['javah'],
JAVAH = r'%s myjavah.py')
-env.JavaH(target = 'test1.class', source = 'test1.java')
+env.JavaH(target = File('test1.h'), source = 'test1.java')
""" % (python))
test.write('test1.java', """\
@@ -66,16 +71,16 @@ test1.java
line 3
""")
-#test.run(arguments = '.', stderr = None)
+test.run(arguments = '.', stderr = None)
-#test.fail_test(test.read('test1.class') != "test1.java\nline 3\n")
+test.fail_test(test.read('test1.h') != "test1.java\nline 3\n")
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
test.write('SConstruct', """\
env = Environment(tools = ['javah'],
JAVAH = r'%s myjavah.py')
-env.Java(target = 'test2.class', source = 'test2.JAVA')
+env.JavaH(target = File('test2.h'), source = 'test2.JAVA')
""" % python)
test.write('test2.JAVA', """\
@@ -86,7 +91,7 @@ line 3
test.run(arguments = '.', stderr = None)
- test.fail_test(test.read('test2.class') != "test2.JAVA\nline 3\n")
+ test.fail_test(test.read('test2.h') != "test2.JAVA\nline 3\n")
if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javah'):
diff --git a/test/RMIC.py b/test/RMIC.py
index abad6cd..8f3623c 100644
--- a/test/RMIC.py
+++ b/test/RMIC.py
@@ -79,7 +79,7 @@ if os.path.normcase('.java') == os.path.normcase('.JAVA'):
test.write('SConstruct', """\
env = Environment(tools = ['rmic'],
RMIC = r'%s myrmic.py')
-env.Java(target = 'outdir', source = 'test2.JAVA')
+env.RMIC(target = 'outdir', source = 'test2.JAVA')
""" % python)
test.write('test2.JAVA', """\
@@ -90,7 +90,7 @@ line 3
test.run(arguments = '.', stderr = None)
- test.fail_test(test.read('test2.class') != "test2.JAVA\nline 3\n")
+ test.fail_test(test.read(['outdir', 'test2.class']) != "test2.JAVA\nline 3\n")
if not os.path.exists('/usr/local/j2sdk1.3.1/bin/rmic'):