ladybird/Tests/LibWeb/Layout/layout_test.sh
Timothy Flynn 9f9b8e7273 CI: Move running LibWeb layout tests to Azure
The current config on GitHub Actions does not use ccache, so it takes
quite a while to build. Instead, let's just run these tests on Azure
where we already build Ladybird and have ccache enabled. This also lets
us sanitize LibWeb on both Linux and macOS.

The script changes here are to A) handle differences between Azure and
GitHub Actions and B) to support running on macOS.
2023-02-01 14:04:44 +00:00

31 lines
932 B
Bash
Executable file

#!/usr/bin/env bash
set -eo pipefail
SCRIPT_DIR="$(cd -P -- "$(dirname -- "${0}")" && pwd -P)"
LADYBIRD_BUILD_DIR="${1}"
if [[ -z "${LADYBIRD_BUILD_DIR}" ]] ; then
echo "Provide path to the Ladybird build directory"
exit 1
fi
if [[ "$(uname -s)" = "Darwin" ]] ; then
LADYBIRD_BINARY="./ladybird.app/Contents/MacOS/ladybird"
else
LADYBIRD_BINARY="./ladybird"
fi
for input_html_path in "${SCRIPT_DIR}"/input/*; do
input_html_file="$(basename "${input_html_path}" .html)"
output_layout_dump=$(cd "${LADYBIRD_BUILD_DIR}"; "${LADYBIRD_BINARY}" -d "${input_html_path}")
expected_layout_dump_path="${SCRIPT_DIR}/expected/${input_html_file}.txt"
if cmp <(echo "${output_layout_dump}") "${expected_layout_dump_path}"; then
echo "${input_html_file} PASSED"
else
echo "${input_html_file} FAILED"
diff "${expected_layout_dump_path}" <(echo "${output_layout_dump}")
fi
done