From: stevenknight Date: Sun, 11 May 2003 16:01:29 +0000 (+0000) Subject: Portability fixes for various tests. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1a1ee770f5559ab7b7cf383d19e1676c5066bb2d;p=scons.git Portability fixes for various tests. git-svn-id: http://scons.tigris.org/svn/scons/trunk@679 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py index 1b5421ca..2bb3be6a 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 45fa4af4..ccb62f27 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 beae7a9f..e881bca7 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 abad6cde..8f3623c9 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'):