From 326e8a0a335a5f9f852f54e2efbe2423b4ee8998 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sat, 19 Aug 2023 15:55:41 -0600 Subject: [PATCH] LibWeb: Only update /etc/hosts for WPT if required lines are not present --- Tests/LibWeb/WPT/run.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/LibWeb/WPT/run.sh b/Tests/LibWeb/WPT/run.sh index f67688c0c5..7408b83beb 100755 --- a/Tests/LibWeb/WPT/run.sh +++ b/Tests/LibWeb/WPT/run.sh @@ -31,9 +31,11 @@ if [ ! -d "${SCRIPT_DIR}/wpt" ]; then # Apply WPT patch with Ladybird runner (cd wpt; git apply ../ladybird_runner.patch) - # Update hosts file - # FIXME: Only do this if required. Otherwise your /etc/hosts gets crowded quickly - python3 "./wpt/wpt" make-hosts-file | sudo tee -a /etc/hosts + # Update hosts file if needed + if [ "$(comm -13 <(sort -u /etc/hosts) <(python3 ./wpt/wpt make-hosts-file | sort -u) | wc -l)" -gt 0 ]; then + echo "Enter superuser password to append wpt hosts to /etc/hosts" + python3 "./wpt/wpt" make-hosts-file | sudo tee -a /etc/hosts + fi fi # Extract metadata.txt into directory with expectation files expected by WPT runner