From 79da6d48c1a54ca905946f0b5809b375e9d2eae4 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 19 Dec 2024 13:04:05 +0000 Subject: [PATCH] Meta: Strip query string from WPT test variants before importing them The output of `WPT.sh list-tests` includes test variants, which vary only by their query string. Since we don't care about this when importing tests, ignore any query strings and ensure duplicates are removed from the given test paths. --- Meta/WPT.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Meta/WPT.sh b/Meta/WPT.sh index 886c5fc69de..39b89634d11 100755 --- a/Meta/WPT.sh +++ b/Meta/WPT.sh @@ -233,23 +233,27 @@ import_wpt() INPUT_PATHS[i]="$item" done - TESTS=() + RAW_TESTS=() while IFS= read -r test_file; do - TESTS+=("$test_file") + RAW_TESTS+=("${test_file%%\?*}") done < <( "${ARG0}" list-tests "${INPUT_PATHS[@]}" ) - if [ "${#TESTS[@]}" -eq 0 ]; then + if [ "${#RAW_TESTS[@]}" -eq 0 ]; then echo "No tests found for the given paths" exit 1 fi + TESTS=() + while IFS= read -r test_file; do + TESTS+=("$test_file") + done < <(printf "%s\n" "${RAW_TESTS[@]}" | sort -u) + pushd "${LADYBIRD_SOURCE_DIR}" > /dev/null ./Meta/ladybird.sh build headless-browser set +e for path in "${TESTS[@]}"; do echo "Importing test from ${path}" - if ! ./Meta/import-wpt-test.py https://wpt.live/"${path}"; then continue fi