diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2015-09-22 08:09:05 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2015-09-22 08:09:05 -0500 |
commit | 3445365503e1e4d5601acf7c05609cc9673ec414 (patch) | |
tree | 7eb70c5bab200b0515a1b4d16873a75855df4c89 /yocto-poky/meta/lib/oeqa | |
parent | d10502479a70bd72ca4e09569b6ee738875e4823 (diff) | |
parent | d7e963193b4e6541206a320316a158a65f1fee89 (diff) | |
download | talos-openbmc-3445365503e1e4d5601acf7c05609cc9673ec414.tar.gz talos-openbmc-3445365503e1e4d5601acf7c05609cc9673ec414.zip |
Merge commit 'd7e963193b4e6541206a320316a158a65f1fee89' into HEAD
Diffstat (limited to 'yocto-poky/meta/lib/oeqa')
-rw-r--r-- | yocto-poky/meta/lib/oeqa/oetest.py | 6 | ||||
-rw-r--r-- | yocto-poky/meta/lib/oeqa/selftest/sstatetests.py | 18 | ||||
-rw-r--r-- | yocto-poky/meta/lib/oeqa/utils/decorators.py | 25 |
3 files changed, 47 insertions, 2 deletions
diff --git a/yocto-poky/meta/lib/oeqa/oetest.py b/yocto-poky/meta/lib/oeqa/oetest.py index 0fe68d4d5..a6f89b6a8 100644 --- a/yocto-poky/meta/lib/oeqa/oetest.py +++ b/yocto-poky/meta/lib/oeqa/oetest.py @@ -151,6 +151,12 @@ class oeRuntimeTest(oeTest): elif (type(self.target).__name__ == "QemuTarget"): self.assertTrue(self.target.check(), msg = "Qemu not running?") + self.setUpLocal() + + # a setup method before tests but after the class instantiation + def setUpLocal(self): + pass + def tearDown(self): # If a test fails or there is an exception if not exc_info() == (None, None, None): diff --git a/yocto-poky/meta/lib/oeqa/selftest/sstatetests.py b/yocto-poky/meta/lib/oeqa/selftest/sstatetests.py index 6906b2123..c4efc47fe 100644 --- a/yocto-poky/meta/lib/oeqa/selftest/sstatetests.py +++ b/yocto-poky/meta/lib/oeqa/selftest/sstatetests.py @@ -3,6 +3,7 @@ import unittest import os import re import shutil +import glob import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest @@ -276,6 +277,8 @@ NATIVELSBSTRING = \"DistroB\" """ The sstate checksums off allarch packages should be independent of whichever MACHINE is set. Check this using bitbake -S. + Also, rather than duplicate the test, check nativesdk stamps are the same between + the two MACHINE values. """ topdir = get_bb_var('TOPDIR') @@ -286,18 +289,20 @@ TMPDIR = \"${TOPDIR}/tmp-sstatesamehash\" MACHINE = \"qemux86\" """) self.track_for_cleanup(topdir + "/tmp-sstatesamehash") - bitbake("world -S none") + bitbake("world meta-toolchain -S none") self.write_config(""" TMPDIR = \"${TOPDIR}/tmp-sstatesamehash2\" MACHINE = \"qemuarm\" """) self.track_for_cleanup(topdir + "/tmp-sstatesamehash2") - bitbake("world -S none") + bitbake("world meta-toolchain -S none") def get_files(d): f = [] for root, dirs, files in os.walk(d): for name in files: + if "meta-environment" in root or "cross-canadian" in root: + continue if "do_build" not in name: f.append(os.path.join(root, name)) return f @@ -306,3 +311,12 @@ MACHINE = \"qemuarm\" files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] self.maxDiff = None self.assertItemsEqual(files1, files2) + + nativesdkdir = os.path.basename(glob.glob(topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0]) + + files1 = get_files(topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir) + files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir) + files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] + self.maxDiff = None + self.assertItemsEqual(files1, files2) + diff --git a/yocto-poky/meta/lib/oeqa/utils/decorators.py b/yocto-poky/meta/lib/oeqa/utils/decorators.py index 162a88fb7..b6adcb184 100644 --- a/yocto-poky/meta/lib/oeqa/utils/decorators.py +++ b/yocto-poky/meta/lib/oeqa/utils/decorators.py @@ -220,3 +220,28 @@ def getAllTags(obj): ret = __gettags(obj) ret.update(__gettags(tc_method)) return ret + +def timeout_handler(seconds): + def decorator(fn): + if hasattr(signal, 'alarm'): + @wraps(fn) + def wrapped_f(self, *args, **kw): + current_frame = sys._getframe() + def raiseTimeOut(signal, frame): + if frame is not current_frame: + try: + self.target.restart() + raise TimeOut('%s seconds' % seconds) + except: + raise TimeOut('%s seconds' % seconds) + prev_handler = signal.signal(signal.SIGALRM, raiseTimeOut) + try: + signal.alarm(seconds) + return fn(self, *args, **kw) + finally: + signal.alarm(0) + signal.signal(signal.SIGALRM, prev_handler) + return wrapped_f + else: + return fn + return decorator |