summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAlexandru Palalau <alexandrux.palalau@intel.com>2013-11-27 19:08:52 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-03 17:45:51 +0000
commitf8ee10865dcde6693f5e7ba47a2a00a4955bdffb (patch)
tree062de7591c75e4381a93586e1223aa5b11870ec4 /meta
parentb9afc0d262160a493a55c9ced6cd285ef29f8feb (diff)
downloadpoky-f8ee10865dcde6693f5e7ba47a2a00a4955bdffb.tar.gz
lib/oeqa/selftest: buildoptions.py: add simple image build tests
Build images and tests different build options like RM_OLD_IMAGE and for WARN_QA/ERROR_QA behaviour. (From OE-Core rev: 75d2a1a37a18a22b0da7ab5b30cf005c78bc313f) Signed-off-by: Alexandru Palalau <alexandrux.palalau@intel.com> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py86
1 files changed, 86 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
new file mode 100644
index 0000000000..f99dda71ff
--- /dev/null
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -0,0 +1,86 @@
1import unittest
2import os
3import logging
4import re
5
6from oeqa.selftest.base import oeSelfTest
7from oeqa.utils.commands import runCmd, bitbake, get_bb_var
8import oeqa.utils.ftools as ftools
9
10class ImageOptionsTests(oeSelfTest):
11
12 def test_incremental_image_generation(self):
13 bitbake("-c cleanall core-image-minimal")
14 self.write_config('INC_RPM_IMAGE_GEN = "1"')
15 self.append_config('IMAGE_FEATURES += "ssh-server-openssh"')
16 bitbake("core-image-minimal")
17 res = runCmd("grep 'Installing openssh-sshd' %s" % (os.path.join(get_bb_var("WORKDIR", "core-image-minimal"), "temp/log.do_rootfs")), ignore_status=True)
18 self.remove_config('IMAGE_FEATURES += "ssh-server-openssh"')
19 self.assertEqual(0, res.status, msg="No match for openssh-sshd in log.do_rootfs")
20 bitbake("core-image-minimal")
21 res = runCmd("grep 'Removing openssh-sshd' %s" %(os.path.join(get_bb_var("WORKDIR", "core-image-minimal"), "temp/log.do_rootfs")),ignore_status=True)
22 self.assertEqual(0, res.status, msg="openssh-sshd was not removed from image")
23
24 def test_rm_old_image(self):
25 bitbake("core-image-minimal")
26 deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal")
27 imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal")
28 oldimgpath = os.path.realpath(os.path.join(deploydir, imagename + ".ext3"))
29 self.append_config("RM_OLD_IMAGE = \"1\"")
30 bitbake("core-image-minimal")
31 self.assertFalse(os.path.exists(oldimgpath), msg="Old image path still exists: %s" % oldimgpath)
32
33 def test_ccache_tool(self):
34 bitbake("ccache-native")
35 self.assertTrue(os.path.isfile(os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'), "ccache")))
36 self.write_config('INHERIT += "ccache"')
37 bitbake("m4 -c cleansstate")
38 bitbake("m4 -c compile")
39 res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True)
40 self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile")
41 bitbake("ccache-native -ccleansstate")
42
43
44class DiskMonTest(oeSelfTest):
45
46 def test_stoptask_behavior(self):
47 result = runCmd("df -k %s" % os.getcwd())
48 size = result.output.split("\n")[1].split()[3]
49 self.append_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},%sK,4510K"' % size)
50 res = bitbake("core-image-minimal", ignore_status = True)
51 self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output)
52 self.assertEqual(res.status, 1)
53 self.append_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},%sK,4510K"' % size)
54 res = bitbake("core-image-minimal", ignore_status = True)
55 self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output)
56 self.assertEqual(res.status, 1)
57 self.append_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},%sK,4510K"' % size)
58 res = bitbake("core-image-minimal")
59 self.assertTrue('WARNING: The free space' in res.output)
60
61class SanityOptionsTest(oeSelfTest):
62
63 def test_options_warnqa_errorqa_switch(self):
64 bitbake("xcursor-transparent-theme -ccleansstate")
65
66 if "packages-list" not in get_bb_var("ERROR_QA"):
67 self.write_config("ERROR_QA_append = \" packages-list\"")
68
69 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
70 res = bitbake("xcursor-transparent-theme", ignore_status=True)
71 self.delete_recipeinc('xcursor-transparent-theme')
72 self.assertTrue("ERROR: QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors." in res.output)
73 self.assertEqual(res.status, 1)
74 self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
75 self.append_config('ERROR_QA_remove = "packages-list"')
76 self.append_config('WARN_QA_append = " packages-list"')
77 bitbake("xcursor-transparent-theme")
78 bitbake("xcursor-transparent-theme -ccleansstate")
79 self.delete_recipeinc('xcursor-transparent-theme')
80
81 def test_sanity_userspace_dependency(self):
82 self.append_config('WARN_QA_append = " unsafe-references-in-binaries unsafe-references-in-scripts"')
83 bitbake("-ccleansstate gzip nfs-utils")
84 res = bitbake("gzip nfs-utils")
85 self.assertTrue("WARNING: QA Issue: gzip" in res.output)
86 self.assertTrue("WARNING: QA Issue: nfs-utils" in res.output)