From f086055e714fe8b4ec169d63437d09c88f256741 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Mon, 10 Oct 2016 02:28:29 -0400 Subject: WT-2956 utility tests -h option is always overridden by the default setup (#3085) --- bench/wtperf/wtperf.c | 1 - test/bloom/test_bloom.c | 2 -- test/checkpoint/test_checkpoint.c | 2 -- test/csuite/wt1965_col_efficiency/main.c | 2 -- test/csuite/wt2246_col_append/main.c | 2 -- test/csuite/wt2323_join_visibility/main.c | 2 -- test/csuite/wt2447_join_main_table/main.c | 2 -- test/csuite/wt2535_insert_race/main.c | 2 -- test/csuite/wt2592_join_schema/main.c | 8 -------- test/csuite/wt2695_checksum/main.c | 2 -- test/csuite/wt2719_reconfig/main.c | 4 +--- test/csuite/wt2834_join_bloom_fix/main.c | 11 +++++------ test/csuite/wt2853_perf/main.c | 2 -- test/cursor_order/cursor_order.c | 2 -- test/fops/t.c | 2 -- test/format/t.c | 4 ++-- test/huge/huge.c | 2 -- test/manydbs/manydbs.c | 2 -- test/packing/intpack-test.c | 2 -- test/packing/intpack-test2.c | 2 -- test/packing/intpack-test3.c | 2 -- test/packing/packing-test.c | 2 -- test/readonly/readonly.c | 2 -- test/recovery/random-abort.c | 2 -- test/recovery/truncated-log.c | 2 -- test/salvage/salvage.c | 2 -- test/thread/t.c | 2 -- test/utility/misc.c | 4 ++-- test/utility/parse_opts.c | 18 ++++++++---------- test/utility/test_util.h | 2 -- 30 files changed, 18 insertions(+), 78 deletions(-) diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index a7618b19707..adddf60f5d3 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -2329,7 +2329,6 @@ err: if (ret == 0) extern int __wt_optind, __wt_optreset; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; /* * usage -- diff --git a/test/bloom/test_bloom.c b/test/bloom/test_bloom.c index 7a298f000aa..67249ff887e 100644 --- a/test/bloom/test_bloom.c +++ b/test/bloom/test_bloom.c @@ -56,8 +56,6 @@ void usage(void) extern char *__wt_optarg; extern int __wt_optind; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/checkpoint/test_checkpoint.c b/test/checkpoint/test_checkpoint.c index 6b2f0d4466c..4998019ad8e 100644 --- a/test/checkpoint/test_checkpoint.c +++ b/test/checkpoint/test_checkpoint.c @@ -42,8 +42,6 @@ static int wt_shutdown(void); extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/csuite/wt1965_col_efficiency/main.c b/test/csuite/wt1965_col_efficiency/main.c index 0dc367c0611..a7235d81b31 100644 --- a/test/csuite/wt1965_col_efficiency/main.c +++ b/test/csuite/wt1965_col_efficiency/main.c @@ -35,8 +35,6 @@ * it is demonstrating an inefficiency rather than a correctness bug. */ -void (*custom_die)(void) = NULL; - /* If changing field count also need to change set_value and get_value calls */ #define NR_FIELDS 8 #define NR_OBJECTS 100 diff --git a/test/csuite/wt2246_col_append/main.c b/test/csuite/wt2246_col_append/main.c index 1da8732abb4..4b352b26051 100644 --- a/test/csuite/wt2246_col_append/main.c +++ b/test/csuite/wt2246_col_append/main.c @@ -42,8 +42,6 @@ #define MILLION 1000000 -void (*custom_die)(void) = NULL; - /* Needs to be global for signal handling. */ static TEST_OPTS *opts, _opts; diff --git a/test/csuite/wt2323_join_visibility/main.c b/test/csuite/wt2323_join_visibility/main.c index 5987b77fd7d..239a3f300d0 100644 --- a/test/csuite/wt2323_join_visibility/main.c +++ b/test/csuite/wt2323_join_visibility/main.c @@ -52,8 +52,6 @@ * of inserts set low as a default. */ -void (*custom_die)(void) = NULL; - #define N_RECORDS 10000 #define N_INSERT 500000 #define N_INSERT_THREAD 2 diff --git a/test/csuite/wt2447_join_main_table/main.c b/test/csuite/wt2447_join_main_table/main.c index bbae61e7ed5..1368e7c8c09 100644 --- a/test/csuite/wt2447_join_main_table/main.c +++ b/test/csuite/wt2447_join_main_table/main.c @@ -49,8 +49,6 @@ * table. */ -void (*custom_die)(void) = NULL; - #define N_RECORDS 10000 static void diff --git a/test/csuite/wt2535_insert_race/main.c b/test/csuite/wt2535_insert_race/main.c index ee567df8749..ae18760a829 100644 --- a/test/csuite/wt2535_insert_race/main.c +++ b/test/csuite/wt2535_insert_race/main.c @@ -36,8 +36,6 @@ * Failure mode: Check that the data is correct at the end of the run. */ -void (*custom_die)(void) = NULL; - void *thread_insert_race(void *); int diff --git a/test/csuite/wt2592_join_schema/main.c b/test/csuite/wt2592_join_schema/main.c index 4ffc9194646..0ec1c765d99 100644 --- a/test/csuite/wt2592_join_schema/main.c +++ b/test/csuite/wt2592_join_schema/main.c @@ -36,12 +36,6 @@ * Failure mode: The failure seen in WT-2592 was that no items were returned * by a join. */ -#include -#include -#include -#include - -#include /* The C struct for the data we are storing in a WiredTiger table. */ typedef struct { @@ -66,8 +60,6 @@ static POP_RECORD pop_data[] = { { "", 0, 0 } }; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/csuite/wt2695_checksum/main.c b/test/csuite/wt2695_checksum/main.c index 50f118bf828..db4fed5dc53 100644 --- a/test/csuite/wt2695_checksum/main.c +++ b/test/csuite/wt2695_checksum/main.c @@ -32,8 +32,6 @@ * Test case description: Smoke-test the CRC. */ -void (*custom_die)(void) = NULL; - static inline void check(uint32_t hw, uint32_t sw, size_t len, const char *msg) { diff --git a/test/csuite/wt2719_reconfig/main.c b/test/csuite/wt2719_reconfig/main.c index 64a47ea49a6..0942cfc73b2 100644 --- a/test/csuite/wt2719_reconfig/main.c +++ b/test/csuite/wt2719_reconfig/main.c @@ -34,9 +34,7 @@ * Test case description: Fuzz testing for WiredTiger reconfiguration. */ -void (*custom_die)(void) = NULL; - -static const char *list[] = { +static const char * const list[] = { ",async=(enabled=0)", ",async=(enabled=1)", ",async=(ops_max=2048)", diff --git a/test/csuite/wt2834_join_bloom_fix/main.c b/test/csuite/wt2834_join_bloom_fix/main.c index 1d6abcfb179..7c80496f1b6 100644 --- a/test/csuite/wt2834_join_bloom_fix/main.c +++ b/test/csuite/wt2834_join_bloom_fix/main.c @@ -39,8 +39,6 @@ * * Failure mode: We get results back from our join. */ -void (*custom_die)(void) = NULL; - #define N_RECORDS 100000 #define N_INSERT 1000000 @@ -103,8 +101,8 @@ main(int argc, char *argv[]) &maincur)); maincur->set_key(maincur, N_RECORDS); maincur->set_value(maincur, 54321, 0, "", 0, N_RECORDS); - maincur->insert(maincur); - maincur->close(maincur); + testutil_check(maincur->insert(maincur)); + testutil_check(maincur->close(maincur)); testutil_check(session->close(session, NULL)); populate(opts); @@ -153,6 +151,7 @@ main(int argc, char *argv[]) key, key2, post, balance, flag); count++; } + testutil_assert(ret == WT_NOTFOUND); testutil_assert(count == 0); testutil_cleanup(opts); @@ -197,6 +196,6 @@ populate(TEST_OPTS *opts) testutil_check(maincur->insert(maincur)); testutil_check(session->commit_transaction(session, NULL)); } - maincur->close(maincur); - session->close(session, NULL); + testutil_check(maincur->close(maincur)); + testutil_check(session->close(session, NULL)); } diff --git a/test/csuite/wt2853_perf/main.c b/test/csuite/wt2853_perf/main.c index 27591fdf214..6cec9634cd1 100644 --- a/test/csuite/wt2853_perf/main.c +++ b/test/csuite/wt2853_perf/main.c @@ -42,8 +42,6 @@ * continues until the test ends (~30 seconds). */ -void (*custom_die)(void) = NULL; - static void *thread_insert(void *); static void *thread_get(void *); diff --git a/test/cursor_order/cursor_order.c b/test/cursor_order/cursor_order.c index aa351e6fea8..85b8c68e545 100644 --- a/test/cursor_order/cursor_order.c +++ b/test/cursor_order/cursor_order.c @@ -44,8 +44,6 @@ static void wt_shutdown(SHARED_CONFIG *); extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/fops/t.c b/test/fops/t.c index bf0588d5a53..7b4a7cf8fca 100644 --- a/test/fops/t.c +++ b/test/fops/t.c @@ -51,8 +51,6 @@ static void wt_shutdown(void); extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/format/t.c b/test/format/t.c index 41bdea11e73..7701595776c 100644 --- a/test/format/t.c +++ b/test/format/t.c @@ -38,8 +38,6 @@ static void usage(void) extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = format_die; /* Local death handler. */ - int main(int argc, char *argv[]) { @@ -47,6 +45,8 @@ main(int argc, char *argv[]) int ch, onerun, reps; const char *config, *home; + custom_die = format_die; /* Local death handler. */ + config = NULL; #ifdef _WIN32 diff --git a/test/huge/huge.c b/test/huge/huge.c index 3aa61a9048e..17e2db353d5 100644 --- a/test/huge/huge.c +++ b/test/huge/huge.c @@ -159,8 +159,6 @@ run(CONFIG *cp, int bigkey, size_t bytes) extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/manydbs/manydbs.c b/test/manydbs/manydbs.c index c5c9a9a7ccd..7e986d47af3 100644 --- a/test/manydbs/manydbs.c +++ b/test/manydbs/manydbs.c @@ -68,8 +68,6 @@ usage(void) extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - static WT_CONNECTION **connections = NULL; static WT_CURSOR **cursors = NULL; static WT_RAND_STATE rnd; diff --git a/test/packing/intpack-test.c b/test/packing/intpack-test.c index 76851b38e35..c84823b741b 100644 --- a/test/packing/intpack-test.c +++ b/test/packing/intpack-test.c @@ -28,8 +28,6 @@ #include "test_util.h" -void (*custom_die)(void) = NULL; - int main(void) { diff --git a/test/packing/intpack-test2.c b/test/packing/intpack-test2.c index a7d31329069..4e612808a35 100644 --- a/test/packing/intpack-test2.c +++ b/test/packing/intpack-test2.c @@ -28,8 +28,6 @@ #include "test_util.h" -void (*custom_die)(void) = NULL; - int main(void) { diff --git a/test/packing/intpack-test3.c b/test/packing/intpack-test3.c index aac0178578f..763b0255ecf 100644 --- a/test/packing/intpack-test3.c +++ b/test/packing/intpack-test3.c @@ -28,8 +28,6 @@ #include "test_util.h" -void (*custom_die)(void) = NULL; - void test_value(int64_t); void test_spread(int64_t, int64_t, int64_t); diff --git a/test/packing/packing-test.c b/test/packing/packing-test.c index f251c17eb67..919b0622806 100644 --- a/test/packing/packing-test.c +++ b/test/packing/packing-test.c @@ -28,8 +28,6 @@ #include "test_util.h" -void (*custom_die)(void) = NULL; - static void check(const char *fmt, ...) { diff --git a/test/readonly/readonly.c b/test/readonly/readonly.c index 7a131912c31..a4b79f5859f 100644 --- a/test/readonly/readonly.c +++ b/test/readonly/readonly.c @@ -158,8 +158,6 @@ open_dbs(int op, const char *dir, extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/recovery/random-abort.c b/test/recovery/random-abort.c index 22a163bedff..03e67e2f723 100644 --- a/test/recovery/random-abort.c +++ b/test/recovery/random-abort.c @@ -179,8 +179,6 @@ fill_db(uint32_t nth) extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/recovery/truncated-log.c b/test/recovery/truncated-log.c index c0effa85e95..c265263d44c 100644 --- a/test/recovery/truncated-log.c +++ b/test/recovery/truncated-log.c @@ -258,8 +258,6 @@ fill_db(void) extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/salvage/salvage.c b/test/salvage/salvage.c index bad0167ca8e..b8553bbd72d 100644 --- a/test/salvage/salvage.c +++ b/test/salvage/salvage.c @@ -64,8 +64,6 @@ static int verbose; /* -v flag */ extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/thread/t.c b/test/thread/t.c index 5b53532e8a6..baadbf2adb9 100644 --- a/test/thread/t.c +++ b/test/thread/t.c @@ -52,8 +52,6 @@ static void wt_shutdown(void); extern int __wt_optind; extern char *__wt_optarg; -void (*custom_die)(void) = NULL; - int main(int argc, char *argv[]) { diff --git a/test/utility/misc.c b/test/utility/misc.c index 096bc752726..1491c9a6938 100644 --- a/test/utility/misc.c +++ b/test/utility/misc.c @@ -27,6 +27,8 @@ */ #include "test_util.h" +void (*custom_die)(void) = NULL; + /* * die -- * Report an error and quit. @@ -142,8 +144,6 @@ testutil_cleanup(TEST_OPTS *opts) if (!opts->preserve) testutil_clean_work_dir(opts->home); - free(opts->conn_config); - free(opts->table_config); free(opts->uri); free(opts->home); } diff --git a/test/utility/parse_opts.c b/test/utility/parse_opts.c index 08aeafa9617..74a1c021d5d 100644 --- a/test/utility/parse_opts.c +++ b/test/utility/parse_opts.c @@ -27,10 +27,6 @@ */ #include "test_util.h" -extern int __wt_opterr; /* if error message should be printed */ -extern int __wt_optind; /* index into parent argv vector */ -extern int __wt_optopt; /* character checked for validity */ -extern int __wt_optreset; /* reset getopt */ extern char *__wt_optarg; /* argument associated with option */ /* @@ -59,7 +55,7 @@ testutil_parse_opts(int argc, char * const *argv, TEST_OPTS *opts) opts->n_append_threads = (uint64_t)atoll(__wt_optarg); break; case 'h': /* Home directory */ - opts->home = __wt_optarg; + opts->home = dstrdup(__wt_optarg); break; case 'n': /* Number of records */ opts->nrecords = (uint64_t)atoll(__wt_optarg); @@ -116,12 +112,14 @@ testutil_parse_opts(int argc, char * const *argv, TEST_OPTS *opts) } /* - * Setup the home directory. It needs to be unique for every test - * or the auto make parallel tester gets upset. + * Setup the home directory if not explicitly specified. It needs to be + * unique for every test or the auto make parallel tester gets upset. */ - len = strlen("WT_TEST.") + strlen(opts->progname) + 10; - opts->home = dmalloc(len); - snprintf(opts->home, len, "WT_TEST.%s", opts->progname); + if (opts->home == NULL) { + len = strlen("WT_TEST.") + strlen(opts->progname) + 10; + opts->home = dmalloc(len); + snprintf(opts->home, len, "WT_TEST.%s", opts->progname); + } /* Setup the default URI string */ len = strlen("table:") + strlen(opts->progname) + 10; diff --git a/test/utility/test_util.h b/test/utility/test_util.h index 1047d1ca8a0..52f4291044d 100644 --- a/test/utility/test_util.h +++ b/test/utility/test_util.h @@ -68,10 +68,8 @@ typedef struct { * resources. */ WT_CONNECTION *conn; - char *conn_config; WT_SESSION *session; bool running; - char *table_config; char *uri; volatile uint64_t next_threadid; uint64_t max_inserted_id; -- cgit v1.2.1