summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-06 12:02:19 +0100
committerSven Gothel <[email protected]>2015-03-06 12:02:19 +0100
commit6a0822b03de2976c5bc37544c50e70094eeb94a7 (patch)
tree785e048e484d6cbd1f7069925d67401f86e8764c /src/junit/com/jogamp
parent43f200428eb595665d6db6edbd5538413f5a977c (diff)
TestByteBuffer*Stream: Reduce mmap load on poor OSX mini test machine to reduce test time (was: > 10 min)
Diffstat (limited to 'src/junit/com/jogamp')
-rw-r--r--src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java31
-rw-r--r--src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java32
-rw-r--r--src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java7
3 files changed, 60 insertions, 10 deletions
diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java
index bef813b..9524e91 100644
--- a/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java
+++ b/src/junit/com/jogamp/common/nio/TestByteBufferCopyStream.java
@@ -35,6 +35,7 @@ import java.nio.channels.FileChannel;
import org.junit.Assert;
import org.junit.Test;
+import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.SingletonJunitCase;
import org.junit.FixMethodOrder;
@@ -171,27 +172,42 @@ public class TestByteBufferCopyStream extends SingletonJunitCase {
@Test
public void test00() throws IOException {
+ final long size;
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ size = quaterGiB;
+ } else {
+ size = twoPlusGiB;
+ }
final int srcSliceShift = MappedByteBufferInputStream.DEFAULT_SLICE_SHIFT;
final int dstSliceShift = MappedByteBufferInputStream.DEFAULT_SLICE_SHIFT;
- final long size = twoPlusGiB;
testImpl(getSimpleTestName(".")+"_In.bin", size, MappedByteBufferInputStream.CacheMode.FLUSH_PRE_HARD, srcSliceShift,
- getSimpleTestName(".")+"_Out.bin", MappedByteBufferInputStream.CacheMode.FLUSH_PRE_HARD, dstSliceShift );
+ getSimpleTestName(".")+"_Out.bin", MappedByteBufferInputStream.CacheMode.FLUSH_PRE_HARD, dstSliceShift );
}
@Test
public void test01() throws IOException {
+ final long size;
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ size = quaterGiB;
+ } else {
+ size = twoPlusGiB;
+ }
final int srcSliceShift = MappedByteBufferInputStream.DEFAULT_SLICE_SHIFT;
final int dstSliceShift = MappedByteBufferInputStream.DEFAULT_SLICE_SHIFT;
- final long size = twoPlusGiB;
testImpl(getSimpleTestName(".")+"_In.bin", size, MappedByteBufferInputStream.CacheMode.FLUSH_PRE_SOFT, srcSliceShift,
getSimpleTestName(".")+"_Out.bin", MappedByteBufferInputStream.CacheMode.FLUSH_PRE_SOFT, dstSliceShift );
}
@Test
public void test02() throws IOException {
+ final long size;
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ size = quaterPlusGiB;
+ } else {
+ size = halfPlusGiB;
+ }
final int srcSliceShift = 27; // 125M bytes per slice
final int dstSliceShift = 27; // 125M bytes per slice
- final long size = halfPlusGiB;
testImpl(getSimpleTestName(".")+"_In.bin", size, MappedByteBufferInputStream.CacheMode.FLUSH_PRE_SOFT, srcSliceShift,
getSimpleTestName(".")+"_Out.bin", MappedByteBufferInputStream.CacheMode.FLUSH_PRE_SOFT, dstSliceShift );
}
@@ -214,7 +230,14 @@ public class TestByteBufferCopyStream extends SingletonJunitCase {
getSimpleTestName(".")+"_Out.bin", MappedByteBufferInputStream.CacheMode.FLUSH_PRE_SOFT, dstSliceShift );
}
+ static boolean manualTest = false;
+
public static void main(final String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-manual")) {
+ manualTest = true;
+ }
+ }
final String tstname = TestByteBufferCopyStream.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java
index 53ebac9..90a954b 100644
--- a/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java
+++ b/src/junit/com/jogamp/common/nio/TestByteBufferInputStream.java
@@ -41,6 +41,7 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IOUtil;
import com.jogamp.junit.util.SingletonJunitCase;
@@ -144,20 +145,32 @@ public class TestByteBufferInputStream extends SingletonJunitCase {
@Test
public void test11MMap1GiBFlushNone() throws IOException {
- testCopyIntSize1Impl2(0, SrcType.MMAP2_NONE, 0, fileOneGiB, oneGiB);
- // testCopyIntSize1Impl2(0, SrcType.MMAP2_NONE, 0, fileTwoPlusGiB, twoPlusGiB);
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_NONE, 0, fileOneMiB, oneMiB);
+ } else {
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_NONE, 0, fileOneGiB, oneGiB);
+ // testCopyIntSize1Impl2(0, SrcType.MMAP2_NONE, 0, fileTwoPlusGiB, twoPlusGiB);
+ }
}
@Test
public void test12MMap1GiBFlushSoft() throws IOException {
- testCopyIntSize1Impl2(0, SrcType.MMAP2_SOFT, 0, fileOneGiB, oneGiB);
- // testCopyIntSize1Impl2(0, SrcType.MMAP2_SOFT, 0, fileTwoPlusGiB, twoPlusGiB);
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_SOFT, 0, fileOneMiB, oneMiB);
+ } else {
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_SOFT, 0, fileOneGiB, oneGiB);
+ // testCopyIntSize1Impl2(0, SrcType.MMAP2_SOFT, 0, fileTwoPlusGiB, twoPlusGiB);
+ }
}
@Test
public void test13MMap2GiBFlushHard() throws IOException {
- // testCopyIntSize1Impl2(0, SrcType.MMAP2_HARD, 0, fileOneGiB, oneGiB);
- testCopyIntSize1Impl2(0, SrcType.MMAP2_HARD, 0, fileTwoPlusGiB, twoPlusGiB);
+ if( !manualTest && Platform.OSType.MACOS == Platform.getOSType() ) {
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_HARD, 0, fileOneMiB, oneMiB);
+ } else {
+ // testCopyIntSize1Impl2(0, SrcType.MMAP2_HARD, 0, fileOneGiB, oneGiB);
+ testCopyIntSize1Impl2(0, SrcType.MMAP2_HARD, 0, fileTwoPlusGiB, twoPlusGiB);
+ }
}
void testCopyIntSize1Impl(final String testFileName, final long expSize) throws IOException {
@@ -336,7 +349,14 @@ public class TestByteBufferInputStream extends SingletonJunitCase {
System.err.println(" MiB"); */
}
+ static boolean manualTest = false;
+
public static void main(final String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-manual")) {
+ manualTest = true;
+ }
+ }
final String tstname = TestByteBufferInputStream.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java b/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java
index 8686b46..b0d7baf 100644
--- a/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java
+++ b/src/junit/com/jogamp/common/nio/TestByteBufferOutputStream.java
@@ -284,7 +284,14 @@ public class TestByteBufferOutputStream extends SingletonJunitCase {
testImpl(getSimpleTestName(".")+".bin", payLoad, 3021L, 6301L, "EOF".getBytes(), sliceShift);
}
+ static boolean manualTest = false;
+
public static void main(final String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-manual")) {
+ manualTest = true;
+ }
+ }
final String tstname = TestByteBufferOutputStream.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}