From patchwork Mon Dec 11 20:36:02 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: 36046 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 8A6B1C4332F for ; Mon, 11 Dec 2023 20:36:26 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.2225.1702326977445849920 for ; Mon, 11 Dec 2023 12:36:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=wAvyVyjN; 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 4B1139C3291 for ; Mon, 11 Dec 2023 15:36:16 -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 h-aRLgo1kytb; Mon, 11 Dec 2023 15:36:15 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 8D8B09C36B1; Mon, 11 Dec 2023 15:36:15 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 8D8B09C36B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702326975; bh=8590O1MBhQngP/fO8f9WL7Jko9khnqpY8TKmQ30aAUE=; h=From:To:Date:Message-Id:MIME-Version; b=wAvyVyjN6ufbbyGBfUNHS9sceJH6Lz68XawkCew5SdX7sy2SNQasKecHNchemxqax Rw1Wbol4w5IP7seqQtwhpzf0CWEULCZD9H/RVxtYNMwYkUafkzIxWRCfmGnA0WTAjO X4FQYD8eIEu4W7lYZOQ+hWiO8iSUBPlVCfc5pJBVgyw+e1a+8v/5Y51GUFhaTMrUf/ QWBviRFlgbK+k+OOM8i8uqxMz9tIzzeqoNACzeZLMk0yGErgUnjeysxJPahVUrVxo/ cOQsaTap8yXs1cXvBHvIXFmITnHXkfHrM21AcdPhn7+x4QIUcuZFSGwy+SWsR9Xlf7 Jb64yut2q8ktA== 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 tyTzCdPhmCdC; Mon, 11 Dec 2023 15:36:15 -0500 (EST) Received: from alex-GA-78LMT-USB3.home (bras-base-mtrlpq427kw-grc-24-184-147-255-35.dsl.bell.ca [184.147.255.35]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 6D6219C3291; Mon, 11 Dec 2023 15:36:15 -0500 (EST) From: Alexander Lussier-Cullen To: toaster@lists.yoctoproject.org Cc: Alexander Lussier-Cullen Subject: [Toaster] bitbake: toaster: Add verbose printout for missing chrome(driver) dependencies Date: Mon, 11 Dec 2023 15:36:02 -0500 Message-Id: <20231211203602.31749-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 ; Mon, 11 Dec 2023 20:36:26 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6078 Signed-off-by: Alexander Lussier-Cullen --- .../tests/browser/selenium_helpers_base.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py index d9ea7fd108..46ced5a167 100644 --- a/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py +++ b/bitbake/lib/toaster/tests/browser/selenium_helpers_base.py @@ -24,7 +24,8 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.common.exceptions import NoSuchElementException, \ - StaleElementReferenceException, TimeoutException + StaleElementReferenceException, TimeoutException, \ + SessionNotCreatedException def create_selenium_driver(cls,browser='chrome'): # set default browser string based on env (if available) @@ -39,7 +40,25 @@ def create_selenium_driver(cls,browser='chrome'): options.add_argument('--disable-dev-shm-usage') options.add_argument('--no-sandbox') options.add_argument('--remote-debugging-port=9222') - return webdriver.Chrome(options=options) + try: + return webdriver.Chrome(options=options) + except SessionNotCreatedException as e: + # check if chrome / chromedriver exists + chrome_path = os.popen("find ~/.cache/selenium/chrome/ -name 'chrome' -type f -print -quit").read().strip() + if not chrome_path: + raise SessionNotCreatedException("Failed to install/find chrome") + chromedriver_path = os.popen("find ~/.cache/selenium/chromedriver/ -name 'chromedriver' -type f -print -quit").read().strip() + if not chromedriver_path: + raise SessionNotCreatedException("Failed to install/find chromedriver") + # check if depends on each are fulfilled + depends_chrome = os.popen(f"ldd {chrome_path} | grep 'not found'").read().strip() + if depends_chrome: + raise SessionNotCreatedException(f"Missing chrome dependencies\n{depends_chrome}") + depends_chromedriver = os.popen(f"ldd {chromedriver_path} | grep 'not found'").read().strip() + if depends_chromedriver: + raise SessionNotCreatedException(f"Missing chrome dependencies\n{depends_chromedriver}") + # raise original error otherwise + raise e elif browser == 'firefox': return webdriver.Firefox() elif browser == 'marionette':