Skip to contentSkip to conversation

testimage.bbclass: Fix break introduced with SIGTERM handling

PATCH New [email protected] 1 participant 1 message Sep 18, 2015 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 testimage.bbclass: Fix break introduced with SIGTERM handling

In reply to a message not in the archive

From: Mariano Lopez <[email protected]>

The SIGTERM introduced another break into runexported test, the handler is in the class TestContext while exporting it will try to convert the singnal handler to JSON, and this will throw an exception.

The SIGTERM handler is not needed in the exported test, so this change will remove the handler before exporting the test. Also when a test is exported the target is not deployed/started anymore, it is not necessary.

[YOCTO #8239]

---
 meta/classes/testimage.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/testimage.bbclass +11 -9
index a1918ba..fd4143d 100644
@@ -305,13 +305,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 +326,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"
 
Signature · 1 line
1.8.4.5