1
0

run-all.sh 959 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. trigger_notification() {
  3. which notify-send 1>/dev/null
  4. if [[ $? == 1 ]] ; then
  5. return
  6. fi
  7. export NOTIFY_USER=$SUDO_USER
  8. export RESULT_STR=$1
  9. # does not work. just pipe result into a non-sudo cmd
  10. su "$NOTIFY_USER" -c "notify-send -u normal -t 43200000 -a Nextcloud -i Nextcloud \"LDAP Integration tests $RESULT_STR\""
  11. }
  12. FILES_ROOT=($(ls -d -p Lib/* | grep -v "/$"))
  13. FILES_USER=($(ls -d -p Lib/User/* | grep -v "/$"))
  14. # TODO: Loop through dirs (and subdirs?) once there are more
  15. TESTFILES=("${FILES_ROOT[@]}" "${FILES_USER[@]}")
  16. TESTCMD="./run-test.sh"
  17. echo "Running " ${#TESTFILES[@]} " tests"
  18. for TESTFILE in "${TESTFILES[@]}" ; do
  19. echo -n "Test: $TESTFILE… "
  20. STATE=`$TESTCMD "$TESTFILE" | grep -c "Tests succeeded"`
  21. if [ "$STATE" -eq 0 ] ; then
  22. echo "failed!"
  23. trigger_notification "failed"
  24. exit 1
  25. fi
  26. echo "succeeded"
  27. done
  28. echo -e "\nAll tests succeeded"
  29. trigger_notification "succeeded"