Meta: Add a list-tests command to WPT.sh

This outputs a list of all the tests that would be run in the given
test directories.
This commit is contained in:
Tim Ledbetter 2024-12-09 11:05:57 +00:00 committed by Andrew Kaster
commit a4f1838798
Notes: github-actions[bot] 2024-12-11 23:31:33 +00:00

View file

@ -60,6 +60,8 @@ print_help() {
Run the Web Platform Tests comparing the results to the expectations in LOG_FILE. Run the Web Platform Tests comparing the results to the expectations in LOG_FILE.
import: $NAME import [TESTS...] import: $NAME import [TESTS...]
Fetch the given test file(s) from https://wpt.live/ and create an in-tree test and expectation files. Fetch the given test file(s) from https://wpt.live/ and create an in-tree test and expectation files.
list-tests: $NAME list-tests [PATHS..]
List the tests in the given PATHS.
Examples: Examples:
$NAME update $NAME update
@ -76,6 +78,8 @@ print_help() {
Run the Web Platform Tests in the 'css/CSS2' directory, comparing the results to the expectations in expectations.log; output the results to results.log. Run the Web Platform Tests in the 'css/CSS2' directory, comparing the results to the expectations in expectations.log; output the results to results.log.
$NAME import html/dom/aria-attribute-reflection.html $NAME import html/dom/aria-attribute-reflection.html
Import the test from https://wpt.live/html/dom/aria-attribute-reflection.html into the Ladybird test suite. Import the test from https://wpt.live/html/dom/aria-attribute-reflection.html into the Ladybird test suite.
$NAME list-tests css/CSS2 dom
Show a list of all tests in the 'css/CSS2' and 'dom' directories.
EOF EOF
} }
@ -199,6 +203,15 @@ serve_wpt()
popd > /dev/null popd > /dev/null
} }
list_tests_wpt()
{
ensure_wpt_repository
pushd "${WPT_SOURCE_DIR}" > /dev/null
./wpt run --list-tests ladybird "${TEST_LIST[@]}"
popd > /dev/null
}
import_wpt() import_wpt()
{ {
for i in "${!INPUT_PATHS[@]}"; do for i in "${!INPUT_PATHS[@]}"; do
@ -229,7 +242,7 @@ compare_wpt() {
rm -rf "${METADATA_DIR}" rm -rf "${METADATA_DIR}"
} }
if [[ "$CMD" =~ ^(update|run|serve|compare|import)$ ]]; then if [[ "$CMD" =~ ^(update|run|serve|compare|import|list-tests)$ ]]; then
case "$CMD" in case "$CMD" in
update) update)
update_wpt update_wpt
@ -257,6 +270,9 @@ if [[ "$CMD" =~ ^(update|run|serve|compare|import)$ ]]; then
shift shift
compare_wpt compare_wpt
;; ;;
list-tests)
list_tests_wpt
;;
esac esac
else else
>&2 echo "Unknown command: $CMD" >&2 echo "Unknown command: $CMD"