summaryrefslogtreecommitdiff
path: root/chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
diff options
context:
space:
mode:
Diffstat (limited to 'chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java')
-rw-r--r--chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java b/chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
new file mode 100644
index 00000000..68bbe918
--- /dev/null
+++ b/chapter29/src/test/java/com/seaofnodes/simple/FuzzerWrap.java
@@ -0,0 +1,78 @@
+package com.seaofnodes.simple;
+
+import com.seaofnodes.simple.fuzzer.Fuzzer;
+import java.util.Random;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * To use the fuzzer run the <code>fuzzPeeps</code> methods.
+ * This can be done from IntelliJ Gui or remove the `@Ignore` annotation and start the test case from the command line
+ * via <code>mvn clean test -Dtest=com.seaofnodes.simple.Fuzzer08Test#fuzzPeeps</code>
+ */
+public class FuzzerWrap {
+
+ private static final long[] REGRESSION_SEEDS = {
+ 375135762521757909L, // bad LCA
+ -148471672577312953L, // bulk mem
+ -5037182906211190034L, // dead Guard control
+ -6359653295501938199L, // monotonicity, escape is dead
+ 6506797708065910879L, // required field without a user constructor
+ 650692970082394944L, // recursive bulk mem split
+ 8335100609598232836L, // ternary result killed by region cleanup
+ 2520958273643234516L, // nested guard merge
+ -3772838984504063325L, // fuzzer regression
+ -4628356252269023530L, // idepth cache version wrap
+ -4022199781524079249L, // fuzzer regression
+ 8824787517620928178L, // unknown-mode unary minus during SCCP
+ -673501011619761901L, // peephole killed self
+ -8212834489697770130L, // bad keep/unkeep in parser
+ 478567486335112458L, // dying escape node
+ -5114548365532699915L, // dominate flags dependencies
+ -4710931876754133070L, // Tests monotonic phi widening
+ };
+
+ private static final long[] OPEN_FAILING_SEEDS = {
+ };
+
+
+ @Test public void fuzzPeepsRegression () { fuzzPeepsSeeds( REGRESSION_SEEDS); }
+ @Test @Ignore public void fuzzPeepsOpenFailures() { fuzzPeepsSeeds(OPEN_FAILING_SEEDS); }
+
+ private static void fuzzPeepsSeeds(long... seeds) {
+ var fuzzer = new Fuzzer();
+ for (long seed : seeds)
+ fuzzer.fuzzPeepsRegression(seed);
+ }
+
+ @Ignore
+ @Test
+ public void fuzzPeepsRandom() {
+ Random R = new Random(System.currentTimeMillis());
+ var fuzzer = new Fuzzer();
+ for (int i=0; i<100; i++)
+ fuzzer.fuzzPeeps(R.nextLong());
+ assertTrue(fuzzer.noExceptions());
+ }
+
+
+ @Ignore
+ @Test
+ public void fuzzPeepsLarge() {
+ var fuzzer = new Fuzzer();
+ for (int i=0; i<1000000; i++)
+ fuzzer.fuzzPeeps(i);
+ assertTrue(fuzzer.noExceptions());
+ }
+
+ @Ignore
+ @Test
+ public void fuzzPeepTiming() {
+ var fuzzer = new Fuzzer();
+ int max_nid=0;
+ for (int i=0; i<1000000; i++)
+ max_nid = fuzzer.fuzzPeepTiming(i, max_nid);
+ }
+
+}