Meta: Support all available logging formats in WPT.sh script

This change allows the user to specify the format of the log file to be
generated by the `WPT.sh` script. Multiple logging arguments may now be
specified.

The supported logging arguments are: `--log-raw`, `--log-unittest`,
`--log-xunit`, `--log-html`, `--log-mach`, `--log-tbpl`,
`--log-grouped`, `--log-chromium`, `--log-wptreport` and
`--log-wptscreenshot`. These arguments act the same as the equivalent
arguments supported by `wpt run`.

The short `--log` argument may also be used as an alias for `--log-raw`.
This commit is contained in:
Tim Ledbetter 2024-09-13 23:50:16 +01:00 committed by Andreas Kling
commit 35ab0a2db6
Notes: github-actions[bot] 2024-09-14 23:57:46 +00:00

View file

@ -54,6 +54,8 @@ print_help() {
Run all of the Web Platform Tests. Run all of the Web Platform Tests.
$NAME run --log expectations.log css dom $NAME run --log expectations.log css dom
Run the Web Platform Tests in the 'css' and 'dom' directories and save the output to expectations.log. Run the Web Platform Tests in the 'css' and 'dom' directories and save the output to expectations.log.
$NAME run --log-wptreport expectations.json --log-wptscreenshot expectations.db css dom
Run the Web Platform Tests in the 'css' and 'dom' directories; save the output in wptreport format to expectations.json and save screenshots to expectations.db.
$NAME compare expectations.log $NAME compare expectations.log
Run all of the Web Platform Tests comparing the results to the expectations in before.log. Run all of the Web Platform Tests comparing the results to the expectations in before.log.
$NAME compare --log results.log expectations.log css/CSS2 $NAME compare --log results.log expectations.log css/CSS2
@ -75,13 +77,22 @@ if [ "$CMD" = "--help" ] || [ "$CMD" = "help" ]; then
fi fi
ARG=$1 ARG=$1
if [ "$ARG" = "--log" ]; then while [[ "$ARG" =~ ^--log(-(raw|unittest|xunit|html|mach|tbpl|grouped|chromium|wptreport|wptscreenshot))?$ ]]; do
case "$ARG" in
--log)
LOG_TYPE="--log-raw"
;;
*)
LOG_TYPE="$ARG"
;;
esac
shift shift
LOG_NAME="$(pwd -P)/$1" LOG_NAME="$(pwd -P)/$1"
[ -n "$LOG_NAME" ] || usage; [ -n "$LOG_NAME" ] || usage;
WPT_ARGS+=( "${LOG_TYPE}=${LOG_NAME}" )
shift shift
WPT_ARGS+=( "--log-raw=${LOG_NAME}" ) ARG=$1
fi done
TEST_LIST=( "$@" ) TEST_LIST=( "$@" )
exit_if_running_as_root "Do not run WPT.sh as root" exit_if_running_as_root "Do not run WPT.sh as root"