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.
This commit is contained in:
Tim Ledbetter 2024-08-15 23:06:36 +01:00 committed by Andreas Kling
parent ea61e189eb
commit 819f966419
Notes: github-actions[bot] 2024-08-17 05:44:39 +00:00

View file

@ -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
}