[OE-core] [RFC PATCH 4/4] scripts/lib/selftest: add more simple build tests

Stefan Stanacar stefanx.stanacar at intel.com
Tue Nov 19 15:43:37 UTC 2013


From: Alexandru Palalau <alexandrux.palalau at intel.com>

Tests for RM_OLD_IMAGE and for WARN_QA/ERROR_QA behaviour.

Signed-off-by: Alexandru Palalau <alexandrux.palalau at intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
---
 scripts/lib/selftest/tests/__init__.py  |  1 +
 scripts/lib/selftest/tests/bboptions.py | 39 +++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 scripts/lib/selftest/tests/bboptions.py

diff --git a/scripts/lib/selftest/tests/__init__.py b/scripts/lib/selftest/tests/__init__.py
index 3acc480..7826054 100644
--- a/scripts/lib/selftest/tests/__init__.py
+++ b/scripts/lib/selftest/tests/__init__.py
@@ -1 +1,2 @@
 from selftest.tests.bboutput import *
+from selftest.tests.bboptions import *
diff --git a/scripts/lib/selftest/tests/bboptions.py b/scripts/lib/selftest/tests/bboptions.py
new file mode 100644
index 0000000..ad35386
--- /dev/null
+++ b/scripts/lib/selftest/tests/bboptions.py
@@ -0,0 +1,39 @@
+import unittest
+import os
+import logging
+
+from selftest.base import oeSelfTest
+from selftest.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer
+import selftest.utils.ftools as ftools
+
+class OptionsTests(oeSelfTest):
+
+    def test_options_warnqa_errorqa_switch(self):
+        bitbake("xcursor-transparent-theme -ccleansstate")
+
+        if "packages-list" not in get_bb_var("ERROR_QA"):
+            self.write_config("ERROR_QA_append = \" packages-list\"")
+
+        xcursor_path = os.path.join(get_test_layer(), "recipes-test/xcursor-transparent-theme/test_recipe.inc")
+        ftools.write_file(xcursor_path, 'PACKAGES += \"${PN}-dbg\"')
+
+        res = bitbake("xcursor-transparent-theme", ignore_status=True)
+        self.assertTrue("ERROR: QA Issue" in res.output)
+        self.assertEqual(res.status, 1)
+
+        self.append_config("ERROR_QA_remove = \"packages-list\"")
+        self.append_config("WARN_QA_append = \" packages-list\"")
+        bitbake("xcursor-transparent-theme")
+        bitbake("xcursor-transparent-theme -ccleansstate")
+        os.remove(xcursor_path)
+
+    def test_options_rm_old_image(self):
+        bitbake("core-image-minimal")
+
+        deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal")
+        imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal")
+        oldimgpath = os.path.realpath(os.path.join(deploydir, imagename + ".ext3"))
+
+        self.append_config("RM_OLD_IMAGE = \"1\"")
+        bitbake("core-image-minimal")
+        self.assertFalse(os.path.exists(oldimgpath), msg="Old image path still exists: %s" % oldimgpath)
-- 
1.8.3.1




More information about the Openembedded-core mailing list