diff options
author | sueloverso <sue@mongodb.com> | 2017-01-17 15:41:40 -0500 |
---|---|---|
committer | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-01-18 07:41:40 +1100 |
commit | 2d2bb414675e449f46d6412db93bb7b32057af0a (patch) | |
tree | b909ea232d0f0699b9060ff8505c97990162e59d | |
parent | f8c20c2b1c258126cc162721eccd51ea4282e1b7 (diff) | |
download | mongo-2d2bb414675e449f46d6412db93bb7b32057af0a.tar.gz |
WT-3118 Protect test against unexpectedly slow child start. (#3248)
-rw-r--r-- | test/recovery/random-abort.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/recovery/random-abort.c b/test/recovery/random-abort.c index c407361c7eb..a6e4d9801e5 100644 --- a/test/recovery/random-abort.c +++ b/test/recovery/random-abort.c @@ -33,7 +33,11 @@ static char home[512]; /* Program working dir */ static const char *progname; /* Program name */ +/* + * These two names for the URI and file system must be maintained in tandem. + */ static const char * const uri = "table:main"; +static const char * const fs_main = "main.wt"; static bool inmem; #define MAX_TH 12 @@ -211,6 +215,7 @@ extern char *__wt_optarg; int main(int argc, char *argv[]) { + struct stat sb; FILE *fp; WT_CONNECTION *conn; WT_CURSOR *cursor; @@ -305,8 +310,15 @@ main(int argc, char *argv[]) /* parent */ /* * Sleep for the configured amount of time before killing - * the child. + * the child. Start the timeout from the time we notice that + * the table has been created. That allows the test to run + * correctly on really slow machines. Verify the process ID + * still exists in case the child aborts for some reason we + * don't stay in this loop forever. */ + snprintf(fname, sizeof(fname), "%s/%s", home, fs_main); + while (stat(fname, &sb) != 0 && kill(pid, 0) == 0) + sleep(1); sleep(timeout); /* |