diff options
author | Sven Gothel <[email protected]> | 2010-03-25 13:07:58 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-03-25 13:07:58 +0100 |
commit | 3a32650d4229f9b4ad1f527d9e30c24ddb69bb3f (patch) | |
tree | b60ea7924b346924b754be03e5467fc62a7dbe1e /test | |
parent | e6288285daf2e2fc16980cd74190e46aad5464be (diff) |
http://www.jogamp.org/bugzilla/show_bug.cgi?id=390
The current junit tests use a fixed 'build' sub-path,
not the customizing 'rootrel.build' path.
More properties needs to be passed through (ant -> junit -> ant)
to comply with the current build system:
* rootrel.build
* os.arch
* gluegen.user.compiler.file
Fixed ..
However .. since even more properties may influence the build,
a more native solution with just plain 'ant' might be more desireable ..
Diffstat (limited to 'test')
-rw-r--r-- | test/junit/com/sun/gluegen/BasicTest.java | 2 | ||||
-rw-r--r-- | test/junit/com/sun/gluegen/BuildUtil.java | 29 | ||||
-rw-r--r-- | test/junit/com/sun/gluegen/StructAccessorTest.java | 2 | ||||
-rw-r--r-- | test/junit/com/sun/gluegen/build.xml | 25 |
4 files changed, 38 insertions, 20 deletions
diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java index a43d3e5..144128c 100644 --- a/test/junit/com/sun/gluegen/BasicTest.java +++ b/test/junit/com/sun/gluegen/BasicTest.java @@ -44,7 +44,7 @@ public class BasicTest { @Test public void bindingTest() throws Exception { - String nativesPath = gluegenRoot + "/build/test/build/natives"; + String nativesPath = testOutput + "/build/natives"; System.load(nativesPath + "/librofl.so"); Class<?> clazz = Class.forName("test.BindingTest"); diff --git a/test/junit/com/sun/gluegen/BuildUtil.java b/test/junit/com/sun/gluegen/BuildUtil.java index de4f8e2..4477d7b 100644 --- a/test/junit/com/sun/gluegen/BuildUtil.java +++ b/test/junit/com/sun/gluegen/BuildUtil.java @@ -17,7 +17,8 @@ public final class BuildUtil { public static final String gluegenRoot; public static final String path; - public static final String output; + public static final String testOutput; + public static final String rootrel_build; static { @@ -25,6 +26,13 @@ public final class BuildUtil { out.println("OS: " + System.getProperty("os.name")); out.println("VM: " + System.getProperty("java.vm.name")); + String rootrel_build_tmp = System.getProperty("rootrel.build"); + if(null==rootrel_build_tmp || rootrel_build_tmp.length()==0) { + rootrel_build_tmp = "build" ; + } + rootrel_build = rootrel_build_tmp; + out.println("rootrel.build: " + rootrel_build); + // setup paths try { File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI()); @@ -36,10 +44,10 @@ public final class BuildUtil { } path = gluegenRoot + "/test/junit/com/sun/gluegen"; - output = gluegenRoot + "/build/test"; + testOutput = gluegenRoot + "/" + rootrel_build + "/test"; out.println("path: "+path); - out.println("output: "+output); + out.println("testOutput: "+testOutput); out.println(" - - - - - - - - - - - - "); cleanGeneratedFiles(); @@ -47,6 +55,9 @@ public final class BuildUtil { //setup ant build file project = new Project(); project.setBaseDir(new File(gluegenRoot)); + project.setProperty("rootrel.build", rootrel_build); + passSystemProperty(project, "gluegen.user.compiler.file"); + passSystemProperty(project, "os.arch"); DefaultLogger logger = new DefaultLogger(); logger.setErrorPrintStream(out); @@ -64,9 +75,17 @@ public final class BuildUtil { ProjectHelper.configureProject(project, buildFile); } + public static Project passSystemProperty(Project p, String name) { + String tmp = System.getProperty(name); + if(null!=tmp && tmp.length()>0) { + p.setProperty(name, tmp); + } + return p; + } + public static void cleanGeneratedFiles() { out.println("cleaning generated files"); - deleteDirectory(new File(output+"/gensrc")); + deleteDirectory(new File(testOutput+"/gensrc")); out.println("done"); } @@ -95,7 +114,7 @@ public final class BuildUtil { out.println("generate binding: " + bindingName); GlueGen.main( "-I"+path, - "-O"+output+"/gensrc", + "-O"+testOutput+"/gensrc", // "-Ecom.sun.gluegen.DebugEmitter", "-C"+path+"/"+bindingName+".cfg", path+"/"+bindingName+".h" ); diff --git a/test/junit/com/sun/gluegen/StructAccessorTest.java b/test/junit/com/sun/gluegen/StructAccessorTest.java index 0cd2953..3562077 100644 --- a/test/junit/com/sun/gluegen/StructAccessorTest.java +++ b/test/junit/com/sun/gluegen/StructAccessorTest.java @@ -46,7 +46,7 @@ public class StructAccessorTest { // compile testcase String source = gluegenRoot + "/test/junit/com/sun/gluegen/StructValidator.java"; - compile(new File(source), gluegenRoot+"/build/test/build/classes"); + compile(new File(source), testOutput + "/build/classes"); // invoke test Class<?> test = Class.forName("com.sun.gluegen.StructValidator"); diff --git a/test/junit/com/sun/gluegen/build.xml b/test/junit/com/sun/gluegen/build.xml index c52101e..ab71431 100644 --- a/test/junit/com/sun/gluegen/build.xml +++ b/test/junit/com/sun/gluegen/build.xml @@ -4,9 +4,15 @@ <description>Tests GlueGen</description> + <condition property="rootrel.build" value="build"> + <not> + <isset property="rootrel.build"/> + </not> + </condition> + <property name="gluegen.root" value="${basedir}" /> - <property name="src.dir" value="${gluegen.root}/build/test/gensrc/java" /> - <property name="build.dir" value="${gluegen.root}/build/test/build" /> + <property name="src.dir" value="${gluegen.root}/${rootrel.build}/test/gensrc/java" /> + <property name="build.dir" value="${gluegen.root}/${rootrel.build}/test/build" /> <!-- Pull in GlueGen cpptasks build file --> <import file="${gluegen.root}/make/gluegen-cpptasks.xml" /> @@ -25,7 +31,7 @@ <javac destdir="${build.dir.java}" source="1.5" failonerror="true" debug="true" verbose="true" debuglevel="lines,vars,source"> <src path="${src.dir}"/> - <classpath path="${gluegen.root}/build/classes:${src.dir}:${gluegen.root}/build/antlr-3.2.jar:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/> + <classpath path="${gluegen.root}/${rootrel.build}/classes:${src.dir}:${gluegen.root}/${rootrel.build}/antlr-3.2.jar:${gluegen.root}/make/lib/junit-4.5.jar:${tools.jar}:${ant.core.lib}"/> </javac> <echo message=" - - - java files compiled - - - "/> @@ -74,7 +80,7 @@ <echo message=" - - - natives compiled - - - "/> <copy todir="${natives.dir}"> - <fileset dir="${gluegen.root}/build/obj"> + <fileset dir="${gluegen.root}/${rootrel.build}/obj"> <include name="*.so"/> </fileset> </copy> @@ -82,15 +88,8 @@ </target> <target name="c.configure.linux" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler"> - - <echo message="configure for Linux.AMD64 build" /> - - <linker id="linker.cfg.linux.amd64.test"> - <linkerparam name="-m64"/> - </linker> - - <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" /> - <property name="linker.cfg.id" value="linker.cfg.linux.amd64.test" /> + <property name="compiler.cfg.id" value="${compiler.cfg.id.base}" /> + <property name="linker.cfg.id" value="${linker.cfg.id.base}" /> </target> </project> |