Skip to content
This repository
tree: fb0710c73f
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 61 lines (52 sloc) 1.552 kb
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
test_dir=`echo $0 | perl -pe's#(.*)/.*#$1#;'`

function help {
    echo "$0 [-h|--help] [--json] [--xml] [-a|--all]"
    echo "-h|--help prints this help message"
    echo "--json run tests which use json postgres extension"
    echo "--xml run tests which use xml postgres feature (compiled with --libxml)"
    echo "-a|--all run all available tests"
    exit;
}

while [ $# -gt 0 ]; do
case "$1" in
        --) shift; break 2;;
        -h) help;;
        --help) help;;
        -a) all=1; shift;;
        --all) all=1; shift;;
        --json) json=1; shift;;
        --xml) xml=1; shift;;
        *) break;;
    esac
shift
done

if [ -n "$all" ]; then
xml=1
json=1
fi

trap 'let fall=$fsuccess+$ffailed;echo;echo "Tests files run: $fall";echo "Ok: $fsuccess";echo "Failed: $ffailed"; if [ 0 -lt "$ffailed" ]; then exit 1; fi' EXIT

fsuccess=0
ffailed=0
for t in $test_dir/test-*.sh; do
if [[ "$0" == "$t" ]]; then
echo "skipping itself: '$t'"
continue;
fi

if [[ "$test_dir/test-json-response-deserialize-callback.sh" == "$t" && -z "$json" ]]; then
echo "need json module for this callback (--json or -a|--all option)";
continue;
fi

if [[ "$test_dir/test-xml-response-deserialize-callback.sh" == "$t" && -z "$xml" ]]; then
echo "need xml support in postgres for this callback (--xml or -a|--all option)";
continue;
fi

echo "############## test: '$t' ##############"
"$t"
if [ 0 == "$?" ]; then
let fsuccess=$fsuccess+1
else
let ffailed=$ffailed+1
fi
echo ''
done
Something went wrong with that request. Please try again.