aboutsummaryrefslogtreecommitdiff
path: root/0.8.0/ebuild/run_test.bash
blob: b5587b9d12ea97df59e1bec676ec846cadde7027 (plain)
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
#!/bin/bash
# vim: set sw=4 sts=4 et :

shopt -s expand_aliases
shopt -s extglob
set +o posix

export TEST_STATUS=
export PALUDIS_IN_TEST_FRAMEWORK="yes"

test_return_code()
{
    local r="$?"
    if [[ "0" == "${r}" ]] ; then
        echo -n "."
    else
        echo -n "!{retcode: ${r}}"
        export local_test_status="fail"
        export TEST_STATUS="fail"
    fi
}

test_equality()
{
    if [[ "${1}" == "${2}" ]] ; then
        echo -n "."
    else
        echo -n "!{'${1}' not equal to '${2}'}"
        export local_test_status="fail"
        export TEST_STATUS="fail"
    fi
}

echo "Test program ${1}:"
source "$(dirname ${1} )/ebuild.bash" || exit 200
source "${1}" || exit 200

for testname in $(set | grep '_TEST *() *$' ) ; do
    [[ ${testname/()} != ${testname} ]] && continue
    echo -n "* ${testname%_TEST}: "
    export local_test_status=""
    ${testname}
    [[ -z "$local_test_status" ]] && echo " OK" || echo " FAIL"
done

[[ -z "$TEST_STATUS" ]]