From 819f96641913700edcccbb324c6b83adfa732e3d Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 15 Aug 2024 23:06:36 +0100 Subject: [PATCH] Meta: Ensure required hosts are present before running tests in `WPT.sh` The Web Platform Tests runner requires that some hostnames point to localhost when running the tests locally. We now append these hostnames to `/etc/hosts` if they aren't already present. --- Meta/WPT.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Meta/WPT.sh b/Meta/WPT.sh index 1719cf4f3c7..90f38664631 100755 --- a/Meta/WPT.sh +++ b/Meta/WPT.sh @@ -86,6 +86,12 @@ ensure_wpt_repository() { if [ ! -d .git ]; then git clone --depth 1 "${WPT_REPOSITORY_URL}" "${WPT_SOURCE_DIR}" fi + + # Update hosts file if needed + if [ "$(comm -13 <(sort -u /etc/hosts) <(./wpt make-hosts-file | sort -u) | wc -l)" -gt 0 ]; then + echo "Enter superuser password to append wpt hosts to /etc/hosts" + ./wpt make-hosts-file | sudo tee -a /etc/hosts + fi popd > /dev/null }