aboutsummaryrefslogtreecommitdiffstats
path: root/meta-perl/recipes-perl/libauthen/libauthen-radius-perl/run-ptest
blob: 5bc8b625bd7c940c4233afb3887bced3297047b7 (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
#!/bin/sh
#

# prepare testing config
CONF_USERS=`readlink -f /etc/raddb/users`
mv ${CONF_USERS} ${CONF_USERS}_orig
echo "testing Cleartext-Password := \"testpassword\"" > ${CONF_USERS}
cat ${CONF_USERS}_orig >> ${CONF_USERS}

# restart radiusd server
systemctl restart radiusd || /etc/init.d/radiusd restart || {
        echo "FAIL: Start radiusd service."
        exit 1
}

# run tests
# FIXME: this is from ptest-perl.bbclass and might not be correct
for case in `find t -type f -name '*.t'`; do
    perl $case >$case.output 2>&1
    ret=$?
    cat $case.output
    if [ $ret -ne 0 ]; then
        echo "FAIL: ${case%.t}"
    elif grep -i 'SKIP' $case.output; then
        echo "SKIP: ${case%.t}"
    else
        echo "PASS: ${case%.t}"
    fi

    rm -f $case.output
done

# restore the config and restart
mv ${CONF_USERS}_orig ${CONF_USERS}
systemctl restart radiusd || /etc/init.d/radiusd restart