Advertisement
Guest User

Untitled

a guest
May 4th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.21 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Path to this script's directory
  4. dir=$(cd `dirname $0` && pwd)
  5.  
  6. # Path to test runner script
  7. runnerScript="$dir/../vendor/nette/tester/Tester/tester.php"
  8. if [ ! -f "$runnerScript" ]; then
  9.     echo "Nette Tester is missing. You can install it using Composer:" >&2
  10.     echo "php composer.phar update --dev." >&2
  11.     exit 2
  12. fi
  13.  
  14. # Default runner arguments
  15. jobsNum=20
  16. phpIni="$dir/php-unix.ini"
  17.  
  18. # Command line arguments processing
  19. i=$#
  20. while [ $i -gt 0 ]; do
  21.     if [ "$1" = "-j" ]; then
  22.         shift && i=$(($i - 1))
  23.         if [ -z "$1" ]; then
  24.             echo "Missing argument for -j option." >&2
  25.             exit 2
  26.         fi
  27.         jobsNum="$1"
  28.  
  29.     elif [ "$1" = "-c" ]; then
  30.         shift && i=$(($i - 1))
  31.         if [ -z "$1" ]; then
  32.             echo "Missing argument for -c option." >&2
  33.             exit 2
  34.         fi
  35.         phpIni="$1"
  36.  
  37.     else
  38.         set -- "$@" "$1"
  39.     fi
  40.     shift && i=$(($i - 1))
  41. done
  42.  
  43. # Run tests with script's arguments, doubled -c option intentionally
  44. php -n -c "$phpIni" "$runnerScript" -j "$jobsNum" -c "$phpIni" "$@" -p php --colors 1
  45. error=$?
  46.  
  47. # Print *.actual content if tests failed
  48. if [ "${VERBOSE-false}" != "false" -a $error -ne 0 ]; then
  49.     for i in $(find "$dir" -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
  50.     exit $error
  51. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement