Skip to content

Commit

Permalink
tests: upgrade devtools web tests deps, use python3 (#13782)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Mar 28, 2022
1 parent a3faef5 commit 896dd6f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/chromium-web-tests/download-content-shell.sh

- name: Install python deps
run: pip install six requests
run: python3 -m pip install six requests

- name: Run Web Tests
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/chromium-web-tests/run-web-tests.sh
Expand Down
11 changes: 4 additions & 7 deletions lighthouse-core/test/chromium-web-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ SKIP_DOWNLOADS=1 yarn test-devtools
### Prerequistes

<details>
<summary> Install `requests`</summary>

Ensure you have `requests` module available globally on your python 2.7 install. New Macs do not come with pip for python 2.7 which is deprecated, so you might have to install that too.
<summary>Install python dependencies</summary>

Ensure you have these modules available globally on your python 3.x install:

```sh
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
pip -m pip install requests
python3 -m pip install requests six
```

</details>
Expand Down Expand Up @@ -108,7 +105,7 @@ yarn run-devtools http://example.com

#### How to modify blink-tools.patch?

Simply make your changes in `.tmp/chromium-web-tests/blink_tools`, and run: `git -C .tmp/chromium-web-tests/blink_tools diff > lighthouse-core/test/chromium-web-tests/blink-tools.patch`
Simply make your changes in `.tmp/chromium-web-tests/blink_tools/latest`, and run: `git -C .tmp/chromium-web-tests/blink_tools/latest diff > lighthouse-core/test/chromium-web-tests/blink-tools.patch`

#### How does the python module `typ` get added to python sys path?

Expand Down
19 changes: 15 additions & 4 deletions lighthouse-core/test/chromium-web-tests/blink-tools.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py b/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
index 693a95d..7890234 100644
index 4323c8c..23ae146 100644
--- a/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
+++ b/third_party/blink/tools/blinkpy/web_tests/controllers/manager.py
@@ -452,9 +452,9 @@ class Manager(object):
@@ -485,9 +485,9 @@ class Manager(object):
if (self._port.requires_http_server()
or any(self._is_http_test(test) for test in tests_to_run)):
self._printer.write_update('Starting HTTP server ...')
Expand All @@ -16,10 +16,21 @@ index 693a95d..7890234 100644

if any(self._is_websocket_test(test) for test in tests_to_run):
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/base.py b/third_party/blink/tools/blinkpy/web_tests/port/base.py
index 6f5b188..0ae630e 100644
index 8f5ff1a..b7f0ae5 100644
--- a/third_party/blink/tools/blinkpy/web_tests/port/base.py
+++ b/third_party/blink/tools/blinkpy/web_tests/port/base.py
@@ -495,15 +495,15 @@ class Port(object):
@@ -63,8 +63,8 @@ from blinkpy.web_tests.port.factory import PortFactory
from blinkpy.web_tests.servers import apache_http
from blinkpy.web_tests.servers import pywebsocket
from blinkpy.web_tests.servers import wptserve
-from blinkpy.web_tests.skia_gold import blink_skia_gold_properties as sgp
-from blinkpy.web_tests.skia_gold import blink_skia_gold_session_manager as sgsm
+# from blinkpy.web_tests.skia_gold import blink_skia_gold_properties as sgp
+# from blinkpy.web_tests.skia_gold import blink_skia_gold_session_manager as sgsm

_log = logging.getLogger(__name__)

@@ -541,15 +541,15 @@ class Port(object):
self.get_option('configuration')):
return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# https://chromium.googlesource.com/chromium/src/
commit_chromium="4ffbceb9e46813c0041c27d52fbcd180348ae073"
commit_chromium="e1c3b88f73fcbff831485c0ca37f877bd22b7a02"
# https://chromium.googlesource.com/catapult/
commit_catapult="370c3d98a6db53222e9f36a4491a3757bb93e61a"
commit_catapult="c2b4e773a8d77586ddea18b1962a3e02d19e682f"

VERSIONED_DIR="$BLINK_TOOLS_PATH/$commit_chromium$commit_catapult"

Expand Down
7 changes: 6 additions & 1 deletion lighthouse-core/test/chromium-web-tests/web-test-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

set -euo pipefail

if ! type -P python3; then
echo "python3 could not be found"
exit 1
fi

# Get newest folder
latest_content_shell_dir=$(ls -t "$LH_ROOT/.tmp/chromium-web-tests/content-shells/" | head -n1)
export latest_content_shell="$LH_ROOT/.tmp/chromium-web-tests/content-shells/$latest_content_shell_dir"
Expand Down Expand Up @@ -49,7 +54,7 @@ set +e
# Print the python command.
set -x

python \
python3 \
"$BLINK_TOOLS_PATH/latest/third_party/blink/tools/run_web_tests.py" \
--layout-tests-directory="$DEVTOOLS_PATH/test/webtests" \
--build-directory="$latest_content_shell/out" \
Expand Down

0 comments on commit 896dd6f

Please sign in to comment.