Skip to contentSkip to conversation

testimage: Fix SDK extraction error handling

PATCH New Richard Purdie 1 participant 1 message Sep 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testimage: Fix SDK extraction error handling

Currently if the SDK fails to extract, no error is shown and the test is marked as passed! Clearly this is incorrect, fix it to correctly raise an error.

meta/classes/testimage.bbclass +4 -1
index f0b732a..ad1f0d1 100644
@@ -379,7 +379,10 @@ def testsdk_main(d):
     sdktestdir = d.expand("${WORKDIR}/testimage-sdk/")
     bb.utils.remove(sdktestdir, True)
     bb.utils.mkdirhier(sdktestdir)
-    subprocess.call("cd %s; %s <<EOF\n./tc\nY\nEOF" % (sdktestdir, tcname), shell=True)
+    try:
+        subprocess.check_output("cd %s; %s <<EOF\n./tc\nY\nEOF" % (sdktestdir, tcname), shell=True)
+    except subprocess.CalledProcessError as e:
+        bb.fatal("Couldn't install the SDK:\n%s" % e.output)
 
     try:
         targets = glob.glob(d.expand(sdktestdir + "/tc/environment-setup-*"))