From patchwork Mon Jul 16 18:33:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 142095 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2734374ljj; Mon, 16 Jul 2018 11:33:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcLVpOmw0340wI+TdXn4xz8tcGhqFkgzC9BM4ZbY2Ky1BIr11rUdz5K9QxnPpRpHXO77u5n X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr17283801plb.181.1531766003191; Mon, 16 Jul 2018 11:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531766003; cv=none; d=google.com; s=arc-20160816; b=MN7KV86MHdgxjvINToG+wueuJY7ndd0TQPiMO/CgIPy5yujAP4v4RPEF93ZsaaUaCp iQBEHpxvihaLhC+P4EznZkeIkwfUmF/bgRmS9/k8SycoGvZmYMY3ViHb1f7W6uP2SnQo KS4xZQQb+drdWAptrdQdjOzUqxUYQfZ0i4YsL21DVchzphdQbXZMPwVjd3PFUV17dSRs yMWG1yB9Ww+qyofxy+nh/jLhqkW8A9a/ngZWE2oKjeRrdTPnQ9Ls/S5PKnx24KI5A/e4 LILA28v0eimeQw2hkr0XLtnBkT8y7RMEKW+q7AfmqwnraCaUQXcaFyqvWQtZPg+kxAsY wSew== 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=XkZOtFFGfxR9uTGvh1I1RAYc8ftNUyocwLSkjx1O0NA=; b=Gvq4Riz1LcTvwVORLZ+Tg59j7pa5+T8YIsVpQcPcGq0f4faxPfOu3hqJsOPmHgsIu4 R4B/8AiVFggekhiuPQWyDxK54ma1IDrIATZW+l2X8Rz2pjjIA/16EMKoHfu1tDt/xfa0 BCZxVXXKEHjx29M865QrgWaUBliFsQIM+u87Qwqkpz+c7eZEw5RmpoUuOttiHxmcVN57 qgdbNEKmI9dUVAtkOhfe1NfXVj96TTm6nOjwnxhAr92oOJMvt3+ATALoY+agFWiV68Bw l0nAPy8IGUWthcp0Fu7o1meKmNYGm/a26TziDLB9S6aROBua8YVhDqB+x6TOIx4V1dKJ 2v8g== 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=Y60XKGkb; 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 u1-v6si30643126pga.71.2018.07.16.11.33.22; Mon, 16 Jul 2018 11:33:23 -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=Y60XKGkb; 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 E86A877142; Mon, 16 Jul 2018 18:33:18 +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 91A297600F for ; Mon, 16 Jul 2018 18:33:16 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id h20-v6so16731803wmb.4 for ; Mon, 16 Jul 2018 11:33:17 -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=bDvTDeWBfEbRhvigVOZHVFyEytMGLbGNSnhw1h08v28=; b=Y60XKGkbIEwNKSP9nahWxsRPzJ3wQqO1KRhAR0USAntMsKxgIJQV6uZ5yOu8l9GIwq STzj7r+MFsugRG+LcAb/ECX0y73tXx17Dmdww8Sr6cP0EthHSyQ2UmZpS3imAb6/PEWF YKMOPoWpWvnpDbVfXjiUKpEeLdDqsnVipnF9IIkPuyeO+bKrXU7umn3lxForjGUG8Xv4 VmePLPpVBtk6GBKAU206XlS+4E7bpfHJRI/hGwUwf4HrIgXLAel1gAhY9XFwE2dx6ry6 FAy8JQU/cSDWJzl+7ahaaGII/3BH+/Ve7aeYBcaJZ3uZV/LBQ9fpWu+btJ7sKx6j8zjM cLTw== 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=bDvTDeWBfEbRhvigVOZHVFyEytMGLbGNSnhw1h08v28=; b=ICkIrlobI+h6fnYxD8xd4pjkvMhcuWgNixuJ8+OvMDFb9smRr9X4r58eckeLFkYB4S /2Ta45MxiPZG814COCwE7p0nu3NFZGr26OO9G+jV9LJ5g7D73FGVFzbGeKqmdxxVj9D1 jZQI3pyLJRAUfMl3K19Z3wgQOD0QwaOKkYCyhbU37g2l//FySl+gF2Yw6OYC85H5KcZk f5d0ybPQtohJkE+TC+FfF6euS+nIXkQ+M9u0QsvlKddnqDGPuOXQZG2uwkmeJ846yr73 LD9u6xFCPICvvuyaovafIFPVa6MoKXN774UY+WKkJ7WOtgAONGhpQ/mHAFQKU48Ey2at sBRA== X-Gm-Message-State: AOUpUlEjENDjwP578S6m/xOT83xFZv3b5fAkukPee/x204m/nPa0gac2 guCvUOHIgDkaGNHeGOUgCNk8yyZ7 X-Received: by 2002:a1c:9a15:: with SMTP id c21-v6mr170646wme.112.1531765996827; Mon, 16 Jul 2018 11:33:16 -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 c5-v6sm24538513wrh.36.2018.07.16.11.33.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 11:33:16 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Mon, 16 Jul 2018 19:33:14 +0100 Message-Id: <20180716183314.30911-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] oeqa/sdk/python: clean up Python test 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 For the same reasons as the runtime Python test, clean up the SDK test. Also port from Python 2 to Python 3, as that's what is supported now. Signed-off-by: Ross Burton --- meta/lib/oeqa/files/test.py | 6 ------ meta/lib/oeqa/sdk/cases/python.py | 35 ++++++++++------------------------- 2 files changed, 10 insertions(+), 31 deletions(-) delete mode 100644 meta/lib/oeqa/files/test.py -- 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.py b/meta/lib/oeqa/files/test.py deleted file mode 100644 index f389225d72d..00000000000 --- a/meta/lib/oeqa/files/test.py +++ /dev/null @@ -1,6 +0,0 @@ -import os - -os.system('touch /tmp/testfile.python') - -a = 9.01e+21 - 9.01e+21 + 0.01 -print("the value of a is %s" % a) diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py index 72dfcc72bde..bd5f1f67be2 100644 --- a/meta/lib/oeqa/sdk/cases/python.py +++ b/meta/lib/oeqa/sdk/cases/python.py @@ -1,32 +1,17 @@ -import os -import shutil -import unittest - -from oeqa.core.utils.path import remove_safe +import subprocess, unittest from oeqa.sdk.case import OESDKTestCase class PythonTest(OESDKTestCase): @classmethod def setUpClass(self): - if not (self.tc.hasHostPackage("nativesdk-python") or - self.tc.hasHostPackage("python-native")): + if not (self.tc.hasHostPackage("nativesdk-python3") or + self.tc.hasHostPackage("python3-native")): raise unittest.SkipTest("No python package in the SDK") - for f in ['test.py']: - shutil.copyfile(os.path.join(self.tc.files_dir, f), - os.path.join(self.tc.sdk_dir, f)) - - def test_python_exists(self): - self._run('which python') - - def test_python_stdout(self): - output = self._run('python %s/test.py' % self.tc.sdk_dir) - self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output) - - def test_python_testfile(self): - self._run('ls /tmp/testfile.python') - - @classmethod - def tearDownClass(self): - remove_safe("%s/test.py" % self.tc.sdk_dir) - remove_safe("/tmp/testfile.python") + 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))