summaryrefslogtreecommitdiffstats
path: root/tests/basic/gfapi/libgfapi-fini-hang.t
blob: ba262a943ee400380971dd8bcb70bd2d79dc9308 (plain)
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
#!/bin/bash

. $(dirname $0)/../../include.rc

function check_process () {
    ps -p $1
    if [ $? -eq 1 ] ; then
        echo "Y"
    else
        echo "N"
    fi
}

cleanup;

TEST glusterd

TEST $CLI volume create $V0 $H0:$B0/brick1;
EXPECT 'Created' volinfo_field $V0 'Status';

TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';

logdir=$(gluster --print-logdir)

TEST build_tester $(dirname $0)/libgfapi-fini-hang.c -o $M0/libgfapi-fini-hang -lgfapi
TEST cd $M0
 ./libgfapi-fini-hang $H0 $V0 $logdir/libgfapi-fini-hang.log &
PID=$!

# check if the process "libgfapi-fini-hang" exits with in $PROCESS_UP_TIMEOUT
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_process $PID

# Kill the process if present
TEST ! kill -9 $PID

TEST rm -f $M0/libgfapi-fini-hang

TEST $CLI volume stop $V0
TEST $CLI volume delete $V0

cleanup;