-
Notifications
You must be signed in to change notification settings - Fork 1
/
srv-tests.sh
executable file
·76 lines (60 loc) · 952 Bytes
/
srv-tests.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
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
CWD=`pwd`
PID_FN="$CWD/unisrvd.pid"
CFG_FN="$srcdir/test-config-srv.json"
#
# Daemon startup
#
# PID file cannot be present at start of tests
if [ -f $PID_FN ]
then
echo Daemon PID file already exists.
exit 1
fi
# Start daemon in background
./unisrvd -c $CFG_FN -p $PID_FN --daemon
sleep 1
# PID file must exist
if [ ! -f $PID_FN ]
then
echo Daemon not started.
exit 1
fi
# Ping process to make sure it exists
kill -0 `cat $PID_FN`
if [ $? -ne 0 ]
then
echo "Daemon cannot be pinged with kill(1)"
kill %1
rm -f $PID_FN
exit 1
fi
RETVAL=0
#./srv-test-client
#if [ $? -ne 0 ]
#then
# echo "Orad test client failed."
# RETVAL=1
#fi
#
# Daemon shutdown
#
if [ ! -f $PID_FN ]
then
echo Daemon PID file is missing.
exit 1
fi
kill `cat $PID_FN`
if [ $? -ne 0 ]
then
echo "Daemon cannot be reached via kill(1)"
exit 1
fi
sleep 1
if [ -f $PID_FN ]
then
echo Daemon PID file remains.
exit 1
fi
rm -rf srvdb
exit $RETVAL