From patchwork Tue Dec 12 20:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lussier-Cullen X-Patchwork-Id: 36118 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E9FAC4332F for ; Tue, 12 Dec 2023 20:25:06 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.6743.1702412699286208829 for ; Tue, 12 Dec 2023 12:25:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=UsEFHtaF; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alexander.lussier-cullen@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 47B169C284E for ; Tue, 12 Dec 2023 15:24:58 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id 9i5q-15XOxEi; Tue, 12 Dec 2023 15:24:57 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id A986B9C375B; Tue, 12 Dec 2023 15:24:57 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com A986B9C375B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702412697; bh=wyBE4Eq+jL6uq7TGr42PX0Qt85IJILDHDQIdJWU/1ok=; h=From:To:Date:Message-Id:MIME-Version; b=UsEFHtaFxcDW8Uxn5mwNtQiiJAu+IDxIyWBY87uH1Aqu4o5RgYkrxT4pO+X4/gJt5 YJCUGhRz78bcd09Ok0swvT7oo5I2HOEn0kovt+/wkLBQ6Q90rAWeEqGRtAy2ff4qSn J4woWt25FO+IuS+xdNqVGighAfZrU03qzaOVCLcREneyOYX6bbh/6pFZQkfOdqRUgZ 7NRMRuRsfP5a93yOh0gBszeDgr17CPViQZRmcrJzt4Xh4wE8ECfbgqyE+D5Jdtwx1z gxlUuwbCXkyMRLLAcn0kqmzIgDSRRkVpbUr7n578Fb1gN3B7cGAQEBaKCYQm9zhLiq QaqJLv6hjlRmw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id stkR78AqrcrU; Tue, 12 Dec 2023 15:24:57 -0500 (EST) Received: from alctower.mtl.sfl (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 8C80C9C284E; Tue, 12 Dec 2023 15:24:57 -0500 (EST) From: Alexander Lussier-Cullen To: toaster@lists.yoctoproject.org Cc: Alexander Lussier-Cullen Subject: [Toaster] bitbake: toaster: add functional testing toaster error details Date: Tue, 12 Dec 2023 15:24:28 -0500 Message-Id: <20231212202428.1374197-1-alexander.lussier-cullen@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 12 Dec 2023 20:25:06 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6087 Functional tests can sometimes fail to initialize toaster. Most often this is due to a conflict on port 8000. Add command information about whichever other process is running on that port to better describe the initialization failure. Signed-off-by: Alexander Lussier-Cullen --- .../lib/toaster/tests/functional/functional_helpers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/toaster/tests/functional/functional_helpers.py b/bitbake/lib/toaster/tests/functional/functional_helpers.py index d3e037a6d0..09cf3ba8e0 100644 --- a/bitbake/lib/toaster/tests/functional/functional_helpers.py +++ b/bitbake/lib/toaster/tests/functional/functional_helpers.py @@ -28,7 +28,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): # So that the buildinfo helper uses the test database' if os.environ.get('DJANGO_SETTINGS_MODULE', '') != \ 'toastermain.settings_test': - raise RuntimeError("Please initialise django with the tests settings: " \ + raise RuntimeError("Please initialise django with the tests settings: " "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") # start toaster @@ -38,7 +38,13 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): cwd=os.environ.get("BUILDDIR"), shell=True) if cls.p.wait() != 0: - raise RuntimeError("Can't initialize toaster") + port_use = os.popen("lsof -i -P -n | grep '8000 (LISTEN)'").read().strip() + message = '' + if port_use: + process_id = port_use.split()[1] + process = os.popen(f"ps -o cmd= -p {process_id}").read().strip() + message = f"Port 8000 occupied by {process}" + raise RuntimeError(f"Can't initialize toaster. {message}") super(SeleniumFunctionalTestCase, cls).setUpClass() cls.live_server_url = 'http://localhost:8000/'