influxdb/test.sh

49 lines
1.1 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 " -p|--packages: Run the test in the given packages only"
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;;
-p|--packages) test_packages="$test_packages $2"; shift 2;;
--) 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
2013-10-08 16:43:46 +00:00
if [ "x`uname`" == "xLinux" ]; then
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
2013-10-08 21:17:05 +00:00
go fmt $packages
./build.sh
2013-10-09 16:08:30 +00:00
[ "x$test_packages" == "x" ] && test_packages="$packages"
echo "Running tests for packages: $test_packages"
[ "x$regex" != "x" ] && 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