From 22cc617902794f4136fe6ba7b631ebe9f7bd4563 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Sat, 31 Mar 2012 00:15:02 +0200 Subject: 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 Reviewed-on: http://review.gluster.com/3067 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi --- libglusterfs/src/run.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libglusterfs') 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 -- cgit