From patchwork Fri Nov 2 04:12:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Martincoski X-Patchwork-Id: 992180 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ui/WcBaK"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42mTGY4gN9zB4R1 for ; Fri, 2 Nov 2018 15:13:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2EE6987E38; Fri, 2 Nov 2018 04:13:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FKVvpAuakLr9; Fri, 2 Nov 2018 04:13:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 8BF1287D54; Fri, 2 Nov 2018 04:13:53 +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 030341BF4DA for ; Fri, 2 Nov 2018 04:13:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0098D863DD for ; Fri, 2 Nov 2018 04:13:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KeiY6Uzyj1rU for ; Fri, 2 Nov 2018 04:13:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B964F85F71 for ; Fri, 2 Nov 2018 04:13:51 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id v68-v6so1173913qka.2 for ; Thu, 01 Nov 2018 21:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=AHiKPiX2VrMquMzO5aS8qs/IntP2uTUFmCK+eG6mmfo=; b=Ui/WcBaK71/U8fxsJPxrHbEU2flHTC3QFe5RU0wPViLiA+d/uMTlA04du+1wGmnoQV A9+OQ8AmgR3gsiQeva1klpUyrDlmgWjf5GmNsesOl1oQWoTdcmSOsV3tPGjcebAu4pfy G/9NJV0t/uyiWSmTVM4EwMGybvx/8saz7CzxC9S9Nen88V5meN/H8bo9Z4+3mIm1/q/6 Ertai7VDOXBA1V1vqhhF3TklhfpGgNr58vAXcJT0RKMlGSML4blvKTjFPJavCxpwjJ8L gVt+Wji0Oh9crb0sNFZdTo4tPhtrHXYBA1a+/XUn/iXmltrJW3tB4jFYVvM44CAV/uyr 4osw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=AHiKPiX2VrMquMzO5aS8qs/IntP2uTUFmCK+eG6mmfo=; b=YfOy0fW0roiXqSZ5TLh1+CChA+zAPaXMNqbk93ypRnMoTkBS8q8LDy5eRXQvFNHXCI 3pKSx0GtfP0vo8qpP9V5dQPZSHd2kuXf6ldO/GWc9n0VS8OwtMU2ubamZk1I0MqXfLy/ wdNNEA8P7t29Zk19Oaklk98k//DWTDyCNij9NiPnIkiBePbLAUih5Y6+GmMuhIWlM6Ak g5y4sCStVuRb93Plxih6LF+tjxrNeD1uwiMhEhmjNsljBSmDwKpKhawrclz1ncjagim0 o7xyGL3peD5SWAPO4MFDkjFCr4D8HKfijs4N51mNHXpXC5DNblEILNjcKenKxKWU7xo/ 3lDw== X-Gm-Message-State: AGRZ1gJ1/R18/IAS8X80fYZxBC/BJJezxyUQA0+wr1bF9+yBiMDux0Xc HGURiRbnXayAlTLP/oTJtYn4ImTa X-Google-Smtp-Source: AJdET5e7qRay9aqFbFArWU9WVKNqA8orZsmHdpVWbtcZ7QzuADdHSyl9HwwD6WwAb45yVpmzLSdejg== X-Received: by 2002:a37:d91:: with SMTP id 139mr9494611qkn.26.1541132030682; Thu, 01 Nov 2018 21:13:50 -0700 (PDT) Received: from ultri5.home ([179.181.159.8]) by smtp.gmail.com with ESMTPSA id 83sm32849688qkz.73.2018.11.01.21.13.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 21:13:50 -0700 (PDT) From: Ricardo Martincoski To: buildroot@buildroot.org Date: Fri, 2 Nov 2018 01:12:37 -0300 Message-Id: <20181102041241.28910-9-ricardo.martincoski@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181102041241.28910-1-ricardo.martincoski@gmail.com> References: <20181102041241.28910-1-ricardo.martincoski@gmail.com> In-Reply-To: <20181016004230.10393-1-ricardo.martincoski@gmail.com> References: <20181016004230.10393-1-ricardo.martincoski@gmail.com> Subject: [Buildroot] [PATCH v2 08/12] support/testing: use TestPythonPackageBase for python-twisted X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Asaf Kahlon , Ricardo Martincoski MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Move the test script to be run on the target from inline in the test case to a separate file. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Cc: Asaf Kahlon Cc: Thomas Petazzoni Cc: Yegor Yefremov --- Changes v1 -> v2: - refresh after creating TestPythonPackageBase; - override run_sample_scripts instead of test_run; --- .../tests/package/sample_python_twisted.py | 9 ++++ .../tests/package/test_python_twisted.py | 42 +++++-------------- 2 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 support/testing/tests/package/sample_python_twisted.py diff --git a/support/testing/tests/package/sample_python_twisted.py b/support/testing/tests/package/sample_python_twisted.py new file mode 100644 index 0000000000..47d6c5debc --- /dev/null +++ b/support/testing/tests/package/sample_python_twisted.py @@ -0,0 +1,9 @@ +from twisted.internet import protocol, reactor, endpoints + + +class F(protocol.Factory): + pass + + +endpoints.serverFromString(reactor, "tcp:1234").listen(F()) +reactor.run() diff --git a/support/testing/tests/package/test_python_twisted.py b/support/testing/tests/package/test_python_twisted.py index 74b32fbd62..fa83620e5e 100644 --- a/support/testing/tests/package/test_python_twisted.py +++ b/support/testing/tests/package/test_python_twisted.py @@ -1,25 +1,19 @@ -from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3 - -TEST_SCRIPT = """ -from twisted.internet import protocol, reactor, endpoints -class F(protocol.Factory): - pass -endpoints.serverFromString(reactor, "tcp:1234").listen(F()) -reactor.run() -""" +from tests.package.test_python import TestPythonPackageBase, TestPythonBase2, TestPythonBase3 -class TestPythonTwisted(TestPythonBase): - def import_test(self): - cmd = "printf '{}' > test.py".format(TEST_SCRIPT) - _, exit_code = self.emulator.run(cmd) - self.assertEqual(exit_code, 0) +class TestPythonTwisted(TestPythonPackageBase): + config_package = \ + """ + BR2_PACKAGE_PYTHON_TWISTED=y + """ + sample_scripts = ["tests/package/sample_python_twisted.py"] + def run_sample_scripts(self): cmd = "netstat -ltn 2>/dev/null | grep 0.0.0.0:1234" _, exit_code = self.emulator.run(cmd) self.assertEqual(exit_code, 1) - cmd = self.interpreter + " test.py &" + cmd = self.interpreter + " sample_python_twisted.py &" # give some time to setup the server cmd += "sleep 30" _, exit_code = self.emulator.run(cmd, timeout=35) @@ -31,22 +25,8 @@ class TestPythonTwisted(TestPythonBase): class TestPythonPy2Twisted(TestPythonTwisted, TestPythonBase2): - config = TestPythonBase2.config + \ - """ - BR2_PACKAGE_PYTHON_TWISTED=y - """ - - def test_run(self): - self.login() - self.import_test() + pass class TestPythonPy3Twisted(TestPythonTwisted, TestPythonBase3): - config = TestPythonBase3.config + \ - """ - BR2_PACKAGE_PYTHON_TWISTED=y - """ - - def test_run(self): - self.login() - self.import_test() + pass