From patchwork Fri Dec 8 01:57:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 35901 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 65A01C4167B for ; Fri, 8 Dec 2023 01:57:19 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web11.10417.1702000631604656326 for ; Thu, 07 Dec 2023 17:57:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=t/MXq2YW; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id EAFF29C33BA for ; Thu, 7 Dec 2023 20:57:10 -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 uLsOCC27r2Yq; Thu, 7 Dec 2023 20:57:10 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 969579C33E2; Thu, 7 Dec 2023 20:57:10 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 969579C33E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702000630; bh=gn8j86AZLwDt86nV+sphGAC1IC5bGwhAumwhVMRr7LM=; h=From:To:Date:Message-Id:MIME-Version; b=t/MXq2YWnMytiHD5Hdp1WgfzDkIwy+JlOiZF+qNgklFBKhnbNM66XVVPOHNwfssXE hqv7o8BWkfHj7aLukWfTyFkaP6Wvqql95bM09SjpH7oVxLGKtNu0HKycRGPihuxqVN +0BTCQ99UYQqOLza7PPk3Szn+cMQUAQHECox92jm9ioAIMLFIbaYad0HvFql4+kjvX mclkyI3IvBw9HnSENDEiC/omKEHc/JrfynnkDWsmvGUWRvDCjpNjM5Zuej+l6Mrt2W RyeQuMzMj5bszKaws0WbGHdq95ubcksjy/ggPYT4aDEHo68h6ff4yQVDWz7JNZg9HR qXEAogJMzNr4A== 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 sGk1lQwUehgH; Thu, 7 Dec 2023 20:57:10 -0500 (EST) Received: from jedi.. (unknown [196.127.183.75]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id D73B69C33BA; Thu, 7 Dec 2023 20:57:09 -0500 (EST) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH] toaster/test: Fixes warnings in autobuilder Date: Fri, 8 Dec 2023 02:57:04 +0100 Message-Id: <20231208015704.688931-1-alassane.yattara@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 ; Fri, 08 Dec 2023 01:57:19 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6072 ../bitbake/lib/toaster/tests/functional/functional_helpers.py:66 /home/pokybuild/yocto-worker/toaster/build/bitbake/lib/toaster/tests/functional/functional_helpers.py:66: DeprecationWarning: invalid escape sequence '\s' project_url=re.search("(projectPageUrl\s:\s\")(.*)(\",)",rc) Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/pokybuild/yocto-worker/toaster/build/bitbake/lib/toaster/tests/commands/test_runbuilds.py", line 39, in run os.kill(int(pid), signal.SIGTERM) ProcessLookupError: [Errno 3] No such process Signed-off-by: Alassane Yattara --- lib/toaster/tests/commands/test_runbuilds.py | 13 ++++++++++--- lib/toaster/tests/functional/functional_helpers.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/toaster/tests/commands/test_runbuilds.py b/lib/toaster/tests/commands/test_runbuilds.py index c77d6cf4..738d36e9 100644 --- a/lib/toaster/tests/commands/test_runbuilds.py +++ b/lib/toaster/tests/commands/test_runbuilds.py @@ -19,6 +19,10 @@ import time import subprocess import signal +import logging + + +logger = logging.getLogger("toaster") class KillRunbuilds(threading.Thread): """ Kill the runbuilds process after an amount of time """ @@ -34,9 +38,12 @@ class KillRunbuilds(threading.Thread): pidfile_path = os.path.join(os.environ.get("BUILDDIR", "."), ".runbuilds.pid") - with open(pidfile_path) as pidfile: - pid = pidfile.read() - os.kill(int(pid), signal.SIGTERM) + try: + with open(pidfile_path) as pidfile: + pid = pidfile.read() + os.kill(int(pid), signal.SIGTERM) + except ProcessLookupError: + logger.warning("Runbuilds not running or already killed") class TestCommands(TestCase): diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py index b80d403b..1c535db6 100644 --- a/lib/toaster/tests/functional/functional_helpers.py +++ b/lib/toaster/tests/functional/functional_helpers.py @@ -62,7 +62,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): def get_URL(self): rc=self.get_page_source() - project_url=re.search("(projectPageUrl\s:\s\")(.*)(\",)",rc) + project_url=re.search(r"(projectPageUrl\s:\s\")(.*)(\",)",rc) return project_url.group(2)