From patchwork Tue Dec 11 23:26:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 153525 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1206329ljp; Tue, 11 Dec 2018 15:27:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZ6Ydjjg9NWj2Vfg1RPULJttzMHfJ+eolCBIfeKu8LCupmcfbG71pSwE+JP/msJKQCYC+J X-Received: by 2002:a63:40c6:: with SMTP id n189mr16021384pga.355.1544570860100; Tue, 11 Dec 2018 15:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544570860; cv=none; d=google.com; s=arc-20160816; b=FFMitAoW0JDMh+PsnaQ27v2cXv+EhDIWYQgR3+Y/JCyg5tY+TwiSpHHe/V2YCnGjda u1NqooHJ3AHsUTHQ4efzhyUsCQ5GwT8AlAscdwSTrE6xoUXFsgdpAg79SbUbNWdXl7Yl O4NqJU19rRrfGtGAMoUthCX+wRZv456I++8eVISZBL+RV9FwWaxSgvt8cok0jpgRK9kT 4HXLj0Ax2m6ytrQ1o8w4TdHQzOmzViCTRJUnf+PFN8mQ5PD3U7QrwbcMMVj+6Ou+Jv1t hE+bQX3xqa0Y01nFJ2+fk/Jcz7MsyBVgPCMuulfUrxGopStpWTlz/lmUUrL9NDTTW+xn B1Uw== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=InY5+4bwJCdhVcgsEAZZNQh3EMtNwye9hE+wh42CfzE=; b=CqE23TtxYGzRaNU9+w1mD9qBCAaAaUqax+YRz5GaLjwsn2o5SrV+T6hetxwPuwWjJS stMo0ueS7msZHTQBNnpO3tYRN1mdvQrlT2DWCSEkDglT4gDP8v63w3Hob0I/OFeOJ9EN 4mGL84kl4BelYzRtf/jNJDA39xHtXSB/Ju3hj5NMf2TWSHYkBVG9nSEaCt7TdTEOqBTn b5FwGV9UiNO29f8Li6xox61u9mUxloPuCFpGYysQPmuAbWDccT97R0UZaP41v2XB0JJk Bm5oKFCNfOKBx6s/TrkWs7/mbeHqb2SUvdgCv+EMDMmj/jxBZvuXWJuhCQUipIke1fa/ lZKw== 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=dLC5nCCv; 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 n12si13100286pgb.563.2018.12.11.15.27.39; Tue, 11 Dec 2018 15:27:40 -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=dLC5nCCv; 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 A8BB46C125; Tue, 11 Dec 2018 23:27:37 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mail.openembedded.org (Postfix) with ESMTP id 5E66D6BCF1 for ; Tue, 11 Dec 2018 23:26:40 +0000 (UTC) Received: by mail-wr1-f45.google.com with SMTP id q18so15820703wrx.9 for ; Tue, 11 Dec 2018 15:26:41 -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:in-reply-to:references; bh=Uk0hzf4sFMOXl6ZviEkCfUe30w8Nz2BlsIjxfEbkUys=; b=dLC5nCCvvX6PM1l5SEoTiYJHNW+rKR3upHd6Hu2tVa89LJqD9SEzRht8zXKA3NBMVj OGp/1YAngplF0V11xnGRaRjjHtcvGVbqB6f4oPKbJYCEc7CMkV9EDADhkVbqneMBp0fr jDdL+ZYAHR5fip7/8XucoVwGevXS931EiJrriAsMq3Hv8FBCJ2xrPlDl/PyJsGS+wW+2 OiwVa6tGpocLm7cFTGN4G5LUOVNlZVrs+O37U03ug8Vnr5zTuXETSIZXcZrqu1fco6yT tBFHN2wJ4nqOpZ8JlAV+Hvo9tT4Jaxu1w75VTHAzbb3+OqeC22HYT2Ekt0xtRBDCy0IQ 5OfA== 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:in-reply-to :references; bh=Uk0hzf4sFMOXl6ZviEkCfUe30w8Nz2BlsIjxfEbkUys=; b=bwmY/22oeFcuXGZqVGO2kqklvftUgN9eFtNPHc0x9gIWTfVoYiJ0obs3/tOFQk3MFr gsF0GRZm38eiqnuCC3pNbBwl0qfasxxVqzJldVS3p6VaaUxmInnO+RpjYWAk04W2/BFw +tCOoeGNsY0jUC2NNyRnvfIf0C9buZFBbSUpEcXzTdTQbRdEP44nPLXAOZ7mlyNTIm1S LtKK4nHS7pD8dvN8+H5QlpYURg1Z1TOgY6YjayLQgPKokxIcDVH2MF9kJTwC7AaCJsCG Xq1CUyV2FqTXwqcPDRRD1MIFBjleIlKYGlSG377625/R692gfMLtkOafAeBb2vxZ1spP MRew== X-Gm-Message-State: AA+aEWaD91lY1fKU4YjbRUgeGexDIDjL9WWgDsjC7Xf3amKUjXcFQgZ0 cwjI/J7mtFpwQBwGF6VMzkwGz5vvQO4= X-Received: by 2002:adf:fb0d:: with SMTP id c13mr16589745wrr.285.1544570800782; Tue, 11 Dec 2018 15:26:40 -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 v19sm30194595wrd.46.2018.12.11.15.26.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 15:26:40 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Tue, 11 Dec 2018 23:26:33 +0000 Message-Id: <20181211232636.13113-2-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181211232636.13113-1-ross.burton@intel.com> References: <20181211232636.13113-1-ross.burton@intel.com> Subject: [OE-core] [PATCH V2 2/5] 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 so that any output is shown, and remove any 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 +++++++++------------ meta/lib/oeqa/sdkext/cases/devtool.py | 3 +++ 6 files changed, 26 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..b9174fadbaa 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.encode('Uryyb, jbeyq', 'rot13'))\"" + output = self._run(cmd) + self.assertEqual(output, "Hello, world\n") diff --git a/meta/lib/oeqa/sdkext/cases/devtool.py b/meta/lib/oeqa/sdkext/cases/devtool.py index 0860e8d17cf..d322f86c73e 100644 --- a/meta/lib/oeqa/sdkext/cases/devtool.py +++ b/meta/lib/oeqa/sdkext/cases/devtool.py @@ -9,6 +9,9 @@ from oeqa.sdkext.case import OESDKExtTestCase from oeqa.core.decorator.oeid import OETestID from oeqa.utils.httpserver import HTTPService +from oeqa.utils.subprocesstweak import errors_have_output +errors_have_output() + class DevtoolTest(OESDKExtTestCase): @classmethod def setUpClass(cls):