summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common
Commit message (Collapse)AuthorAgeFilesLines
* Add Ringbuffer interface an 2 implementations, synchronized (locking) ↵Sven Gothel2013-08-223-0/+462
| | | | | | | | | | | | | | | | | | | | | | | | SyncedRingbuffer and lock-free LFRingbuffer. SyncedRingbuffer is moved from JOGL to GlueGen, and generalized w/ common interface Ringbuffer to allow testing diff. implementations. - Added Ringbuffer.AllocEmptyArray factory interface, allowing to pass a constructor to construct the generic array. - Added functionality is growBuffer(..), allowing to either grow a full or empty buffer, using Ringbuffer.AllocEmptyArray. - Removed explicit 'clearRef' at get*(..), always clear the taken reference for better interface generalization. - Added LFRingbuffer, exposing lock-free get*(..) and put*(..) methods using the 'Always Keep One Slot Open' pattern using the read/write index as barriers only. - Ctor's copy an optional passed user array into the internal array, utilizing Ringbuffer.AllocEmptyArray. - Added unit tests.
* Fix URLCompositionTest for Bug 757 (3): If file, replace '/' in expected ↵Sven Gothel2013-06-191-2/+4
| | | | | | result w/ OS specific File.separatorChar Take 3 (duh!): JRE impl. varies .. i.e. plain URL w/o JAR path differs from URL w/ JAR scheme on Windows .. well.
* Fix URLCompositionTest for Bug 757 (2): If file, replace '/' in expected ↵Sven Gothel2013-06-191-1/+11
| | | | | | result w/ OS specific File.separatorChar The JAR entry shall stay untouched, i.e. separator is platform independent '/'.
* Fix URLCompositionTest for Bug 757: If file, replace '/' in expected result ↵Sven Gothel2013-06-191-10/+12
| | | | w/ OS specific File.separatorChar
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-193-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | compatible w/ file scheme. Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823). The URI encoded path cannot be read by File I/O (if file scheme), since the latter requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space). The encoded URL is produced if calling 'uri.toURL()' and hence the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'. Tested w/ - synthetic URI/URL coposition (unit test) - manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl. +++ Misc.: - 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)' ++
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-095-84/+180
| | | | to remove DNS Lookups etc ..
* Enhance VersionNumber*: Use only RegExp and cache default (no wrapped ↵Sven Gothel2013-05-311-9/+206
| | | | whitespace tokenizer); String match: Store end-of-match and flag defined components.
* Function- RunnableTask: Add PrintStream 'exceptionOut' argument allowing non ↵Sven Gothel2013-03-181-1/+1
| | | | | | | blocking exceptions to be shown. Exceptions occuring on non blocking off-thread tasks shall at least be made visible while not allowed to crash the system.
* Make JarUtil work with custom classloadersWade Walker2013-02-111-0/+77
| | | | | | | | Added the ability for users to set a "resolver" in JarUtil that lets it find resources that are loaded by a custom classloader. This is needed in OSGi apps (like Eclipse RCP apps), since OSGi resources do not have simple jar: URLs (they use a custom protocol called bundleresource:).
* Bug 681: Add Elf Parsing for other OS than Linux, if ARM and !ANDROID using ↵Sven Gothel2013-02-091-11/+45
| | | | | | | | /proc/self/exe (Linux) or a found java/jvm native lib. - PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib) - NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration! - TestElfReader01: Add test for finding java/jvm native lib and parse it
* TestElfReader01.testGNULinuxSelfExe: Restrict to LINUXSven Gothel2013-02-081-1/+4
|
* Bug 681: Use ELF Header + ARM EABI Section Parsing in PlatformPropsImpl to ↵Sven Gothel2013-02-081-20/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to distinguish ARM soft-float/hard-float (part-2) + /** + * Returns the {@link ABIType} of the current platform using given {@link CPUType cpuType} + * and {@link OSType osType} as a hint. + * <p> + * Note the following queries are performed: + * <ul> + * <li> not {@link CPUFamily#ARM} -> {@link ABIType#GENERIC_ABI} </li> + * <li> else + * <ul> + * <li> not {@link OSType#LINUX} -> {@link ABIType#EABI_GNU_ARMEL} </li> + * <li> else + * <ul> + * <li> Elf ARM Tags -> {@link ABIType#EABI_GNU_ARMEL}, {@link ABIType#EABI_GNU_ARMHF} </li> + * </ul></li> + * </ul></li> + * </ul> + * </p> + * <p> + * Elf ARM Tags are read using {@link ElfHeader}, .. and {@link SectionArmAttributes#abiVFPArgsAcceptsVFPVariant(byte)}. + * </p> + * + * @param cpuType + * @param osType + * @return + */ + private static final ABIType queryABITypeImpl(CPUType cpuType, OSType osType) {
* Bug 681: Add Basic ELF Header + ARM EABI Section Parsing, allowing to ↵Sven Gothel2013-02-082-5/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | distinguish ARM soft-float/hard-float (part-1) https://jogamp.org/bugzilla/show_bug.cgi?id=681 + * References: + * <ul> + * <li>http://linux.die.net/man/5/elf</li> + * <li>http://www.sco.com/developers/gabi/latest/contents.html</li> + * <li>http://infocenter.arm.com/ + * <ul> + * <li>ARM IHI 0044E, current through ABI release 2.09</li> + * <li>ARM IHI 0045D, current through ABI release 2.09</li> + * </ul></li> Added self contained jogamp.common.os.elf package w/ entry point class ElfHeader to read a RandomAccessFile and parse it as an ELF file. ELF Parsing completness: - Header: OK - SectionHeader: OK - Section Type SHT_ARM_ATTRIBUTES: OK - Will be read into SectionArmAttributes - Used to distinguisgh soft/hard VFP float Tested manually on: - Linux intel 32bit / 64bit, arm soft-float and hard-float
* PrimitiveStack: Add 'void position(int)' to set new position. Add test case ↵Sven Gothel2012-12-311-21/+57
| | | | w/ initialSizeElem:=0.
* Add com.jogamp.common.util.PrimitiveStack (FloatStack and IntegerStack), a ↵Sven Gothel2012-12-301-0/+266
| | | | | | | | | | | | simple primitive stack implementation. Currently only FILO put/get operations are implemented using either primitive arrays as I/O itself or <Type>Buffer. Unit tests are included.. Note: Only FloatStack is implemented in a manual, where others (IntegerStack) is derived (generated) from it. Same goes w/ unit tests.
* Fix VersionNumber: Non digits cut off pattern was '\D.*' and cut off digits ↵Sven Gothel2012-10-241-0/+102
| | | | | | | | | | | | | | | | | | | in case leading non digits appear. '\D.*' matches a leading non-digit and then any character. First the string is tokenized by delim: "OpenGL ES GLSL ES 1.0.16" -> "OpenGL ES GLSL ES 1", "0", "16" Enhance pattern as follows and access collected group if matching: // group1: \D* == leading non digits, optional // group2: \d* == digits // group3: .* == any pending chars, optional final java.util.regex.Pattern nonDigitsCutOff = java.util.regex.Pattern.compile("(\\D*)(\\d*)(.*)"); Reorganized storage from atomic values to int[3] array, allowing simple pattern matching loop. Added unit test.
* Buffers: Add normalized put methods, i.e. incl. value range conversion; New ↵Sven Gothel2012-10-171-0/+137
| | | | util. ValueConv for primitive type value conversion
* TestSingletonServerSocket01: unlock singleton lockSven Gothel2012-10-041-0/+2
|
* SingletonInstanceServerSocket: Add another (manual) unit tests for timeouts.Sven Gothel2012-09-211-0/+72
|
* SingletonInstanceServerSocket: Add unit tests; Create new server Thread @ ↵Sven Gothel2012-09-212-0/+160
| | | | start, otherwise we may collide w/ a failed start. Misc: Cleanup / reuse strings.
* Lock Cleanup (API Change)Sven Gothel2012-06-272-8/+0
| | | | | | | | - LockExt -> ThreadLock - clarifying semantics (API Change) - ThreadLock: Remove isOwner(), use isOwner(Thread.currentThread) - adding @Override
* Implement Bug #598 - JOGL ALL JAR File Change incl. it's Native Jar URL ↵Sven Gothel2012-06-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Derivation +++ JNILibLoaderBase.addNativeJarLibs(..): Add API doc JNILibLoaderBase: "addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)" -> "addNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker, String[] stripBasenameSuffixes)" Derive the 'all' (1st choice) native JAR URL solely on the given class's JAR URL. Examples: JOCL: // only: jocl.jar -> jocl-natives-'os.and.arch'.jar addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null ); JOGL: final ClassLoader cl = GLProfile.class.getClassLoader(); // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar, // jogl-core.jar -> jogl-natives-<os.and.arch>.jar, // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available) final String newtFactoryClassName = "com.jogamp.newt.NewtFactory"; final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null }; if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) { classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl); } JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } ); Efficiency / Performance: - Reduced JAR URL lookup calls JarUtil.getJarURL(..) - JNILibLoaderBase, Platform, JarUtil - Attempt loading Jar files (native, class, ..) only once - TempJarCache Code Cleanup (IOUtil, JarUtil, : - IOException if not found - IllegalArgumentException if null argument +++ jogamp.android-launcher.jar -> jogamp-android-launcher.jar +++
* Fix IOUtil: Handle all '../' and './' cases by reducing the path.Sven Gothel2012-04-024-6/+33
|
* Dump Envs: Suppress COOKIE, SSH and GPG env varsSven Gothel2012-03-281-4/+19
|
* Test: Add dump of environment varsSven Gothel2012-03-281-4/+17
|
* Add support for armhf/gnueabihf resulting in new 'os.and.arch' := [ ↵Sven Gothel2012-03-282-4/+63
| | | | | | | | | | | | | | | | 'android-armv7hf' and 'linux-armv7hf' ] - Platform gets new ABIType [ GENERIC, ARMEL, ARMHF ] - Platform impl. needs to guess ABIType in case of ARM, since no Java system property ('os.arch' ..) reflects the new EABI. I consider this a bug, since this will also hinder JNLP to work. The latter also uses 'os.arch' sys property to determine the nativelib resource! (See Platform.guessABITypeImpl(..) for details how we guess the type.) - Adding symbolic links to ubuntu's gnueabihf cross tool chain - Adding armhf crossbuild script
* Add 'asset' URLConnection; IOUtil uses URLConnection / incr. effeciency; ↵Sven Gothel2012-03-175-15/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android ClassLoaderUtil cleanup; - Add 'asset' URLConnection - Please read API doc 'PiggybackURLConnection' and 'AssetURLConnection' - Solves generic resource handling where platform locations may differ, ie ClassLoader lookup on Android in the 'assets/' subfolder. - New Android 'AssetDexClassLoader' uses 'assets/' folder for findResource(..) - aapt.signed (our APK ant task) - uses 'assets/' folder - adds the 'assetsdir' attribute allowing to copy other assets into the APK - IOUtil uses URLConnection / incr. effeciency - using URLConnection on all getResource(..) since URL is connected anyways for validation and URLConnection can be used by caller right away - String getRelativeOf(URL, String) -> URL getRelativeOf(URL, String) - preserves scheme, authority, etc - simple parentOf handling, more efficient - reusing new 'asset' protocol impl. - Android ClassLoaderUtil cleanup; - Use createClassLoader(..) impl for build-in static jogamp and user APKs, which removes code redundancy Tests: New code path, especially 'assets' are covered by new unit tests, no regressions on Linux.
* Stabilize open InputStream's / Closeable's: Decorate w/ try-finally and ↵Sven Gothel2012-03-101-4/+22
| | | | close within the latter
* Don't build and use gluegen.apk (compile time only) ; Don't test classloader ↵Sven Gothel2012-03-071-5/+16
| | | | | | -> JarURL on Android All [remaining] tests passed on Android!
* android test: Specify 'java.io.tempdir' and add TestJarsInJar.apk / Disable ↵Sven Gothel2012-03-071-0/+6
| | | | most of tests in TestJarUtil
* RecursiveThreadGroupLock: New recursive lock interface and impl, allowing ↵Sven Gothel2011-12-111-0/+327
| | | | | | | | | | | | 'spawn off' process to become the lock owner. To avoid complicated synchronization via synchronized, wait and notify between one thread and a 'spawn' off thread which temporarly requires the hold lock, RecursiveThreadGroupLock allows to add and remove other threads to become owners of the lock as if they were the original holder. This simplifies some rare locking use cases, eg. in JOGL's GLProfile initialization sequence where a SharedResourceRunner thread is taking over initialization of shared resources.
* TestTracer -> JunitTracerv2.0-rc4Sven Gothel2011-12-0214-28/+28
|
* Fix Test1p2ProcAddressEmitter (static var); Add TestTracerSven Gothel2011-12-0214-14/+34
|
* TempJarCache/JNILibLoaderBase: Identify the Jar files by their URL within ↵Sven Gothel2011-12-012-6/+6
| | | | our lifecycle. JarFile's hash almost always differs.
* JarUtil: Improve Robustness (Bug 522) and API doc, prepare for Jar-In-Jar. ↵Sven Gothel2011-11-292-5/+174
| | | | | | | | Add unit test. Misc.: - IOUtil: Add toURL* methods - TempJarCache: Add 'URL getResource(String)'
* Add assertion to RunnableTask test case (forgot in commit: ↵Sven Gothel2011-11-221-1/+4
| | | | 43b7675259eb76c570b6cc3a44fec2b9f6410697)
* RunnableTask: Add documentation, incl. unit test. Add ↵Sven Gothel2011-11-221-0/+100
| | | | ReflectionUtil.MethodAccess, a convenient Method instance accessor.
* Fix VersionNumber cstr w/ string parsing: cutt-off non-digit-parts, suppress ↵Sven Gothel2011-10-272-0/+26
| | | | exceptions
* Lock ChangeSet (fin): Cleanup, fix and enhance RecursiveLock implementationSven Gothel2011-09-271-77/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - RecursiveLock _is_ interface. - Use LockFactory to create a RecursiveLock. - Impl: RecursiveLockImpl01Unfairish - just using notify w/o any queue: fast - still enqueuing new lock-applicants if queue full (nice) - lock's sync extends AbstractOwnableSynchronizer and uses it (monitor) - Impl: RecursiveLockImpl01CompleteFair - using queue and interrupt for correctness (slow) - lock's sync extends AbstractOwnableSynchronizer and uses it (monitor) - Impl: RecursiveLockImplJava5 for using Java5's concurrency impl. - to verify correctness, performance and deviation of locking time TestRecursiveLock01 new performance measurements incl. simple avrg and deviation shows best combined performance-deviation w/ our RecursiveLockImpl01Unfairish os Linux and MacOSX. RecursiveLockImpl01Unfairish is the default in LockFactory. Adding 'private' LockDebugUtil, allowing validating all holdings locks of one thread as stack traces (Throwable). Besides the AbstractOwnableSynchronizer utilization, this helps debugging deadlocks and starvation very well.
* TempJarCache/JNILibLoaderBase: Validate the to be loader JarFile's ↵Sven Gothel2011-09-231-3/+18
| | | | Certificates if caller has any. Add Convenient JNILibLoaderBase.addNativeJarLibs(..) method.
* Temp Cache: More control over the lifecycle, explicit TempJarCache ↵Sven Gothel2011-09-201-2/+26
| | | | initialization/usage only
* Enhancements / New utils: JarUtil, TempFileCache and TempJarCacheSven Gothel2011-09-191-0/+218
| | | | | | | | | | | | | | | | | | | | JarUtil: Utility to handle Jar files and it's content, incl. extracting it's entries TempFileCache: Utility to have a save temporary file cache per JVM and per instance, eg. per ClassLoader. The temp cache is cleaned up with the next usage of TempFileCache, which solves the troubles of JVM bugs and situations where the JVM is not able to close and delete open temp files. TempJarCache: Utility to cache Jar files temporary (using TempFileCache) and access it's content. This class is suitable to implement a URLClassLoader or similar resource loading facilities. All tested w/ TestTempJarCache
* ArrayHashSet: Add Java Generics SyntaxSven Gothel2011-08-241-10/+6
|
* fix cross test: Test* -> *Test* ; Reduce iterations further for ARM to ↵Sven Gothel2011-07-235-8/+8
| | | | speedup test
* Fix TestStructAccessorEndianSven Gothel2011-07-211-3/+10
| | | | | | | | | | | | - StructAccessor uses byteOffset now (since 8b3057585930357bb16546f584d998953b084034) Fix linux armv7l eabi: - build.xml arm7 -> armv7 - all tests passes Adding NativeSizeAlignment-linux-armv7l_eabi from passing test OK: linux 32/64/armv7l, windows 32/64
* Cleanup: Platform CPU enum, MachineDescription,Sven Gothel2011-07-205-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Platform: - enum CPUFamily is part of CPUType - DALVIK -> ANDROID - ARM: ARM + ARMv[567] MachineDescription - self contained - static size/alignment Config (enum) for unix32, unix64, win32, win64 and armeabi - add 'long double' - Removed MachineDescription32Bit, MachineDescription64Bit - createStatic(..) uses OS/CPU to fetch best match if not at runtime FIXES: JavaEmitter's struct-emit: Proper 32/64 struct sizes TODO: StructAccessor's mapping to <Type>Buffer w/ index os sizeof(<Type>) doesn't work, since offset may not be multiple of sizeof(<Type>)! i.e. typedef struct { int8_t bits1; // +1 - 0 // +3 (p32) int32_t id; // +4 - 4 int8_t bits2; // +1 - 8 // +3 (p32) - int64_t long0; // +8 - 12 so "longBuffer.get(<type-sized index>)" is invalid, but "byteBuffer.getLong(<byte index>)" must be done. The actual impl. doesn't matter, hence dropping the other nio type mappings is good.
* Junit tests on ARM: Reducing some test/perf loops allowing to pass tests on ↵Sven Gothel2011-07-175-8/+38
| | | | low performance ARM
* GlueGen proper size / alignment of primitive and compound types usage [1/2] ↵Sven Gothel2011-07-174-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Preparation. Currently GlueGen fails for type long (size) and some alignments (see package.html). - The size and alignment values shall be queried at runtime. - Compound alignment needs to follow the described natural alignment (also @runtime). - - Build - add Linux Arm7 (EABI) - junit test - added compound/struct tests, pointing out the shortcomings of current impl. - package.html - Added alignment documentation - remove intptr.cfg - add GluGen types int8_t, int16_t, uint8_t, uint16_t - move MachineDescription* into runtime - Platform - has runtime MachineDescription - moved size, .. to MachineDescription - use enums for OSType, CPUArch and CPUType defined by os.name/os.arch, triggering exception if os/arch is not supported. This avoids Java String comparison and conscious os/arch detection. - MachineDescription: - compile time instances MachineDescription32Bits, MachineDescription64Bits - runtime queried instance MachineDescriptionRuntime - correct size, alignment, page size, ..
* Fix HastMapTests - Clone: Use unique random pairs: key,valueSven Gothel2011-06-267-118/+284
|
* Merged Locator -> IOUtil; int Platform.getPageSize(); Added unit test for ↵Sven Gothel2011-06-082-0/+181
| | | | IOUtil and Platform's page size