summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2012-03-31 00:15:02 +0200
committerVijay Bellur <vijay@gluster.com>2012-04-02 22:38:49 -0700
commit22cc617902794f4136fe6ba7b631ebe9f7bd4563 (patch)
treeef28a5d744e06fc04e1814bf6f9e3dcddc6955a5 /libglusterfs
parentb283a09b05606b953339ea419d16cb1ec40326c3 (diff)
libglusterfs/run: test suite refinement
If run is compiled as a standalone self-test program (-DRUN_STANDALONE -DRUN_DO_TESTS) add the possibility to pass an integer which makes the program sleep that many seconds before exit (0 forever). This makes it possible to investigate post-test state (eg. if there are leftover zombies). Change-Id: Ia8d80a74eb83615ad50db2e17bb2701dc0d69070 BUG: 808427 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3067 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/run.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c
index 46bb37d7374..44ef2f0d739 100644
--- a/libglusterfs/src/run.c
+++ b/libglusterfs/src/run.c
@@ -422,7 +422,7 @@ TBANNER (const char *txt)
}
int
-main ()
+main (int argc, char **argv)
{
runner_t runner;
char buf[80];
@@ -430,6 +430,8 @@ main ()
int ret;
int fd;
long pathmax = pathconf ("/", _PC_PATH_MAX);
+ struct timeval tv = {0,};
+ struct timeval *tvp = NULL;
wdbuf = malloc (pathmax);
assert (wdbuf);
@@ -479,6 +481,13 @@ main ()
printf (" %d [%s]", errno, strerror (errno));
putchar ('\n');
+ if (argc > 1) {
+ tv.tv_sec = strtoul (argv[1], NULL, 10);
+ if (tv.tv_sec > 0)
+ tvp = &tv;
+ select (0, 0, 0, 0, tvp);
+ }
+
return 0;
}
#endif