ladybird/Tests/LibWeb/rebaseline-libweb-test
sideshowbarker 0c77b3bf59 Tests: Allow specifying a build preset for rebaseline-libweb-test
This change enables using the rebaseline-libweb-test script with Debug
and Sanitizer builds — and allows specifying which build to use when
using rebaseline-libweb-test to generate new test-expectations files.

The mechanism used is to check the BUILD_PRESET environment variable.

Otherwise, without this change, there’s no way to use the
rebaseline-libweb-test script with Debug and Sanitizer builds — except
by manually hacking the script locally to hardcode a directory name.
2024-09-08 09:46:56 +02:00

40 lines
1.1 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set +e
t=$1
if echo -n $t | grep ^file: ; then
t=$(echo -n $t | sed s@^file://@@)
fi
if echo -n $t | grep Layout ; then
mode_flag="-d"
else
mode_flag="-T"
fi
input_dir=$(dirname $t)
expected_dir=$(echo $input_dir | sed s/input/expected/)
test_name=$(basename $t .html)
if [[ "$BUILD_PRESET" == "Sanitizer" ]]; then
build_dir=$LADYBIRD_SOURCE_DIR/Build/ladybird-sanitizers
elif [[ "$BUILD_PRESET" == "Debug" ]]; then
build_dir=$LADYBIRD_SOURCE_DIR/Build/ladybird-debug
else
build_dir=$LADYBIRD_SOURCE_DIR/Build/ladybird
fi
cd "$build_dir" || echo "Couldnt cd to build directory" >&2 && exit 1
if [[ -f ./bin/headless-browser ]]; then
ladybird_headless_binary=./bin/headless-browser
elif [[ -f ./bin/Ladybird.app/Contents/MacOS/headless-browser ]]; then
ladybird_headless_binary=./bin/Ladybird.app/Contents/MacOS/headless-browser
else
echo "ERR: Could not find headless-browser binary" >&2
exit 1
fi
mkdir -p $expected_dir
$ladybird_headless_binary $mode_flag --force-fontconfig --layout-test-mode $input_dir/$test_name.html > $expected_dir/$test_name.txt