From 5a68344ea254e70d88c754a011fd06d2bb87aaa7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 7 Mar 2012 03:26:10 +0100 Subject: android test: Specify 'java.io.tempdir' and add TestJarsInJar.apk / Disable most of tests in TestJarUtil --- make/build-test.xml | 4 +++- make/lib/TestJarsInJar.apk | Bin 0 -> 2297 bytes src/junit/com/jogamp/common/util/TestJarUtil.java | 6 +++++ src/junit/com/jogamp/junit/util/JunitTracer.java | 26 +++++++++++++++++----- 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 make/lib/TestJarsInJar.apk diff --git a/make/build-test.xml b/make/build-test.xml index 48b8734..9f8ef25 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -86,7 +86,7 @@ - + @@ -298,6 +298,7 @@ rsync -rtv --delete --delete-after --delete-excluded \${line.separator} --exclude 'android-sdk/' --exclude 'resources/' --exclude 'scripts/' \${line.separator} --exclude 'stub_includes/' --exclude 'nbproject/' --exclude '*.log' --exclude '*.zip' --exclude '*.7z' \${line.separator} ${env.HOST_UID}@${env.HOST_IP}::${env.HOST_RSYNC_ROOT}/${gluegen.basename} ${env.TARGET_ROOT} ${line.separator} +mkdir ${env.TARGET_ROOT}/tmp ${line.separator} cd ${env.TARGET_ROOT}/${gluegen.basename}/${env.NODE_LABEL}/make ${line.separator} export ${system.env.library.path}=/system/lib:${env.TARGET_ROOT}/${gluegen.basename}/${env.NODE_LABEL}/${rootrel.build}/obj:${env.TARGET_ROOT}/${gluegen.basename}/${env.NODE_LABEL}/${rootrel.build}/test/build/natives ${line.separator} export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar ${line.separator} @@ -326,6 +327,7 @@ export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.j dalvikvm \${line.separator} -Xjnigreflimit:2000 \${line.separator} -cp ${junit.run.remote.apks} \${line.separator} +-Djava.io.tmpdir=${env.TARGET_ROOT}/tmp \${line.separator} -Dgluegen.root=${gluegen.root} \${line.separator} -Drootrel.build=${rootrel.build} \${line.separator} com.android.internal.util.WithFramework \${line.separator} diff --git a/make/lib/TestJarsInJar.apk b/make/lib/TestJarsInJar.apk new file mode 100644 index 0000000..10ab274 Binary files /dev/null and b/make/lib/TestJarsInJar.apk differ diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java index caaac9c..ea6cebf 100644 --- a/src/junit/com/jogamp/common/util/TestJarUtil.java +++ b/src/junit/com/jogamp/common/util/TestJarUtil.java @@ -43,6 +43,7 @@ import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.GlueGenVersion; +import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; @@ -53,6 +54,11 @@ public class TestJarUtil extends JunitTracer { @BeforeClass public static void init() { + if(AndroidVersion.isAvailable) { + // ClassLoader -> JarURL doesn't work w/ Dalvik + setTestSupported(false); + // we allow basic TempFileCache initialization (test) .. + } // may already been initialized by other test // Assert.assertFalse(TempCacheReg.isTempFileCacheUsed()); Assert.assertTrue(TempFileCache.initSingleton()); diff --git a/src/junit/com/jogamp/junit/util/JunitTracer.java b/src/junit/com/jogamp/junit/util/JunitTracer.java index c175601..befc2ad 100644 --- a/src/junit/com/jogamp/junit/util/JunitTracer.java +++ b/src/junit/com/jogamp/junit/util/JunitTracer.java @@ -28,6 +28,7 @@ package com.jogamp.junit.util; +import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.After; @@ -39,16 +40,23 @@ import org.junit.rules.TestName; public abstract class JunitTracer { @Rule public TestName _unitTestName = new TestName(); + static volatile boolean testSupported = true; + + public static void setTestSupported(boolean v) { + System.err.println("setTestSupported: "+v); + testSupported = v; + } + public final String getTestMethodName() { return _unitTestName.getMethodName(); } - public final String getSimpleTestName() { - return getClass().getSimpleName()+" - "+getTestMethodName(); + public final String getSimpleTestName(String separator) { + return getClass().getSimpleName()+separator+getTestMethodName(); } - public final String getFullTestName() { - return getClass().getName()+" - "+getTestMethodName(); + public final String getFullTestName(String separator) { + return getClass().getName()+separator+getTestMethodName(); } @BeforeClass @@ -64,13 +72,19 @@ public abstract class JunitTracer { @Before public void setUp() { - System.err.println("++++ TestCase.setUp: "+getFullTestName()); + System.err.print("++++ TestCase.setUp: "+getFullTestName(" - ")); + if(!testSupported) { + System.err.println(" - "+unsupportedTestMsg); + Assume.assumeTrue(testSupported); + } + System.err.println(); } @After public void tearDown() { - System.err.println("++++ TestCase.tearDown: "+getFullTestName()); + System.err.println("++++ TestCase.tearDown: "+getFullTestName(" - ")); } + static final String unsupportedTestMsg = "Test not supported on this platform."; } -- cgit v1.2.3