2023-06-01 16:05:23 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
2023-08-19 19:41:42 +00:00
|
|
|
SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
|
|
|
|
|
2023-06-01 16:05:23 +00:00
|
|
|
if [ -z "$SERENITY_SOURCE_DIR" ]
|
|
|
|
then
|
2023-08-19 19:41:42 +00:00
|
|
|
SERENITY_SOURCE_DIR="$(realpath "${SCRIPT_DIR}/../../../")"
|
|
|
|
export SERENITY_SOURCE_DIR
|
2023-06-01 16:05:23 +00:00
|
|
|
fi
|
|
|
|
|
2023-06-14 18:00:48 +00:00
|
|
|
|
2023-08-19 23:15:54 +00:00
|
|
|
WEBDRIVER_BINARY=$(env PATH="${SERENITY_SOURCE_DIR}/Build/lagom/bin:${SERENITY_SOURCE_DIR}/Meta/Lagom/Build/bin:${PATH}" \
|
|
|
|
which WebDriver)
|
|
|
|
update_expectations_metadata=false
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
case $arg in
|
|
|
|
--webdriver-binary=*)
|
|
|
|
WEBDRIVER_BINARY="$(realpath "${arg#*=}")"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--update-expectations-metadata)
|
|
|
|
update_expectations_metadata=true
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown argument ${arg}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$WEBDRIVER_BINARY" ]; then
|
|
|
|
echo "Unable to find WebDriver binary, did you build Ladybird?"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-06-01 16:05:23 +00:00
|
|
|
|
2023-08-19 19:41:42 +00:00
|
|
|
pushd "${SCRIPT_DIR}"
|
2023-06-01 16:05:23 +00:00
|
|
|
|
2023-08-19 19:41:42 +00:00
|
|
|
if [ ! -d "${SCRIPT_DIR}/wpt" ]; then
|
|
|
|
# Clone patched web-platform-tests repository
|
|
|
|
git clone --depth 10000 https://github.com/web-platform-tests/wpt.git
|
2023-06-01 16:05:23 +00:00
|
|
|
|
2023-08-19 19:41:42 +00:00
|
|
|
# Switch to the commit that was used to generate tests expectations. Requires periodic updates.
|
2023-10-23 19:17:29 +00:00
|
|
|
git -C wpt checkout eedf737ce39c512d0ca3471f988972e3ece11822
|
2023-06-01 16:05:23 +00:00
|
|
|
|
2023-08-19 21:55:41 +00:00
|
|
|
# Update hosts file if needed
|
|
|
|
if [ "$(comm -13 <(sort -u /etc/hosts) <(python3 ./wpt/wpt make-hosts-file | sort -u) | wc -l)" -gt 0 ]; then
|
|
|
|
echo "Enter superuser password to append wpt hosts to /etc/hosts"
|
|
|
|
python3 "./wpt/wpt" make-hosts-file | sudo tee -a /etc/hosts
|
|
|
|
fi
|
2023-08-19 19:41:42 +00:00
|
|
|
fi
|
2023-06-01 16:05:23 +00:00
|
|
|
|
|
|
|
# Extract metadata.txt into directory with expectation files expected by WPT runner
|
2023-08-19 19:41:42 +00:00
|
|
|
python3 ./concat-extract-metadata.py --extract metadata.txt metadata
|
2023-06-01 16:05:23 +00:00
|
|
|
|
2023-06-14 18:00:48 +00:00
|
|
|
# Generate name for file with wpt run log
|
|
|
|
wpt_run_log_filename="$(mktemp).txt"
|
|
|
|
|
2023-06-01 16:05:23 +00:00
|
|
|
# Run tests.
|
2023-08-19 23:15:54 +00:00
|
|
|
python3 ./wpt/wpt run ladybird \
|
|
|
|
--webdriver-binary "${WEBDRIVER_BINARY}" \
|
|
|
|
--no-fail-on-unexpected \
|
|
|
|
--no-fail-on-unexpected-pass \
|
|
|
|
--skip-timeout \
|
|
|
|
--include-manifest include.ini \
|
|
|
|
--metadata ./metadata \
|
|
|
|
--manifest ./MANIFEST.json \
|
|
|
|
--log-raw "${wpt_run_log_filename}"
|
2023-06-14 18:00:48 +00:00
|
|
|
|
|
|
|
# Update expectations metadata files if requested
|
|
|
|
if [[ $update_expectations_metadata == true ]]; then
|
2023-08-19 19:41:42 +00:00
|
|
|
python3 ./wpt/wpt update-expectations --product ladybird --metadata ./metadata --manifest ./MANIFEST.json "${wpt_run_log_filename}"
|
|
|
|
python3 ./concat-extract-metadata.py --concat ./metadata > metadata.txt
|
2023-06-14 18:00:48 +00:00
|
|
|
fi
|
2023-08-19 19:41:42 +00:00
|
|
|
|
|
|
|
popd
|