Skip to content

test script robustness and flexibility #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ sudo: false

language: cpp

arch:
- amd64
- arm64
- ppc64le
- s390x

compiler:
- gcc

Expand Down
31 changes: 17 additions & 14 deletions test/run_tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ FAIL alpha1.png alpha2.png
EOF
}

echo "*** tmpdir: ${tmpdir:=/tmp}"

# Change to test directory
readonly script_directory=$(dirname "$0")
echo "*** script_directory: ${script_directory:=$(dirname "$0")}"
cd "$script_directory"

if [ -z "${pdiff:=}" ]; then
found=0
for d in ../build .. ../obj*; do
pdiff="$d/perceptualdiff"
Expand All @@ -40,9 +43,9 @@ done
if [ $found = 0 ]; then
echo 'perceptualdiff must be built and exist in the repository root or the "build" directory'
exit 1
else
echo "*** testing executable binary $pdiff"
fi
fi
echo "*** testing executable binary $pdiff"

#------------------------------------------------------------------------------

Expand Down Expand Up @@ -77,27 +80,27 @@ fi
"$pdiff" --help | grep -i 'usage'

rm -f diff.png
"$pdiff" --output diff.png --verbose fish[12].png 2>&1 | grep -q 'FAIL'
ls diff.png
rm -f diff.png
"$pdiff" --output ${tmpdir}/diff.png --verbose fish{1,2}.png 2>&1 | grep -q 'FAIL'
ls ${tmpdir}/diff.png
rm -f ${tmpdir}/diff.png

head fish1.png > fake.png
"$pdiff" --verbose fish1.png fake.png 2>&1 | grep -q 'Failed to load'
rm -f fake.png
head fish1.png > ${tmpdir}/fake.png
"$pdiff" --verbose fish1.png ${tmpdir}/fake.png 2>&1 | grep -q 'Failed to load'
rm -f ${tmpdir}/fake.png

mkdir -p unwritable.png
"$pdiff" --output unwritable.png --verbose fish[12].png 2>&1 | grep -q 'Failed to save'
rmdir unwritable.png
mkdir -p ${tmpdir}/unwritable.png
"$pdiff" --output ${tmpdir}/unwritable.png --verbose fish{1,2}.png 2>&1 | grep -q 'Failed to save'
rmdir ${tmpdir}/unwritable.png

"$pdiff" fish[12].png --output foo 2>&1 | grep -q 'unknown filetype'
"$pdiff" fish{1,2}.png --output ${tmpdir}/foo 2>&1 | grep -q 'unknown filetype'
"$pdiff" --verbose fish1.png 2>&1 | grep -q 'Not enough'
"$pdiff" --down-sample -3 fish1.png Aqsis_vase.png 2>&1 | grep -q 'Invalid'
"$pdiff" --threshold -3 fish1.png Aqsis_vase.png 2>&1 | grep -q 'Invalid'
"$pdiff" cam_mb_ref.tif cam_mb.tif --fake-option
"$pdiff" --verbose --scale fish1.png Aqsis_vase.png 2>&1 | grep -q 'FAIL'
"$pdiff" --down-sample 2 fish1.png Aqsis_vase.png 2>&1 | grep -q 'FAIL'
"$pdiff" /dev/null /dev/null 2>&1 | grep -q 'Unknown filetype'
"$pdiff" --verbose --sum-errors fish[12].png 2>&1 | grep -q 'sum'
"$pdiff" --verbose --sum-errors fish{1,2}.png 2>&1 | grep -q 'sum'
"$pdiff" --color-factor .5 -threshold 1000 --gamma 3 --luminance 90 cam_mb_ref.tif cam_mb.tif
"$pdiff" --verbose -down-sample 30 -scale --luminance-only --fov 80 cam_mb_ref.tif cam_mb.tif
"$pdiff" --fov wrong fish1.png fish1.png 2>&1 | grep -q 'Invalid argument'
Expand Down