From patchwork Sat Sep 16 20:38:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 814544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SGOwu+Jp"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xvkcp0PKRz9sRm for ; Sun, 17 Sep 2017 06:38:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3F2C3307CE; Sat, 16 Sep 2017 20:38:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mUB+VTKhJ9LW; Sat, 16 Sep 2017 20:38:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1FDE630708; Sat, 16 Sep 2017 20:38:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 5F01C1C1F5B for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 56E5688D28 for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XBNu5Vspz0Mu for ; Sat, 16 Sep 2017 20:38:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 0789E88D2F for ; Sat, 16 Sep 2017 20:38:27 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id x17so5498232wmd.5 for ; Sat, 16 Sep 2017 13:38:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qy2YDc6L4YkLHShLZvXkmKE2h+j4BTMMHa0Np/0qCmE=; b=SGOwu+JpKa5GWGAaWOkr9k9mT+FGNiO7st/UpgzYfPwI+KELynyF0rJE53J+PKev7+ NpKkME1toXJ6afcp4VJsHI+NtiJrHjEa4CZAMA5aITIoaSg9rxvrAytUTo+1MoVp3x6M h/y8hbCF+um903mMpIpxudGZtu4dytwxeTbw+jcub7wh/oubpAzPfsyYDheY2FL0uR6f xS2VuSlPzIB1P+em3FdX5TUsQfYvcrDE8eW3sKE3Jb3coyDlE4YkSS4xL5WiNooMkw08 WU4V9X7AZ21rbOmV+yJ4ay5B9Pk1cME/vDGY7xU1NZ8knvlm00Y1cR4sDPofZLURtBp7 zzow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Qy2YDc6L4YkLHShLZvXkmKE2h+j4BTMMHa0Np/0qCmE=; b=U/MRbP/YzPaVgY/wlkeYAuSf5VbF98QB6oucBiTSbVqD6S0VH07MCB4JOa1WkT9KTs QPb/TP87F/yaur2RAHaVH6Dw7amKXRSkcfycVyYIrZd+WT7EfMdUSWyaIhTfwXtINjDr cgBHOjXQi79CU6g/1h3OZjaW/W4ySM1R3Y7KXqvSN+nzRVqQa0vHs0vEJGxzZD1YenqR SF54WJ6LDDkqmdZSDRKLJ03LyZPgrvgN4Hrpmhwd9BWMT8b+5PjMctzkcC9W8uYuPj4L SrW1Qwe3EE7vPXW+w0c1i18yOl4z8O1Im1CiJBJzP6Wxy5VLfIGJjYiQoYOXrcXOr8SI ffNA== X-Gm-Message-State: AHPjjUjk4qhazxAoM0TWWqbDMYUUazo58DdpLxbyqLNt+lmtWSuTC9by iNa9s7T3kX+EjJOQuEcFQ078Cg== X-Google-Smtp-Source: AOwi7QD1U2C0iUOAhkdG+MDiO/Uf3BBCU9Vv59/Y4x3M6T2Zu2U6K+X4JjySuCC8RanV7DqZOXeeyg== X-Received: by 10.28.92.73 with SMTP id q70mr5839789wmb.150.1505594305019; Sat, 16 Sep 2017 13:38:25 -0700 (PDT) Received: from localhost.localdomain (2a01cb088610730010ddb904e4e3a574.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:10dd:b904:e4e3:a574]) by smtp.gmail.com with ESMTPSA id 66sm3733187wmn.37.2017.09.16.13.38.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2017 13:38:24 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 16 Sep 2017 22:38:20 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Cc: Thomas Petazzoni , "Yann E. MORIN" , Ricardo Martincoski Subject: [Buildroot] [PATCH 1/2] support/run-tests: move packages tests to packages directories X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Move the existing few packages' tests to the correspnding package directories. If we were to add the package/ directory to nose2's search path, we would have to add __init__.py files about everywhere, at each level of the directory hierarchy, because nose2 only includes tests that are in a python pacakge (a directory with a __init__.py file is a python package). This is far from ideal, especially since we have absolutely nothing to put in those __init__.py files. An alternative is to just scan the package/ directory ourselves, and create symlinks in a sub-directory of support/tessting/tests/ so that nose2 does find them. We have no two packages with the same name, we don't risk having two symlinks with the same name. That second solution is what we choose to do, at the cost of a slight increase in complexity in the run-test script. Signed-off-by: "Yann E. MORIN" Cc: Ricardo Martincoski Cc: Thomas Petazzoni Cc: Arnout Vandecappelle Cc: Samuel Martin --- .gitignore | 1 + .../dropbear/dropbear.py | 0 .../python-ipython/python-ipython.py | 0 .../test_python.py => package/python/python.py | 0 support/testing/run-tests | 22 ++++++++++++++++++++++ support/testing/tests/package/__init__.py | 0 6 files changed, 23 insertions(+) rename support/testing/tests/package/test_dropbear.py => package/dropbear/dropbear.py (100%) rename support/testing/tests/package/test_ipython.py => package/python-ipython/python-ipython.py (100%) rename support/testing/tests/package/test_python.py => package/python/python.py (100%) delete mode 100644 support/testing/tests/package/__init__.py diff --git a/support/testing/tests/package/__init__.py b/support/testing/tests/package/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.gitignore b/.gitignore index bb02d9f572..e85c07f99a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.o /*.patch /*.diff +/support/testing/tests/package/ *.orig *.rej *~ diff --git a/support/testing/tests/package/test_dropbear.py b/package/dropbear/dropbear.py similarity index 100% rename from support/testing/tests/package/test_dropbear.py rename to package/dropbear/dropbear.py diff --git a/support/testing/tests/package/test_ipython.py b/package/python-ipython/python-ipython.py similarity index 100% rename from support/testing/tests/package/test_ipython.py rename to package/python-ipython/python-ipython.py diff --git a/support/testing/tests/package/test_python.py b/package/python/python.py similarity index 100% rename from support/testing/tests/package/test_python.py rename to package/python/python.py diff --git a/support/testing/run-tests b/support/testing/run-tests index ae0bd336b5..67736331ae 100755 --- a/support/testing/run-tests +++ b/support/testing/run-tests @@ -2,6 +2,9 @@ import argparse import sys import os +import errno +import shutil +import re import nose2 import multiprocessing @@ -36,6 +39,9 @@ def main(): script_path = os.path.realpath(__file__) test_dir = os.path.dirname(script_path) + gatheradditionaltests(os.path.abspath("."), + os.path.join(test_dir,"tests","package")) + if args.stdout: BRTest.logtofile = False @@ -116,5 +122,21 @@ def main(): nose2.discover(argv=nose2_args) +def gatheradditionaltests(search_dir, symlink_dir): + try: + shutil.rmtree(symlink_dir) + except OSError as err: + if not err.errno == errno.ENOENT: + raise err + pass + os.mkdir(symlink_dir) + open(os.path.join(symlink_dir,"__init__.py"), "w").close() + for dir, _, files in os.walk(os.path.abspath(search_dir)): + package = os.path.basename(dir) + for file in files: + if re.match("^{}.py$".format(package),file): + os.symlink(os.path.join(dir,file), + os.path.join(symlink_dir,"test_{}.py".format(package))) + if __name__ == "__main__": sys.exit(main()) From patchwork Sat Sep 16 20:38:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 814545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="StgDLhtl"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xvkcq2C0Sz9t2S for ; Sun, 17 Sep 2017 06:38:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BAC3788D1E; Sat, 16 Sep 2017 20:38:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pUg9dpsoGQIr; Sat, 16 Sep 2017 20:38:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3525788D28; Sat, 16 Sep 2017 20:38:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id DBED81C1F5B for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D6F0588D28 for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EPjb8sViQroN for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 0697088D5C for ; Sat, 16 Sep 2017 20:38:28 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i131so5540533wma.1 for ; Sat, 16 Sep 2017 13:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=uTiQLoTsbebvPZEzTASGRj/miGRnYbhDvOy/iCAWulg=; b=StgDLhtlT3h5aPGo/q5T0ZsZuFmqGIXflD3TQkRULR89n6AeSlWxzCFx/+eKhObz7+ HOyEm+yth/QhJVkdr0l/psQUOIcoolBWgxp7KvRsN16NkL1qFOcY3m6GQsmGaVYHlkD9 ywmhllatkr9IMyx2U77eNWqsvw3f5eLtfvrq/chLmtYEwGLJVGQHj1vmGGghIDNREBNu 7D1UE+or1yVbtIg+oICQk7JkXxTZ4UIZYqAg+I7KiCxRwu1OEQwyCHZcmocrlwj8GJML z35SfuwFiZe0tXZAHqNXjalW6IRnqwgZUs9uzyobO0u2bUe8++zk6gDaZULFFl9AzJRn Ia4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=uTiQLoTsbebvPZEzTASGRj/miGRnYbhDvOy/iCAWulg=; b=emnUYJkyKXZzf+BY2RdDxevsWwFjtRmct4XbDlJcgfK2efxx2PaboV7Df9HTJ8M5mE JvhB6amZnNadGyVX8mN0g5VQUtrX8ihLE2FqNogHUzOrYHe+B43Z9VclIyx8Omxfr9c8 FEiLuNvO1KevHr7H1DoL8KvB6Tc98Bid9ciLGKBXLe9mdCV2BkZ+ms6YP/iAKwHwqyLB Pfvcr51cYeEYewQ8Vg/CW5vmEfHOWos5Fi6580Qjhe24n7YoJWVYDhqPAbRO5/G3IIYY alevbeRi7jfPF33zY+ae6Tx/+hpcAPXflfKQF16xsi4JNlel8UINgcuqrLLWeg3H4cai 5lCw== X-Gm-Message-State: AHPjjUhhOQDOOUY3veviUIuPutE8Qad5cxZFAhgyQFCO/wUYcZv05Rkg 82v7BxGuD2XM818fsF73uA2IZw== X-Google-Smtp-Source: AOwi7QCy88CdeLY5QZQfkis1/ziYuqnfk8w4+u3GZe5GGFMKY81JRsCBQbW+a26ioDX3tsLjob27Sw== X-Received: by 10.28.46.16 with SMTP id u16mr5330180wmu.125.1505594306270; Sat, 16 Sep 2017 13:38:26 -0700 (PDT) Received: from localhost.localdomain (2a01cb088610730010ddb904e4e3a574.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:10dd:b904:e4e3:a574]) by smtp.gmail.com with ESMTPSA id 66sm3733187wmn.37.2017.09.16.13.38.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2017 13:38:25 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 16 Sep 2017 22:38:21 +0200 Message-Id: <5d8ea4ebb51023d3943fb4e5a1678f8cfba70527.1505594291.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Cc: "Yann E . MORIN" Subject: [Buildroot] [PATCH 2/2] testing: add python-cryptography tests X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Yegor Yefremov Signed-off-by: Yegor Yefremov Reviewed-by: Ricardo Martincoski [yann.morin.1998@free.fr: - move to package directory, - indent the config fragment ] Signed-off-by: Yann E. MORIN --- Note: This is exactly the same as https://patchwork.ozlabs.org/patch/811011/ but with the test moved to the python-cryptography package and the config fragment indented. --- .gitlab-ci.yml | 2 ++ package/python-cryptography/python-cryptography.py | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 package/python-cryptography/python-cryptography.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b44c935f2a..091b016191 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -250,6 +250,8 @@ tests.package.test_ipython.TestIPythonPy2: *runtime_test tests.package.test_ipython.TestIPythonPy3: *runtime_test tests.package.test_python.TestPython2: *runtime_test tests.package.test_python.TestPython3: *runtime_test +tests.package.test_python_cryptography.TestPythonPy2Cryptography: *runtime_test +tests.package.test_python_cryptography.TestPythonPy3Cryptography: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootMusl: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc: *runtime_test tests.toolchain.test_external.TestExternalToolchainCCache: *runtime_test diff --git a/package/python-cryptography/python-cryptography.py b/package/python-cryptography/python-cryptography.py new file mode 100644 index 0000000000..907baaafa6 --- /dev/null +++ b/package/python-cryptography/python-cryptography.py @@ -0,0 +1,31 @@ +import os + +from tests.package.test_python import TestPythonBase + +class TestPythonCryptography(TestPythonBase): + def fernet_test(self, timeout=-1): + cmd = self.interpreter + " -c 'from cryptography.fernet import Fernet;" + cmd += "key = Fernet.generate_key();" + cmd += "f = Fernet(key)'" + _, exit_code = self.emulator.run(cmd, timeout) + self.assertEqual(exit_code, 0) + +class TestPythonPy2Cryptography(TestPythonCryptography): + config = TestPythonBase.config + \ + """ + BR2_PACKAGE_PYTHON=y + BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y + """ + def test_run(self): + self.login() + self.fernet_test(40) + +class TestPythonPy3Cryptography(TestPythonCryptography): + config = TestPythonBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y + """ + def test_run(self): + self.login() + self.fernet_test(40)