run-all.sh 1.1 KB

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