Meta: Add a flag to WPT.sh to run Ladybird headlessly
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

We have more work to do before we can run WPT headlessly by default
(i.e. handling alerts). But for now, we can run it headlessly locally
with the --headless flag.
This commit is contained in:
Timothy Flynn 2024-10-21 19:31:05 -04:00 committed by Tim Ledbetter
parent b24a7079f1
commit 14c3bff5da
Notes: github-actions[bot] 2024-10-22 03:25:25 +00:00

View file

@ -18,9 +18,9 @@ BUILD_DIR=$(get_build_dir "$BUILD_PRESET")
default_binary_path() {
if [ "$(uname -s)" = "Darwin" ]; then
echo "${BUILD_DIR}/bin/Ladybird.app/Contents/MacOS/"
echo "${BUILD_DIR}/bin/Ladybird.app/Contents/MacOS"
else
echo "${BUILD_DIR}/bin/"
echo "${BUILD_DIR}/bin"
fi
}
@ -31,8 +31,7 @@ WPT_CERTIFICATES=(
"tools/certs/cacert.pem"
"${LADYBIRD_SOURCE_DIR}/Build/ladybird/Lagom/cacert.pem"
)
WPT_ARGS=( "--binary=${LADYBIRD_BINARY}"
"--webdriver-binary=${WEBDRIVER_BINARY}"
WPT_ARGS=( "--webdriver-binary=${WEBDRIVER_BINARY}"
"--install-webdriver"
"--processes=${WPT_PROCESSES}"
"--webdriver-arg=--force-cpu-painting"
@ -82,23 +81,39 @@ if [ "$CMD" = "--help" ] || [ "$CMD" = "help" ]; then
exit 0
fi
set_logging_flags()
{
[ -n "${1}" ] || usage;
[ -n "${2}" ] || usage;
log_type="${1}"
log_name="$(pwd -P)/${2}"
WPT_ARGS+=( "${log_type}=${log_name}" )
}
ARG=$1
while [[ "$ARG" =~ ^--log(-(raw|unittest|xunit|html|mach|tbpl|grouped|chromium|wptreport|wptscreenshot))?$ ]]; do
while [[ "$ARG" =~ ^(--headless|(--log(-(raw|unittest|xunit|html|mach|tbpl|grouped|chromium|wptreport|wptscreenshot))?))$ ]]; do
case "$ARG" in
--headless)
LADYBIRD_BINARY="$(default_binary_path)/headless-browser"
WPT_ARGS+=( "--webdriver-arg=--headless" )
;;
--log)
LOG_TYPE="--log-raw"
set_logging_flags "--log-raw" "${2}"
shift
;;
*)
LOG_TYPE="$ARG"
set_logging_flags "${ARG}" "${2}"
shift
;;
esac
shift
LOG_NAME="$(pwd -P)/$1"
[ -n "$LOG_NAME" ] || usage;
WPT_ARGS+=( "${LOG_TYPE}=${LOG_NAME}" )
shift
ARG=$1
done
WPT_ARGS+=( "--binary=${LADYBIRD_BINARY}" )
TEST_LIST=( "$@" )
exit_if_running_as_root "Do not run WPT.sh as root"