From patchwork Thu Jul 19 23:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 142387 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2309975ljj; Thu, 19 Jul 2018 16:46:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYEqJ+xRT9nltM/PunxwP4N5UqBLTCNtMP4cK99ilnpVSwoO7fuK2v+3wJyCL8drvs/h/6 X-Received: by 2002:a65:64d7:: with SMTP id t23-v6mr12052398pgv.207.1532043986891; Thu, 19 Jul 2018 16:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532043986; cv=none; d=google.com; s=arc-20160816; b=kST4B/zFe9DYR3E2KYnfZruejtgG6kwPdoplU3pg0lL4GXCkz8S85g9npFiElhlx/3 kCXLcb7GXCO246Yw/bLyGa7LyaFQPFAXULhkSB4g0KaVdLKiQZ565a4sBR5TrM8pzhcC 3/dqFwOdKEJ5/H3ziaiKTx4LICu+KFuIlRiDFjNQYErtC6uYPpA43JbnNE+OqZ6wNEs9 kBZ/cHhNqTdI4XdP/kBCl7ulfEL7QHuCpJ1aboz5ODxHNINdg7J4PshY5jpOAs2q9kSp F7IJZpA4fuQqB9XDONGkIza0dVx1sBSO7irqtkEdmCMg5dvIqKPM3wuUabyjpwUB9O82 b11w== 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:arc-authentication-results; bh=yHwF4ib5KgMzBtIyySa/rtbOMU9jKS9izTGZsBZg8tY=; b=jn8KgCfTPoyHC7j+aXMOAkVqoWkRQcqR5V/6Sw+oscEASTvIOJ7JLa5175VTMM+0tE TUObneUrd6X4SvsQbxOGhasyiyy4pQ/p0A39C2kxMf2o4FRsEDPhsoCmNTL85yyHmjX9 BAZnykGUnmljZUZsr8PJ6eu/ROmAUq3IbBRV8JdMwmKsTfBGMI34s/dIVCiuK0mU3CFr QwZL+qcvdCLJ9xv1UJuIv3W7C+8CXj4vv4/wxNV7Um3dHNg6abHn3d4CYGz/GgRgOBQK 78pyHNTQn5I6/Xb1xPEqvqLGYcOuh2l6NpJ80jyIiIna4ZjHZv9GCxpXPFaDc4a0cdap 57lQ== 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=VYqyj7fh; 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 194-v6si510251pfz.101.2018.07.19.16.46.26; Thu, 19 Jul 2018 16:46:26 -0700 (PDT) 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=VYqyj7fh; 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 layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id A8B4F78AB3; Thu, 19 Jul 2018 23:46:24 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by mail.openembedded.org (Postfix) with ESMTP id E121578AB2 for ; Thu, 19 Jul 2018 23:46:23 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id v25-v6so7783319wmc.0 for ; Thu, 19 Jul 2018 16:46:25 -0700 (PDT) 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=BgTrUv/joxymPCGTBwcGidaiMj6CUuzjQmVtx2Mgn2Y=; b=VYqyj7fh9UcVGknfcRz0ebagK0vTU4NM7hgcoSbIGtOr3ZYEGDeTIZrB1J6PvBxxZA My2Xz+zkztijS7nakm+Dmuiywe4eorVXgIN19E3+F1uC/ci5QUWvz00S0V+aFWgWi5D4 9KvRpPwPZmrL+v6Rr5X4U/E/gltw5frsBR25GDPqzPqgcNsmH3TRdQotQ6MFBePc78uE cbOEfkVPjR6ulXTFKvepTyifkg2HPHHymSNwoQ5yu+mGU995wE4V6qIx09u7MDP//Idr KCXtvYwt8SAWUVMEAGxNC9MrajZiRCqNhhrbeG4VJ/GiBWPQXhAN/BpxEvo2a8eyE9nP eaug== 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=BgTrUv/joxymPCGTBwcGidaiMj6CUuzjQmVtx2Mgn2Y=; b=GehRr8rt7B5dSGE9dc/ZDLX9FZdP3sS+spALXaYlGaWlDWkA8viWBo5oT/+xSlZYu2 pxi7T/px6bK7lsVi/S00nH1jrm7X8rh9lwmtik0FO4ZxMrDogipEKW4VPykmwm02kkRl z7lVyMqPVOev9YQHQXQJGb3t3UBgvHQx+suWYTcUaDjYmVcXEK3m/k7QrJ5BgGGCW1OC 6+dTP63tuxxTlyfT/zbqUb+0PoWYFV34RG93tLpRvIFbG3oMgf5g8iRYjMJcK33FZigu B375Oym0XblgoCLUtT2weD98pUIf+25TXQ1RCvD1VZGs7EZATVPqJkWvmgOYHL429Hky YbjQ== X-Gm-Message-State: AOUpUlEWjPAwxzZ1LV2blUHpKjrZ5rzmDcSI7n6yDITTKW/QlOnJawc7 yhJYK+6GwK/DzPVkumR4GCLqF6sOyyk= X-Received: by 2002:a1c:57c1:: with SMTP id l184-v6mr77434wmb.16.1532043984277; Thu, 19 Jul 2018 16:46:24 -0700 (PDT) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id 64-v6sm384397wrj.50.2018.07.19.16.46.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 16:46:23 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Fri, 20 Jul 2018 00:46:21 +0100 Message-Id: <20180719234621.26804-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] oeqa: rationalise Perl tests 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 As with the Python test, this can be both better and faster. No need to copy a file, just run a one-liner. Signed-off-by: Ross Burton --- meta/lib/oeqa/files/test.pl | 2 -- meta/lib/oeqa/runtime/cases/perl.py | 32 ++++---------------------------- meta/lib/oeqa/sdk/cases/perl.py | 25 +++++++------------------ 3 files changed, 11 insertions(+), 48 deletions(-) delete mode 100644 meta/lib/oeqa/files/test.pl -- 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/files/test.pl b/meta/lib/oeqa/files/test.pl deleted file mode 100644 index 689c8f16355..00000000000 --- a/meta/lib/oeqa/files/test.pl +++ /dev/null @@ -1,2 +0,0 @@ -$a = 9.01e+21 - 9.01e+21 + 0.01; -print ("the value of a is ", $a, "\n"); diff --git a/meta/lib/oeqa/runtime/cases/perl.py b/meta/lib/oeqa/runtime/cases/perl.py index d0b7e8ed925..afeeb180e24 100644 --- a/meta/lib/oeqa/runtime/cases/perl.py +++ b/meta/lib/oeqa/runtime/cases/perl.py @@ -1,37 +1,13 @@ import os from oeqa.runtime.case import OERuntimeTestCase -from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.oeid import OETestID from oeqa.runtime.decorator.package import OEHasPackage class PerlTest(OERuntimeTestCase): - - @classmethod - def setUpClass(cls): - src = os.path.join(cls.tc.files_dir, 'test.pl') - dst = '/tmp/test.pl' - cls.tc.target.copyTo(src, dst) - - @classmethod - def tearDownClass(cls): - dst = '/tmp/test.pl' - cls.tc.target.run('rm %s' % dst) - - @OETestID(1141) - @OETestDepends(['ssh.SSHTest.test_ssh']) - @OEHasPackage(['perl']) - def test_perl_exists(self): - status, output = self.target.run('which perl') - msg = 'Perl binary not in PATH or not on target.' - self.assertEqual(status, 0, msg=msg) - @OETestID(208) - @OETestDepends(['perl.PerlTest.test_perl_exists']) + @OEHasPackage(['perl']) def test_perl_works(self): - status, output = self.target.run('perl /tmp/test.pl') - msg = 'Exit status was not 0. Output: %s' % output - self.assertEqual(status, 0, msg=msg) - - msg = 'Incorrect output: %s' % output - self.assertEqual(output, "the value of a is 0.01", msg=msg) + status, output = self.target.run("perl -e '$_=\"Uryyb, jbeyq\"; tr/a-zA-Z/n-za-mN-ZA-M/;print'") + self.assertEqual(status, 0) + self.assertEqual(output, "Hello, world") diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py index 8085678116c..ff50b468006 100644 --- a/meta/lib/oeqa/sdk/cases/perl.py +++ b/meta/lib/oeqa/sdk/cases/perl.py @@ -1,8 +1,4 @@ -import os -import shutil import unittest - -from oeqa.core.utils.path import remove_safe from oeqa.sdk.case import OESDKTestCase class PerlTest(OESDKTestCase): @@ -12,17 +8,10 @@ class PerlTest(OESDKTestCase): self.tc.hasHostPackage("perl-native")): raise unittest.SkipTest("No perl package in the SDK") - for f in ['test.pl']: - shutil.copyfile(os.path.join(self.tc.files_dir, f), - os.path.join(self.tc.sdk_dir, f)) - self.testfile = os.path.join(self.tc.sdk_dir, "test.pl") - - def test_perl_exists(self): - self._run('which perl') - - def test_perl_works(self): - self._run('perl %s' % self.testfile) - - @classmethod - def tearDownClass(self): - remove_safe(self.testfile) + 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))