forked from OpenAtomFoundation/pikiwidb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pikiwidbtests.sh
executable file
·63 lines (50 loc) · 1.13 KB
/
pikiwidbtests.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# clear the log file
function cleanup() {
rm -rf ./logs*
rm -rf ./db*
rm -rf dbsync/
rm src/redis-server
}
# check if tcl is installed
function check_tcl {
if [ -z "$(which tclsh)" ]; then
echo "tclsh is not installed"
exit 1
fi
}
# handle different build directories.
function setup_build_dir {
BUILD_DIR="./bin"
echo "BUILD_DIR: $BUILD_DIR"
}
# setup pikiwidb bin and conf
function setup_pikiwidb_bin {
PIKIWIDB_BIN="./$BUILD_DIR/pikiwidb"
if [ ! -f "$PIKIWIDB_BIN" ]; then
echo "pikiwidb bin not found"
exit 1
fi
cp $PIKIWIDB_BIN src/redis-server
cp ./pikiwidb.conf tests/assets/default.conf
}
cleanup
check_tcl
setup_build_dir
setup_pikiwidb_bin
echo "run pikiwidb tests $1"
if [ "$1" == "all" ]; then
tclsh tests/test_helper.tcl --clients 1
else
tclsh tests/test_helper.tcl --clients 1 --single unit/$1
fi
if [ $? -ne 0 ]; then
echo "pikiwidb tests failed"
cleanup
exit 1
fi
# You can use './pikiwidb.sh all clean 'to ensure that the
# data can be deleted immediately after the test
if [ "$2" == "clean" ]; then
cleanup
fi