diff options
Diffstat (limited to 'meta/classes/testimage.bbclass')
| -rw-r--r-- | meta/classes/testimage.bbclass | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 7c783ea065..19a37cb037 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
| @@ -236,6 +236,7 @@ def testimage_main(d): | |||
| 236 | import os | 236 | import os |
| 237 | import oeqa.runtime | 237 | import oeqa.runtime |
| 238 | import time | 238 | import time |
| 239 | import signal | ||
| 239 | from oeqa.oetest import loadTests, runTests | 240 | from oeqa.oetest import loadTests, runTests |
| 240 | from oeqa.targetcontrol import get_target_controller | 241 | from oeqa.targetcontrol import get_target_controller |
| 241 | from oeqa.utils.dump import get_host_dumper | 242 | from oeqa.utils.dump import get_host_dumper |
| @@ -273,12 +274,20 @@ def testimage_main(d): | |||
| 273 | self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split() | 274 | self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split() |
| 274 | self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split() | 275 | self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split() |
| 275 | manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + ".manifest") | 276 | manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + ".manifest") |
| 277 | self.sigterm = False | ||
| 278 | self.origsigtermhandler = signal.getsignal(signal.SIGTERM) | ||
| 279 | signal.signal(signal.SIGTERM, self.sigterm_exception) | ||
| 276 | try: | 280 | try: |
| 277 | with open(manifest) as f: | 281 | with open(manifest) as f: |
| 278 | self.pkgmanifest = f.read() | 282 | self.pkgmanifest = f.read() |
| 279 | except IOError as e: | 283 | except IOError as e: |
| 280 | bb.fatal("No package manifest file found. Did you build the image?\n%s" % e) | 284 | bb.fatal("No package manifest file found. Did you build the image?\n%s" % e) |
| 281 | 285 | ||
| 286 | def sigterm_exception(self, signum, stackframe): | ||
| 287 | bb.warn("TestImage received SIGTERM, shutting down...") | ||
| 288 | self.sigterm = True | ||
| 289 | self.target.stop() | ||
| 290 | |||
| 282 | # test context | 291 | # test context |
| 283 | tc = TestContext() | 292 | tc = TestContext() |
| 284 | 293 | ||
| @@ -293,8 +302,8 @@ def testimage_main(d): | |||
| 293 | 302 | ||
| 294 | target.deploy() | 303 | target.deploy() |
| 295 | 304 | ||
| 296 | target.start() | ||
| 297 | try: | 305 | try: |
| 306 | target.start() | ||
| 298 | if export: | 307 | if export: |
| 299 | exportTests(d,tc) | 308 | exportTests(d,tc) |
| 300 | else: | 309 | else: |
| @@ -311,6 +320,7 @@ def testimage_main(d): | |||
| 311 | else: | 320 | else: |
| 312 | raise bb.build.FuncFailed("%s - FAILED - check the task log and the ssh log" % pn ) | 321 | raise bb.build.FuncFailed("%s - FAILED - check the task log and the ssh log" % pn ) |
| 313 | finally: | 322 | finally: |
| 323 | signal.signal(signal.SIGTERM, tc.origsigtermhandler) | ||
| 314 | target.stop() | 324 | target.stop() |
| 315 | 325 | ||
| 316 | testimage_main[vardepsexclude] =+ "BB_ORIGENV" | 326 | testimage_main[vardepsexclude] =+ "BB_ORIGENV" |
