diff options
Diffstat (limited to 'yocto-poky/meta/classes/testimage.bbclass')
-rw-r--r-- | yocto-poky/meta/classes/testimage.bbclass | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/yocto-poky/meta/classes/testimage.bbclass b/yocto-poky/meta/classes/testimage.bbclass index a1918ba9e..b4d4a69b0 100644 --- a/yocto-poky/meta/classes/testimage.bbclass +++ b/yocto-poky/meta/classes/testimage.bbclass @@ -80,11 +80,13 @@ testimage_dump_target () { testimage_dump_host () { top -bn1 + iostat -x -z -N -d -p ALL 20 2 ps -ef free df memstat dmesg + ip -s link netstat -an } @@ -146,6 +148,10 @@ def get_tests_list(d, type="runtime"): testslist.append("oeqa." + type + "." + testname) found = True break + elif os.path.exists(os.path.join(p, 'lib', 'oeqa', type, testname.split(".")[0] + '.py')): + testslist.append("oeqa." + type + "." + testname) + found = True + break if not found: bb.fatal('Test %s specified in TEST_SUITES could not be found in lib/oeqa/runtime under BBPATH' % testname) @@ -172,6 +178,7 @@ def exportTests(d,tc): import json import shutil import pkgutil + import re exportpath = d.getVar("TEST_EXPORT_DIR", True) @@ -198,9 +205,18 @@ def exportTests(d,tc): savedata["host_dumper"]["parent_dir"] = tc.host_dumper.parent_dir savedata["host_dumper"]["cmds"] = tc.host_dumper.cmds - with open(os.path.join(exportpath, "testdata.json"), "w") as f: + json_file = os.path.join(exportpath, "testdata.json") + with open(json_file, "w") as f: json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True) + # Replace absolute path with relative in the file + exclude_path = os.path.join(d.getVar("COREBASE", True),'meta','lib','oeqa') + f1 = open(json_file,'r').read() + f2 = open(json_file,'w') + m = f1.replace(exclude_path,'oeqa') + f2.write(m) + f2.close() + # now start copying files # we'll basically copy everything under meta/lib/oeqa, with these exceptions # - oeqa/targetcontrol.py - not needed @@ -214,6 +230,8 @@ def exportTests(d,tc): bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils")) # copy test modules, this should cover tests in other layers too for t in tc.testslist: + if re.search("\w+\.\w+\.test_\S+", t): + t = '.'.join(t.split('.')[:3]) mod = pkgutil.get_loader(t) shutil.copy2(mod.filename, os.path.join(exportpath, "oeqa/runtime")) # copy __init__.py files @@ -279,14 +297,20 @@ def testimage_main(d): self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split() self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split() manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + ".manifest") + nomanifest = d.getVar("IMAGE_NO_MANIFEST", True) + self.sigterm = False self.origsigtermhandler = signal.getsignal(signal.SIGTERM) signal.signal(signal.SIGTERM, self.sigterm_exception) - try: - with open(manifest) as f: - self.pkgmanifest = f.read() - except IOError as e: - bb.fatal("No package manifest file found. Did you build the image?\n%s" % e) + + if nomanifest is None or nomanifest != "1": + try: + with open(manifest) as f: + self.pkgmanifest = f.read() + except IOError as e: + bb.fatal("No package manifest file found. Did you build the image?\n%s" % e) + else: + self.pkgmanifest = "" def sigterm_exception(self, signum, stackframe): bb.warn("TestImage received SIGTERM, shutting down...") @@ -305,13 +329,15 @@ def testimage_main(d): import traceback bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) - target.deploy() - try: - target.start() - if export: - exportTests(d,tc) - else: + if export: + signal.signal(signal.SIGTERM, tc.origsigtermhandler) + tc.origsigtermhandler = None + exportTests(d,tc) + else: + target.deploy() + try: + target.start() starttime = time.time() result = runTests(tc) stoptime = time.time() @@ -324,9 +350,9 @@ def testimage_main(d): bb.plain(msg) else: raise bb.build.FuncFailed("%s - FAILED - check the task log and the ssh log" % pn ) - finally: - signal.signal(signal.SIGTERM, tc.origsigtermhandler) - target.stop() + finally: + signal.signal(signal.SIGTERM, tc.origsigtermhandler) + target.stop() testimage_main[vardepsexclude] =+ "BB_ORIGENV" |