From 54347c2642928aa91b55178a8c697e2c1ddd8cac Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Wed, 5 Jun 2024 12:49:25 +0100 Subject: [PATCH] Java: add basic ECJ integration tests --- .../all-platforms/java/ecj-sample-noexit/Test.java | 1 + .../all-platforms/java/ecj-sample-noexit/test.expected | 1 + .../all-platforms/java/ecj-sample-noexit/test.py | 6 ++++++ .../all-platforms/java/ecj-sample-noexit/test.ql | 3 +++ .../all-platforms/java/ecj-sample/Test.java | 1 + .../all-platforms/java/ecj-sample/test.expected | 1 + .../integration-tests/all-platforms/java/ecj-sample/test.py | 6 ++++++ .../integration-tests/all-platforms/java/ecj-sample/test.ql | 3 +++ 8 files changed, 22 insertions(+) create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/Test.java create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.expected create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.py create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.ql create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample/Test.java create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample/test.expected create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample/test.py create mode 100644 java/ql/integration-tests/all-platforms/java/ecj-sample/test.ql diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/Test.java b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/Test.java new file mode 100644 index 000000000000..fd283abf4686 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/Test.java @@ -0,0 +1 @@ +public class Test { } diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.expected b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.expected new file mode 100644 index 000000000000..8f3e41e24f08 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.expected @@ -0,0 +1 @@ +| Test.java:1:14:1:17 | Test | diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.py b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.py new file mode 100644 index 000000000000..1478610427ae --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.py @@ -0,0 +1,6 @@ +import urllib.request +from create_database_utils import * + +urllib.request.urlretrieve("https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.37.0/ecj-3.37.0.jar", "ecj.jar") + +run_codeql_database_create(["java -cp ecj.jar org.eclipse.jdt.internal.compiler.batch.Main -noExit Test.java"], lang="java") diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.ql b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.ql new file mode 100644 index 000000000000..a61eb5e336a8 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample-noexit/test.ql @@ -0,0 +1,3 @@ +import java + +select any(Class c | c.fromSource()) diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample/Test.java b/java/ql/integration-tests/all-platforms/java/ecj-sample/Test.java new file mode 100644 index 000000000000..fd283abf4686 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample/Test.java @@ -0,0 +1 @@ +public class Test { } diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample/test.expected b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.expected new file mode 100644 index 000000000000..8f3e41e24f08 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.expected @@ -0,0 +1 @@ +| Test.java:1:14:1:17 | Test | diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample/test.py b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.py new file mode 100644 index 000000000000..9acadbdb6f1f --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.py @@ -0,0 +1,6 @@ +import urllib.request +from create_database_utils import * + +urllib.request.urlretrieve("https://repo1.maven.org/maven2/org/eclipse/jdt/ecj/3.37.0/ecj-3.37.0.jar", "ecj.jar") + +run_codeql_database_create(["java -cp ecj.jar org.eclipse.jdt.internal.compiler.batch.Main Test.java"], lang="java") diff --git a/java/ql/integration-tests/all-platforms/java/ecj-sample/test.ql b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.ql new file mode 100644 index 000000000000..a61eb5e336a8 --- /dev/null +++ b/java/ql/integration-tests/all-platforms/java/ecj-sample/test.ql @@ -0,0 +1,3 @@ +import java + +select any(Class c | c.fromSource())