aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/selftest/cases/bbtests.py24
-rw-r--r--meta/lib/oeqa/selftest/cases/buildhistory.py6
-rw-r--r--meta/lib/oeqa/selftest/cases/buildoptions.py21
-rw-r--r--meta/lib/oeqa/selftest/cases/lic_checksum.py4
-rw-r--r--meta/lib/oeqa/selftest/cases/pkgdata.py16
-rw-r--r--meta/lib/oeqa/selftest/cases/signing.py2
-rw-r--r--meta/lib/oeqa/utils/commands.py8
-rw-r--r--meta/lib/oeqa/utils/misc.py11
8 files changed, 49 insertions, 43 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py
index 4c82049032b..f377de49961 100644
--- a/meta/lib/oeqa/selftest/cases/bbtests.py
+++ b/meta/lib/oeqa/selftest/cases/bbtests.py
@@ -3,17 +3,13 @@ import re
import oeqa.utils.ftools as ftools
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
+from oeqa.utils.misc import getline
from oeqa.selftest.case import OESelftestTestCase
from oeqa.core.decorator.oeid import OETestID
class BitbakeTests(OESelftestTestCase):
- def getline(self, res, line):
- for l in res.output.split('\n'):
- if line in l:
- return l
-
@OETestID(789)
def test_run_bitbake_from_dir_1(self):
os.chdir(os.path.join(self.builddir, 'conf'))
@@ -46,13 +42,15 @@ class BitbakeTests(OESelftestTestCase):
@OETestID(105)
def test_bitbake_invalid_recipe(self):
- result = bitbake('-b asdf', ignore_status=True)
- self.assertTrue("ERROR: Unable to find any recipe file matching 'asdf'" in result.output, msg = "Though asdf recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % result.output)
+ invalid = 'asdf'
+ result = bitbake('-b %s' % invalid, ignore_status=True)
+ self.assertTrue("ERROR: Unable to find any recipe file matching '%s'" % invalid in result.error, msg = "Though %s recipe doesn't exist, bitbake didn't output any err. message. bitbake output: %s" % (invalid, result.error))
@OETestID(107)
def test_bitbake_invalid_target(self):
- result = bitbake('asdf', ignore_status=True)
- self.assertTrue("ERROR: Nothing PROVIDES 'asdf'" in result.output, msg = "Though no 'asdf' target exists, bitbake didn't output any err. message. bitbake output: %s" % result.output)
+ invalid = 'asdf'
+ result = bitbake(invalid, ignore_status=True)
+ self.assertTrue("ERROR: Nothing PROVIDES '%s'" % invalid in result.error, msg = "Though no '%s' target exists, bitbake didn't output any err. message. bitbake output: %s" % (invalid, result.error))
@OETestID(106)
def test_warnings_errors(self):
@@ -71,8 +69,8 @@ class BitbakeTests(OESelftestTestCase):
result = bitbake('man -c patch', ignore_status=True)
self.delete_recipeinc('man')
bitbake('-cclean man')
- line = self.getline(result, "Function failed: patch_do_patch")
- self.assertTrue(line and line.startswith("ERROR:"), msg = "Repeated patch application didn't fail. bitbake output: %s" % result.output)
+ line = getline(result.error, "Function failed: patch_do_patch")
+ self.assertTrue(line and line.startswith("ERROR:"), msg = "Repeated patch application didn't fail. bitbake output: %s" % result.error)
@OETestID(1354)
def test_force_task_1(self):
@@ -144,9 +142,9 @@ INHERIT_remove = \"report-error\"
bitbake('-ccleanall man')
self.delete_recipeinc('man')
self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output)
- self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.output, msg = "\"invalid\" file \
+ self.assertTrue('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:' in result.error, msg = "\"invalid\" file \
doesn't exist, yet no error message encountered. bitbake output: %s" % result.output)
- line = self.getline(result, 'Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.')
+ line = getline(result.error, 'Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.')
self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \
doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output)
diff --git a/meta/lib/oeqa/selftest/cases/buildhistory.py b/meta/lib/oeqa/selftest/cases/buildhistory.py
index 06792d9146d..2d28cefdcbe 100644
--- a/meta/lib/oeqa/selftest/cases/buildhistory.py
+++ b/meta/lib/oeqa/selftest/cases/buildhistory.py
@@ -37,10 +37,10 @@ class BuildhistoryBase(OESelftestTestCase):
if expect_error:
self.assertEqual(result.status, 1, msg="Error expected for global config '%s' and target config '%s'" % (global_config, target_config))
- search_for_error = re.search(error_regex, result.output)
- self.assertTrue(search_for_error, msg="Could not find desired error in output: %s (%s)" % (error_regex, result.output))
+ search_for_error = re.search(error_regex, result.error)
+ self.assertTrue(search_for_error, msg="Could not find desired error in output: %s (%s)" % (error_regex, result.error))
else:
- self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.output))
+ self.assertEqual(result.status, 0, msg="Command 'bitbake %s' has failed unexpectedly: %s" % (target, result.error))
# No tests should be added to the base class.
# Please create a new class that inherit this one, or use one of those already available for adding tests.
diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py
index 1f1bb7ae631..bfb6ba339a2 100644
--- a/meta/lib/oeqa/selftest/cases/buildoptions.py
+++ b/meta/lib/oeqa/selftest/cases/buildoptions.py
@@ -6,6 +6,7 @@ import tempfile
from oeqa.selftest.case import OESelftestTestCase
from oeqa.selftest.cases.buildhistory import BuildhistoryBase
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars
+from oeqa.utils.misc import getline
import oeqa.utils.ftools as ftools
from oeqa.core.decorator.oeid import OETestID
@@ -58,21 +59,17 @@ class DiskMonTest(OESelftestTestCase):
def test_stoptask_behavior(self):
self.write_config('BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},100000G,100K"')
res = bitbake("m4", ignore_status = True)
- self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.output, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.output)
- self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
+ self.assertTrue('ERROR: No new tasks can be executed since the disk space monitor action is "STOPTASKS"!' in res.error, msg = "Tasks should have stopped. Disk monitor is set to STOPTASK: %s" % res.error)
+ self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.error))
self.write_config('BB_DISKMON_DIRS = "ABORT,${TMPDIR},100000G,100K"')
res = bitbake("m4", ignore_status = True)
- self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.output, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.output)
- self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
+ self.assertTrue('ERROR: Immediately abort since the disk space monitor action is "ABORT"!' in res.error, "Tasks should have been aborted immediatelly. Disk monitor is set to ABORT: %s" % res.error)
+ self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.error))
self.write_config('BB_DISKMON_DIRS = "WARN,${TMPDIR},100000G,100K"')
res = bitbake("m4")
self.assertTrue('WARNING: The free space' in res.output, msg = "A warning should have been displayed for disk monitor is set to WARN: %s" %res.output)
class SanityOptionsTest(OESelftestTestCase):
- def getline(self, res, line):
- for l in res.output.split('\n'):
- if line in l:
- return l
@OETestID(927)
def test_options_warnqa_errorqa_switch(self):
@@ -85,7 +82,7 @@ class SanityOptionsTest(OESelftestTestCase):
self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme')
res = bitbake("xcursor-transparent-theme -f -c package", ignore_status=True)
self.delete_recipeinc('xcursor-transparent-theme')
- line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
+ line = getline(res.error, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
self.assertEqual(res.status, 1, msg = "bitbake reported exit code %s. It should have been 1. Bitbake output: %s" % (str(res.status), res.output))
self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"')
@@ -93,7 +90,7 @@ class SanityOptionsTest(OESelftestTestCase):
self.append_config('WARN_QA_append = " packages-list"')
res = bitbake("xcursor-transparent-theme -f -c package")
self.delete_recipeinc('xcursor-transparent-theme')
- line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
+ line = getline(res.output, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.")
self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
@OETestID(278)
@@ -102,7 +99,7 @@ class SanityOptionsTest(OESelftestTestCase):
self.add_command_to_tearDown('bitbake -c clean gzip')
res = bitbake("gzip -f -c package_qa")
- line = self.getline(res, "QA Issue: gzip")
+ line = getline(res.output, "QA Issue: gzip")
self.assertFalse(line, "WARNING: QA Issue: gzip message is present in bitbake's output and shouldn't be: %s" % res.output)
self.append_config("""
@@ -111,7 +108,7 @@ do_install_append_pn-gzip () {
}
""")
res = bitbake("gzip -f -c package_qa")
- line = self.getline(res, "QA Issue: gzip")
+ line = getline(res.output, "QA Issue: gzip")
self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
@OETestID(1421)
diff --git a/meta/lib/oeqa/selftest/cases/lic_checksum.py b/meta/lib/oeqa/selftest/cases/lic_checksum.py
index 37407157c1e..33bb47ac3ad 100644
--- a/meta/lib/oeqa/selftest/cases/lic_checksum.py
+++ b/meta/lib/oeqa/selftest/cases/lic_checksum.py
@@ -31,5 +31,5 @@ SRC_URI = "file://%s;md5=d41d8cd98f00b204e9800998ecf8427e"
self.write_config("INHERIT_remove = \"report-error\"")
result = bitbake(bitbake_cmd, ignore_status=True)
- if error_msg not in result.output:
- raise AssertionError(result.output)
+ if error_msg not in result.error:
+ raise AssertionError(result.error)
diff --git a/meta/lib/oeqa/selftest/cases/pkgdata.py b/meta/lib/oeqa/selftest/cases/pkgdata.py
index 0b4caf1b2c2..696fa7d5e20 100644
--- a/meta/lib/oeqa/selftest/cases/pkgdata.py
+++ b/meta/lib/oeqa/selftest/cases/pkgdata.py
@@ -23,16 +23,16 @@ class OePkgdataUtilTests(OESelftestTestCase):
result = runCmd('oe-pkgdata-util lookup-pkg zlib-dev')
self.assertEqual(result.output, 'libz-dev')
result = runCmd('oe-pkgdata-util lookup-pkg nonexistentpkg', ignore_status=True)
- self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
- self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
+ self.assertEqual(result.status, 1, "Status different than 1. error: %s" % result.error)
+ self.assertEqual(result.error, 'ERROR: The following packages could not be found: nonexistentpkg')
# Reverse tests
result = runCmd('oe-pkgdata-util lookup-pkg -r "libz1 busybox"')
self.assertEqual(result.output, 'zlib\nbusybox')
result = runCmd('oe-pkgdata-util lookup-pkg -r libz-dev')
self.assertEqual(result.output, 'zlib-dev')
result = runCmd('oe-pkgdata-util lookup-pkg -r nonexistentpkg', ignore_status=True)
- self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
- self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
+ self.assertEqual(result.status, 1, "Status different than 1. error: %s" % result.error)
+ self.assertEqual(result.error, 'ERROR: The following packages could not be found: nonexistentpkg')
@OETestID(1205)
def test_read_value(self):
@@ -51,8 +51,8 @@ class OePkgdataUtilTests(OESelftestTestCase):
result = runCmd('oe-pkgdata-util find-path /usr/bin/m4')
self.assertEqual(result.output, 'm4: /usr/bin/m4')
result = runCmd('oe-pkgdata-util find-path /not/exist', ignore_status=True)
- self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
- self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /not/exist')
+ self.assertEqual(result.status, 1, "Status different than 1. error: %s" % result.error)
+ self.assertEqual(result.error, 'ERROR: Unable to find any package producing path /not/exist')
@OETestID(1204)
def test_lookup_recipe(self):
@@ -61,8 +61,8 @@ class OePkgdataUtilTests(OESelftestTestCase):
result = runCmd('oe-pkgdata-util lookup-recipe libz-dbg')
self.assertEqual(result.output, 'zlib')
result = runCmd('oe-pkgdata-util lookup-recipe nonexistentpkg', ignore_status=True)
- self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output)
- self.assertEqual(result.output, 'ERROR: The following packages could not be found: nonexistentpkg')
+ self.assertEqual(result.status, 1, "Status different than 1. error: %s" % result.error)
+ self.assertEqual(result.error, 'ERROR: The following packages could not be found: nonexistentpkg')
@OETestID(1202)
def test_list_pkgs(self):
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py
index edb5f653f20..cd64eb5cbf4 100644
--- a/meta/lib/oeqa/selftest/cases/signing.py
+++ b/meta/lib/oeqa/selftest/cases/signing.py
@@ -133,7 +133,7 @@ class Signing(OESelftestTestCase):
ret = runCmd('gpg --homedir %s --verify %s %s' % (self.gpg_dir, recipe_sig[0], recipe_tgz[0]))
# gpg: Signature made Thu 22 Oct 2015 01:45:09 PM EEST using RSA key ID 61EEFB30
# gpg: Good signature from "testuser (nocomment) <testuser@email.com>"
- self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.')
+ self.assertIn('gpg: Good signature from', ret.error, 'Package signed incorrectly.')
class LockedSignatures(OESelftestTestCase):
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 4ef0e874ffd..055a59cab14 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -70,6 +70,7 @@ class Command(object):
self.stop()
def stop(self):
+
if self.thread.isAlive():
self.process.terminate()
# let's give it more time to terminate gracefully before killing it
@@ -78,10 +79,9 @@ class Command(object):
self.process.kill()
self.thread.join()
- if not self.output:
- self.output = ""
- else:
- self.output = self.output.decode("utf-8", errors='replace').rstrip()
+ self.output = self.output.decode("utf-8", errors='replace').rstrip() if self.output else ""
+ self.error = self.error.decode("utf-8", errors='ignore').rstrip() if self.error else ""
+
self.status = self.process.poll()
self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))
diff --git a/meta/lib/oeqa/utils/misc.py b/meta/lib/oeqa/utils/misc.py
new file mode 100644
index 00000000000..b5579e5b635
--- /dev/null
+++ b/meta/lib/oeqa/utils/misc.py
@@ -0,0 +1,11 @@
+# Copyright (C) 2013-2017 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+def getline(data, line):
+ _line = ''
+ for l in data.split('\n'):
+ if line in l:
+ _line = l
+ break
+ return _line