Old tests run with new system.
The tests are ported and run with the new system, though many currently
don't pass. Some of the tests also need additional fixing to run
properly.
Change-Id: I3263cf5dcb0fe064a3e6c02e4aa1bb9a067f64c7
diff --git a/test/003-omnibus-opcodes/build b/test/003-omnibus-opcodes/build
index 9eb5ed3..5a8a1a0 100644
--- a/test/003-omnibus-opcodes/build
+++ b/test/003-omnibus-opcodes/build
@@ -23,4 +23,11 @@
${JAVAC} -d classes `find src2 -name '*.java'`
dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes
-zip test.jar classes.dex
+zip ${ANDROID_PRODUCT_OUT}/system/framework/test.jar classes.dex
+
+dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
diff --git a/test/003-omnibus-opcodes/expected.txt b/test/003-omnibus-opcodes/expected.txt
index 4895dc3..28b1813 100644
--- a/test/003-omnibus-opcodes/expected.txt
+++ b/test/003-omnibus-opcodes/expected.txt
@@ -1,4 +1,3 @@
-(assertions are enabled)
InstField assign...
InstField check...
InstField.nullCheck
diff --git a/test/003-omnibus-opcodes/src/Array.java b/test/003-omnibus-opcodes/src/Array.java
index f385dd8..1daf3b9 100644
--- a/test/003-omnibus-opcodes/src/Array.java
+++ b/test/003-omnibus-opcodes/src/Array.java
@@ -10,60 +10,60 @@
* Verify array contents.
*/
static void checkBytes(byte[] bytes) {
- assert(bytes[0] == 0);
- assert(bytes[1] == -1);
- assert(bytes[2] == -2);
- assert(bytes[3] == -3);
- assert(bytes[4] == -4);
+ Main.assertTrue(bytes[0] == 0);
+ Main.assertTrue(bytes[1] == -1);
+ Main.assertTrue(bytes[2] == -2);
+ Main.assertTrue(bytes[3] == -3);
+ Main.assertTrue(bytes[4] == -4);
}
static void checkShorts(short[] shorts) {
- assert(shorts[0] == 20);
- assert(shorts[1] == 10);
- assert(shorts[2] == 0);
- assert(shorts[3] == -10);
- assert(shorts[4] == -20);
+ Main.assertTrue(shorts[0] == 20);
+ Main.assertTrue(shorts[1] == 10);
+ Main.assertTrue(shorts[2] == 0);
+ Main.assertTrue(shorts[3] == -10);
+ Main.assertTrue(shorts[4] == -20);
}
static void checkChars(char[] chars) {
- assert(chars[0] == 40000);
- assert(chars[1] == 40001);
- assert(chars[2] == 40002);
- assert(chars[3] == 40003);
- assert(chars[4] == 40004);
+ Main.assertTrue(chars[0] == 40000);
+ Main.assertTrue(chars[1] == 40001);
+ Main.assertTrue(chars[2] == 40002);
+ Main.assertTrue(chars[3] == 40003);
+ Main.assertTrue(chars[4] == 40004);
}
static void checkInts(int[] ints) {
- assert(ints[0] == 70000);
- assert(ints[1] == 70001);
- assert(ints[2] == 70002);
- assert(ints[3] == 70003);
- assert(ints[4] == 70004);
+ Main.assertTrue(ints[0] == 70000);
+ Main.assertTrue(ints[1] == 70001);
+ Main.assertTrue(ints[2] == 70002);
+ Main.assertTrue(ints[3] == 70003);
+ Main.assertTrue(ints[4] == 70004);
}
static void checkBooleans(boolean[] booleans) {
- assert(booleans[0]);
- assert(booleans[1]);
- assert(!booleans[2]);
- assert(booleans[3]);
- assert(!booleans[4]);
+ Main.assertTrue(booleans[0]);
+ Main.assertTrue(booleans[1]);
+ Main.assertTrue(!booleans[2]);
+ Main.assertTrue(booleans[3]);
+ Main.assertTrue(!booleans[4]);
}
static void checkFloats(float[] floats) {
- assert(floats[0] == -1.5);
- assert(floats[1] == -0.5);
- assert(floats[2] == 0.0);
- assert(floats[3] == 0.5);
- assert(floats[4] == 1.5);
+ Main.assertTrue(floats[0] == -1.5);
+ Main.assertTrue(floats[1] == -0.5);
+ Main.assertTrue(floats[2] == 0.0);
+ Main.assertTrue(floats[3] == 0.5);
+ Main.assertTrue(floats[4] == 1.5);
}
static void checkLongs(long[] longs) {
- assert(longs[0] == 0x1122334455667788L);
- assert(longs[1] == 0x8877665544332211L);
- assert(longs[2] == 0L);
- assert(longs[3] == 1L);
- assert(longs[4] == -1L);
+ Main.assertTrue(longs[0] == 0x1122334455667788L);
+ Main.assertTrue(longs[1] == 0x8877665544332211L);
+ Main.assertTrue(longs[2] == 0L);
+ Main.assertTrue(longs[3] == 1L);
+ Main.assertTrue(longs[4] == -1L);
}
static void checkStrings(String[] strings) {
- assert(strings[0].equals("zero"));
- assert(strings[1].equals("one"));
- assert(strings[2].equals("two"));
- assert(strings[3].equals("three"));
- assert(strings[4].equals("four"));
+ Main.assertTrue(strings[0].equals("zero"));
+ Main.assertTrue(strings[1].equals("one"));
+ Main.assertTrue(strings[2].equals("two"));
+ Main.assertTrue(strings[3].equals("three"));
+ Main.assertTrue(strings[4].equals("four"));
}
/*
@@ -73,41 +73,41 @@
System.out.println("Array.checkRange32");
int i = 0;
- assert(ints.length == 5);
+ Main.assertTrue(ints.length == 5);
try {
i = ints[5]; // exact bound
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
ints[5] = i; // exact bound
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
i = ints[6]; // one past
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
i = ints[negVal1]; // -1
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
ints[negVal1] = i; // -1
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
i = ints[negVal2]; // min int
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
@@ -115,7 +115,7 @@
try {
i = empty[1];
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
@@ -128,41 +128,41 @@
System.out.println("Array.checkRange64");
long l = 0L;
- assert(longs.length == 5);
+ Main.assertTrue(longs.length == 5);
try {
l = longs[5]; // exact bound
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
longs[5] = l; // exact bound
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
l = longs[6]; // one past
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
l = longs[negVal1]; // -1
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
longs[negVal1] = l; // -1
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
try {
l = longs[negVal2]; // min int
- assert(false);
+ Main.assertTrue(false);
} catch (ArrayIndexOutOfBoundsException aioobe) {
// good
}
@@ -178,14 +178,14 @@
try {
ints = new int[count];
- assert(false);
+ Main.assertTrue(false);
} catch (NegativeArraySizeException nase) {
// good
}
try {
strings = new String[count];
- assert(false);
+ Main.assertTrue(false);
} catch (NegativeArraySizeException nase) {
// good
}
diff --git a/test/003-omnibus-opcodes/src/Classes.java b/test/003-omnibus-opcodes/src/Classes.java
index c89ff3e..d7f937c 100644
--- a/test/003-omnibus-opcodes/src/Classes.java
+++ b/test/003-omnibus-opcodes/src/Classes.java
@@ -10,7 +10,7 @@
int mSome;
public void subFunc(boolean wantSub) {
- assert(!wantSub);
+ Main.assertTrue(!wantSub);
}
void checkCast(Object thisRef, Object moreRef, Object nullRef) {
@@ -20,90 +20,90 @@
MoreClasses more;
classes = (Classes) thisRef;
- assert(thisRef instanceof Classes);
+ Main.assertTrue(thisRef instanceof Classes);
classes = (Classes) moreRef;
- assert(moreRef instanceof Classes);
+ Main.assertTrue(moreRef instanceof Classes);
more = (MoreClasses) moreRef;
- assert(moreRef instanceof MoreClasses);
- assert(!(thisRef instanceof MoreClasses));
+ Main.assertTrue(moreRef instanceof MoreClasses);
+ Main.assertTrue(!(thisRef instanceof MoreClasses));
try {
more = (MoreClasses) thisRef;
- assert(false);
+ Main.assertTrue(false);
} catch (ClassCastException cce) {
//System.out.println(" class cast msg: " + cce.getMessage());
//Dalvik throws terser message than Hotspot VM
- assert(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7));
+ Main.assertTrue(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7));
}
- assert(!(thisRef instanceof MoreClasses));
+ Main.assertTrue(!(thisRef instanceof MoreClasses));
/* hopefully these classes cause a resolve */
try {
java.math.RoundingMode mode = (java.math.RoundingMode) thisRef;
- assert(false);
+ Main.assertTrue(false);
} catch (ClassCastException cce) {
//System.out.println(" class cast msg: " + cce.getMessage());
//Dalvik throws terser message than Hotspot VM
- assert(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7));
+ Main.assertTrue(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7));
}
- assert(!(thisRef instanceof java.math.BigDecimal));
+ Main.assertTrue(!(thisRef instanceof java.math.BigDecimal));
/* try some stuff with a null reference */
classes = (Classes) nullRef;
classes = (MoreClasses) nullRef;
more = (MoreClasses) nullRef;
- assert(!(nullRef instanceof Classes));
+ Main.assertTrue(!(nullRef instanceof Classes));
}
static void xTests(Object x) {
- assert( x instanceof Classes);
- assert(!(x instanceof MoreClasses));
+ Main.assertTrue( x instanceof Classes);
+ Main.assertTrue(!(x instanceof MoreClasses));
}
static void yTests(Object y) {
- assert( y instanceof Classes);
- assert( y instanceof MoreClasses);
+ Main.assertTrue( y instanceof Classes);
+ Main.assertTrue( y instanceof MoreClasses);
}
static void xarTests(Object xar) {
- assert( xar instanceof Object);
- assert(!(xar instanceof Classes));
- assert( xar instanceof Classes[]);
- assert(!(xar instanceof MoreClasses[]));
- assert( xar instanceof Object[]);
- assert(!(xar instanceof Object[][]));
+ Main.assertTrue( xar instanceof Object);
+ Main.assertTrue(!(xar instanceof Classes));
+ Main.assertTrue( xar instanceof Classes[]);
+ Main.assertTrue(!(xar instanceof MoreClasses[]));
+ Main.assertTrue( xar instanceof Object[]);
+ Main.assertTrue(!(xar instanceof Object[][]));
}
static void yarTests(Object yar) {
- assert( yar instanceof Classes[]);
- assert( yar instanceof MoreClasses[]);
+ Main.assertTrue( yar instanceof Classes[]);
+ Main.assertTrue( yar instanceof MoreClasses[]);
}
static void xarararTests(Object xararar) {
- assert( xararar instanceof Object);
- assert( xararar instanceof Object[]);
- assert(!(xararar instanceof Classes));
- assert(!(xararar instanceof Classes[]));
- assert(!(xararar instanceof Classes[][]));
- assert( xararar instanceof Classes[][][]);
- assert(!(xararar instanceof MoreClasses[][][]));
- assert( xararar instanceof Object[][][]);
- assert( xararar instanceof Serializable);
- assert( xararar instanceof Serializable[]);
- assert( xararar instanceof Serializable[][]);
- assert(!(xararar instanceof Serializable[][][]));
+ Main.assertTrue( xararar instanceof Object);
+ Main.assertTrue( xararar instanceof Object[]);
+ Main.assertTrue(!(xararar instanceof Classes));
+ Main.assertTrue(!(xararar instanceof Classes[]));
+ Main.assertTrue(!(xararar instanceof Classes[][]));
+ Main.assertTrue( xararar instanceof Classes[][][]);
+ Main.assertTrue(!(xararar instanceof MoreClasses[][][]));
+ Main.assertTrue( xararar instanceof Object[][][]);
+ Main.assertTrue( xararar instanceof Serializable);
+ Main.assertTrue( xararar instanceof Serializable[]);
+ Main.assertTrue( xararar instanceof Serializable[][]);
+ Main.assertTrue(!(xararar instanceof Serializable[][][]));
}
static void yarararTests(Object yararar) {
- assert( yararar instanceof Classes[][][]);
- assert( yararar instanceof MoreClasses[][][]);
+ Main.assertTrue( yararar instanceof Classes[][][]);
+ Main.assertTrue( yararar instanceof MoreClasses[][][]);
}
static void iarTests(Object iar) {
- assert( iar instanceof Object);
- assert(!(iar instanceof Object[]));
+ Main.assertTrue( iar instanceof Object);
+ Main.assertTrue(!(iar instanceof Object[]));
}
static void iararTests(Object iarar) {
- assert( iarar instanceof Object);
- assert( iarar instanceof Object[]);
- assert(!(iarar instanceof Object[][]));
+ Main.assertTrue( iarar instanceof Object);
+ Main.assertTrue( iarar instanceof Object[]);
+ Main.assertTrue(!(iarar instanceof Object[][]));
}
/*
@@ -186,7 +186,7 @@
/* this is expected to fail; 1073921584 * 4 overflows 32 bits */
try {
String[][][][][] multiX = new String[5][2][3][2][1073921584];
- assert(false);
+ Main.assertTrue(false);
} catch (Error e) {
//System.out.println(" Got expected failure: " + e);
}
@@ -210,7 +210,7 @@
public MoreClasses() {}
public void subFunc(boolean wantSub) {
- assert(wantSub);
+ Main.assertTrue(wantSub);
}
public void superFunc(boolean wantSub) {
diff --git a/test/003-omnibus-opcodes/src/Compare.java b/test/003-omnibus-opcodes/src/Compare.java
index 43a708a..c0b2fd5 100644
--- a/test/003-omnibus-opcodes/src/Compare.java
+++ b/test/003-omnibus-opcodes/src/Compare.java
@@ -14,42 +14,42 @@
System.out.println("IntMath.testIntCompare");
if (minus > plus)
- assert(false);
+ Main.assertTrue(false);
if (minus >= plus)
- assert(false);
+ Main.assertTrue(false);
if (plus < minus)
- assert(false);
+ Main.assertTrue(false);
if (plus <= minus)
- assert(false);
+ Main.assertTrue(false);
if (plus == minus)
- assert(false);
+ Main.assertTrue(false);
if (plus != plus2)
- assert(false);
+ Main.assertTrue(false);
/* try a branch-taken */
if (plus != minus) {
- assert(true);
+ Main.assertTrue(true);
} else {
- assert(false);
+ Main.assertTrue(false);
}
if (minus > 0)
- assert(false);
+ Main.assertTrue(false);
if (minus >= 0)
- assert(false);
+ Main.assertTrue(false);
if (plus < 0)
- assert(false);
+ Main.assertTrue(false);
if (plus <= 0)
- assert(false);
+ Main.assertTrue(false);
if (plus == 0)
- assert(false);
+ Main.assertTrue(false);
if (zero != 0)
- assert(false);
+ Main.assertTrue(false);
if (zero == 0) {
- assert(true);
+ Main.assertTrue(true);
} else {
- assert(false);
+ Main.assertTrue(false);
}
}
@@ -63,39 +63,39 @@
System.out.println("IntMath.testLongCompare");
if (minus > plus)
- assert(false);
+ Main.assertTrue(false);
if (plus < minus)
- assert(false);
+ Main.assertTrue(false);
if (plus == minus)
- assert(false);
+ Main.assertTrue(false);
if (plus >= plus+1)
- assert(false);
+ Main.assertTrue(false);
if (minus >= minus+1)
- assert(false);
+ Main.assertTrue(false);
/* try a branch-taken */
if (plus != minus) {
- assert(true);
+ Main.assertTrue(true);
} else {
- assert(false);
+ Main.assertTrue(false);
}
/* compare when high words are equal but low words differ */
if (plus > alsoPlus)
- assert(false);
+ Main.assertTrue(false);
if (alsoPlus < plus)
- assert(false);
+ Main.assertTrue(false);
if (alsoPlus == plus)
- assert(false);
+ Main.assertTrue(false);
/* high words are equal, low words have apparently different signs */
if (minus < alsoMinus) // bug!
- assert(false);
+ Main.assertTrue(false);
if (alsoMinus > minus)
- assert(false);
+ Main.assertTrue(false);
if (alsoMinus == minus)
- assert(false);
+ Main.assertTrue(false);
}
/*
@@ -106,29 +106,29 @@
System.out.println("IntMath.testFloatCompare");
if (minus > plus)
- assert(false);
+ Main.assertTrue(false);
if (plus < minus)
- assert(false);
+ Main.assertTrue(false);
if (plus == minus)
- assert(false);
+ Main.assertTrue(false);
if (plus != plus2)
- assert(false);
+ Main.assertTrue(false);
if (plus <= nan)
- assert(false);
+ Main.assertTrue(false);
if (plus >= nan)
- assert(false);
+ Main.assertTrue(false);
if (minus <= nan)
- assert(false);
+ Main.assertTrue(false);
if (minus >= nan)
- assert(false);
+ Main.assertTrue(false);
if (nan >= plus)
- assert(false);
+ Main.assertTrue(false);
if (nan <= plus)
- assert(false);
+ Main.assertTrue(false);
if (nan == nan)
- assert(false);
+ Main.assertTrue(false);
}
static void testDoubleCompare(double minus, double plus, double plus2,
@@ -136,29 +136,29 @@
System.out.println("IntMath.testDoubleCompare");
if (minus > plus)
- assert(false);
+ Main.assertTrue(false);
if (plus < minus)
- assert(false);
+ Main.assertTrue(false);
if (plus == minus)
- assert(false);
+ Main.assertTrue(false);
if (plus != plus2)
- assert(false);
+ Main.assertTrue(false);
if (plus <= nan)
- assert(false);
+ Main.assertTrue(false);
if (plus >= nan)
- assert(false);
+ Main.assertTrue(false);
if (minus <= nan)
- assert(false);
+ Main.assertTrue(false);
if (minus >= nan)
- assert(false);
+ Main.assertTrue(false);
if (nan >= plus)
- assert(false);
+ Main.assertTrue(false);
if (nan <= plus)
- assert(false);
+ Main.assertTrue(false);
if (nan == nan)
- assert(false);
+ Main.assertTrue(false);
}
public static void run() {
diff --git a/test/003-omnibus-opcodes/src/FloatMath.java b/test/003-omnibus-opcodes/src/FloatMath.java
index 3c49402..0658a65 100644
--- a/test/003-omnibus-opcodes/src/FloatMath.java
+++ b/test/003-omnibus-opcodes/src/FloatMath.java
@@ -16,102 +16,102 @@
/* float --> int */
f = 1234.5678f;
i = (int) f;
- assert(i == 1234);
+ Main.assertTrue(i == 1234);
f = -1234.5678f;
i = (int) f;
- assert(i == -1234);
+ Main.assertTrue(i == -1234);
/* float --> long */
f = 1238.5678f;
l = (long) f;
- assert(l == 1238);
+ Main.assertTrue(l == 1238);
f = -1238.5678f;
l = (long) f;
- assert(l == -1238);
+ Main.assertTrue(l == -1238);
/* float --> double */
f = 1238.5678f;
d = (double) f;
- assert(d > 1238.567 && d < 1238.568);
+ Main.assertTrue(d > 1238.567 && d < 1238.568);
/* double --> int */
d = 1234.5678;
i = (int) d;
- assert(i == 1234);
+ Main.assertTrue(i == 1234);
d = -1234.5678;
i = (int) d;
- assert(i == -1234);
+ Main.assertTrue(i == -1234);
/* double --> long */
d = 5678956789.0123;
l = (long) d;
- assert(l == 5678956789L);
+ Main.assertTrue(l == 5678956789L);
d = -5678956789.0123;
l = (long) d;
- assert(l == -5678956789L);
+ Main.assertTrue(l == -5678956789L);
/* double --> float */
d = 1238.5678;
f = (float) d;
- assert(f > 1238.567 && f < 1238.568);
+ Main.assertTrue(f > 1238.567 && f < 1238.568);
/* int --> long */
i = 7654;
l = (long) i;
- assert(l == 7654L);
+ Main.assertTrue(l == 7654L);
i = -7654;
l = (long) i;
- assert(l == -7654L);
+ Main.assertTrue(l == -7654L);
/* int --> float */
i = 1234;
f = (float) i;
- assert(f > 1233.9f && f < 1234.1f);
+ Main.assertTrue(f > 1233.9f && f < 1234.1f);
i = -1234;
f = (float) i;
- assert(f < -1233.9f && f > -1234.1f);
+ Main.assertTrue(f < -1233.9f && f > -1234.1f);
/* int --> double */
i = 1238;
d = (double) i;
- assert(d > 1237.9f && d < 1238.1f);
+ Main.assertTrue(d > 1237.9f && d < 1238.1f);
i = -1238;
d = (double) i;
- assert(d < -1237.9f && d > -1238.1f);
+ Main.assertTrue(d < -1237.9f && d > -1238.1f);
/* long --> int (with truncation) */
l = 5678956789L;
i = (int) l;
- assert(i == 1383989493);
+ Main.assertTrue(i == 1383989493);
l = -5678956789L;
i = (int) l;
- assert(i == -1383989493);
+ Main.assertTrue(i == -1383989493);
/* long --> float */
l = 5678956789L;
f = (float) l;
- assert(f > 5.6789564E9 && f < 5.6789566E9);
+ Main.assertTrue(f > 5.6789564E9 && f < 5.6789566E9);
l = -5678956789L;
f = (float) l;
- assert(f < -5.6789564E9 && f > -5.6789566E9);
+ Main.assertTrue(f < -5.6789564E9 && f > -5.6789566E9);
/* long --> double */
l = 6678956789L;
d = (double) l;
- assert(d > 6.6789567E9 && d < 6.6789568E9);
+ Main.assertTrue(d > 6.6789567E9 && d < 6.6789568E9);
l = -6678956789L;
d = (double) l;
- assert(d < -6.6789567E9 && d > -6.6789568E9);
+ Main.assertTrue(d < -6.6789567E9 && d > -6.6789568E9);
}
/*
@@ -136,12 +136,12 @@
return results;
}
static void floatOperCheck(float[] results) {
- assert(results[0] > 69996.99f && results[0] < 69997.01f);
- assert(results[1] > 70002.99f && results[1] < 70003.01f);
- assert(results[2] > -210000.01f && results[2] < -209999.99f);
- assert(results[3] > -23333.34f && results[3] < -23333.32f);
- assert(results[4] > 0.999f && results[4] < 1.001f);
- assert(results[8] > 70000.99f && results[8] < 70001.01f);
+ Main.assertTrue(results[0] > 69996.99f && results[0] < 69997.01f);
+ Main.assertTrue(results[1] > 70002.99f && results[1] < 70003.01f);
+ Main.assertTrue(results[2] > -210000.01f && results[2] < -209999.99f);
+ Main.assertTrue(results[3] > -23333.34f && results[3] < -23333.32f);
+ Main.assertTrue(results[4] > 0.999f && results[4] < 1.001f);
+ Main.assertTrue(results[8] > 70000.99f && results[8] < 70001.01f);
}
/*
@@ -166,12 +166,12 @@
return results;
}
static void doubleOperCheck(double[] results) {
- assert(results[0] > 69996.99 && results[0] < 69997.01);
- assert(results[1] > 70002.99 && results[1] < 70003.01);
- assert(results[2] > -210000.01 && results[2] < -209999.99);
- assert(results[3] > -23333.34 && results[3] < -23333.32);
- assert(results[4] > 0.999 && results[4] < 1.001);
- assert(results[8] > 70000.99 && results[8] < 70001.01);
+ Main.assertTrue(results[0] > 69996.99 && results[0] < 69997.01);
+ Main.assertTrue(results[1] > 70002.99 && results[1] < 70003.01);
+ Main.assertTrue(results[2] > -210000.01 && results[2] < -209999.99);
+ Main.assertTrue(results[3] > -23333.34 && results[3] < -23333.32);
+ Main.assertTrue(results[4] > 0.999 && results[4] < 1.001);
+ Main.assertTrue(results[8] > 70000.99 && results[8] < 70001.01);
}
/*
@@ -194,12 +194,12 @@
}
static void checkConvI(int[] results) {
System.out.println("FloatMath.checkConvI");
- assert(results[0] == 0x44332211);
- assert(results[1] == 123);
- assert(results[2] == -3);
- assert(results[3] == 0x7fffffff);
- assert(results[4] == 0x80000000);
- assert(results[5] == 0);
+ Main.assertTrue(results[0] == 0x44332211);
+ Main.assertTrue(results[1] == 123);
+ Main.assertTrue(results[2] == -3);
+ Main.assertTrue(results[3] == 0x7fffffff);
+ Main.assertTrue(results[4] == 0x80000000);
+ Main.assertTrue(results[5] == 0);
}
static long[] convL(int i, float f, double d, double zero) {
@@ -214,12 +214,12 @@
}
static void checkConvL(long[] results) {
System.out.println("FloatMath.checkConvL");
- assert(results[0] == 0xFFFFFFFF88776655L);
- assert(results[1] == 123);
- assert(results[2] == -3);
- assert(results[3] == 0x7fffffffffffffffL);
- assert(results[4] == 0x8000000000000000L);
- assert(results[5] == 0);
+ Main.assertTrue(results[0] == 0xFFFFFFFF88776655L);
+ Main.assertTrue(results[1] == 123);
+ Main.assertTrue(results[2] == -3);
+ Main.assertTrue(results[3] == 0x7fffffffffffffffL);
+ Main.assertTrue(results[4] == 0x8000000000000000L);
+ Main.assertTrue(results[5] == 0);
}
static float[] convF(int i, long l, double d) {
@@ -231,7 +231,7 @@
}
static void checkConvF(float[] results) {
System.out.println("FloatMath.checkConvF");
- // TODO: assert values
+ // TODO: Main.assertTrue values
for (int i = 0; i < results.length; i++)
System.out.println(" " + i + ": " + results[i]);
System.out.println("-2.0054409E9, -8.6133031E18, -3.1415927");
@@ -246,7 +246,7 @@
}
static void checkConvD(double[] results) {
System.out.println("FloatMath.checkConvD");
- // TODO: assert values
+ // TODO: Main.assertTrue values
for (int i = 0; i < results.length; i++)
System.out.println(" " + i + ": " + results[i]);
System.out.println("-2.005440939E9, -8.6133032459203287E18, 123.4560012817382");
@@ -256,10 +256,10 @@
System.out.println("FloatMath.checkConsts");
float f = 10.0f; // const/special
- assert(f > 9.9 && f < 10.1);
+ Main.assertTrue(f > 9.9 && f < 10.1);
double d = 10.0; // const-wide/special
- assert(d > 9.9 && d < 10.1);
+ Main.assertTrue(d > 9.9 && d < 10.1);
}
/*
@@ -289,21 +289,21 @@
static void jlmTests(float ff, double dd) {
System.out.println("FloatMath.jlmTests");
- assert(approxEqual(Math.abs(ff), ff, 0.001f));
- assert(approxEqual(Math.abs(-ff), ff, 0.001f));
- assert(approxEqual(Math.min(ff, -5.0f), -5.0f, 0.001f));
- assert(approxEqual(Math.max(ff, -5.0f), ff, 0.001f));
+ Main.assertTrue(approxEqual(Math.abs(ff), ff, 0.001f));
+ Main.assertTrue(approxEqual(Math.abs(-ff), ff, 0.001f));
+ Main.assertTrue(approxEqual(Math.min(ff, -5.0f), -5.0f, 0.001f));
+ Main.assertTrue(approxEqual(Math.max(ff, -5.0f), ff, 0.001f));
- assert(approxEqual(Math.abs(dd), dd, 0.001));
- assert(approxEqual(Math.abs(-dd), dd, 0.001));
- assert(approxEqual(Math.min(dd, -5.0), -5.0, 0.001));
- assert(approxEqual(Math.max(dd, -5.0), dd, 0.001));
+ Main.assertTrue(approxEqual(Math.abs(dd), dd, 0.001));
+ Main.assertTrue(approxEqual(Math.abs(-dd), dd, 0.001));
+ Main.assertTrue(approxEqual(Math.min(dd, -5.0), -5.0, 0.001));
+ Main.assertTrue(approxEqual(Math.max(dd, -5.0), dd, 0.001));
double sq = Math.sqrt(dd);
- assert(approxEqual(sq*sq, dd, 0.001));
+ Main.assertTrue(approxEqual(sq*sq, dd, 0.001));
- assert(approxEqual(0.5403023058681398, Math.cos(1.0), 0.00000001));
- assert(approxEqual(0.8414709848078965, Math.sin(1.0), 0.00000001));
+ Main.assertTrue(approxEqual(0.5403023058681398, Math.cos(1.0), 0.00000001));
+ Main.assertTrue(approxEqual(0.8414709848078965, Math.sin(1.0), 0.00000001));
}
public static void run() {
diff --git a/test/003-omnibus-opcodes/src/InstField.java b/test/003-omnibus-opcodes/src/InstField.java
index 80b95ab..fe322b0 100644
--- a/test/003-omnibus-opcodes/src/InstField.java
+++ b/test/003-omnibus-opcodes/src/InstField.java
@@ -38,25 +38,25 @@
System.out.println("InstField.nullCheck");
try {
int x = nully.mInt1;
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
// good
}
try {
long l = nully.mLong1;
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
// good
}
try {
nully.mInt1 = 5;
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
// good
}
try {
nully.mLong1 = 17L;
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
// good
}
@@ -86,23 +86,23 @@
public void checkFields() {
System.out.println("InstField check...");
- assert(mBoolean1);
- assert(!mBoolean2);
- assert(mByte1 == 127);
- assert(mByte2 == -128);
- assert(mChar1 == 32767);
- assert(mChar2 == 65535);
- assert(mShort1 == 32767);
- assert(mShort2 == -32768);
- assert(mInt1 == 65537);
- assert(mInt2 == -65537);
- assert(mFloat1 > 3.141f && mFloat1 < 3.142f);
- assert(mFloat2 < mFloat1);
- assert(mLong1 == 1234605616436508552L);
- assert(mLong2 == -1234605616436508552L);
- assert(mDouble1 > 3.141592653 && mDouble1 < 3.141592654);
- assert(mDouble2 > mDouble1);
- assert(mVolatileLong1 == 1234605616436508551L);
- assert(mVolatileLong2 == -1234605616436508551L);
+ Main.assertTrue(mBoolean1);
+ Main.assertTrue(!mBoolean2);
+ Main.assertTrue(mByte1 == 127);
+ Main.assertTrue(mByte2 == -128);
+ Main.assertTrue(mChar1 == 32767);
+ Main.assertTrue(mChar2 == 65535);
+ Main.assertTrue(mShort1 == 32767);
+ Main.assertTrue(mShort2 == -32768);
+ Main.assertTrue(mInt1 == 65537);
+ Main.assertTrue(mInt2 == -65537);
+ Main.assertTrue(mFloat1 > 3.141f && mFloat1 < 3.142f);
+ Main.assertTrue(mFloat2 < mFloat1);
+ Main.assertTrue(mLong1 == 1234605616436508552L);
+ Main.assertTrue(mLong2 == -1234605616436508552L);
+ Main.assertTrue(mDouble1 > 3.141592653 && mDouble1 < 3.141592654);
+ Main.assertTrue(mDouble2 > mDouble1);
+ Main.assertTrue(mVolatileLong1 == 1234605616436508551L);
+ Main.assertTrue(mVolatileLong2 == -1234605616436508551L);
}
}
diff --git a/test/003-omnibus-opcodes/src/IntMath.java b/test/003-omnibus-opcodes/src/IntMath.java
index 89194de..ae5a273 100644
--- a/test/003-omnibus-opcodes/src/IntMath.java
+++ b/test/003-omnibus-opcodes/src/IntMath.java
@@ -18,9 +18,9 @@
i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24;
l = i1 | ((long)i2 << 32);
- assert(i1 == 0x44332211);
- assert(i2 == 0xbbaa9988);
- assert(l == 0xbbaa998844332211L);
+ Main.assertTrue(i1 == 0x44332211);
+ Main.assertTrue(i2 == 0xbbaa9988);
+ Main.assertTrue(l == 0xbbaa998844332211L);
l = (long)mBytes[0]
| (long)mBytes[1] << 8
@@ -31,7 +31,7 @@
| (long)mBytes[6] << 48
| (long)mBytes[7] << 56;
- assert(l == 0xbbaa998844332211L);
+ Main.assertTrue(l == 0xbbaa998844332211L);
}
static void shiftTest2() {
@@ -49,7 +49,7 @@
long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) |
(e << 24) | (f << 16) | (g << 8) | h);
- assert(result == 0x1122334455667788L);
+ Main.assertTrue(result == 0x1122334455667788L);
}
static void unsignedShiftTest() {
@@ -65,10 +65,10 @@
c >>>= 4;
i >>>= 4;
- assert((int) b == -1);
- assert((int) s == -1);
- assert((int) c == 0x0fff);
- assert(i == 268435455);
+ Main.assertTrue((int) b == -1);
+ Main.assertTrue((int) s == -1);
+ Main.assertTrue((int) c == 0x0fff);
+ Main.assertTrue(i == 268435455);
}
static void convTest() {
@@ -82,20 +82,20 @@
/* int --> long */
i = 7654;
l = (long) i;
- assert(l == 7654L);
+ Main.assertTrue(l == 7654L);
i = -7654;
l = (long) i;
- assert(l == -7654L);
+ Main.assertTrue(l == -7654L);
/* long --> int (with truncation) */
l = 5678956789L;
i = (int) l;
- assert(i == 1383989493);
+ Main.assertTrue(i == 1383989493);
l = -5678956789L;
i = (int) l;
- assert(i == -1383989493);
+ Main.assertTrue(i == -1383989493);
}
static void charSubTest() {
@@ -107,7 +107,7 @@
/* chars are unsigned-expanded to ints before subtraction */
i = char1 - char2;
- assert(i == 0xffff00ea);
+ Main.assertTrue(i == 0xffff00ea);
}
/*
@@ -143,18 +143,18 @@
int negOne = -results[5];
int plusOne = 1;
int result = (((minInt + plusOne) - plusOne) / negOne) / negOne;
- assert(result == minInt);
+ Main.assertTrue(result == minInt);
- assert(results[0] == 69997);
- assert(results[1] == 70003);
- assert(results[2] == -210000);
- assert(results[3] == 605032704); // overflow / truncate
- assert(results[4] == -23333);
- assert(results[5] == 1);
- assert(results[6] == 70000);
- assert(results[7] == -3);
- assert(results[8] == -70003);
- assert(results[9] == 70000);
+ Main.assertTrue(results[0] == 69997);
+ Main.assertTrue(results[1] == 70003);
+ Main.assertTrue(results[2] == -210000);
+ Main.assertTrue(results[3] == 605032704); // overflow / truncate
+ Main.assertTrue(results[4] == -23333);
+ Main.assertTrue(results[5] == 1);
+ Main.assertTrue(results[6] == 70000);
+ Main.assertTrue(results[7] == -3);
+ Main.assertTrue(results[8] == -70003);
+ Main.assertTrue(results[9] == 70000);
}
/*
@@ -177,14 +177,14 @@
return results;
}
static void lit16Check(int[] results) {
- assert(results[0] == 78777);
- assert(results[1] == -76777);
- assert(results[2] == 77777000);
- assert(results[3] == 77);
- assert(results[4] == 777);
- assert(results[5] == 960);
- assert(results[6] == -39);
- assert(results[7] == -76855);
+ Main.assertTrue(results[0] == 78777);
+ Main.assertTrue(results[1] == -76777);
+ Main.assertTrue(results[2] == 77777000);
+ Main.assertTrue(results[3] == 77);
+ Main.assertTrue(results[4] == 777);
+ Main.assertTrue(results[5] == 960);
+ Main.assertTrue(results[6] == -39);
+ Main.assertTrue(results[7] == -76855);
}
/*
@@ -213,16 +213,16 @@
/* check this edge case while we're here (div-int/lit8) */
int minInt = -2147483648;
int result = minInt / -1;
- assert(result == minInt);
+ Main.assertTrue(result == minInt);
- assert(results[0] == -55545);
- assert(results[1] == 55565);
- assert(results[2] == -555550);
- assert(results[3] == -5555);
- assert(results[4] == -5);
- assert(results[5] == 8);
- assert(results[6] == -1);
- assert(results[7] == 55563);
+ Main.assertTrue(results[0] == -55545);
+ Main.assertTrue(results[1] == 55565);
+ Main.assertTrue(results[2] == -555550);
+ Main.assertTrue(results[3] == -5555);
+ Main.assertTrue(results[4] == -5);
+ Main.assertTrue(results[5] == 8);
+ Main.assertTrue(results[6] == -1);
+ Main.assertTrue(results[7] == 55563);
}
@@ -244,10 +244,10 @@
static void intShiftCheck(int[] results) {
System.out.println("IntMath.intShiftCheck");
- assert(results[0] == 0x00aa0100);
- assert(results[1] == 0xffff00aa);
- assert(results[2] == 0x00ff00aa);
- assert(results[3] == 0xaa00);
+ Main.assertTrue(results[0] == 0x00aa0100);
+ Main.assertTrue(results[1] == 0xffff00aa);
+ Main.assertTrue(results[2] == 0x00ff00aa);
+ Main.assertTrue(results[3] == 0xaa00);
}
/*
@@ -283,20 +283,20 @@
long negOne = -results[5];
long plusOne = 1;
long result = (((minLong + plusOne) - plusOne) / negOne) / negOne;
- assert(result == minLong);
+ Main.assertTrue(result == minLong);
- assert(results[0] == 69999999997L);
- assert(results[1] == 70000000003L);
- assert(results[2] == -210000000000L);
- assert(results[3] == -6833923606740729856L); // overflow
- assert(results[4] == -23333333333L);
- assert(results[5] == 1);
- assert(results[6] == 70000000000L);
- assert(results[7] == -3);
- assert(results[8] == -70000000003L);
- assert(results[9] == 70000000000L);
+ Main.assertTrue(results[0] == 69999999997L);
+ Main.assertTrue(results[1] == 70000000003L);
+ Main.assertTrue(results[2] == -210000000000L);
+ Main.assertTrue(results[3] == -6833923606740729856L); // overflow
+ Main.assertTrue(results[4] == -23333333333L);
+ Main.assertTrue(results[5] == 1);
+ Main.assertTrue(results[6] == 70000000000L);
+ Main.assertTrue(results[7] == -3);
+ Main.assertTrue(results[8] == -70000000003L);
+ Main.assertTrue(results[9] == 70000000000L);
- assert(results.length == 10);
+ Main.assertTrue(results.length == 10);
}
/*
@@ -317,12 +317,12 @@
static long longShiftCheck(long[] results) {
System.out.println("IntMath.longShiftCheck");
- assert(results[0] == 0x96deff00aa010000L);
- assert(results[1] == 0xffffd5aa96deff00L);
- assert(results[2] == 0x0000d5aa96deff00L);
- assert(results[3] == 0xffff96deff000000L);
+ Main.assertTrue(results[0] == 0x96deff00aa010000L);
+ Main.assertTrue(results[1] == 0xffffd5aa96deff00L);
+ Main.assertTrue(results[2] == 0x0000d5aa96deff00L);
+ Main.assertTrue(results[3] == 0xffff96deff000000L);
- assert(results.length == 4);
+ Main.assertTrue(results.length == 4);
return results[0]; // test return-long
}
@@ -337,7 +337,7 @@
return x;
}
static void unopCheck(int result) {
- assert(result == 37);
+ Main.assertTrue(result == 37);
}
static class Shorty {
@@ -359,9 +359,9 @@
return shorts;
}
static void truncateCheck(Shorty shorts) {
- assert(shorts.mShort == -5597); // 0xea23
- assert(shorts.mChar == 59939); // 0xea23
- assert(shorts.mByte == 35); // 0x23
+ Main.assertTrue(shorts.mShort == -5597); // 0xea23
+ Main.assertTrue(shorts.mChar == 59939); // 0xea23
+ Main.assertTrue(shorts.mByte == 35); // 0x23
}
/*
@@ -372,25 +372,25 @@
try {
int x = 100 / z;
- assert(false);
+ Main.assertTrue(false);
} catch (ArithmeticException ae) {
}
try {
int x = 100 % z;
- assert(false);
+ Main.assertTrue(false);
} catch (ArithmeticException ae) {
}
try {
long x = 100L / z;
- assert(false);
+ Main.assertTrue(false);
} catch (ArithmeticException ae) {
}
try {
long x = 100L % z;
- assert(false);
+ Main.assertTrue(false);
} catch (ArithmeticException ae) {
}
}
@@ -411,10 +411,10 @@
long longDivResult = mostNegLong / ldiv;
long longModResult = mostNegLong % ldiv;
- assert(intDivResult == mostNegInt);
- assert(intModResult == 0);
- assert(longDivResult == mostNegLong);
- assert(longModResult == 0);
+ Main.assertTrue(intDivResult == mostNegInt);
+ Main.assertTrue(intModResult == 0);
+ Main.assertTrue(longDivResult == mostNegLong);
+ Main.assertTrue(longModResult == 0);
}
/*
@@ -424,12 +424,12 @@
static void checkConsts(byte small, short medium, int large, long huge) {
System.out.println("IntMath.checkConsts");
- assert(small == 1); // const/4
- assert(medium == -256); // const/16
- assert(medium == -256L); // const-wide/16
- assert(large == -88888); // const
- assert(large == -88888L); // const-wide/32
- assert(huge == 0x9922334455667788L); // const-wide
+ Main.assertTrue(small == 1); // const/4
+ Main.assertTrue(medium == -256); // const/16
+ Main.assertTrue(medium == -256L); // const-wide/16
+ Main.assertTrue(large == -88888); // const
+ Main.assertTrue(large == -88888L); // const-wide/32
+ Main.assertTrue(huge == 0x9922334455667788L); // const-wide
}
/*
@@ -440,15 +440,15 @@
static void jlmTests(int ii, long ll) {
System.out.println("IntMath.jlmTests");
- assert(Math.abs(ii) == ii);
- assert(Math.abs(-ii) == ii);
- assert(Math.min(ii, -5) == -5);
- assert(Math.max(ii, -5) == ii);
+ Main.assertTrue(Math.abs(ii) == ii);
+ Main.assertTrue(Math.abs(-ii) == ii);
+ Main.assertTrue(Math.min(ii, -5) == -5);
+ Main.assertTrue(Math.max(ii, -5) == ii);
- assert(Math.abs(ll) == ll);
- assert(Math.abs(-ll) == ll);
- assert(Math.min(ll, -5L) == -5L);
- assert(Math.max(ll, -5L) == ll);
+ Main.assertTrue(Math.abs(ll) == ll);
+ Main.assertTrue(Math.abs(-ll) == ll);
+ Main.assertTrue(Math.min(ll, -5L) == -5L);
+ Main.assertTrue(Math.max(ll, -5L) == ll);
}
public static void run() {
@@ -475,7 +475,7 @@
intShiftCheck(intResults);
longResults = longShiftTest(0xd5aa96deff00aa01L, 16);
long longRet = longShiftCheck(longResults);
- assert(longRet == 0x96deff00aa010000L);
+ Main.assertTrue(longRet == 0x96deff00aa010000L);
Shorty shorts = truncateTest(-16717277); // 0xff00ea23
truncateCheck(shorts);
diff --git a/test/003-omnibus-opcodes/src/InternedString.java b/test/003-omnibus-opcodes/src/InternedString.java
index 4baab0c..c2a2cd9 100644
--- a/test/003-omnibus-opcodes/src/InternedString.java
+++ b/test/003-omnibus-opcodes/src/InternedString.java
@@ -33,7 +33,7 @@
s = CONST;
System.gc();
// "blahblah" should disappear from the intern list
- assert(strRef.get() == null);
+ Main.assertTrue(strRef.get() == null);
}
private static void testImmortalInternedString() {
@@ -41,9 +41,9 @@
System.gc();
// Class constant string should be entered to the interned table when
// loaded
- assert(CONST == CONST.intern());
+ Main.assertTrue(CONST == CONST.intern());
// and it should survive the gc
- assert(strRef.get() != null);
+ Main.assertTrue(strRef.get() != null);
String s = CONST;
// "Class InternedString" should remain on the intern list
@@ -51,6 +51,6 @@
// Kill s, otherwise the string object is still accessible from root set
s = "";
System.gc();
- assert(strRef.get() == CONST);
+ Main.assertTrue(strRef.get() == CONST);
}
}
diff --git a/test/003-omnibus-opcodes/src/Main.java b/test/003-omnibus-opcodes/src/Main.java
index fb39d76..eecead0 100644
--- a/test/003-omnibus-opcodes/src/Main.java
+++ b/test/003-omnibus-opcodes/src/Main.java
@@ -22,15 +22,6 @@
* Start up.
*/
public static void main(String[] args) {
- boolean assertEnabled = false;
- assert assertEnabled = true;
- if (!assertEnabled) {
- System.out.println("FAIL: assert doesn't work (specify '-ea')\n");
- throw new RuntimeException();
- } else {
- System.out.println("(assertions are enabled)");
- }
-
Main main = new Main();
main.run();
@@ -79,4 +70,10 @@
}
InternedString.run();
}
+
+ public static void assertTrue(boolean condition) {
+ if (!condition) {
+ throw new Error();
+ }
+ }
}
diff --git a/test/003-omnibus-opcodes/src/MethodCall.java b/test/003-omnibus-opcodes/src/MethodCall.java
index f89194b..cddf4a3 100644
--- a/test/003-omnibus-opcodes/src/MethodCall.java
+++ b/test/003-omnibus-opcodes/src/MethodCall.java
@@ -26,7 +26,7 @@
/* overridden method */
int tryThing() {
int val = super.tryThing();
- assert(val == 7);
+ Main.assertTrue(val == 7);
return val;
}
@@ -43,11 +43,11 @@
String[][] a27, String[] a28, String a29)
{
System.out.println("MethodCalls.manyArgs");
- assert(a0 == 0);
- assert(a9 > 8.99 && a9 < 9.01);
- assert(a16 == -16);
- assert(a25 == 25);
- assert(a29.equals("twenty nine"));
+ Main.assertTrue(a0 == 0);
+ Main.assertTrue(a9 > 8.99 && a9 < 9.01);
+ Main.assertTrue(a16 == -16);
+ Main.assertTrue(a25 == 25);
+ Main.assertTrue(a29.equals("twenty nine"));
}
public static void run() {
@@ -60,7 +60,7 @@
inst = null;
try {
inst.directly();
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
// good
}
diff --git a/test/003-omnibus-opcodes/src/Monitor.java b/test/003-omnibus-opcodes/src/Monitor.java
index 66d7c65..506c60f 100644
--- a/test/003-omnibus-opcodes/src/Monitor.java
+++ b/test/003-omnibus-opcodes/src/Monitor.java
@@ -13,7 +13,7 @@
synchronized (obj) {
mVal++;
obj = null; // does NOT cause a failure on exit
- assert(obj == null);
+ Main.assertTrue(obj == null);
}
}
@@ -27,7 +27,7 @@
synchronized (obj) {
mVal++;
}
- assert(false);
+ Main.assertTrue(false);
} catch (NullPointerException npe) {
/* expected */
}
@@ -39,6 +39,6 @@
new Monitor().subTest();
- assert(mVal == 2);
+ Main.assertTrue(mVal == 2);
}
}
diff --git a/test/003-omnibus-opcodes/src/StaticField.java b/test/003-omnibus-opcodes/src/StaticField.java
index 7ccdd7e..d1367b7 100644
--- a/test/003-omnibus-opcodes/src/StaticField.java
+++ b/test/003-omnibus-opcodes/src/StaticField.java
@@ -54,23 +54,23 @@
public static void checkFields() {
System.out.println("StaticField check...");
- assert(mBoolean1);
- assert(!mBoolean2);
- assert(mByte1 == 127);
- assert(mByte2 == -128);
- assert(mChar1 == 32767);
- assert(mChar2 == 65535);
- assert(mShort1 == 32767);
- assert(mShort2 == -32768);
- assert(mInt1 == 65537);
- assert(mInt2 == -65537);
- assert(mFloat1 > 3.141f && mFloat2 < 3.142f);
- assert(mFloat2 < mFloat1);
- assert(mLong1 == 1234605616436508552L);
- assert(mLong2 == -1234605616436508552L);
- assert(mDouble1 > 3.141592653 && mDouble1 < 3.141592654);
- assert(mDouble2 > mDouble1);
- assert(mVolatileLong1 == 1234605616436508551L);
- assert(mVolatileLong2 == -1234605616436508551L);
+ Main.assertTrue(mBoolean1);
+ Main.assertTrue(!mBoolean2);
+ Main.assertTrue(mByte1 == 127);
+ Main.assertTrue(mByte2 == -128);
+ Main.assertTrue(mChar1 == 32767);
+ Main.assertTrue(mChar2 == 65535);
+ Main.assertTrue(mShort1 == 32767);
+ Main.assertTrue(mShort2 == -32768);
+ Main.assertTrue(mInt1 == 65537);
+ Main.assertTrue(mInt2 == -65537);
+ Main.assertTrue(mFloat1 > 3.141f && mFloat2 < 3.142f);
+ Main.assertTrue(mFloat2 < mFloat1);
+ Main.assertTrue(mLong1 == 1234605616436508552L);
+ Main.assertTrue(mLong2 == -1234605616436508552L);
+ Main.assertTrue(mDouble1 > 3.141592653 && mDouble1 < 3.141592654);
+ Main.assertTrue(mDouble2 > mDouble1);
+ Main.assertTrue(mVolatileLong1 == 1234605616436508551L);
+ Main.assertTrue(mVolatileLong2 == -1234605616436508551L);
}
}
diff --git a/test/003-omnibus-opcodes/src/Switch.java b/test/003-omnibus-opcodes/src/Switch.java
index 67c82b0..01d8729 100644
--- a/test/003-omnibus-opcodes/src/Switch.java
+++ b/test/003-omnibus-opcodes/src/Switch.java
@@ -8,17 +8,17 @@
int a = 1;
switch (a) {
- case -1: assert(false); break;
- case 0: assert(false); break;
+ case -1: Main.assertTrue(false); break;
+ case 0: Main.assertTrue(false); break;
case 1: /*correct*/ break;
- case 2: assert(false); break;
- case 3: assert(false); break;
- case 4: assert(false); break;
- default: assert(false); break;
+ case 2: Main.assertTrue(false); break;
+ case 3: Main.assertTrue(false); break;
+ case 4: Main.assertTrue(false); break;
+ default: Main.assertTrue(false); break;
}
switch (a) {
- case 3: assert(false); break;
- case 4: assert(false); break;
+ case 3: Main.assertTrue(false); break;
+ case 4: Main.assertTrue(false); break;
default: /*correct*/ break;
}
@@ -26,29 +26,29 @@
switch (a) {
case 0x12345678: /*correct*/ break;
- case 0x12345679: assert(false); break;
- default: assert(false); break;
+ case 0x12345679: Main.assertTrue(false); break;
+ default: Main.assertTrue(false); break;
}
switch (a) {
- case 57: assert(false); break;
- case -6: assert(false); break;
+ case 57: Main.assertTrue(false); break;
+ case -6: Main.assertTrue(false); break;
case 0x12345678: /*correct*/ break;
- case 22: assert(false); break;
- case 3: assert(false); break;
- default: assert(false); break;
+ case 22: Main.assertTrue(false); break;
+ case 3: Main.assertTrue(false); break;
+ default: Main.assertTrue(false); break;
}
switch (a) {
- case -6: assert(false); break;
- case 3: assert(false); break;
+ case -6: Main.assertTrue(false); break;
+ case 3: Main.assertTrue(false); break;
default: /*correct*/ break;
}
a = -5;
switch (a) {
- case 12: assert(false); break;
+ case 12: Main.assertTrue(false); break;
case -5: /*correct*/ break;
- case 0: assert(false); break;
- default: assert(false); break;
+ case 0: Main.assertTrue(false); break;
+ default: Main.assertTrue(false); break;
}
switch (a) {
diff --git a/test/003-omnibus-opcodes/src/Throw.java b/test/003-omnibus-opcodes/src/Throw.java
index 91ee6dd..cc187b4 100644
--- a/test/003-omnibus-opcodes/src/Throw.java
+++ b/test/003-omnibus-opcodes/src/Throw.java
@@ -30,13 +30,13 @@
System.out.println("Throw.one");
try {
throwNullPointerException();
- assert(false);
+ Main.assertTrue(false);
} catch (Exception ex) {
// good
return;
}
- assert(false);
+ Main.assertTrue(false);
}
public void twoA() {
@@ -56,9 +56,9 @@
gotN = true;
}
- assert(gotA);
- assert(!gotN);
- assert(!gotWeird);
+ Main.assertTrue(gotA);
+ Main.assertTrue(!gotN);
+ Main.assertTrue(!gotWeird);
}
public void twoN() {
@@ -78,9 +78,9 @@
gotN = true;
}
- assert(!gotA);
- assert(gotN);
- assert(!gotWeird);
+ Main.assertTrue(!gotA);
+ Main.assertTrue(gotN);
+ Main.assertTrue(!gotWeird);
}
public void rethrow() {
@@ -92,10 +92,10 @@
try {
try {
throwNullPointerException();
- assert(false);
+ Main.assertTrue(false);
} catch (Exception ex) {
if (ex instanceof ArithmeticException) {
- assert(false);
+ Main.assertTrue(false);
}
if (ex instanceof NullPointerException) {
caught = true;
@@ -108,9 +108,9 @@
second = true;
}
- assert(caught);
- assert(lly);
- assert(second);
+ Main.assertTrue(caught);
+ Main.assertTrue(lly);
+ Main.assertTrue(second);
}
public static void run() {
diff --git a/test/003-omnibus-opcodes/src/UnresTest1.java b/test/003-omnibus-opcodes/src/UnresTest1.java
index 5a80a7a..a938a5d 100644
--- a/test/003-omnibus-opcodes/src/UnresTest1.java
+++ b/test/003-omnibus-opcodes/src/UnresTest1.java
@@ -8,71 +8,71 @@
UnresStuff stuff = new UnresStuff();
try {
int x = stuff.instField;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try { // hit the same one a second time
int x = stuff.instField;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
stuff.instField = 5;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
double d = stuff.wideInstField;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
stuff.wideInstField = 0.0;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
int y = UnresStuff.staticField;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
UnresStuff.staticField = 17;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
double d = UnresStuff.wideStaticField;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
UnresStuff.wideStaticField = 1.0;
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchFieldError nsfe) {
// good
}
try {
stuff.virtualMethod();
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchMethodError nsfe) {
// good
}
try {
UnresStuff.staticMethod();
- assert(false);
+ Main.assertTrue(false);
} catch (NoSuchMethodError nsfe) {
// good
}
diff --git a/test/003-omnibus-opcodes/src/UnresTest2.java b/test/003-omnibus-opcodes/src/UnresTest2.java
index 768be8f..f1e8dd1 100644
--- a/test/003-omnibus-opcodes/src/UnresTest2.java
+++ b/test/003-omnibus-opcodes/src/UnresTest2.java
@@ -10,13 +10,13 @@
try {
UnresClass un = (UnresClass) obj;
- assert(false);
+ Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
try {
foo = obj instanceof UnresClass;
- assert(false);
+ Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
@@ -31,14 +31,14 @@
try {
un = new UnresClass();
- assert(false);
+ Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
try {
UnresClass[] uar = new UnresClass[3];
- assert(false);
+ Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
// good
}
diff --git a/test/023-many-interfaces/build b/test/023-many-interfaces/build
index fc81d62..a2b7eea 100644
--- a/test/023-many-interfaces/build
+++ b/test/023-many-interfaces/build
@@ -25,4 +25,11 @@
${JAVAC} -d classes src/*.java
dx --debug --dex --dump-to=classes.lst --output=classes.dex classes
-zip test.jar classes.dex
+zip ${ANDROID_PRODUCT_OUT}/system/framework/test.jar classes.dex
+
+dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
diff --git a/test/056-const-string-jumbo/build b/test/056-const-string-jumbo/build
index c5e35db..98f27b8 100644
--- a/test/056-const-string-jumbo/build
+++ b/test/056-const-string-jumbo/build
@@ -44,4 +44,11 @@
dx -JXmx500m --debug --dex --no-optimize --positions=none --no-locals \
--dump-to=classes.lst --output=classes.dex classes
-zip test.jar classes.dex
+zip ${ANDROID_PRODUCT_OUT}/system/framework/test.jar classes.dex
+
+dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
diff --git a/test/085-old-style-inner-class/build b/test/085-old-style-inner-class/build
index dc6f3bb..6f41a0d 100644
--- a/test/085-old-style-inner-class/build
+++ b/test/085-old-style-inner-class/build
@@ -26,4 +26,11 @@
dx --debug --dex --dump-to=classes.lst --output=classes.dex \
--dump-width=1000 classes 2>/dev/null
-zip test.jar classes.dex
+zip ${ANDROID_PRODUCT_OUT}/system/framework/test.jar classes.dex
+
+dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
diff --git a/test/etc/default-build b/test/etc/default-build
index b8df442..dcc372a 100755
--- a/test/etc/default-build
+++ b/test/etc/default-build
@@ -26,7 +26,14 @@
dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \
--dump-width=1000 classes
-zip test.jar classes.dex
+zip ${ANDROID_PRODUCT_OUT}/system/framework/test.jar classes.dex
+
+dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
if [ -r src-ex ]; then
mkdir classes-ex
@@ -37,7 +44,14 @@
# quick shuffle so that the stored name is "classes.dex"
mv classes.dex classes-1.dex
mv classes-ex.dex classes.dex
- zip test-ex.jar classes.dex
+ zip ${ANDROID_PRODUCT_OUT}/system/framework/test-ex.jar classes.dex
mv classes.dex classes-ex.dex
mv classes-1.dex classes.dex
+
+ dex2oatd -Xms16m -Xmx16m \
+ --boot-dex-file=${ANDROID_PRODUCT_OUT}/system/framework/core.jar \
+ --boot=${ANDROID_PRODUCT_OUT}/system/framework/core.oat \
+ --dex-file=${ANDROID_PRODUCT_OUT}/system/framework/test-ex.jar \
+ --image=${ANDROID_PRODUCT_OUT}/system/framework/test-ex.oat \
+ --strip-prefix=${ANDROID_PRODUCT_OUT}
fi
diff --git a/test/etc/push-and-run-test-jar b/test/etc/push-and-run-test-jar
index e2fde42..8b490cd 100755
--- a/test/etc/push-and-run-test-jar
+++ b/test/etc/push-and-run-test-jar
@@ -106,11 +106,15 @@
msg "------------------------------"
if [ "$QUIET" = "n" ]; then
- adb push test.jar /data
- adb push test-ex.jar /data
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test.jar /system/framework
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test.oat /system/framework
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test-ex.jar /system/framework
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test-ex.oat /system/framework
else
- adb push test.jar /data >/dev/null 2>&1
- adb push test-ex.jar /data >/dev/null 2>&1
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test.jar /system/framework >/dev/null 2>&1
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test.oat /system/framework >/dev/null 2>&1
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test-ex.jar /system/framework >/dev/null 2>&1
+ adb push ${ANDROID_PRODUCT_OUT}/system/framework/test-ex.oat /system/framework >/dev/null 2>&1
fi
if [ "$DEBUG" = "y" ]; then
@@ -126,10 +130,15 @@
if [ "$ZYGOTE" = "y" ]; then
adb shell cd /data \; dvz -classpath test.jar Main "$@"
else
- cmdline="cd /data; dalvikvm $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG \
- $GC_OPTS -cp test.jar -Xint:${INTERP} -ea Main"
+ cmdline="cd /data; oatexecd -Xbootclasspath:/system/framework/core.jar \
+ -Xbootimage:/system/framework/core.oat \
+ -classpath /system/framework/test.jar \
+ -Ximage:/system/framework/test.oat Main"
+ #cmdline="cd /data; dalvikvm $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG \
+ # $GC_OPTS -cp test.jar -Xint:${INTERP} -ea Main"
if [ "$DEV_MODE" = "y" ]; then
echo $cmdline "$@"
fi
+
adb shell $cmdline "$@"
fi