Skip to contentSkip to conversation

0/3] Add openjdk oeqa tests

PATCH Superseded Richard Leitner 1 participant 4 messages Jun 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 0/3] Add openjdk oeqa tests

This patch-series adds tests and images for openjdk and openjre. They will be the basis of future quality gates for accepting patches.

Changes v2:
+ Add "Testing" section to README
+ Adapt dependencies of java jar tests to "java_exists"

Richard Leitner (3):
oeqa: runtime: add java & javac testcases
images/classes: add open{jdk,jre}-{7,8} test
README: add "Testing" section

 README                                        |  16 +++++++
 classes/openjdk-test-image.bbclass            |   5 +++
 classes/openjre-test-image.bbclass            |   9 ++++
 lib/oeqa/files/test.jar                       | Bin 0 -> 8164 bytes
 lib/oeqa/files/test.java                      |   8 ++++
 lib/oeqa/runtime/cases/java.py                |  60 ++++++++++++++++++++++++++
 lib/oeqa/runtime/cases/javac.py               |  32 ++++++++++++++
 recipes-images/images/openjdk-7-test-image.bb |   3 ++
 recipes-images/images/openjdk-8-test-image.bb |   3 ++
 recipes-images/images/openjre-7-test-image.bb |   3 ++
 recipes-images/images/openjre-8-test-image.bb |   3 ++
 11 files changed, 142 insertions(+)
 create mode 100644 classes/openjdk-test-image.bbclass
 create mode 100644 classes/openjre-test-image.bbclass
 create mode 100644 lib/oeqa/files/test.jar
 create mode 100644 lib/oeqa/files/test.java
 create mode 100644 lib/oeqa/runtime/cases/java.py
 create mode 100644 lib/oeqa/runtime/cases/javac.py
 create mode 100644 recipes-images/images/openjdk-7-test-image.bb
 create mode 100644 recipes-images/images/openjdk-8-test-image.bb
 create mode 100644 recipes-images/images/openjre-7-test-image.bb
 create mode 100644 recipes-images/images/openjre-8-test-image.bb
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/1 1/3] oeqa: runtime: add java & javac testcases

These testcases verify that java and javac are working. They will be used as "quality-gate" test for accepting patches in the future.

---
 lib/oeqa/files/test.jar         | Bin 0 -> 8164 bytes
 lib/oeqa/files/test.java        |   8 ++++++
 lib/oeqa/runtime/cases/java.py  |  60 ++++++++++++++++++++++++++++++++++++++++
 lib/oeqa/runtime/cases/javac.py |  32 +++++++++++++++++++++
 4 files changed, 100 insertions(+)
 create mode 100644 lib/oeqa/files/test.jar
 create mode 100644 lib/oeqa/files/test.java
 create mode 100644 lib/oeqa/runtime/cases/java.py
 create mode 100644 lib/oeqa/runtime/cases/javac.py
lib/oeqa/files/test.jar new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..a539b22991dc516ec6057d43a5e8f3a42c4d8f51
GIT binary patch
lib/oeqa/files/test.java new file +8 -0
new file mode 100644
index 0000000..a661972
@@ -0,0 +1,8 @@
+package test;
+
+public class test {
+	public static void main(String[] args) {
+		System.out.println("the answer is 42");
+	}
+
+}
lib/oeqa/runtime/cases/java.py new file +60 -0

60 lines not on this page · raw message

lib/oeqa/runtime/cases/javac.py new file +32 -0
new file mode 100644
index 0000000..ad6de25
@@ -0,0 +1,32 @@
+import os
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.runtime.decorator.package import OEHasPackage
+
+class JavacTest(OERuntimeTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        myfilesdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../files/')
+        src = os.path.join(myfilesdir, 'test.java')
+        dst = '/tmp/test.java'
+        cls.tc.target.copyTo(src, dst)
+
+    @classmethod
+    def tearDownClass(cls):
+        dst = '/tmp/test.java /tmp/test.class'
+        cls.tc.target.run('rm %s' % dst)
+
+    @OETestDepends(['java.JavaTest.test_java_exists'])
+    def test_javac_exists(self):
+        status, output = self.target.run('which javac')
+        msg = 'javac binary not in PATH or not on target.'
+        self.assertEqual(status, 0, msg=msg)
+
+    @OETestDepends(['javac.JavacTest.test_javac_exists'])
+    def test_javac_works(self):
+        status, output = self.target.run('javac /tmp/test.java')
+        msg = 'Exit status was not 0. Output: %s' % output
+        self.assertEqual(status, 0, msg=msg)
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 1/1 2/3] images/classes: add open{jdk, jre}-{7, 8} test

