Makefile: optional call file for testcases
authorBernhard Urban <lewurm@gmail.com>
Sun, 20 May 2012 00:00:10 +0000 (02:00 +0200)
committerBernhard Urban <lewurm@gmail.com>
Sun, 20 May 2012 00:10:14 +0000 (02:10 +0200)
in order to easier pass arguments to the JVM for certain testcases,
e.g. classpath stuff

15 files changed:
Makefile
tests/ClassPath2.call [new file with mode: 0644]
tests/ClassPath2.compile [new file with mode: 0644]
tests/ClassPath2.java [new file with mode: 0644]
tests/ClassPath3.call [new file with mode: 0644]
tests/ClassPath3.compile [new file with mode: 0644]
tests/ClassPath3.java [new file with mode: 0644]
tests/JARUsage1.call [new file with mode: 0644]
tests/JARUsage1.compile [new file with mode: 0644]
tests/JARUsage1.java [new file with mode: 0644]
tests/JARUsage2.call [new file with mode: 0644]
tests/JARUsage2.java [new file with mode: 0644]
tests/jar1.jar [new file with mode: 0644]
tests/this/is/a/class/path/test/ClassPath1.java [new file with mode: 0644]
tests/this/is/a/class/path/test/ClassPath2.java [new file with mode: 0644]

index 55954ae8cfe96aae03f252afb352f5063ac37cc2..48a1b4085ef31f34394ffa0c4e6a99ec7eeb5063 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -25,12 +25,18 @@ all: mate $(CLASS_FILES)
 
 tests: mate $(TEST_CLASS_FILES)
 
+CALLF = $(basename $@).call
+testcase = ./tools/openjdktest.sh "$(1) $(basename $@)"
 %.test: %.class mate
-       @./tools/openjdktest.sh $(basename $@)
-
+       @if [ -f $(CALLF) ]; \
+               then $(call testcase,`cat $(CALLF)`); \
+               else $(call testcase, ); fi
 
+COMPILEF = $(basename $@).compile
 %.class: %.java
-       $(JAVAC) $<
+       @if [ -f $(COMPILEF) ]; \
+               then $(SHELL) $(COMPILEF); \
+               else $(JAVAC) $<; fi
 
 ffi/native.o: ffi/native.c
        ghc -Wall -O2 -c $< -o $@
diff --git a/tests/ClassPath2.call b/tests/ClassPath2.call
new file mode 100644 (file)
index 0000000..7047aa4
--- /dev/null
@@ -0,0 +1 @@
+-cp .:tests/this/is/a/class
diff --git a/tests/ClassPath2.compile b/tests/ClassPath2.compile
new file mode 100644 (file)
index 0000000..1bdc2d3
--- /dev/null
@@ -0,0 +1,2 @@
+javac tests/this/is/a/class/path/test/ClassPath1.java
+javac -classpath tests/this/is/a/class tests/ClassPath2.java
diff --git a/tests/ClassPath2.java b/tests/ClassPath2.java
new file mode 100644 (file)
index 0000000..e4cbc5f
--- /dev/null
@@ -0,0 +1,7 @@
+package tests;
+
+public class ClassPath2 {
+       public static void main(String args[]) {
+               path.test.ClassPath1.hello();
+       }
+}
diff --git a/tests/ClassPath3.call b/tests/ClassPath3.call
new file mode 100644 (file)
index 0000000..2b0240e
--- /dev/null
@@ -0,0 +1 @@
+-cp tests/this/is/a/class:. path.test.ClassPath2
diff --git a/tests/ClassPath3.compile b/tests/ClassPath3.compile
new file mode 100644 (file)
index 0000000..2498b45
--- /dev/null
@@ -0,0 +1 @@
+javac tests/this/is/a/class/path/test/ClassPath2.java
diff --git a/tests/ClassPath3.java b/tests/ClassPath3.java
new file mode 100644 (file)
index 0000000..ad4b204
--- /dev/null
@@ -0,0 +1,7 @@
+package tests;
+
+public class ClassPath3 {
+       public static void main(String args[]) {
+               // fake
+       }
+}
diff --git a/tests/JARUsage1.call b/tests/JARUsage1.call
new file mode 100644 (file)
index 0000000..b588bde
--- /dev/null
@@ -0,0 +1 @@
+-cp .:tests/jar1.jar
diff --git a/tests/JARUsage1.compile b/tests/JARUsage1.compile
new file mode 100644 (file)
index 0000000..8473ead
--- /dev/null
@@ -0,0 +1 @@
+javac -classpath tests/jar1.jar tests/JARUsage1.java
diff --git a/tests/JARUsage1.java b/tests/JARUsage1.java
new file mode 100644 (file)
index 0000000..8eb2dd5
--- /dev/null
@@ -0,0 +1,7 @@
+package tests;
+
+public class JARUsage1 {
+       public static void main(String []args) {
+               javaapplication2.NewClass.OHAI();
+       }
+}
diff --git a/tests/JARUsage2.call b/tests/JARUsage2.call
new file mode 100644 (file)
index 0000000..8975e0c
--- /dev/null
@@ -0,0 +1 @@
+-jar tests/jar1.jar
diff --git a/tests/JARUsage2.java b/tests/JARUsage2.java
new file mode 100644 (file)
index 0000000..839b087
--- /dev/null
@@ -0,0 +1,7 @@
+package tests;
+
+public class JARUsage2 {
+       public static void main(String []args) {
+               // dummy
+       }
+}
diff --git a/tests/jar1.jar b/tests/jar1.jar
new file mode 100644 (file)
index 0000000..3c2cd94
Binary files /dev/null and b/tests/jar1.jar differ
diff --git a/tests/this/is/a/class/path/test/ClassPath1.java b/tests/this/is/a/class/path/test/ClassPath1.java
new file mode 100644 (file)
index 0000000..00db0da
--- /dev/null
@@ -0,0 +1,11 @@
+package path.test;
+
+public class ClassPath1 {
+       public static void hello () {
+               System.out.printf("hello, i'm ClassPath1\n");
+       }
+
+       public static void main(String []args) {
+               System.out.printf("hello again\n");
+       }
+}
diff --git a/tests/this/is/a/class/path/test/ClassPath2.java b/tests/this/is/a/class/path/test/ClassPath2.java
new file mode 100644 (file)
index 0000000..8c97eec
--- /dev/null
@@ -0,0 +1,7 @@
+package path.test;
+
+public class ClassPath2 {
+       public static void main(String []args) {
+               System.out.printf("hello again\n");
+       }
+}