-
Notifications
You must be signed in to change notification settings - Fork 8
/
runtests
executable file
·45 lines (39 loc) · 1.13 KB
/
runtests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash -e
VALGRIND=0
REDIS_FOLDER=""
SPECIFIC_TEST=""
SPECIFIC_TEST_GROUP=""
while [[ $# -gt 0 ]]; do
case $1 in
-v|--valgrind)
VALGRIND=1
shift ;;
-f|--redis-folder)
REDIS_FOLDER=" --redis-folder $2 "
shift 2 ;;
-t|--test)
SPECIFIC_TEST=" --test $2 "
shift 2 ;;
-g|--test-group)
SPECIFIC_TEST_GROUP=" --test-group $2 "
shift 2 ;;
*|-h)
echo "Usage: $(basename $0) [-v|--valgrind] [-f|--folder REDIS_FOLDER] [-t|--test TEST] [-g|--test-group GROUP]"
exit 1 ;;
esac
done
export LD_LIBRARY_PATH="`pwd`/lib"${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}:/usr/local/lib
if [[ ${VALGRIND} -ne 0 ]]; then
valgrind \
--track-origins=yes \
--leak-check=full \
--leak-resolution=high \
--error-exitcode=1 \
--log-file=test/log/valgrind.log \
./test/test_static_lib -v $REDIS_FOLDER $SPECIFIC_TEST $SPECIFIC_TEST_GROUP && exit 0
sed -n -e '/SUMMARY:/,$p' ./test/log/valgrind.log | tail -n 20
echo -en "\n(Entire log available at: ./test/log/valgrind.log)\n"
exit 1
else
./test/test_lib $REDIS_FOLDER $SPECIFIC_TEST $SPECIFIC_TEST_GROUP
fi