1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#/bin/bash
if [[ "$(which php-parser)" == "" ]]; then
echo "ERROR: cannot find php-parser in your PATH!"
exit 1
fi
if [ ! -d "$1" ]; then
echo "USAGE: $0 /path/to/php-tests"
exit 2
fi
passed=""
failed=""
path=$1
shift 1
if [ ! -d /tmp/php-parser-tests ]; then
mkdir /tmp/php-parser-tests
fi
for f in $(find "$path" -type f -name "*.phpt"); do
base=$(basename $f)
perl -ne '(/^--FILE--$/../^--EXPECT(F)?--$/) && print' "$f" | egrep -v '^--(FILE|EXPECT(F)?)--$' > /tmp/$base
fail=$(egrep '^Parse error: ' $f)
if php-parser /tmp/$base &>/tmp/$base.log; then
if [[ "$fail" == "" ]]; then
echo "passed $base"
passed=$(echo -e "$passed\n$base")
else
echo
echo "failed $base"
cat /tmp/$base.log
echo
failed=$(echo -e "$failed\n$base")
fi
else
if [[ "$fail" == "" ]]; then
echo
echo "failed $base"
cat /tmp/$base.log
echo
failed=$(echo -e "$failed\n$base")
else
echo "passed $base"
passed=$(echo -e "$passed\n$base")
fi
fi
done
echo
echo "PASSED:"
echo
echo "$passed"
echo
echo "FAILED:"
echo
echo "$failed"
|