aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/tests/Integration/run-all.sh
blob: 02bab97e45fe14c1101f98a4c21b5abb82afd8d5 (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
#!/bin/bash

trigger_notification() {
    which notify-send 1>/dev/null
    if [[ $? == 1 ]] ; then
        return
    fi
    export NOTIFY_USER=$SUDO_USER
    export RESULT_STR=$1
    # does not work. just pipe result into a non-sudo cmd
    su "$NOTIFY_USER" -c "notify-send -u normal -t 43200000 -a Nextcloud -i Nextcloud \"LDAP Integration tests $RESULT_STR\""
}

FILES_ROOT=($(ls -d -p Lib/* | grep -v "/$"))
FILES_USER=($(ls -d -p Lib/User/* | grep -v "/$"))
# TODO: Loop through dirs (and subdirs?) once there are more
TESTFILES=("${FILES_ROOT[@]}" "${FILES_USER[@]}")

TESTCMD="./run-test.sh"

echo "Running " ${#TESTFILES[@]} " tests"
for TESTFILE in "${TESTFILES[@]}" ; do
    echo -n "Test: $TESTFILE… "
	STATE=`$TESTCMD "$TESTFILE" | grep -c "Tests succeeded"`
	if [ "$STATE" -eq 0 ] ; then
		echo "failed!"
		trigger_notification "failed"
		exit 1
	fi
    echo "succeeded"
done

echo -e "\nAll tests succeeded"
trigger_notification "succeeded"