#!/bin/sh

input=$data_srcdir$/commands
output=$tempdir$/output

cd $tempdir$ && cadaver http://127.0.0.1:$yaws_port1$ < $input > $output 2>&1

# Count the number of "succeeded" messages. Some version of cadaver
# after 0.23.3 stopped outputting "succeeded" for the propnames
# command, so our grep ignores any such messages that are preceded
# only by whitespace so our check is portable across cadaver versions.
success=`grep -c -E '[^ ].*succeeded\.' $output`
if [ $success -ne 8 ]; then
    echo "- not all cadaver actions succeeded, see $output for details"
    cat $output
    exit 1
fi
printf '\n** All %s tests completed successfully.\n\n' `pwd`
exit 0

