2011-11-14 11:10:59 +00:00
|
|
|
#!/bin/sh
|
|
|
|
check_redis_running() {
|
|
|
|
redis-cli echo "just checking" > /dev/null
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2012-07-18 07:43:26 +00:00
|
|
|
# Quit early if Redis server isn't running
|
|
|
|
if ! check_redis_running; then
|
|
|
|
echo "Redis not running." >&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2012-07-18 07:36:33 +00:00
|
|
|
if command -v rg >/dev/null; then
|
2012-02-05 08:14:40 +00:00
|
|
|
safe_rg=rg
|
|
|
|
else
|
|
|
|
# Fall back for systems that don't have rg installed
|
|
|
|
safe_rg=cat
|
|
|
|
fi
|
|
|
|
|
2015-10-14 19:08:55 +00:00
|
|
|
export RUN_SLOW_TESTS_TOO=1
|
2012-07-18 07:43:26 +00:00
|
|
|
if [ "$1" = '-f' ]; then # Poor man's argparse
|
2015-10-14 19:08:55 +00:00
|
|
|
unset RUN_SLOW_TESTS_TOO
|
2012-07-18 07:43:26 +00:00
|
|
|
shift 1
|
2012-02-24 06:39:44 +00:00
|
|
|
fi
|
|
|
|
|
2012-07-18 07:43:26 +00:00
|
|
|
# For use on build server, we need exit code to be representative of success/failure
|
|
|
|
if [ "$1" = '-x' ]; then
|
|
|
|
shift 1
|
|
|
|
/usr/bin/env python -m unittest discover -v -s tests $@ 2>&1
|
2011-11-14 11:10:59 +00:00
|
|
|
else
|
2012-07-18 07:43:26 +00:00
|
|
|
/usr/bin/env python -m unittest discover -v -s tests $@ 2>&1 | egrep -v '^test_' | $safe_rg
|
2011-11-14 11:10:59 +00:00
|
|
|
fi
|