diff options
author | Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com> | 2023-12-11 15:36:02 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-12 15:58:57 +0000 |
commit | effe2498ebecfc2065993a290c1a50b9c6adfca0 (patch) | |
tree | 3c057db563f84ee4475dcc0eedda7e620b687c00 /bitbake/lib | |
parent | df5c8d6471bf2484db61c7f180c9758fad4182e1 (diff) | |
download | poky-effe2498ebecfc2065993a290c1a50b9c6adfca0.tar.gz |
bitbake: toaster: Add verbose printout for missing chrome(driver) dependencies
If the chrome driver binary is missing dependencies, it was near impossible
to work out which ones from just the logs. Add code to help debug things
if this happens by including the ldd output.
(Bitbake rev: 0ffe5fccbb7db5aca5c409fe00be2be69a6e37d9)
Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/tests/browser/selenium_helpers_base.py | 23 |
1 files 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 | |||
24 | from selenium.webdriver.common.by import By | 24 | from selenium.webdriver.common.by import By |
25 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | 25 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities |
26 | from selenium.common.exceptions import NoSuchElementException, \ | 26 | from selenium.common.exceptions import NoSuchElementException, \ |
27 | StaleElementReferenceException, TimeoutException | 27 | StaleElementReferenceException, TimeoutException, \ |
28 | SessionNotCreatedException | ||
28 | 29 | ||
29 | def create_selenium_driver(cls,browser='chrome'): | 30 | def create_selenium_driver(cls,browser='chrome'): |
30 | # set default browser string based on env (if available) | 31 | # set default browser string based on env (if available) |
@@ -39,7 +40,25 @@ def create_selenium_driver(cls,browser='chrome'): | |||
39 | options.add_argument('--disable-dev-shm-usage') | 40 | options.add_argument('--disable-dev-shm-usage') |
40 | options.add_argument('--no-sandbox') | 41 | options.add_argument('--no-sandbox') |
41 | options.add_argument('--remote-debugging-port=9222') | 42 | options.add_argument('--remote-debugging-port=9222') |
42 | return webdriver.Chrome(options=options) | 43 | try: |
44 | return webdriver.Chrome(options=options) | ||
45 | except SessionNotCreatedException as e: | ||
46 | # check if chrome / chromedriver exists | ||
47 | chrome_path = os.popen("find ~/.cache/selenium/chrome/ -name 'chrome' -type f -print -quit").read().strip() | ||
48 | if not chrome_path: | ||
49 | raise SessionNotCreatedException("Failed to install/find chrome") | ||
50 | chromedriver_path = os.popen("find ~/.cache/selenium/chromedriver/ -name 'chromedriver' -type f -print -quit").read().strip() | ||
51 | if not chromedriver_path: | ||
52 | raise SessionNotCreatedException("Failed to install/find chromedriver") | ||
53 | # check if depends on each are fulfilled | ||
54 | depends_chrome = os.popen(f"ldd {chrome_path} | grep 'not found'").read().strip() | ||
55 | if depends_chrome: | ||
56 | raise SessionNotCreatedException(f"Missing chrome dependencies\n{depends_chrome}") | ||
57 | depends_chromedriver = os.popen(f"ldd {chromedriver_path} | grep 'not found'").read().strip() | ||
58 | if depends_chromedriver: | ||
59 | raise SessionNotCreatedException(f"Missing chrome dependencies\n{depends_chromedriver}") | ||
60 | # raise original error otherwise | ||
61 | raise e | ||
43 | elif browser == 'firefox': | 62 | elif browser == 'firefox': |
44 | return webdriver.Firefox() | 63 | return webdriver.Firefox() |
45 | elif browser == 'marionette': | 64 | elif browser == 'marionette': |