Skip to content

Commit

Permalink
Fix html_file arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rodarima committed Dec 30, 2023
1 parent bf8b28e commit c5669d4
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions test/html/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,7 @@
set -e
set -x

html_file="$1"
if [ ! -e "$html_file" ]; then
echo "missing test file: $html_file"
exit 1
fi

ref_file="${html_file%.html}.ref.html"
if [ ! -e "$ref_file" ]; then
echo "missing reference file: $ref_file"
exit 1
fi

test_name=$(basename "$html_file")

wdir=$(mktemp -d "${test_name}_XXX")
WDIR=$(mktemp -d "${test_name}_XXX")
DILLOBIN=${DILLOBIN:-$TOP_BUILDDIR/src/dillo}

if [ ! -e $DILLOBIN ]; then
Expand Down Expand Up @@ -46,20 +32,35 @@ function render_page() {

function test_file() {

mkfifo $wdir/display.fifo
exec 6<> $wdir/display.fifo
html_file="$1"
if [ ! -e "$html_file" ]; then
echo "missing test file: $html_file"
exit 1
fi

ref_file="${html_file%.html}.ref.html"
if [ ! -e "$ref_file" ]; then
echo "missing reference file: $ref_file"
exit 1
fi

test_name=$(basename "$html_file")


mkfifo $WDIR/display.fifo
exec 6<> $WDIR/display.fifo
#Xvfb :33 -screen 5 1024x768x8 2>/dev/null &
Xvfb -screen 5 1024x768x8 -displayfd 6 &
xorgpid=$!
trap "kill $xorgpid" EXIT

read disp < $wdir/display.fifo
read disp < $WDIR/display.fifo
export DISPLAY=":$disp"

render_page $html_file $wdir/html.png
render_page $ref_file $wdir/ref.png
render_page "$html_file" "$WDIR/html.png"
render_page "$ref_file" "$WDIR/ref.png"

diffvalue=$(compare -metric AE $wdir/html.png $wdir/ref.png $wdir/diff.png 2>&1)
diffvalue=$(compare -metric AE $WDIR/html.png $WDIR/ref.png $WDIR/diff.png 2>&1)

if [ "$diffvalue" = "0" ]; then
echo "OK"
Expand All @@ -70,7 +71,7 @@ function test_file() {
fi

exec 6>&-
rm $wdir/display.fifo
rm $WDIR/display.fifo

#kill $xorgpid

Expand Down

0 comments on commit c5669d4

Please sign in to comment.