Patchwork [RFC,4/4] scripts/lib/selftest: add more simple build tests

login
register
mail settings
Submitter Stanacar, StefanX
Date Nov. 19, 2013, 3:43 p.m.
Message ID <b5be24c1f66a83836b0ca6b2fa19be350ea92664.1384874570.git.stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/61971/
State New
Headers show

Comments

Stanacar, StefanX - Nov. 19, 2013, 3:43 p.m.
From: Alexandru Palalau <alexandrux.palalau@intel.com>

Tests for RM_OLD_IMAGE and for WARN_QA/ERROR_QA behaviour.

Signed-off-by: Alexandru Palalau <alexandrux.palalau@intel.com>
Signed-off-by: Stefan Stanacar <stefanx.stanacar@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

Patch

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)