From patchwork Mon Dec 10 15:07:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 153271 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3661969ljp; Mon, 10 Dec 2018 07:07:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/X+mpjlYcGSMxykViwhzzx8mcD96nTLKymxSFuBSLQEEbZDM4DWyj8VvdoPrR0g/G3ZPt/G X-Received: by 2002:a62:1bd7:: with SMTP id b206mr12613395pfb.213.1544454438098; Mon, 10 Dec 2018 07:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544454438; cv=none; d=google.com; s=arc-20160816; b=JboYcmv3uxw2MZzsaABEH9baq3PXGu/l+2a3iDPwClV0SE86IYDyIRSmbTsRORko1g KiNINV0yjn9QAknk7ncd/rWAUWMLYenyl+dbS988O60tFjmzaIdzZr2nqIrz2Pk4WAHa 8mQlNakCG9PTBtywhUGIdKF7ypzGI4PdDdlHp/+kDIrQ8SPbMtRO1UO2UDsACxaJS7dt AchzxGnaowNxV6dB+uTp8bJgbL19VHmIQGyrl+eU0vUU0MYUAm1o7winUI+qBc9k0bJD EfmVcuLbFol8D+ZGzHulintliGXA/90rVw3ym9BVKGHGSYbqif1XRIxa0lfqeZSwk9+O d/Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=nbPGf6bH4HPgclsBJVShPzlLgLpM97qkV4MIwEVM0hU=; b=TGC2Yv3pED00hIjlK0VBA4Z8gGU51FvdZRIiFSH67JuKlYQ8Jm2n0eeSigwdcF+MvK N99HhBoKuzImrzEYUCMDk32Nw4vRODDTK/4FRou7gCHATpdpEnBtYrMEp7zBtITd3/Om hv3RxBTdCx56pnKcTkYgT9MyFULxpaoc+2edOd/wCaLn4YkDMvpEftl8dAOYx65Hq2vj pMV4xYCm4Sh5+Bf6y7OkE5U/8uQEbryBOsXm644Ipd7aCrAoL2GKUTX1j1opGZSWPsBt Kyc6WNF4beU81IdjPyM8PrezRR0QpWkRqxe169PqHFQWuhrsSsZxbNvPkOlTwe+67U0C ylhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=APWcPAhh; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id j135si9558616pgc.517.2018.12.10.07.07.17; Mon, 10 Dec 2018 07:07:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=APWcPAhh; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 33CB8608B7; Mon, 10 Dec 2018 15:07:13 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mail.openembedded.org (Postfix) with ESMTP id 1F55660777 for ; Mon, 10 Dec 2018 15:07:10 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id x10so10815276wrs.8 for ; Mon, 10 Dec 2018 07:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=12ZWXUOXFHG+wSDYsPOI8RB5AhJn8dM4OP3UDkXv2xY=; b=APWcPAhhTq0v0oKoPbKwzmcQYgePbnIJkH0BuuK/WKNWzp3ejVBaGd2U1HYjS+oM6b gbfWUhpGSGRY68+6VxjR80aVlH7Z5yRYF36okNEfaYniIZfAMY6oy4zeroigihu6y9Sw DGxgOQH7yI3WT6KUFGbYHrryTrwSsXltw6ItjamH4Hgzkx5xC0cfFF5y4fZAru1C/7iS LgK9I9piqkSTlPNE3/o6dOfVJWRzcRRH/RwRV5b/cwB7Ce7VVT3fz70WY+YX3WgFvISV nOc79YZEI8EDV/Bf4Jh4R+L+AywVa4uTcXMmn2RQiZ5G1gTFoA06JsLA1u/BeoFhfVhQ WUTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=12ZWXUOXFHG+wSDYsPOI8RB5AhJn8dM4OP3UDkXv2xY=; b=DNk3gTuPdedzasTOLWijlh41dSojC4BE+6EGPKZt7YbUJMHQqs+u2tlWChJ40Jc0l/ Ifvd1rkDvGTEYtGWtJi7kdSeYcQcNUDoUqybg9ngva2Ej6neZ+IG89fuLRsPULRm/ZCq qUhU2/0B/FXWot+ElZ7xhShqx0ILTI05CL+qrqV70fQQxPzO3AgW44bnwdL9dbNrCCBt lIURqYIgTllfz6nwm+V93gU0ZGQQT7jas9oh/o+hiUi0CgjUbM8mPTQ0xM8UyI6NaTlJ ly6DauQ1jh3rWWF48NgqAB2rWSpoXZWK9CzATn9Y1Sof4tA48SGau9w7AdR2usWOr7cj Up4g== X-Gm-Message-State: AA+aEWaRs9SFRtw6JaCLwkjN6G8kHPkoCpXEo0PI1p9l7LDlyBBVn2ak Qi82gA0DRuvWa6bnIfYkaFm8ZrUpXIk= X-Received: by 2002:a5d:6808:: with SMTP id w8mr9685433wru.270.1544454431351; Mon, 10 Dec 2018 07:07:11 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id t76sm16610138wme.33.2018.12.10.07.07.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 07:07:10 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Mon, 10 Dec 2018 15:07:07 +0000 Message-Id: <20181210150707.7239-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] oeqa/sdk: show output if run() fails X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Use oeqa.utils.subprocesstweak to monkey-patch the subprocess exception to show the output if available, and clean up explicit try/catch handling that would have hidden this. Signed-off-by: Ross Burton --- meta/lib/oeqa/sdk/cases/buildcpio.py | 3 +++ meta/lib/oeqa/sdk/cases/buildlzip.py | 2 ++ meta/lib/oeqa/sdk/cases/gcc.py | 3 +++ meta/lib/oeqa/sdk/cases/perl.py | 12 ++++++------ meta/lib/oeqa/sdk/cases/python.py | 21 +++++++++------------ 5 files changed, 23 insertions(+), 18 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oeqa/sdk/cases/buildcpio.py b/meta/lib/oeqa/sdk/cases/buildcpio.py index f348ac5d909..6697b12de29 100644 --- a/meta/lib/oeqa/sdk/cases/buildcpio.py +++ b/meta/lib/oeqa/sdk/cases/buildcpio.py @@ -2,6 +2,9 @@ import unittest from oeqa.sdk.case import OESDKTestCase from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + class BuildCpioTest(OESDKTestCase): td_vars = ['DATETIME'] diff --git a/meta/lib/oeqa/sdk/cases/buildlzip.py b/meta/lib/oeqa/sdk/cases/buildlzip.py index 9d137f30ebf..b57fbbece7f 100644 --- a/meta/lib/oeqa/sdk/cases/buildlzip.py +++ b/meta/lib/oeqa/sdk/cases/buildlzip.py @@ -2,6 +2,8 @@ import unittest from oeqa.sdk.case import OESDKTestCase from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() class BuildLzipTest(OESDKTestCase): td_vars = ['DATETIME'] diff --git a/meta/lib/oeqa/sdk/cases/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py index b32b01fc241..54c6fc488bc 100644 --- a/meta/lib/oeqa/sdk/cases/gcc.py +++ b/meta/lib/oeqa/sdk/cases/gcc.py @@ -5,6 +5,9 @@ import unittest from oeqa.core.utils.path import remove_safe from oeqa.sdk.case import OESDKTestCase +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + class GccCompileTest(OESDKTestCase): td_vars = ['MACHINE'] diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py index e1d2bc159a0..b8adc5ac72d 100644 --- a/meta/lib/oeqa/sdk/cases/perl.py +++ b/meta/lib/oeqa/sdk/cases/perl.py @@ -1,6 +1,9 @@ import unittest from oeqa.sdk.case import OESDKTestCase +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + class PerlTest(OESDKTestCase): def setUp(self): if not (self.tc.hasHostPackage("nativesdk-perl") or @@ -8,9 +11,6 @@ class PerlTest(OESDKTestCase): raise unittest.SkipTest("No perl package in the SDK") def test_perl(self): - try: - cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'" - output = self._run(cmd) - self.assertEqual(output, "Hello, world") - except subprocess.CalledProcessError as e: - self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) + cmd = "perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'" + output = self._run(cmd) + self.assertEqual(output, "Hello, world") diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index 2254867d455..aaab050e9ae 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py @@ -1,6 +1,9 @@ import subprocess, unittest from oeqa.sdk.case import OESDKTestCase +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + class Python2Test(OESDKTestCase): def setUp(self): if not (self.tc.hasHostPackage("nativesdk-python-core") or @@ -8,12 +11,9 @@ class Python2Test(OESDKTestCase): raise unittest.SkipTest("No python package in the SDK") def test_python2(self): - try: - cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" - output = self._run(cmd) - self.assertEqual(output, "Hello, world\n") - except subprocess.CalledProcessError as e: - self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) + cmd = "python -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" + output = self._run(cmd) + self.assertEqual(output, "Hello, world\n") class Python3Test(OESDKTestCase): def setUp(self): @@ -22,9 +22,6 @@ class Python3Test(OESDKTestCase): raise unittest.SkipTest("No python3 package in the SDK") def test_python3(self): - try: - cmd = "python3 -c \"import codecs; print(codecs.encode('Uryyb, jbeyq', 'rot13'))\"" - output = self._run(cmd) - self.assertEqual(output, "Hello, world\n") - except subprocess.CalledProcessError as e: - self.fail("Unexpected exit %d (output %s)" % (e.returncode, e.output)) + cmd = "python3 -c \"import codecs; print(codecs.encocde('Uryyb, jbeyq', 'rot13'))\"" + output = self._run(cmd) + self.assertEqual(output, "Hello, world\n")