runtests 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env bash
  2. # Get the absolute path containing this script
  3. cd $(dirname "$0")
  4. HERE=$PWD
  5. test_import () {
  6. ./admin/checkimports
  7. }
  8. test_syntax () {
  9. ./admin/syntaxcheck
  10. }
  11. test_tabs () {
  12. /usr/bin/env bash "$HERE/notabs"
  13. }
  14. test_longlines () {
  15. /usr/bin/env bash "$HERE/nolonglines"
  16. }
  17. test_nobadbraces () {
  18. /usr/bin/env bash "$HERE/nobadbraces"
  19. }
  20. test_nobadcase () {
  21. /usr/bin/env bash "$HERE/nobadcase"
  22. }
  23. test_opentag () {
  24. /usr/bin/env bash "$HERE/open_tag"
  25. }
  26. test_docblocks () {
  27. /usr/bin/env bash "$HERE/docblocks"
  28. }
  29. test_php () {
  30. if uname -a | grep -i cygwin >/dev/null 2>/dev/null ; then
  31. /usr/bin/env php "$(dirname "$0")/texttest.php" --insecure-rand \
  32. $TEXTTEST_ARGS
  33. else
  34. /usr/bin/env php "$HERE/texttest.php" $TEXTTEST_ARGS
  35. fi
  36. }
  37. tests="syntax tabs longlines nobadbraces nobadcase opentag docblocks php import"
  38. failures=
  39. # Run in repository root (parent of this directory)
  40. cd $(dirname "$HERE")
  41. chmod +x ./admin/fixperms
  42. ./admin/fixperms
  43. for test_name in $tests
  44. do
  45. echo "Running test $test_name" 1>&2
  46. if ! eval "test_$test_name"
  47. then
  48. failures="$failures $test_name"
  49. fi
  50. done
  51. if [ ! -z "$failures" ]
  52. then
  53. echo "Failures in: $failures" 1>&2
  54. exit 1
  55. fi