summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/scripts/java-win32.bat4
-rwxr-xr-xmake/scripts/java-win64.bat4
-rwxr-xr-xmake/scripts/runtest-x32.bat3
-rwxr-xr-xmake/scripts/runtest-x64.bat3
-rwxr-xr-xmake/scripts/runtest.sh6
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java77
-rw-r--r--src/java/com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.305b.gzbin0 -> 305 bytes
-rw-r--r--src/java/com/jogamp/common/util/bin/exe-windows-i586-268b.binbin268 -> 0 bytes
-rwxr-xr-xsrc/native/tinype/make.bat1
-rw-r--r--src/native/tinype/tiny.c4
-rwxr-xr-xsrc/native/tinype/tiny.exebin0 -> 2048 bytes
-rwxr-xr-xsrc/native/tinype/tiny.exe.gzbin0 -> 305 bytes
12 files changed, 68 insertions, 34 deletions
diff --git a/make/scripts/java-win32.bat b/make/scripts/java-win32.bat
index 26392a6..23fbb64 100755
--- a/make/scripts/java-win32.bat
+++ b/make/scripts/java-win32.bat
@@ -17,8 +17,8 @@ echo CP_ALL %CP_ALL%
set X_ARGS="-Drootrel.build=%BLD_SUB%" "-Dgluegen.root=.."
REM set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary"
-REM set D_ARGS="-Djogamp.debug.IOUtil"
-set D_ARGS="-Djogamp.debug=all"
+set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe"
+REM set D_ARGS="-Djogamp.debug=all"
REM %J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
%J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win32.log 2>&1
diff --git a/make/scripts/java-win64.bat b/make/scripts/java-win64.bat
index a45adac..fb60ced 100755
--- a/make/scripts/java-win64.bat
+++ b/make/scripts/java-win64.bat
@@ -18,8 +18,8 @@ echo CP_ALL %CP_ALL%
set X_ARGS="-Drootrel.build=%BLD_SUB%" "-Dgluegen.root=.."
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.JarUtil" "-Djogamp.debug.TempJarCache"
REM set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary" "-Djogamp.debug.IOUtil"
-REM set D_ARGS="-Djogamp.debug.IOUtil"
-set D_ARGS="-Djogamp.debug=all"
+set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe"
+REM set D_ARGS="-Djogamp.debug=all"
REM %J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
%J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
diff --git a/make/scripts/runtest-x32.bat b/make/scripts/runtest-x32.bat
index 9297d9a..6f169d5 100755
--- a/make/scripts/runtest-x32.bat
+++ b/make/scripts/runtest-x32.bat
@@ -3,11 +3,12 @@ REM set TMP=C:\Documents and Settings\jogamp\temp-exec
REM set TEMP=C:\Users\jogamp\temp-exec
REM set TMP=C:\Users\jogamp\temp-exec
-scripts\java-win32.bat com.jogamp.common.GlueGenVersion
+REM scripts\java-win32.bat com.jogamp.common.GlueGenVersion
REM scripts\java-win32.bat com.jogamp.common.util.TestVersionInfo
REM scripts\java-win32.bat com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
REM scripts\java-win32.bat com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
REM scripts\java-win32.bat com.jogamp.common.util.TestTempJarCache
+scripts\java-win32.bat com.jogamp.common.util.TestPlatform01
REM scripts\java-win32.bat com.jogamp.common.os.TestElfReader01
REM scripts\java-win32.bat com.jogamp.common.util.TestIOUtilURIHandling
REM scripts\java-win32.bat com.jogamp.common.nio.TestByteBufferInputStream
diff --git a/make/scripts/runtest-x64.bat b/make/scripts/runtest-x64.bat
index 1dfff6f..70a0ec3 100755
--- a/make/scripts/runtest-x64.bat
+++ b/make/scripts/runtest-x64.bat
@@ -6,12 +6,13 @@ REM set TMP=C:\Users\jogamp\temp-exec
REM scripts\java-win64.bat com.jogamp.common.GlueGenVersion
REM scripts\java-win64.bat com.jogamp.common.util.TestVersionInfo
-scripts\java-win64.bat com.jogamp.gluegen.jcpp.IncludeAbsoluteTest
+REM scripts\java-win64.bat com.jogamp.gluegen.jcpp.IncludeAbsoluteTest
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
REM scripts\java-win64.bat com.jogamp.common.util.TestTempJarCache
REM scripts\java-win64.bat com.jogamp.common.os.TestElfReader01
+scripts\java-win64.bat com.jogamp.common.util.TestPlatform01
REM scripts\java-win64.bat com.jogamp.common.util.TestIOUtil01
REM scripts\java-win64.bat com.jogamp.common.util.TestJarUtil
diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh
index c3b5331..d66d8c5 100755
--- a/make/scripts/runtest.sh
+++ b/make/scripts/runtest.sh
@@ -60,7 +60,7 @@ X_ARGS="-Drootrel.build=$ROOTREL_BUILD -Dgluegen.root=$GLUEGEN_ROOT"
#D_ARGS="-Djogamp.debug.Lock"
#D_ARGS="-Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogamp.debug.Lock.TraceLock"
-#D_ARGS="-Djogamp.debug.IOUtil"
+D_ARGS="-Djogamp.debug.IOUtil -Djogamp.debug.IOUtil.Exe"
#D_ARGS="-Djogamp.debug.ByteBufferInputStream"
#D_ARGS="-Djogamp.debug.Bitstream"
#D_ARGS="-Djogamp.debug=all"
@@ -95,7 +95,7 @@ function onetest() {
#onetest com.jogamp.common.util.TestIteratorIndexCORE 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.locks.TestRecursiveLock01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.locks.TestRecursiveThreadGroupLock01 2>&1 | tee -a $LOG
-onetest com.jogamp.common.util.locks.TestSingletonServerSocket00 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.util.locks.TestSingletonServerSocket00 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.locks.TestSingletonServerSocket01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.locks.TestSingletonServerSocket02 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestFloatStack01 2>&1 | tee -a $LOG
@@ -105,7 +105,7 @@ onetest com.jogamp.common.util.locks.TestSingletonServerSocket00 2>&1 | tee -a $
#onetest com.jogamp.common.util.IntIntHashMapTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.IntObjectHashMapTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.LongIntHashMapTest 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.util.TestPlatform01 2>&1 | tee -a $LOG
+onetest com.jogamp.common.util.TestPlatform01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestRunnableTask01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestIOUtil01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestTempJarCache 2>&1 | tee -a $LOG
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 347d843..88b39e6 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -40,6 +40,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.Reader;
+import java.io.SyncFailedException;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.net.URISyntaxException;
@@ -47,11 +48,13 @@ import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.util.regex.Pattern;
+import java.util.zip.GZIPInputStream;
import jogamp.common.Debug;
import jogamp.common.os.AndroidUtils;
import jogamp.common.os.PlatformPropsImpl;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.net.AssetURLContext;
import com.jogamp.common.net.Uri;
import com.jogamp.common.nio.Buffers;
@@ -59,7 +62,14 @@ import com.jogamp.common.os.MachineDataInfo;
import com.jogamp.common.os.Platform;
public class IOUtil {
- public static final boolean DEBUG = Debug.debug("IOUtil");
+ public static final boolean DEBUG;
+ private static final boolean DEBUG_EXE;
+
+ static {
+ Debug.initSingleton();
+ DEBUG = Debug.debug("IOUtil");
+ DEBUG_EXE = PropertyAccess.isPropertyDefined("jogamp.debug.IOUtil.Exe", true);
+ }
/** Std. temporary directory property key <code>java.io.tmpdir</code>. */
private static final String java_io_tmpdir_propkey = "java.io.tmpdir";
@@ -691,13 +701,15 @@ public class IOUtil {
return new String[] { scriptFile };
}
}
- private static final byte[] getBytesFromRelFile(final byte[] res, final String fname, final int size) throws IOException {
+ private static final byte[] getBytesFromRelFile(final byte[] res, final String fname, final int iSize, final int dSize) throws IOException {
final URLConnection con = IOUtil.getResource(IOUtil.class, fname);
- final InputStream in = con.getInputStream();
+ final InputStream in = ( dSize > 0 && dSize < iSize ) ?
+ new GZIPInputStream(con.getInputStream(), dSize) :
+ con.getInputStream();
int numBytes = 0;
try {
while (true) {
- final int remBytes = size - numBytes;
+ final int remBytes = iSize - numBytes;
int count;
if ( 0 >= remBytes || (count = in.read(res, numBytes, remBytes)) == -1 ) {
break;
@@ -707,8 +719,8 @@ public class IOUtil {
} finally {
in.close();
}
- if( size != numBytes ) {
- throw new IOException("Got "+numBytes+" bytes != expected "+size);
+ if( iSize != numBytes ) {
+ throw new IOException("Got "+numBytes+" bytes != expected "+iSize);
}
return res;
}
@@ -719,20 +731,27 @@ public class IOUtil {
if( Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE &&
Platform.CPUFamily.X86 == PlatformPropsImpl.CPU_ARCH.family
) {
- final int codeSize = 268;
+ final int gzipSize = 305;
+ final int codeSize = 2048;
final byte[] code;
synchronized ( exeTestBytesLock ) {
byte[] _code;
if( null == exeTestBytesRef || null == ( _code = exeTestBytesRef.get() ) ) {
- code = getBytesFromRelFile(new byte[512], "bin/exe-windows-i586-268b.bin", codeSize);
+ // code = getBytesFromRelFile(new byte[codeSize], "bin/exe-windows-i386-2048b.bin", codeSize, 0);
+ code = getBytesFromRelFile(new byte[codeSize], "bin/exe-windows-i386-2048b.bin.305b.gz", codeSize, gzipSize);
exeTestBytesRef = new WeakReference<byte[]>(code);
} else {
code = _code;
}
}
- final OutputStream out = new FileOutputStream(exefile);
+ final FileOutputStream out = new FileOutputStream(exefile);
try {
out.write(code, 0, codeSize);
+ try {
+ out.getFD().sync();
+ } catch (final SyncFailedException sfe) {
+ ExceptionUtils.dumpThrowable("", sfe);
+ }
} finally {
out.close();
}
@@ -742,6 +761,11 @@ public class IOUtil {
final FileWriter fout = new FileWriter(exefile);
try {
fout.write(shellCode);
+ try {
+ fout.flush();
+ } catch (final IOException sfe) {
+ ExceptionUtils.dumpThrowable("", sfe);
+ }
} finally {
fout.close();
}
@@ -865,32 +889,34 @@ public class IOUtil {
public static boolean testDirExec(final File dir)
throws SecurityException
{
+ final boolean debug = DEBUG_EXE || DEBUG;
+
if (!testFile(dir, true, true)) {
- if(DEBUG) {
+ if( debug ) {
System.err.println("IOUtil.testDirExec: <"+dir.getAbsolutePath()+">: Not writeable dir");
}
return false;
}
if(!getOSHasNoexecFS()) {
- if(DEBUG) {
+ if( debug ) {
System.err.println("IOUtil.testDirExec: <"+dir.getAbsolutePath()+">: Always executable");
}
return true;
}
- final long t0 = DEBUG ? System.currentTimeMillis() : 0;
+ final long t0 = debug ? System.currentTimeMillis() : 0;
final File exeTestFile;
try {
exeTestFile = File.createTempFile("jogamp_exe_tst", getExeTestFileSuffix(), dir);
} catch (final SecurityException se) {
throw se; // fwd Security exception
} catch (final IOException e) {
- if(DEBUG) {
+ if( debug ) {
e.printStackTrace();
}
return false;
}
- final long t1 = DEBUG ? System.currentTimeMillis() : 0;
+ final long t1 = debug ? System.currentTimeMillis() : 0;
int res = -1;
if(exeTestFile.setExecutable(true /* exec */, true /* ownerOnly */)) {
try {
@@ -899,30 +925,31 @@ public class IOUtil {
// Using 'Process.exec(String[])' avoids StringTokenizer of 'Process.exec(String)'
// and hence splitting up command by spaces!
final Process pr = Runtime.getRuntime().exec( getExeTestCommandArgs( exeTestFile.getCanonicalPath() ) );
- /**
- * Disable StreamMonitor, which throttles exec-test performance a lot!
- *
- * if( isStringSet(shellCode) ) {
+ if( DEBUG_EXE ) {
new StreamMonitor(new InputStream[] { pr.getInputStream(), pr.getErrorStream() }, System.err, "Exe-Tst: ");
- }
- */
+ }
pr.waitFor() ;
res = pr.exitValue();
} catch (final SecurityException se) {
throw se; // fwd Security exception
} catch (final Throwable t) {
res = -2;
- if(DEBUG) {
+ if( debug ) {
System.err.println("IOUtil.testDirExec: <"+exeTestFile.getAbsolutePath()+">: Caught "+t.getClass().getSimpleName()+": "+t.getMessage());
t.printStackTrace();
}
}
}
final boolean ok = 0 == res;
- final long t2 = DEBUG ? System.currentTimeMillis() : 0;
- exeTestFile.delete();
- if( DEBUG) {
- System.err.println("IOUtil.testDirExec(): <"+dir.getAbsolutePath()+">: res "+res+" -> "+ok);
+ if( !DEBUG_EXE ) {
+ exeTestFile.delete();
+ }
+ if( debug ) {
+ final long t2 = System.currentTimeMillis();
+ if( DEBUG_EXE ) {
+ System.err.println("IOUtil.testDirExec(): test-exe <"+exeTestFile.getAbsolutePath()+">");
+ }
+ System.err.println("IOUtil.testDirExec(): abs-path <"+dir.getAbsolutePath()+">: res "+res+" -> "+ok);
System.err.println("IOUtil.testDirExec(): total "+(t2-t0)+"ms, create "+(t1-t0)+"ms, execute "+(t2-t1)+"ms");
}
return ok;
diff --git a/src/java/com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.305b.gz b/src/java/com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.305b.gz
new file mode 100644
index 0000000..1444ae6
--- /dev/null
+++ b/src/java/com/jogamp/common/util/bin/exe-windows-i386-2048b.bin.305b.gz
Binary files differ
diff --git a/src/java/com/jogamp/common/util/bin/exe-windows-i586-268b.bin b/src/java/com/jogamp/common/util/bin/exe-windows-i586-268b.bin
deleted file mode 100644
index b0d5f63..0000000
--- a/src/java/com/jogamp/common/util/bin/exe-windows-i586-268b.bin
+++ /dev/null
Binary files differ
diff --git a/src/native/tinype/make.bat b/src/native/tinype/make.bat
new file mode 100755
index 0000000..121e7ee
--- /dev/null
+++ b/src/native/tinype/make.bat
@@ -0,0 +1 @@
+c:\mingw\bin\gcc -nodefaultlibs -nostdlib -s -Os -o tiny.exe tiny.c
diff --git a/src/native/tinype/tiny.c b/src/native/tinype/tiny.c
new file mode 100644
index 0000000..4d645bf
--- /dev/null
+++ b/src/native/tinype/tiny.c
@@ -0,0 +1,4 @@
+int __main()
+{
+ return 0;
+}
diff --git a/src/native/tinype/tiny.exe b/src/native/tinype/tiny.exe
new file mode 100755
index 0000000..6191a27
--- /dev/null
+++ b/src/native/tinype/tiny.exe
Binary files differ
diff --git a/src/native/tinype/tiny.exe.gz b/src/native/tinype/tiny.exe.gz
new file mode 100755
index 0000000..1444ae6
--- /dev/null
+++ b/src/native/tinype/tiny.exe.gz
Binary files differ