diff options
author | Poornima G <pgurusid@redhat.com> | 2016-07-25 10:26:58 +0530 |
---|---|---|
committer | Raghavendra Talur <rtalur@redhat.com> | 2016-09-21 03:20:13 -0700 |
commit | e8ca52704f4d4a63f689b087587d90e938e902db (patch) | |
tree | 042d49996ab5b9a40bea56e2ff705b6fff470f7f /tests | |
parent | d4e16452c82fcf6a71292aa91f5d7424a31b7b0f (diff) |
tests: Fix the spurious failure in libgfapi-fini-hang.t
RCA:
After running libgfapi-fini-hang, there is a EXPECT_WITHIN which waits
for PROCESS_UP_TIMEOUT(20s), for the process libgfapi-fini-hang to die.
Currently EXPECT_WITHIN is returning success even if the process
libgfapi-fini-hang is alive. This is because "pgrep libgfapi-fini-hang"
in check_process() is returning 1(no process alive) even if the process
is alive. Man page of pgrep says "The process name used for matching is
limited to the 15 characters". Hence changing the name of executable from
libgfapi-fini-hang to gfapi-hang, so that it falls within the limit.
As explained the failure is not because there was a hang(logs show that
glfs_set_volfile_server was still executing), but because EXPECT_WITHIN
was not really waiting. And hence there was a race between the execution
of the process libgfapi-fini-hang and the kill.
> Change-Id: I257715865e0d3e5a14f83d1e235c01899e1cae68
> BUG: 1358594
> Signed-off-by: Poornima G <pgurusid@redhat.com>
> Reviewed-on: http://review.gluster.org/14997
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Tested-by: Gluster Build System <jenkins@build.gluster.org>
BUG: 1375990
Change-Id: I6c0fd776bb0f044c0b3b9389897e05214e0fedc5
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-on: http://review.gluster.org/15506
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/gfapi/libgfapi-fini-hang.c | 7 | ||||
-rwxr-xr-x | tests/basic/gfapi/libgfapi-fini-hang.t | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/tests/basic/gfapi/libgfapi-fini-hang.c b/tests/basic/gfapi/libgfapi-fini-hang.c index 81b065ca924..e192751f295 100644 --- a/tests/basic/gfapi/libgfapi-fini-hang.c +++ b/tests/basic/gfapi/libgfapi-fini-hang.c @@ -24,19 +24,20 @@ main (int argc, char *argv[]) int ret = 0, i; glfs_fd_t *fd = NULL; char readbuf[32]; - char *filename = "a1"; + char *logname = NULL; char *hostname = NULL; char *volname = NULL; fprintf (stderr, "Starting libgfapi_fini\n"); - if (argc < 3) { + if (argc < 4) { fprintf (stderr, "Invalid argument\n"); exit(1); } hostname = argv[1]; volname = argv[2]; + logname = argv[3]; fs = glfs_new (volname); if (!fs) { @@ -47,7 +48,7 @@ main (int argc, char *argv[]) ret = glfs_set_volfile_server (fs, "tcp", hostname, 0); LOG_ERR("glfs_set_volfile_server", ret); - ret = glfs_set_logging (fs, "/dev/stderr", 7); + ret = glfs_set_logging (fs, logname, 7); LOG_ERR("glfs_set_logging", ret); /* Do not call glfs_init. diff --git a/tests/basic/gfapi/libgfapi-fini-hang.t b/tests/basic/gfapi/libgfapi-fini-hang.t index 8bbeb848122..7c939872574 100755 --- a/tests/basic/gfapi/libgfapi-fini-hang.t +++ b/tests/basic/gfapi/libgfapi-fini-hang.t @@ -3,7 +3,7 @@ . $(dirname $0)/../../include.rc function check_process () { - pgrep libgfapi-fini-hang + ps -p $1 if [ $? -eq 1 ] ; then echo "Y" else @@ -21,16 +21,18 @@ EXPECT 'Created' volinfo_field $V0 'Status'; TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; +logdir=`gluster --print-logdir` + TEST build_tester -lgfapi $(dirname $0)/libgfapi-fini-hang.c -o $M0/libgfapi-fini-hang TEST cd $M0 - ./libgfapi-fini-hang $H0 $V0 & -lpid=$! + ./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 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_process $PID # Kill the process if present -TEST ! kill -9 $lpid +TEST ! kill -9 $PID TEST rm -f $M0/libgfapi-fini-hang |