influxdb/test.sh

53 lines
1.4 KiB
Bash
Raw Normal View History

2013-10-03 17:11:48 +00:00
#!/usr/bin/env bash
set -e
2013-10-03 17:11:48 +00:00
cd `dirname $0`
. exports.sh
2013-10-09 16:08:30 +00:00
function print_usage {
2013-10-09 17:28:21 +00:00
echo "$0 [-o regex] [-p package_name]"
2013-10-09 16:08:30 +00:00
echo " -o|--only: Run the test that matches the given regex"
echo " --no-valgrind: Skip the valgrind memory leak test"
2013-10-09 16:08:30 +00:00
echo " -p|--packages: Run the test in the given packages only"
2013-10-10 19:42:31 +00:00
echo " -b|--benchmarks: Run benchmarks"
2013-10-09 16:08:30 +00:00
echo " -h|--help: Prints this help message"
}
2013-10-09 17:28:21 +00:00
while [ $# -ne 0 ]; do
2013-10-09 16:08:30 +00:00
case "$1" in
-h|--help) print_usage; exit 1; shift;;
-o|--only) regex=$2; shift 2;;
--no-valgrind) valgrind=no; shift;;
2013-10-09 16:08:30 +00:00
-p|--packages) test_packages="$test_packages $2"; shift 2;;
2013-10-10 19:42:31 +00:00
-b|--benchmarks) gocheck_args="$gocheck_args -gocheck.b"; shift;;
2013-10-09 16:08:30 +00:00
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
2013-10-09 15:29:51 +00:00
pushd src/parser
2013-10-08 19:50:59 +00:00
./build_parser.sh
if [ "x`uname`" == "xLinux" -a "x$valgrind" != "xno" ]; then
2013-10-08 16:43:46 +00:00
if ! ./test_memory_leaks.sh; then
2013-10-08 19:50:59 +00:00
echo "ERROR: memory leak detected"
exit 1
2013-10-08 16:43:46 +00:00
fi
fi
2013-10-08 19:50:59 +00:00
popd
2013-10-03 17:11:48 +00:00
go get launchpad.net/gocheck
go fmt $packages || echo "Cannot format code"
2013-10-08 21:17:05 +00:00
./build.sh
2013-10-09 16:08:30 +00:00
[ "x$test_packages" == "x" ] && test_packages="$packages"
echo "Running tests for packages: $test_packages"
2013-10-10 19:42:31 +00:00
[ "x$regex" != "x" ] && gocheck_args="$gocheck_args -gocheck.f $regex"
2013-10-08 21:38:56 +00:00
ulimit -n 2048 || echo could not change ulimit
2013-10-09 16:08:30 +00:00
go test $test_packages -v -gocheck.v $gocheck_args