ladybird/Tests/LibWeb/rebaseline-libweb-test
Sam Atkins eaea80007c Tests: Make rebaseline's build-dir check unambiguous
At least on my Linux machine using zsh, this line was interpreted as

  ( cd "$build_dir" || echo ... ) && exit 1

instead of the intended

  cd "$build_dir" || ( echo ... && exit 1 )

...meaning that it always exited regardless of whether it found the
build dir or not. So, let's make the intended precedence explicit.
2024-09-18 12:41:57 +01:00

40 lines
1.1 KiB
Bash
Executable file
Raw Permalink 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