-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Dillo test suite | ||
|
||
This repository contains the WPT as a git submodule and a set of tools to be | ||
able to run some test on Dillo. There are a lot of tests that we cannot pass | ||
simply because Dillo doesn't support Javascript. | ||
|
||
To run the tests, you will need to provide the path to the dillo binary using | ||
the DILLOBIN variable. | ||
|
||
``` | ||
$ export DILLOBIN=/path/to/dillo | ||
``` | ||
|
||
Use the `genlist` script to generate a list of all suitable tests for Dillo and | ||
`runtest` to run them: | ||
|
||
``` | ||
$ ./genlist | ./runlist | ||
``` | ||
|
||
Use grep or other filters to select a particular subset of tests. You can also | ||
run one specific test by using: | ||
|
||
``` | ||
$ echo wpt/path/to/the/test.html | ./runlist | ||
``` | ||
|
||
The result of the tests will be printed to the stdout. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
find wpt/css/CSS2/ -type f | grep -E '\.(html|xht)$' | grep -v -- '-ref.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
if [ ! -e $DILLOBIN ]; then | ||
echo missing dillo binary, set DILLOBIN with the path to dillo | ||
exit 1 | ||
fi | ||
|
||
ntot=0 | ||
nok=0 | ||
|
||
while read testfile; do | ||
let ntot="$ntot+1" | ||
#./single.sh "$testfile" | ||
./runtest "$testfile" >/dev/null 2>&1 | ||
ret=$? | ||
if [ "$ret" == "0" ]; then | ||
echo "OK $testfile" | ||
let nok="$nok+1" | ||
elif [ "$ret" == "100" ]; then | ||
echo "FAIL $testfile" | ||
else | ||
echo "BAD $testfile" | ||
fi | ||
done | ||
|
||
echo | ||
echo "Passed tests: $nok/$ntot" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/sh | ||
|
||
# Return errors: | ||
# | ||
# 0 - The test passed | ||
# 1 - Cannot find Dillo binary | ||
# 2 - Cannot find test or reference test | ||
# 3 - Dillo crashed or cannot find window | ||
# 100 - The test doesn't match the reference | ||
|
||
set -e | ||
#set -x | ||
|
||
if [ ! -e "$DILLOBIN" ]; then | ||
echo missing dillo binary, set DILLOBIN with the path to dillo | ||
exit 1 | ||
fi | ||
|
||
test_fpath="$1" | ||
|
||
# Set the testfile to absolute path | ||
testfile="$PWD/$test_fpath" | ||
|
||
if [ ! -e "$testfile" ]; then | ||
echo "cannot find test file: $testfile" >&2 | ||
exit 2 | ||
fi | ||
|
||
testdir=$(dirname "$testfile") | ||
|
||
# Get the match file | ||
match=$(xmllint --html --xpath "string(//head/link[@rel='match']/@href)" "$testfile") | ||
|
||
if [ -z "$match" ]; then | ||
echo "cannot find link rel=match file" >&2 | ||
exit 2 | ||
fi | ||
|
||
reffile="$testdir/$match" | ||
|
||
if [ ! -e "$reffile" ]; then | ||
echo "reference file $reffile not found" >&2 | ||
exit 2 | ||
fi | ||
|
||
magick_bin="convert" | ||
if command -v magick 2>&1 >/dev/null; then | ||
magick_bin="magick" | ||
fi | ||
|
||
function render_page() { | ||
htmlfile="$1" | ||
outpic="$2" | ||
|
||
"$DILLOBIN" -f "$htmlfile" & | ||
dillopid=$! | ||
|
||
# TODO: We need a better system to determine when the page loaded | ||
sleep 0.5 | ||
|
||
# Capture only Dillo window | ||
winid=$(xwininfo -all -root | awk '/Dillo:/ {print $1}') | ||
if [ -z "$winid" ]; then | ||
echo "cannot find Dillo window" >&2 | ||
exit 3 | ||
fi | ||
xwd -id "$winid" -silent | ${magick_bin} xwd:- png:${outpic} | ||
|
||
kill "$dillopid" | ||
} | ||
|
||
mkdir -p out | ||
|
||
render_page "$testfile" "out/test.png" | ||
render_page "$reffile" "out/ref.png" | ||
|
||
# AE = Absolute Error count of the number of different pixels | ||
diffcount=$(compare -metric AE "out/test.png" "out/ref.png" "out/diff.png" 2>&1 || true) | ||
|
||
# The test passes only if both images are identical | ||
if [ "$diffcount" = "0" ]; then | ||
#echo "OK $testfile" | ||
ret=0 | ||
else | ||
#echo "FAIL $testfile" | ||
ret=100 | ||
fi | ||
|
||
exit $ret |