In reply to Richard Leitner

Add image classes and images for open{jdk,jre}-{7,8} oeqa tests. These will be the basis for future "quality gates".

---
 classes/openjdk-test-image.bbclass            | 5 +++++
 classes/openjre-test-image.bbclass            | 9 +++++++++
 recipes-images/images/openjdk-7-test-image.bb | 3 +++
 recipes-images/images/openjdk-8-test-image.bb | 3 +++
 recipes-images/images/openjre-7-test-image.bb | 3 +++
 recipes-images/images/openjre-8-test-image.bb | 3 +++
 6 files changed, 26 insertions(+)
 create mode 100644 classes/openjdk-test-image.bbclass
 create mode 100644 classes/openjre-test-image.bbclass
 create mode 100644 recipes-images/images/openjdk-7-test-image.bb
 create mode 100644 recipes-images/images/openjdk-8-test-image.bb
 create mode 100644 recipes-images/images/openjre-7-test-image.bb
 create mode 100644 recipes-images/images/openjre-8-test-image.bb
classes/openjdk-test-image.bbclass new file +5 -0
new file mode 100644
index 0000000..f6e4fca
@@ -0,0 +1,5 @@
+DESCRIPTION = "An image for OpenJDK testing purposes"
+
+TEST_SUITES_append = " javac"
+
+inherit openjre-test-image
classes/openjre-test-image.bbclass new file +9 -0
new file mode 100644
index 0000000..77dbd74
@@ -0,0 +1,9 @@
+DESCRIPTION = "An image for OpenJRE testing purposes"
+
+IMAGE_FEATURES += "ssh-server-openssh package-management"
+
+IMAGE_INSTALL = "${CORE_IMAGE_BASE_INSTALL}"
+
+DEFAULT_TEST_SUITES_pn-${PN} = "ping ssh java"
+
+inherit core-image
recipes-images/images/openjdk-7-test-image.bb new file +3 -0
new file mode 100644
index 0000000..1e6d734
@@ -0,0 +1,3 @@
+IMAGE_INSTALL_append = " openjdk-7-jdk "
+
+inherit openjdk-test-image
recipes-images/images/openjdk-8-test-image.bb new file +3 -0
new file mode 100644
index 0000000..d2eb040
@@ -0,0 +1,3 @@
+IMAGE_INSTALL_append = " openjdk-8 "
+
+inherit openjdk-test-image
recipes-images/images/openjre-7-test-image.bb new file +3 -0
new file mode 100644
index 0000000..2616255
@@ -0,0 +1,3 @@
+IMAGE_INSTALL_append = " openjdk-7-jre "
+
+inherit openjre-test-image
recipes-images/images/openjre-8-test-image.bb new file +3 -0
new file mode 100644
index 0000000..e722ec3
@@ -0,0 +1,3 @@
+IMAGE_INSTALL_append = " openjre-8 "
+
+inherit openjre-test-image
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 1/1 3/3] README: add "Testing" section

In reply to Richard Leitner

Add new "Testing" section in README where we describe how meta-java tests may be used.

---
 README | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
README +16 -0
index b66df64..17a25e7 100644
@@ -57,6 +57,22 @@ Main layer maintainers:
   Otavio Salvador <[email protected]>
   Richard Leitner <[email protected]>
 
+Testing
+-------
+
+The meta-java layer may be tested using oeqa's runtime image tests. The easiest
+way is to add the following configuration to your local.conf:
+
+SANITY_TESTED_DISTROS=""
+TEST_IMAGE = "1"
+
+Then you should be able to use the open{jre,jdk}-{7,8}-test-image recipes.
+Furthermore you could also include the tests provided in lib/oeqa/runtime/cases
+into your test image. More information on image testing is available at:
+
+	https://wiki.yoctoproject.org/wiki/Image_tests
+
+
 Usage instructions
 ------------------
 
Signature · 1 line
2.11.0