summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2017-01-23 16:10:56 +1100
committerDavid Hows <howsdav@gmail.com>2017-01-23 16:10:56 +1100
commitc91b93d2786342505fd9e151c8aa6b68ee03a1fb (patch)
tree7a4890f387b0adc5f028e4369ebc7037097585c1 /src/third_party/wiredtiger/test
parent3b1134f5821dcabf89fa6df25b58a674cd3b6ab9 (diff)
downloadmongo-c91b93d2786342505fd9e151c8aa6b68ee03a1fb.tar.gz
Import wiredtiger: 48a3cbc17fa902528217287fd075c87efb44aebc from branch mongodb-3.6
ref: 8d23249433..48a3cbc17f for: 3.5.2 SERVER-16796 Increase logging activity for journal recovery operations WT-2 What does metadata look like? WT-2402 Misaligned structure accesses lead to undefined behavior WT-2771 Add a statistic to track per-btree dirty cache usage WT-2833 improvement: add projections to wt dump utility WT-2898 Improve performance of eviction-heavy workloads by dynamically controlling the number of eviction threads WT-2994 Create documentation describing page sizes and relationships WT-3080 Python test suite: add timestamp or elapsed time for tests WT-3082 Python test suite: shorten default run to avoid pull request timeouts. WT-3083 Fix a bug in wtperf config dump WT-3086 Add transaction state information to cache stuck diagnostic information WT-3091 Add stats to test_perf0001 WT-3092 Quiet a warning from autogen.sh WT-3093 Padding the WT_RWLOCK structure grew the WT_PAGE structure. WT-3099 lint: static function declarations, non-text characters in documentation WT-3100 test bug: format is weighted to delete, insert, then write operations. WT-3104 Fix wtperf configs for eviction tests WT-3105 Fix a deadlock caused by allocating eviction thread sessions dynamically WT-3106 Add truncate support to command line wt utility WT-3108 Also dump disk page size as part of metadata information WT-3109 wording fix in transaction doc WT-3110 Add more test cases for the WT command line utility WT-3112 Handle list lock statistic not incremented in eviction server WT-3114 Avoid archiving log files immediately after recovery WT-3116 Python style testing in s_all may not execute correctly WT-3118 Protect random-abort test against unexpectedly slow child start WT-3121 In test suite create standard way to load extensions WT-3127 bug: CPU yield calls don't necessarily imply memory barriers WT-3134 Coverity scan reports 1368529 and 1368528
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r--src/third_party/wiredtiger/test/format/config.c104
-rw-r--r--src/third_party/wiredtiger/test/format/config.h18
-rw-r--r--src/third_party/wiredtiger/test/format/format.h1
-rw-r--r--src/third_party/wiredtiger/test/recovery/random-abort.c27
-rw-r--r--src/third_party/wiredtiger/test/recovery/truncated-log.c4
-rw-r--r--src/third_party/wiredtiger/test/suite/run.py3
-rw-r--r--src/third_party/wiredtiger/test/suite/test_async01.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_async02.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_backup03.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_backup04.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_bug011.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_collator.py32
-rw-r--r--src/third_party/wiredtiger/test/suite/test_compress01.py20
-rw-r--r--src/third_party/wiredtiger/test/suite/test_config03.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor07.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_cursor08.py20
-rw-r--r--src/third_party/wiredtiger/test/suite/test_dump.py54
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt01.py39
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt02.py48
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt03.py37
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt04.py43
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt05.py39
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt06.py39
-rw-r--r--src/third_party/wiredtiger/test/suite/test_encrypt07.py35
-rw-r--r--src/third_party/wiredtiger/test/suite/test_intpack.py4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_join01.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_join03.py30
-rw-r--r--src/third_party/wiredtiger/test/suite/test_join04.py30
-rw-r--r--src/third_party/wiredtiger/test/suite/test_join07.py30
-rw-r--r--src/third_party/wiredtiger/test/suite/test_jsondump02.py18
-rw-r--r--src/third_party/wiredtiger/test/suite/test_lsm01.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_perf001.py3
-rw-r--r--src/third_party/wiredtiger/test/suite/test_readonly01.py3
-rw-r--r--src/third_party/wiredtiger/test/suite/test_reconfig01.py12
-rw-r--r--src/third_party/wiredtiger/test/suite/test_reconfig02.py1
-rw-r--r--src/third_party/wiredtiger/test/suite/test_schema05.py30
-rw-r--r--src/third_party/wiredtiger/test/suite/test_schema07.py3
-rw-r--r--src/third_party/wiredtiger/test/suite/test_stat02.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_truncate01.py9
-rw-r--r--src/third_party/wiredtiger/test/suite/test_truncate02.py3
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn02.py26
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn04.py22
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn05.py28
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn06.py4
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn07.py56
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn08.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn09.py17
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn11.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn13.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_txn15.py2
-rw-r--r--src/third_party/wiredtiger/test/suite/test_util14.py92
-rw-r--r--src/third_party/wiredtiger/test/suite/test_util15.py71
-rw-r--r--src/third_party/wiredtiger/test/suite/test_util16.py71
-rw-r--r--src/third_party/wiredtiger/test/suite/test_util17.py57
-rw-r--r--src/third_party/wiredtiger/test/suite/wtdataset.py92
-rw-r--r--src/third_party/wiredtiger/test/suite/wttest.py85
-rw-r--r--src/third_party/wiredtiger/test/wtperf/test_conf_dump.py296
57 files changed, 1133 insertions, 551 deletions
diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c
index cf922b5db04..50430fe073e 100644
--- a/src/third_party/wiredtiger/test/format/config.c
+++ b/src/third_party/wiredtiger/test/format/config.c
@@ -44,6 +44,7 @@ static void config_map_compression(const char *, u_int *);
static void config_map_encryption(const char *, u_int *);
static void config_map_file_type(const char *, u_int *);
static void config_map_isolation(const char *, u_int *);
+static void config_pct(void);
static void config_reset(void);
/*
@@ -159,31 +160,19 @@ config_setup(void)
config_encryption();
config_isolation();
config_lrt();
+ config_pct();
/*
- * Periodically, set the delete percentage to 0 so salvage gets run,
- * as long as the delete percentage isn't nailed down.
- * Don't do it on the first run, all our smoke tests would hit it.
- */
- if (!g.replay && g.run_cnt % 10 == 9 && !config_is_perm("delete_pct"))
- config_single("delete_pct=0", 0);
-
- /*
- * If this is an LSM run, set the cache size and crank up the insert
- * percentage.
+ * If this is an LSM run, ensure cache size sanity.
+ * Ensure there is at least 1MB of cache per thread.
*/
- if (DATASOURCE("lsm")) {
- if (!config_is_perm("cache"))
+ if (!config_is_perm("cache")) {
+ if (DATASOURCE("lsm"))
g.c_cache = 30 * g.c_chunk_size;
-
- if (!config_is_perm("insert_pct"))
- g.c_insert_pct = mmrand(NULL, 50, 85);
+ if (g.c_cache < g.c_threads)
+ g.c_cache = g.c_threads;
}
- /* Ensure there is at least 1MB of cache per thread. */
- if (!config_is_perm("cache") && g.c_cache < g.c_threads)
- g.c_cache = g.c_threads;
-
/* Give in-memory configuration a final review. */
config_in_memory_check();
@@ -482,6 +471,83 @@ config_lrt(void)
}
/*
+ * config_pct --
+ * Configure operation percentages.
+ */
+static void
+config_pct(void)
+{
+ static struct {
+ const char *name; /* Operation */
+ uint32_t *vp; /* Value store */
+ u_int order; /* Order of assignment */
+ } list[] = {
+#define CONFIG_DELETE_ENTRY 0
+ { "delete_pct", &g.c_delete_pct, 0 },
+ { "insert_pct", &g.c_insert_pct, 0 },
+ { "read_pct", &g.c_read_pct, 0 },
+ { "write_pct", &g.c_write_pct, 0 },
+ };
+ u_int i, max_order, max_slot, n, pct;
+
+ /*
+ * Walk the list of operations, checking for an illegal configuration
+ * and creating a random order in the list.
+ */
+ pct = 0;
+ for (i = 0; i < WT_ELEMENTS(list); ++i)
+ if (config_is_perm(list[i].name))
+ pct += *list[i].vp;
+ else
+ list[i].order = mmrand(NULL, 1, 1000);
+ if (pct > 100)
+ testutil_die(EINVAL,
+ "operation percentages total to more than 100%%");
+
+ /*
+ * If the delete percentage isn't nailed down, periodically set it to
+ * 0 so salvage gets run. Don't do it on the first run, all our smoke
+ * tests would hit it.
+ */
+ if (!config_is_perm("delete_pct") && !g.replay && g.run_cnt % 10 == 9) {
+ list[CONFIG_DELETE_ENTRY].order = 0;
+ *list[CONFIG_DELETE_ENTRY].vp = 0;
+ }
+
+ /*
+ * Walk the list, allocating random numbers of operations in a random
+ * order.
+ *
+ * If the "order" field is non-zero, we need to create a value for this
+ * operation. Find the largest order field in the array; if one non-zero
+ * order field is found, it's the last entry and gets the remainder of
+ * the operations.
+ */
+ for (pct = 100 - pct;;) {
+ for (i = n =
+ max_order = max_slot = 0; i < WT_ELEMENTS(list); ++i) {
+ if (list[i].order != 0)
+ ++n;
+ if (list[i].order > max_order) {
+ max_order = list[i].order;
+ max_slot = i;
+ }
+ }
+ if (n == 0)
+ break;
+ if (n == 1) {
+ *list[max_slot].vp = pct;
+ break;
+ }
+ *list[max_slot].vp = mmrand(NULL, 0, pct);
+ list[max_slot].order = 0;
+ pct -= *list[max_slot].vp;
+ }
+ testutil_assert(g.c_delete_pct +
+ g.c_insert_pct + g.c_read_pct + g.c_write_pct == 100);
+}
+
+/*
* config_error --
* Display configuration information on error.
*/
diff --git a/src/third_party/wiredtiger/test/format/config.h b/src/third_party/wiredtiger/test/format/config.h
index e4f7af2e1b2..e3e1e73a786 100644
--- a/src/third_party/wiredtiger/test/format/config.h
+++ b/src/third_party/wiredtiger/test/format/config.h
@@ -131,7 +131,7 @@ static CONFIG c[] = {
{ "delete_pct",
"percent operations that are deletes",
- 0x0, 0, 45, 90, &g.c_delete_pct, NULL },
+ C_IGNORE, 0, 0, 100, &g.c_delete_pct, NULL },
{ "dictionary",
"if values are dictionary compressed", /* 20% */
@@ -171,7 +171,7 @@ static CONFIG c[] = {
{ "insert_pct",
"percent operations that are inserts",
- 0x0, 0, 45, 90, &g.c_insert_pct, NULL },
+ C_IGNORE, 0, 0, 100, &g.c_insert_pct, NULL },
{ "internal_key_truncation",
"if internal keys are truncated", /* 95% */
@@ -254,6 +254,14 @@ static CONFIG c[] = {
"quiet run (same as -q)",
C_IGNORE|C_BOOL, 0, 0, 0, &g.c_quiet, NULL },
+ { "read_pct",
+ "percent operations that are reads",
+ C_IGNORE, 0, 0, 100, &g.c_read_pct, NULL },
+
+ { "rebalance",
+ "rebalance testing", /* 100% */
+ C_BOOL, 100, 1, 0, &g.c_rebalance, NULL },
+
{ "repeat_data_pct",
"percent duplicate values in row- or var-length column-stores",
0x0, 0, 90, 90, &g.c_repeat_data_pct, NULL },
@@ -270,10 +278,6 @@ static CONFIG c[] = {
"the number of runs",
C_IGNORE, 0, UINT_MAX, UINT_MAX, &g.c_runs, NULL },
- { "rebalance",
- "rebalance testing", /* 100% */
- C_BOOL, 100, 1, 0, &g.c_rebalance, NULL },
-
{ "salvage",
"salvage testing", /* 100% */
C_BOOL, 100, 1, 0, &g.c_salvage, NULL },
@@ -320,7 +324,7 @@ static CONFIG c[] = {
{ "write_pct",
"percent operations that are writes",
- 0x0, 0, 90, 90, &g.c_write_pct, NULL },
+ C_IGNORE, 0, 0, 100, &g.c_write_pct, NULL },
{ NULL, NULL, 0x0, 0, 0, 0, NULL, NULL }
};
diff --git a/src/third_party/wiredtiger/test/format/format.h b/src/third_party/wiredtiger/test/format/format.h
index c1f4875dbb2..6bb44410acc 100644
--- a/src/third_party/wiredtiger/test/format/format.h
+++ b/src/third_party/wiredtiger/test/format/format.h
@@ -192,6 +192,7 @@ typedef struct {
uint32_t c_reverse;
uint32_t c_rows;
uint32_t c_runs;
+ uint32_t c_read_pct;
uint32_t c_rebalance;
uint32_t c_salvage;
uint32_t c_split_pct;
diff --git a/src/third_party/wiredtiger/test/recovery/random-abort.c b/src/third_party/wiredtiger/test/recovery/random-abort.c
index c407361c7eb..660ef0cca67 100644
--- a/src/third_party/wiredtiger/test/recovery/random-abort.c
+++ b/src/third_party/wiredtiger/test/recovery/random-abort.c
@@ -31,9 +31,13 @@
#include <sys/wait.h>
#include <signal.h>
-static char home[512]; /* Program working dir */
+static char home[1024]; /* 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;
@@ -222,7 +227,7 @@ main(int argc, char *argv[])
pid_t pid;
bool fatal, rand_th, rand_time, verify_only;
const char *working_dir;
- char fname[64], kname[64];
+ char fname[64], kname[64], statname[1024];
if ((progname = strrchr(argv[0], DIR_DELIM)) == NULL)
progname = argv[0];
@@ -263,7 +268,7 @@ main(int argc, char *argv[])
if (argc != 0)
usage();
- testutil_work_dir_from_path(home, 512, working_dir);
+ testutil_work_dir_from_path(home, sizeof(home), working_dir);
/*
* If the user wants to verify they need to tell us how many threads
* there were so we can find the old record files.
@@ -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(statname, sizeof(statname), "%s/%s", home, fs_main);
+ while (stat(statname, &sb) != 0 && kill(pid, 0) == 0)
+ sleep(1);
sleep(timeout);
/*
@@ -340,11 +352,8 @@ main(int argc, char *argv[])
for (i = 0; i < nth; ++i) {
middle = 0;
snprintf(fname, sizeof(fname), RECORDS_FILE, i);
- if ((fp = fopen(fname, "r")) == NULL) {
- fprintf(stderr,
- "Failed to open %s. i %" PRIu32 "\n", fname, i);
- testutil_die(errno, "fopen");
- }
+ if ((fp = fopen(fname, "r")) == NULL)
+ testutil_die(errno, "fopen: %s", fname);
/*
* For every key in the saved file, verify that the key exists
diff --git a/src/third_party/wiredtiger/test/recovery/truncated-log.c b/src/third_party/wiredtiger/test/recovery/truncated-log.c
index c265263d44c..6a142b8e710 100644
--- a/src/third_party/wiredtiger/test/recovery/truncated-log.c
+++ b/src/third_party/wiredtiger/test/recovery/truncated-log.c
@@ -35,7 +35,7 @@
#define snprintf _snprintf
#endif
-static char home[512]; /* Program working dir */
+static char home[1024]; /* Program working dir */
static const char *progname; /* Program name */
static const char * const uri = "table:main";
@@ -290,7 +290,7 @@ main(int argc, char *argv[])
if (argc != 0)
usage();
- testutil_work_dir_from_path(home, 512, working_dir);
+ testutil_work_dir_from_path(home, sizeof(home), working_dir);
testutil_make_work_dir(home);
/*
diff --git a/src/third_party/wiredtiger/test/suite/run.py b/src/third_party/wiredtiger/test/suite/run.py
index ba6d9f78503..97c58bfdccf 100644
--- a/src/third_party/wiredtiger/test/suite/run.py
+++ b/src/third_party/wiredtiger/test/suite/run.py
@@ -324,7 +324,8 @@ if __name__ == '__main__':
# All global variables should be set before any test classes are loaded.
# That way, verbose printing can be done at the class definition level.
wttest.WiredTigerTestCase.globalSetup(preserve, timestamp, gdbSub,
- verbose, dirarg, longtest)
+ verbose, wt_builddir, dirarg,
+ longtest)
# Without any tests listed as arguments, do discovery
if len(testargs) == 0:
diff --git a/src/third_party/wiredtiger/test/suite/test_async01.py b/src/third_party/wiredtiger/test/suite/test_async01.py
index cbb3dad8de6..158c16a9381 100644
--- a/src/third_party/wiredtiger/test/suite/test_async01.py
+++ b/src/third_party/wiredtiger/test/suite/test_async01.py
@@ -132,7 +132,7 @@ class test_async01(wttest.WiredTigerTestCase, suite_subprocess):
])
# Enable async for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'async=(enabled=true,ops_max=%s,' % self.async_ops + \
'threads=%s)' % self.async_threads
diff --git a/src/third_party/wiredtiger/test/suite/test_async02.py b/src/third_party/wiredtiger/test/suite/test_async02.py
index 50652da6dfd..28435fe85b2 100644
--- a/src/third_party/wiredtiger/test/suite/test_async02.py
+++ b/src/third_party/wiredtiger/test/suite/test_async02.py
@@ -129,7 +129,7 @@ class test_async02(wttest.WiredTigerTestCase, suite_subprocess):
])
# Enable async for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'async=(enabled=true,ops_max=%s,' % self.async_ops + \
'threads=%s)' % self.async_threads
diff --git a/src/third_party/wiredtiger/test/suite/test_backup03.py b/src/third_party/wiredtiger/test/suite/test_backup03.py
index 73d05f0b0a1..c1ed3cc9e1a 100644
--- a/src/third_party/wiredtiger/test/suite/test_backup03.py
+++ b/src/third_party/wiredtiger/test/suite/test_backup03.py
@@ -74,7 +74,7 @@ class test_backup_target(wttest.WiredTigerTestCase, suite_subprocess):
('backup_9', dict(big=3,list=[])), # Backup everything
]
- scenarios = make_scenarios(list)
+ scenarios = make_scenarios(list, prune=3, prunelong=1000)
# Create a large cache, otherwise this test runs quite slowly.
conn_config = 'cache_size=1G'
diff --git a/src/third_party/wiredtiger/test/suite/test_backup04.py b/src/third_party/wiredtiger/test/suite/test_backup04.py
index 919649fed57..be52a5e1e97 100644
--- a/src/third_party/wiredtiger/test/suite/test_backup04.py
+++ b/src/third_party/wiredtiger/test/suite/test_backup04.py
@@ -60,7 +60,7 @@ class test_backup_target(wttest.WiredTigerTestCase, suite_subprocess):
])
# Create a large cache, otherwise this test runs quite slowly.
- def conn_config(self, dir):
+ def conn_config(self):
return 'cache_size=1G,log=(archive=false,enabled,file_max=%s)' % \
self.logmax
diff --git a/src/third_party/wiredtiger/test/suite/test_bug011.py b/src/third_party/wiredtiger/test/suite/test_bug011.py
index 969aaeb5b39..5e0721b93f1 100644
--- a/src/third_party/wiredtiger/test/suite/test_bug011.py
+++ b/src/third_party/wiredtiger/test/suite/test_bug011.py
@@ -43,7 +43,7 @@ class test_bug011(wttest.WiredTigerTestCase):
nrows = 10000
nops = 10000
# Add connection configuration for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'cache_size=1GB'
@wttest.longtest("Eviction copes with lots of files")
diff --git a/src/third_party/wiredtiger/test/suite/test_collator.py b/src/third_party/wiredtiger/test/suite/test_collator.py
index 3fae4ff47cb..7ce135c8976 100644
--- a/src/third_party/wiredtiger/test/suite/test_collator.py
+++ b/src/third_party/wiredtiger/test/suite/test_collator.py
@@ -48,34 +48,10 @@ class test_collator(wttest.WiredTigerTestCase):
nentries = 100
nindices = 4
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, libname) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + libname + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- extarg = self.extensionArg([('extractors', 'csv', 'csv_extractor'),
- ('collators', 'revint', 'revint_collator')])
- connarg = 'create,error_prefix="{0}: ",{1}'.format(
- self.shortid(), extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('extractors', 'csv')
+ extlist.extension('collators', 'revint')
def create_indices(self):
# Create self.nindices index files, each with a column from the CSV
diff --git a/src/third_party/wiredtiger/test/suite/test_compress01.py b/src/third_party/wiredtiger/test/suite/test_compress01.py
index 606f7b63235..ef1064d294e 100644
--- a/src/third_party/wiredtiger/test/suite/test_compress01.py
+++ b/src/third_party/wiredtiger/test/suite/test_compress01.py
@@ -51,22 +51,10 @@ class test_compress01(wttest.WiredTigerTestCase):
nrecords = 10000
bigvalue = "abcdefghij" * 1000
- # Load the compression extension, compression is enabled elsewhere.
- def conn_config(self, dir):
- return self.extensionArg(self.compress)
-
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, name):
- if name == None:
- return ''
-
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext/compressors')
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('compression extension "' + extfile + '" not built')
- return ',extensions=["' + extfile + '"]'
+ # Load the compression extension, skip the test if missing
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('compressors', self.compress)
# Create a table, add keys with both big and small values, then verify them.
def test_compress(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_config03.py b/src/third_party/wiredtiger/test/suite/test_config03.py
index 6699f7d2650..89038d71319 100644
--- a/src/third_party/wiredtiger/test/suite/test_config03.py
+++ b/src/third_party/wiredtiger/test/suite/test_config03.py
@@ -71,7 +71,7 @@ class test_config03(test_base03.test_base03):
cache_size_scenarios, create_scenarios, error_prefix_scenarios,
eviction_target_scenarios, eviction_trigger_scenarios,
multiprocess_scenarios, session_max_scenarios,
- transactional_scenarios, verbose_scenarios, prune=1000)
+ transactional_scenarios, verbose_scenarios, prune=100, prunelong=1000)
#wttest.WiredTigerTestCase.printVerbose(2, 'test_config03: running ' + \
# str(len(scenarios)) + ' of ' + \
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor07.py b/src/third_party/wiredtiger/test/suite/test_cursor07.py
index d6078183fc1..19db718fd11 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor07.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor07.py
@@ -49,7 +49,7 @@ class test_cursor07(wttest.WiredTigerTestCase, suite_subprocess):
('reopen', dict(reopen=True))
])
# Enable logging for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
'transaction_sync="(method=dsync,enabled)"'
diff --git a/src/third_party/wiredtiger/test/suite/test_cursor08.py b/src/third_party/wiredtiger/test/suite/test_cursor08.py
index 3f8f50defa7..cc76f528aa9 100644
--- a/src/third_party/wiredtiger/test/suite/test_cursor08.py
+++ b/src/third_party/wiredtiger/test/suite/test_cursor08.py
@@ -54,24 +54,14 @@ class test_cursor08(wttest.WiredTigerTestCase, suite_subprocess):
]
scenarios = make_scenarios(reopens, compress)
# Load the compression extension, and enable it for logging.
- def conn_config(self, dir):
+ def conn_config(self):
return 'log=(archive=false,enabled,file_max=%s,' % self.logmax + \
'compressor=%s),' % self.compress + \
- 'transaction_sync="(method=dsync,enabled)",' + \
- self.extensionArg(self.compress)
+ 'transaction_sync="(method=dsync,enabled)"'
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, name):
- if name == None or name == 'none':
- return ''
-
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext/compressors')
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('compression extension "' + extfile + '" not built')
- return ',extensions=["' + extfile + '"]'
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('compressors', self.compress)
def test_log_cursor(self):
# print "Creating %s with config '%s'" % (self.uri, self.create_params)
diff --git a/src/third_party/wiredtiger/test/suite/test_dump.py b/src/third_party/wiredtiger/test/suite/test_dump.py
index f6a83c32489..3127c7aef00 100644
--- a/src/third_party/wiredtiger/test/suite/test_dump.py
+++ b/src/third_party/wiredtiger/test/suite/test_dump.py
@@ -32,7 +32,7 @@ import wiredtiger, wttest
from suite_subprocess import suite_subprocess
from wtscenario import make_scenarios
from wtdataset import SimpleDataSet, SimpleIndexDataSet, SimpleLSMDataSet, \
- ComplexDataSet, ComplexLSMDataSet
+ ComplexDataSet, ComplexLSMDataSet, ProjectionDataSet, ProjectionIndexDataSet
# test_dump.py
# Utilities: wt dump
@@ -62,6 +62,10 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
('table-simple-lsm', dict(uri='table:', dataset=SimpleLSMDataSet)),
('table-complex', dict(uri='table:', dataset=ComplexDataSet)),
('table-complex-lsm', dict(uri='table:', dataset=ComplexLSMDataSet)),
+ ('table-simple-proj', dict(uri='table:',
+ dataset=ProjectionDataSet, projection=True)),
+ ('table-index-proj', dict(uri='table:',
+ dataset=ProjectionIndexDataSet, projection=True)),
]
scenarios = make_scenarios(types, keyfmt, dumpfmt)
@@ -158,5 +162,53 @@ class test_dump(wttest.WiredTigerTestCase, suite_subprocess):
pop = self.dataset(self, uri2, self.nentries, key_format=self.keyfmt)
pop.check()
+# test_dump_projection
+# Utilities: wt dump
+# Test the dump utility with projections
+class test_dump_projection(wttest.WiredTigerTestCase, suite_subprocess):
+ dir = 'dump.dir' # Backup directory name
+
+ name = 'test_dump'
+ nentries = 2500
+ uri = 'table:'
+
+ # Dump, re-load and do a content comparison.
+ def test_dump(self):
+
+ # Create the object.
+ uri = self.uri + self.name
+ pop = ProjectionDataSet(self, uri, self.nentries, key_format='S')
+ pop.populate()
+
+ # Check some cases with invalid projections.
+ self.runWt(['dump', '-x', uri + '('], \
+ outfilename='bad1.out', errfilename='err1.out', failure=True)
+ self.check_non_empty_file('err1.out')
+ self.runWt(['dump', '-x', uri + '(xx)'], \
+ outfilename='bad2.out', errfilename='err2.out', failure=True)
+ self.check_non_empty_file('err2.out')
+ self.runWt(['dump', '-x', uri + pop.projection[:-1]], \
+ outfilename='bad3.out', errfilename='err3.out', failure=True)
+ self.check_non_empty_file('err3.out')
+
+ # Dump the object with a valid projection.
+ self.runWt(['dump', '-x', uri + pop.projection], outfilename='dump.out')
+
+ # Re-load the object in a new home.
+ os.mkdir(self.dir)
+ self.runWt(['-h', self.dir, 'load', '-f', 'dump.out'])
+
+ # Check the database contents.
+ self.runWt(['list'], outfilename='list.out')
+ self.runWt(['-h', self.dir, 'list'], outfilename='list.out.new')
+ s1 = set(open('list.out').read().split())
+ s2 = set(open('list.out.new').read().split())
+ self.assertEqual(not s1.symmetric_difference(s2), True)
+
+ # Check the object's contents.
+ self.reopen_conn(self.dir)
+ pop_reload = ProjectionDataSet(self, uri, self.nentries, key_format='S')
+ pop_reload.check()
+
if __name__ == '__main__':
wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt01.py b/src/third_party/wiredtiger/test/suite/test_encrypt01.py
index 746c9d13e96..317bed93246 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt01.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt01.py
@@ -66,41 +66,20 @@ class test_encrypt01(wttest.WiredTigerTestCase):
nrecords = 5000
bigvalue = "abcdefghij" * 1001 # len(bigvalue) = 10010
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.sys_encrypt)
+ extlist.extension('encryptors', self.file_encrypt)
+ extlist.extension('compressors', self.block_compress)
+ extlist.extension('compressors', self.log_compress)
+
+ def conn_config(self):
encarg = 'encryption=(name={0}{1}),'.format(
self.sys_encrypt, self.sys_encrypt_args)
comparg = ''
if self.log_compress != None:
comparg='log=(compressor={0}),'.format(self.log_compress)
- extarg = self.extensionArg([('encryptors', self.sys_encrypt),
- ('encryptors', self.file_encrypt),
- ('compressors', self.block_compress),
- ('compressors', self.log_compress)])
- conn = self.wiredtiger_open(dir,
- 'create,error_prefix="{0}: ",{1}{2}{3}'.format(
- self.shortid(), encarg, comparg, extarg))
- self.pr(`conn`)
- return conn
-
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
+ return encarg + comparg
# Create a table, add keys with both big and small values, then verify them.
def test_encrypt(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt02.py b/src/third_party/wiredtiger/test/suite/test_encrypt02.py
index 648686274c4..d950be067e2 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt02.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt02.py
@@ -39,51 +39,27 @@ from wtscenario import make_scenarios
class test_encrypt02(wttest.WiredTigerTestCase, suite_subprocess):
uri = 'file:test_encrypt02'
encrypt_type = [
- ('noarg', dict( encrypt='rotn', encrypt_args='name=rotn',
- secret_arg=None)),
- ('keyid', dict( encrypt='rotn', encrypt_args='name=rotn,keyid=11',
- secret_arg=None)),
- ('pass', dict( encrypt='rotn', encrypt_args='name=rotn',
- secret_arg='ABC')),
- ('keyid-pass', dict( encrypt='rotn', encrypt_args='name=rotn,keyid=11',
- secret_arg='ABC')),
+ ('noarg', dict( encrypt_args='name=rotn', secret_arg=None)),
+ ('keyid', dict( encrypt_args='name=rotn,keyid=11', secret_arg=None)),
+ ('pass', dict( encrypt_args='name=rotn', secret_arg='ABC')),
+ ('keyid-pass', dict(
+ encrypt_args='name=rotn,keyid=11', secret_arg='ABC')),
]
scenarios = make_scenarios(encrypt_type)
+ def conn_extensions(self, extlist):
+ # Load the compression extension, skip the test if missing
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', 'rotn')
+
nrecords = 5000
bigvalue = "abcdefghij" * 1001 # len(bigvalue) = 10010
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
+ def conn_config(self):
secretarg = ''
if self.secret_arg != None:
secretarg = ',secretkey=' + self.secret_arg
- encarg = 'encryption=({0}{1})'.format(self.encrypt_args, secretarg)
- extarg = self.extensionArg([('encryptors', self.encrypt)])
- connarg = 'create,error_prefix="{0}: ",{1},{2}'.format(
- self.shortid(), encarg, extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ return 'encryption=({0}{1})'.format(self.encrypt_args, secretarg)
# Create a table, add keys with both big and small values, then verify them.
def test_pass(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt03.py b/src/third_party/wiredtiger/test/suite/test_encrypt03.py
index cf459190637..302572bd044 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt03.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt03.py
@@ -50,37 +50,14 @@ class test_encrypt03(wttest.WiredTigerTestCase):
]
scenarios = make_scenarios(types, encrypt)
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- encarg = 'encryption=(name={0}{1}),'.format(
- self.sys_encrypt, self.sys_encrypt_args)
- extarg = self.extensionArg([('encryptors', self.sys_encrypt),
- ('encryptors', self.file_encrypt)])
- self.pr('encarg = ' + encarg + ' extarg = ' + extarg)
- conn = self.wiredtiger_open(dir,
- 'create,error_prefix="{0}: ",{1}{2}'.format(
- self.shortid(), encarg, extarg))
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.sys_encrypt)
+ extlist.extension('encryptors', self.file_encrypt)
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
+ def conn_config(self):
+ return 'encryption=(name={0}{1}),'.format(
+ self.sys_encrypt, self.sys_encrypt_args)
# Create a table with encryption values that are in error.
def test_encrypt(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt04.py b/src/third_party/wiredtiger/test/suite/test_encrypt04.py
index a244cf97961..17777fc9564 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt04.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt04.py
@@ -77,9 +77,16 @@ class test_encrypt04(wttest.WiredTigerTestCase, suite_subprocess):
wttest.WiredTigerTestCase.__init__(self, *args, **kwargs)
self.part = 1
+ def conn_extensions(self, extlist):
+ extarg = None
+ if self.expect_forceerror:
+ extarg='(config=\"rotn_force_error=true\")'
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.name, extarg)
+
# Override WiredTigerTestCase, we have extensions.
def setUpConnectionOpen(self, dir):
- forceerror = None
+ self.expect_forceerror = False
if self.part == 1:
self.name = self.name1
self.keyid = self.keyid1
@@ -93,16 +100,15 @@ class test_encrypt04(wttest.WiredTigerTestCase, suite_subprocess):
self.fileinclear = self.fileinclear2 if \
hasattr(self, 'fileinclear2') else False
if hasattr(self, 'forceerror1') and hasattr(self, 'forceerror2'):
- forceerror = "rotn_force_error=true"
- self.expect_forceerror = forceerror != None
+ self.expect_forceerror = True
self.got_forceerror = False
encarg = 'encryption=(name={0},keyid={1},secretkey={2}),'.format(
self.name, self.keyid, self.secretkey)
- # If forceerror is set for this test, add a config arg to
- # the extension string. That signals rotn to return a (-1000)
- # error code, which we'll detect here.
- extarg = self.extensionArg([('encryptors', self.name, forceerror)])
+ # If forceerror is set for this test, conn_extensions adds a
+ # config arg to the extension string. That signals rotn to
+ # return a (-1000) error code, which we'll detect here.
+ extarg = self.extensionsConfig()
self.pr('encarg = ' + encarg + ' extarg = ' + extarg)
completed = False
try:
@@ -135,29 +141,6 @@ class test_encrypt04(wttest.WiredTigerTestCase, suite_subprocess):
self.assertEqual(cursor.search(), 0)
self.assertEquals(cursor.get_value(), val)
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, extarg) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- extfile = '"' + extfile + '"'
- if not extfile in extfiles:
- s = extfile
- if extarg != None:
- s += "=(config=\"" + extarg + "\")"
- extfiles.append(s)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=[' + ','.join(extfiles) + ']'
-
# Evaluate expression, which either must succeed (if expect_okay)
# or must fail (if !expect_okay).
def check_okay(self, expect_okay, expr):
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt05.py b/src/third_party/wiredtiger/test/suite/test_encrypt05.py
index 19a3522b3d5..d8862321821 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt05.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt05.py
@@ -49,41 +49,20 @@ class test_encrypt05(wttest.WiredTigerTestCase):
nrecords = 500
bigvalue = 'a' * 500 # we use values that will definitely give compression
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.sys_encrypt)
+ extlist.extension('encryptors', self.file_encrypt)
+ extlist.extension('compressors', self.block_compress)
+ extlist.extension('compressors', self.log_compress)
+
+ def conn_config(self):
encarg = 'encryption=(name={0}{1}),'.format(
self.sys_encrypt, self.sys_encrypt_args)
comparg = ''
if self.log_compress != None:
comparg='log=(compressor={0}),'.format(self.log_compress)
- extarg = self.extensionArg([('encryptors', self.sys_encrypt),
- ('encryptors', self.file_encrypt),
- ('compressors', self.block_compress),
- ('compressors', self.log_compress)])
- conn = self.wiredtiger_open(dir,
- 'create,error_prefix="{0}: ",{1}{2}{3}'.format(
- self.shortid(), encarg, comparg, extarg))
- self.pr(`conn`)
- return conn
-
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
+ return encarg + comparg
def getvalue(self, r, n):
if n < len(self.bigvalue):
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt06.py b/src/third_party/wiredtiger/test/suite/test_encrypt06.py
index 893c4ba3095..72718e53b2b 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt06.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt06.py
@@ -89,38 +89,15 @@ class test_encrypt06(wttest.WiredTigerTestCase):
scenarios = make_scenarios(encrypt, storagetype)
nrecords = 1000
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- encarg = 'encryption=(name={0}{1}),'.format(
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.sys_encrypt)
+ extlist.extension('encryptors', self.file0_encrypt)
+ extlist.extension('encryptors', self.file1_encrypt)
+
+ def conn_config(self):
+ return 'encryption=(name={0}{1}),'.format(
self.sys_encrypt, self.sys_encrypt_args)
- comparg = ''
- extarg = self.extensionArg([('encryptors', self.sys_encrypt),
- ('encryptors', self.file0_encrypt),
- ('encryptors', self.file1_encrypt)])
- self.open_params = 'create,error_prefix="{0}: ",{1}{2}{3}'.format(
- self.shortid(), encarg, comparg, extarg)
- conn = self.wiredtiger_open(dir, self.open_params)
- self.pr(`conn`)
- return conn
-
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
def encrypt_file_params(self, name, args):
if name == None:
diff --git a/src/third_party/wiredtiger/test/suite/test_encrypt07.py b/src/third_party/wiredtiger/test/suite/test_encrypt07.py
index 97ab1987d4f..81c9f1a49ea 100644
--- a/src/third_party/wiredtiger/test/suite/test_encrypt07.py
+++ b/src/third_party/wiredtiger/test/suite/test_encrypt07.py
@@ -44,35 +44,14 @@ class test_encrypt07(test_salvage.test_salvage):
nrecords = 5000
bigvalue = "abcdefghij" * 1007 # len(bigvalue) = 10070
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- encarg = 'encryption=(name={0}{1}),'.format(
- self.sys_encrypt, self.sys_encrypt_args)
- extarg = self.extensionArg([('encryptors', self.sys_encrypt)])
- conn = self.wiredtiger_open(dir,
- 'create,error_prefix="{0}: ",{1}{2}'.format(
- self.shortid(), encarg, extarg))
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ # Load the compression extension, skip the test if missing
+ extlist.skip_if_missing = True
+ extlist.extension('encryptors', self.sys_encrypt)
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
+ def conn_config(self):
+ return 'encryption=(name={0}{1}),'.format(
+ self.sys_encrypt, self.sys_encrypt_args)
def rot13(self, s):
return codecs.encode(s, 'rot_13')
diff --git a/src/third_party/wiredtiger/test/suite/test_intpack.py b/src/third_party/wiredtiger/test/suite/test_intpack.py
index b0cece09494..ae391e68fca 100644
--- a/src/third_party/wiredtiger/test/suite/test_intpack.py
+++ b/src/third_party/wiredtiger/test/suite/test_intpack.py
@@ -126,8 +126,8 @@ class PackTester:
class test_intpack(wttest.WiredTigerTestCase):
name = 'test_intpack'
- # We have to be a bit verbose here with naming, as there can be problems with
- # case insensitive test names:w
+ # We have to be a bit verbose here with naming, scenario names are
+ # case insensitive and must be unique.
scenarios = make_scenarios([
('int8_t_b', dict(formatcode='b', low=-128, high=127, nbits=8)),
diff --git a/src/third_party/wiredtiger/test/suite/test_join01.py b/src/third_party/wiredtiger/test/suite/test_join01.py
index 2c4328dc7d3..bdd86a06d4f 100644
--- a/src/third_party/wiredtiger/test/suite/test_join01.py
+++ b/src/third_party/wiredtiger/test/suite/test_join01.py
@@ -69,7 +69,7 @@ class test_join01(wttest.WiredTigerTestCase):
]
scenarios = make_scenarios(type_scen, bloom0_scen, bloom1_scen,
projection_scen, nested_scen, stats_scen,
- order_scen)
+ order_scen, prune=50, prunelong=1000)
# We need statistics for these tests.
conn_config = 'statistics=(all)'
diff --git a/src/third_party/wiredtiger/test/suite/test_join03.py b/src/third_party/wiredtiger/test/suite/test_join03.py
index edab7146a6b..dd8111f6ead 100644
--- a/src/third_party/wiredtiger/test/suite/test_join03.py
+++ b/src/third_party/wiredtiger/test/suite/test_join03.py
@@ -36,33 +36,9 @@ class test_join03(wttest.WiredTigerTestCase):
table_name1 = 'test_join03'
nentries = 100
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, libname) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + libname + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- extarg = self.extensionArg([('extractors', 'csv', 'csv_extractor')])
- connarg = 'create,error_prefix="{0}: ",{1}'.format(
- self.shortid(), extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('extractors', 'csv')
def gen_key(self, i):
return [ i + 1 ]
diff --git a/src/third_party/wiredtiger/test/suite/test_join04.py b/src/third_party/wiredtiger/test/suite/test_join04.py
index a71418d9f05..e65b8b53333 100644
--- a/src/third_party/wiredtiger/test/suite/test_join04.py
+++ b/src/third_party/wiredtiger/test/suite/test_join04.py
@@ -36,33 +36,9 @@ class test_join04(wttest.WiredTigerTestCase):
table_name1 = 'test_join04'
nentries = 100
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, libname) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + libname + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- extarg = self.extensionArg([('extractors', 'csv', 'csv_extractor')])
- connarg = 'create,error_prefix="{0}: ",{1}'.format(
- self.shortid(), extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('extractors', 'csv')
# JIRA WT-2308:
# Test extractors with equality joins
diff --git a/src/third_party/wiredtiger/test/suite/test_join07.py b/src/third_party/wiredtiger/test/suite/test_join07.py
index 2a32e678d72..8fae3539246 100644
--- a/src/third_party/wiredtiger/test/suite/test_join07.py
+++ b/src/third_party/wiredtiger/test/suite/test_join07.py
@@ -200,33 +200,9 @@ class test_join07(wttest.WiredTigerTestCase):
scenarios = make_scenarios(extractscen)
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, libname) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + libname + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- extarg = self.extensionArg([('extractors', 'csv', 'csv_extractor')])
- connarg = 'create,error_prefix="{0}: ",{1}'.format(
- self.shortid(), extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('extractors', 'csv')
def expect(self, token, expected):
if token == None or token.kind not in expected:
diff --git a/src/third_party/wiredtiger/test/suite/test_jsondump02.py b/src/third_party/wiredtiger/test/suite/test_jsondump02.py
index 8482851fb94..60863c4aa97 100644
--- a/src/third_party/wiredtiger/test/suite/test_jsondump02.py
+++ b/src/third_party/wiredtiger/test/suite/test_jsondump02.py
@@ -234,6 +234,24 @@ class test_jsondump02(wttest.WiredTigerTestCase, suite_subprocess):
('"ikey" : 4,\n"Skey" : "key4"',
'"S1" : "val16",\n"i2" : 16,\n"S3" : "val64",\n"i4" : 64'))
self.check_json(self.table_uri4, table4_json)
+ # This projection has 3 value fields reversed with a key at the end.
+ table4_json_projection = (
+ ('"ikey" : 1,\n"Skey" : "key1"',
+ '"i4" : 1,\n"S3" : "val1",\n"i2" : 1,\n"ikey" : 1'),
+ ('"ikey" : 2,\n"Skey" : "key2"',
+ '"i4" : 8,\n"S3" : "val8",\n"i2" : 4,\n"ikey" : 2'),
+ ('"ikey" : 3,\n"Skey" : "key3"',
+ '"i4" : 27,\n"S3" : "val27",\n"i2" : 9,\n"ikey" : 3'),
+ ('"ikey" : 4,\n"Skey" : "key4"',
+ '"i4" : 64,\n"S3" : "val64",\n"i2" : 16,\n"ikey" : 4'))
+ # bad projection URI
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.check_json(self.table_uri4 + '(i4,S3,i2,ikey',
+ table4_json_projection),
+ '/Unbalanced brackets/')
+ # This projection should work.
+ self.check_json(self.table_uri4 + '(i4,S3,i2,ikey)',
+ table4_json_projection)
# The dump config currently is not supported for the index type.
self.check_json(uri4index1, (
('"Skey" : "key1"',
diff --git a/src/third_party/wiredtiger/test/suite/test_lsm01.py b/src/third_party/wiredtiger/test/suite/test_lsm01.py
index b44df4bae14..f705b09b0a4 100644
--- a/src/third_party/wiredtiger/test/suite/test_lsm01.py
+++ b/src/third_party/wiredtiger/test/suite/test_lsm01.py
@@ -57,7 +57,7 @@ class test_lsm01(wttest.WiredTigerTestCase):
scenarios = wtscenario.make_scenarios(
chunk_size_scenarios, merge_max_scenarios, bloom_scenarios,
bloom_bit_scenarios, bloom_hash_scenarios, record_count_scenarios,
- prune=500)
+ prune=100, prunelong=500)
# Test drop of an object.
def test_lsm(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_perf001.py b/src/third_party/wiredtiger/test/suite/test_perf001.py
index b22ed2baeb0..6331a3f64d6 100644
--- a/src/third_party/wiredtiger/test/suite/test_perf001.py
+++ b/src/third_party/wiredtiger/test/suite/test_perf001.py
@@ -40,7 +40,8 @@ class test_perf001(wttest.WiredTigerTestCase):
scenarios = make_scenarios([
#('file-file', dict(tabletype='file',indextype='file')),
- ('file-lsm', dict(tabletype='file',indextype='lsm')),
+ ('file-lsm', dict(tabletype='file',indextype='lsm', cfg='',
+ conn_config="statistics=(fast),statistics_log=(wait=1)")),
#('lsm-file', dict(tabletype='lsm',indextype='file')),
#('lsm-lsm', dict(tabletype='lsm',indextype='lsm')),
])
diff --git a/src/third_party/wiredtiger/test/suite/test_readonly01.py b/src/third_party/wiredtiger/test/suite/test_readonly01.py
index e4b431ca1da..f41280a3283 100644
--- a/src/third_party/wiredtiger/test/suite/test_readonly01.py
+++ b/src/third_party/wiredtiger/test/suite/test_readonly01.py
@@ -75,8 +75,7 @@ class test_readonly01(wttest.WiredTigerTestCase, suite_subprocess):
scenarios = make_scenarios(basecfg_list, dir_list, log_list, types)
- def conn_config(self, dir):
- self.home = dir
+ def conn_config(self):
params = \
'error_prefix="%s",' % self.shortid() + \
'%s' % self.logcfg + \
diff --git a/src/third_party/wiredtiger/test/suite/test_reconfig01.py b/src/third_party/wiredtiger/test/suite/test_reconfig01.py
index e76becac76a..cbc8bca5740 100644
--- a/src/third_party/wiredtiger/test/suite/test_reconfig01.py
+++ b/src/third_party/wiredtiger/test/suite/test_reconfig01.py
@@ -64,6 +64,18 @@ class test_reconfig01(wttest.WiredTigerTestCase):
# same ops_max of 512 and thread of 8.
self.conn.reconfigure("async=(enabled=true)")
+ def test_reconfig_eviction(self):
+ # Increase the max number of running threads (default 8).
+ self.conn.reconfigure("eviction=(threads_max=10)")
+ # Increase the min number of running threads (default 1).
+ self.conn.reconfigure("eviction=(threads_min=5)")
+ # Decrease the max number of running threads.
+ self.conn.reconfigure("eviction=(threads_max=7)")
+ # Decrease the min number of running threads.
+ self.conn.reconfigure("eviction=(threads_min=2)")
+ # Set min and max the same.
+ self.conn.reconfigure("eviction=(threads_min=6,threads_max=6)")
+
def test_reconfig_lsm_manager(self):
# We create and populate a tiny LSM so that we can start off with
# the LSM threads running and change the numbers of threads.
diff --git a/src/third_party/wiredtiger/test/suite/test_reconfig02.py b/src/third_party/wiredtiger/test/suite/test_reconfig02.py
index 36a78a1805f..8054b2a6ab5 100644
--- a/src/third_party/wiredtiger/test/suite/test_reconfig02.py
+++ b/src/third_party/wiredtiger/test/suite/test_reconfig02.py
@@ -109,6 +109,7 @@ class test_reconfig02(wttest.WiredTigerTestCase):
# Now turn on archive, sleep a bit to allow the archive thread
# to run and then confirm that all original logs are gone.
self.conn.reconfigure("log=(archive=true)")
+ self.session.checkpoint("force")
time.sleep(2)
cur_logs = fnmatch.filter(os.listdir('.'), "*Log*")
for o in orig_logs:
diff --git a/src/third_party/wiredtiger/test/suite/test_schema05.py b/src/third_party/wiredtiger/test/suite/test_schema05.py
index 28ad51b3c92..d536a629373 100644
--- a/src/third_party/wiredtiger/test/suite/test_schema05.py
+++ b/src/third_party/wiredtiger/test/suite/test_schema05.py
@@ -57,33 +57,9 @@ class test_schema05(wttest.WiredTigerTestCase):
('index-after', { 'create_index' : 2 }),
])
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, exts):
- extfiles = []
- for ext in exts:
- (dirname, name, libname) = ext
- if name != None and name != 'none':
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext', dirname)
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + libname + '.so')
- if not os.path.exists(extfile):
- self.skipTest('extension "' + extfile + '" not built')
- if not extfile in extfiles:
- extfiles.append(extfile)
- if len(extfiles) == 0:
- return ''
- else:
- return ',extensions=["' + '","'.join(extfiles) + '"]'
-
- # Override WiredTigerTestCase, we have extensions.
- def setUpConnectionOpen(self, dir):
- extarg = self.extensionArg([('extractors', 'csv', 'csv_extractor')])
- connarg = 'create,error_prefix="{0}: ",{1}'.format(
- self.shortid(), extarg)
- conn = self.wiredtiger_open(dir, connarg)
- self.pr(`conn`)
- return conn
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('extractors', 'csv')
def create_indices(self):
# Create self.nindices index files, each with a column from the CSV
diff --git a/src/third_party/wiredtiger/test/suite/test_schema07.py b/src/third_party/wiredtiger/test/suite/test_schema07.py
index ac397c6e1a1..3e4b1d28a4d 100644
--- a/src/third_party/wiredtiger/test/suite/test_schema07.py
+++ b/src/third_party/wiredtiger/test/suite/test_schema07.py
@@ -33,8 +33,7 @@ import wiredtiger, wttest
class test_schema07(wttest.WiredTigerTestCase):
tablename = 'table:test_schema07'
- def conn_config(self, dir):
- return 'cache_size=10MB'
+ conn_config = 'cache_size=10MB'
@wttest.longtest("Creating many tables shouldn't fill the cache")
def test_many_tables(self):
diff --git a/src/third_party/wiredtiger/test/suite/test_stat02.py b/src/third_party/wiredtiger/test/suite/test_stat02.py
index cecda7f1ddc..45af283ed02 100644
--- a/src/third_party/wiredtiger/test/suite/test_stat02.py
+++ b/src/third_party/wiredtiger/test/suite/test_stat02.py
@@ -59,7 +59,7 @@ class test_stat_cursor_config(wttest.WiredTigerTestCase):
scenarios = make_scenarios(uri, data_config, cursor_config)
# Turn on statistics for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'statistics=(%s)' % self.data_config
# For each database/cursor configuration, confirm the right combinations
diff --git a/src/third_party/wiredtiger/test/suite/test_truncate01.py b/src/third_party/wiredtiger/test/suite/test_truncate01.py
index 2319eeddbef..7d2b3862568 100644
--- a/src/third_party/wiredtiger/test/suite/test_truncate01.py
+++ b/src/third_party/wiredtiger/test/suite/test_truncate01.py
@@ -183,11 +183,11 @@ class test_truncate_cursor(wttest.WiredTigerTestCase):
# those tests to file objects.
types = [
('file', dict(type='file:', valuefmt='S',
- config='allocation_size=512,leaf_page_max=512')),
+ config='allocation_size=512,leaf_page_max=512', P=0.25)),
('file8t', dict(type='file:', valuefmt='8t',
- config='allocation_size=512,leaf_page_max=512')),
+ config='allocation_size=512,leaf_page_max=512', P=0.25)),
('table', dict(type='table:', valuefmt='S',
- config='allocation_size=512,leaf_page_max=512')),
+ config='allocation_size=512,leaf_page_max=512', P=0.5)),
]
keyfmt = [
('integer', dict(keyfmt='i')),
@@ -203,7 +203,8 @@ class test_truncate_cursor(wttest.WiredTigerTestCase):
('big', dict(nentries=1000,skip=37)),
]
- scenarios = make_scenarios(types, keyfmt, size, reopen)
+ scenarios = make_scenarios(types, keyfmt, size, reopen,
+ prune=10, prunelong=1000)
# Set a cursor key.
def cursorKey(self, ds, uri, key):
diff --git a/src/third_party/wiredtiger/test/suite/test_truncate02.py b/src/third_party/wiredtiger/test/suite/test_truncate02.py
index 73fed362354..729825b26d4 100644
--- a/src/third_party/wiredtiger/test/suite/test_truncate02.py
+++ b/src/third_party/wiredtiger/test/suite/test_truncate02.py
@@ -85,7 +85,8 @@ class test_truncate_fast_delete(wttest.WiredTigerTestCase):
('txn2', dict(commit=False)),
]
- scenarios = make_scenarios(types, keyfmt, overflow, reads, writes, txn)
+ scenarios = make_scenarios(types, keyfmt, overflow, reads, writes, txn,
+ prune=20, prunelong=1000)
# Return the number of records visible to the cursor; test both forward
# and backward iteration, they are different code paths in this case.
diff --git a/src/third_party/wiredtiger/test/suite/test_txn02.py b/src/third_party/wiredtiger/test/suite/test_txn02.py
index a0c2c12a47c..01626057b9e 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn02.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn02.py
@@ -93,11 +93,10 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
checklog_calls = 100 if wttest.islongtest() else 2
checklog_mod = (len(scenarios) / checklog_calls + 1)
- def setUpConnectionOpen(self, dir):
- self.home = dir
+ def conn_config(self):
# Cycle through the different transaction_sync values in a
# deterministic manner.
- self.txn_sync = self.sync_list[
+ txn_sync = self.sync_list[
self.scenario_number % len(self.sync_list)]
#
# We don't want to run zero fill with only the same settings, such
@@ -107,17 +106,9 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
zerofill = 'false'
if self.scenario_number % freq == 0:
zerofill = 'true'
- self.backup_dir = os.path.join(self.home, "WT_BACKUP")
- conn_params = \
- 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
- 'log=(zero_fill=%s),' % zerofill + \
- 'create,error_prefix="%s: ",' % self.shortid() + \
- 'transaction_sync="%s",' % self.txn_sync
- # print "Creating conn at '%s' with config '%s'" % (dir, conn_params)
- conn = self.wiredtiger_open(dir, conn_params)
- self.pr(`conn`)
- self.session2 = conn.open_session()
- return conn
+ return 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
+ 'log=(zero_fill=%s),' % zerofill + \
+ 'transaction_sync="%s",' % txn_sync
# Check that a cursor (optionally started in a new transaction), sees the
# expected values.
@@ -176,8 +167,10 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
backup_conn = self.wiredtiger_open(self.backup_dir,
backup_conn_params)
try:
- self.check(backup_conn.open_session(), None, committed)
+ session = backup_conn.open_session()
finally:
+ session.checkpoint("force")
+ self.check(backup_conn.open_session(), None, committed)
# Sleep long enough so that the archive thread is guaranteed
# to run before we close the connection.
time.sleep(1.0)
@@ -204,6 +197,8 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
self.assertEqual(cur_logs, pr_logs)
def test_ops(self):
+ self.backup_dir = os.path.join(self.home, "WT_BACKUP")
+ self.session2 = self.conn.open_session()
# print "Creating %s with config '%s'" % (self.uri, self.create_params)
self.session.create(self.uri, self.create_params)
# Set up the table with entries for 1, 2, 10 and 11.
@@ -226,6 +221,7 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
# Close and reopen the connection and cursor.
if reopen == 'reopen':
self.reopen_conn()
+ self.session2 = self.conn.open_session()
c = self.session.open_cursor(self.uri, None, 'overwrite')
self.session.begin_transaction(
diff --git a/src/third_party/wiredtiger/test/suite/test_txn04.py b/src/third_party/wiredtiger/test/suite/test_txn04.py
index ade39272f84..d8f6774ded1 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn04.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn04.py
@@ -63,24 +63,15 @@ class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):
txn1s = [('t1c', dict(txn1='commit')), ('t1r', dict(txn1='rollback'))]
scenarios = make_scenarios(types, op1s, txn1s)
- # Overrides WiredTigerTestCase
- def setUpConnectionOpen(self, dir):
- self.home = dir
+
+ def conn_config(self):
# Cycle through the different transaction_sync values in a
# deterministic manner.
- self.txn_sync = self.sync_list[
+ txn_sync = self.sync_list[
self.scenario_number % len(self.sync_list)]
- self.backup_dir = os.path.join(self.home, "WT_BACKUP")
# Set archive false on the home directory.
- conn_params = \
- 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
- 'create,error_prefix="%s: ",' % self.shortid() + \
- 'transaction_sync="%s",' % self.txn_sync
- # print "Creating conn at '%s' with config '%s'" % (dir, conn_params)
- conn = self.wiredtiger_open(dir, conn_params)
- self.pr(`conn`)
- self.session2 = conn.open_session()
- return conn
+ return 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
+ 'transaction_sync="%s",' % txn_sync
# Check that a cursor (optionally started in a new transaction), sees the
# expected values.
@@ -146,6 +137,7 @@ class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):
# The runWt command closes our connection and sessions so
# we need to reopen them here.
self.hot_backup(None, committed)
+ self.session2 = self.conn.open_session()
c = self.session.open_cursor(self.uri, None, 'overwrite')
c.set_value(1)
# Then do the given modification.
@@ -193,6 +185,8 @@ class test_txn04(wttest.WiredTigerTestCase, suite_subprocess):
self.hot_backup(self.uri, committed)
def test_ops(self):
+ self.backup_dir = os.path.join(self.home, "WT_BACKUP")
+ self.session2 = self.conn.open_session()
with self.expectedStdoutPattern('recreating metadata'):
self.ops()
diff --git a/src/third_party/wiredtiger/test/suite/test_txn05.py b/src/third_party/wiredtiger/test/suite/test_txn05.py
index 9e84fe7d3fe..7aaff221ba4 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn05.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn05.py
@@ -64,23 +64,15 @@ class test_txn05(wttest.WiredTigerTestCase, suite_subprocess):
txn1s = [('t1c', dict(txn1='commit')), ('t1r', dict(txn1='rollback'))]
scenarios = make_scenarios(types, op1s, txn1s)
- # Overrides WiredTigerTestCase
- def setUpConnectionOpen(self, dir):
- self.home = dir
+
+ def conn_config(self):
# Cycle through the different transaction_sync values in a
# deterministic manner.
- self.txn_sync = self.sync_list[
+ txn_sync = self.sync_list[
self.scenario_number % len(self.sync_list)]
- self.backup_dir = os.path.join(self.home, "WT_BACKUP")
- conn_params = \
- 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
- 'create,error_prefix="%s: ",' % self.shortid() + \
- 'transaction_sync="%s",' % self.txn_sync
- # print "Creating conn at '%s' with config '%s'" % (dir, conn_params)
- conn = self.wiredtiger_open(dir, conn_params)
- self.pr(`conn`)
- self.session2 = conn.open_session()
- return conn
+ # Set archive false on the home directory.
+ return 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
+ 'transaction_sync="%s",' % txn_sync
# Check that a cursor (optionally started in a new transaction), sees the
# expected values.
@@ -139,8 +131,12 @@ class test_txn05(wttest.WiredTigerTestCase, suite_subprocess):
backup_conn = self.wiredtiger_open(self.backup_dir,
backup_conn_params)
try:
- self.check(backup_conn.open_session(), None, committed)
+ session = backup_conn.open_session()
finally:
+ self.check(session, None, committed)
+ # Force a checkpoint because we don't record the recovery
+ # checkpoint as available for archiving.
+ session.checkpoint("force")
# Sleep long enough so that the archive thread is guaranteed
# to run before we close the connection.
time.sleep(1.0)
@@ -163,6 +159,8 @@ class test_txn05(wttest.WiredTigerTestCase, suite_subprocess):
self.runWt(['-h', self.backup_dir, 'printlog'], outfilename='printlog.out')
def test_ops(self):
+ self.backup_dir = os.path.join(self.home, "WT_BACKUP")
+ self.session2 = self.conn.open_session()
# print "Creating %s with config '%s'" % (self.uri, self.create_params)
self.session.create(self.uri, self.create_params)
# Set up the table with entries for 1-5.
diff --git a/src/third_party/wiredtiger/test/suite/test_txn06.py b/src/third_party/wiredtiger/test/suite/test_txn06.py
index 2bff97f6aac..c91dc6a623b 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn06.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn06.py
@@ -40,10 +40,10 @@ class test_txn06(wttest.WiredTigerTestCase, suite_subprocess):
source_uri = 'table:' + tablename + "_src"
nrows = 100000
- def setUpConnectionOpen(self, *args):
+ def conn_config(self):
if not wiredtiger.verbose_build():
self.skipTest('requires a verbose build')
- return super(test_txn06, self).setUpConnectionOpen(*args)
+ return ''
def test_long_running(self):
# Populate a table
diff --git a/src/third_party/wiredtiger/test/suite/test_txn07.py b/src/third_party/wiredtiger/test/suite/test_txn07.py
index f9577bad7f2..e2986fb999a 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn07.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn07.py
@@ -70,43 +70,20 @@ class test_txn07(wttest.WiredTigerTestCase, suite_subprocess):
('none', dict(compress='')),
]
- scenarios = make_scenarios(types, op1s, txn1s, compress)
- # Overrides WiredTigerTestCase
- def setUpConnectionOpen(self, dir):
- self.home = dir
- # Cycle through the different transaction_sync values in a
- # deterministic manner.
- self.txn_sync = self.sync_list[
- self.scenario_number % len(self.sync_list)]
- self.backup_dir = os.path.join(self.home, "WT_BACKUP")
- conn_params = \
- 'log=(archive=false,enabled,file_max=%s,' % self.logmax + \
- 'compressor=%s)' % self.compress + \
- self.extensionArg(self.compress) + \
- ',create,error_prefix="%s: ",' % self.shortid() + \
- "statistics=(fast)," + \
- 'transaction_sync="%s",' % self.txn_sync
- # print "Creating conn at '%s' with config '%s'" % (dir, conn_params)
- try:
- conn = self.wiredtiger_open(dir, conn_params)
- except wiredtiger.WiredTigerError as e:
- print "Failed conn at '%s' with config '%s'" % (dir, conn_params)
- self.pr(`conn`)
- self.session2 = conn.open_session()
- return conn
-
- # Return the wiredtiger_open extension argument for a shared library.
- def extensionArg(self, name):
- if name == None or name == '':
- return ''
-
- testdir = os.path.dirname(__file__)
- extdir = os.path.join(run.wt_builddir, 'ext/compressors')
- extfile = os.path.join(
- extdir, name, '.libs', 'libwiredtiger_' + name + '.so')
- if not os.path.exists(extfile):
- self.skipTest('compression extension "' + extfile + '" not built')
- return ',extensions=["' + extfile + '"]'
+ scenarios = make_scenarios(types, op1s, txn1s, compress,
+ prune=30, prunelong=1000)
+
+ def conn_config(self):
+ return 'log=(archive=false,enabled,file_max=%s,' % self.logmax + \
+ 'compressor=%s)' % self.compress + \
+ ',create,error_prefix="%s: ",' % self.shortid() + \
+ "statistics=(fast)," + \
+ 'transaction_sync="%s",' % \
+ self.sync_list[self.scenario_number % len(self.sync_list)]
+
+ def conn_extensions(self, extlist):
+ extlist.skip_if_missing = True
+ extlist.extension('compressors', self.compress)
# Check that a cursor (optionally started in a new transaction), sees the
# expected values.
@@ -139,7 +116,7 @@ class test_txn07(wttest.WiredTigerTestCase, suite_subprocess):
self.backup(self.backup_dir)
backup_conn_params = 'log=(enabled,file_max=%s,' % self.logmax + \
'compressor=%s)' % self.compress + \
- self.extensionArg(self.compress)
+ self.extensionsConfig()
backup_conn = self.wiredtiger_open(self.backup_dir, backup_conn_params)
try:
self.check(backup_conn.open_session(), None, committed)
@@ -147,6 +124,9 @@ class test_txn07(wttest.WiredTigerTestCase, suite_subprocess):
backup_conn.close()
def test_ops(self):
+ self.backup_dir = os.path.join(self.home, "WT_BACKUP")
+ self.session2 = self.conn.open_session()
+
# print "Creating %s with config '%s'" % (self.uri, self.create_params)
self.session.create(self.uri, self.create_params)
# Set up the table with entries for 1-5.
diff --git a/src/third_party/wiredtiger/test/suite/test_txn08.py b/src/third_party/wiredtiger/test/suite/test_txn08.py
index f0cdf08df07..04faed9d45a 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn08.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn08.py
@@ -41,7 +41,7 @@ class test_txn08(wttest.WiredTigerTestCase, suite_subprocess):
uri = 'table:' + tablename
# Turn on logging for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'log=(archive=false,enabled,file_max=%s),' % self.logmax + \
'transaction_sync="(method=dsync,enabled)"'
diff --git a/src/third_party/wiredtiger/test/suite/test_txn09.py b/src/third_party/wiredtiger/test/suite/test_txn09.py
index cfad8270ab1..768d714e248 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn09.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn09.py
@@ -80,19 +80,9 @@ class test_txn09(wttest.WiredTigerTestCase, suite_subprocess):
op1s, txn1s, op2s, txn2s, op3s, txn3s, op4s, txn4s,
prune=20, prunelong=5000)
- # Overrides WiredTigerTestCase
- def setUpConnectionOpen(self, dir):
- self.home = dir
- conn_params = \
- 'create,error_prefix="%s: ",' % self.shortid() + \
- 'log=(archive=false,enabled=%s),' % int(self.log_enabled) + \
- 'transaction_sync=(enabled=false),'
-
- # print "Opening conn at '%s' with config '%s'" % (dir, conn_params)
- conn = self.wiredtiger_open(dir, conn_params)
- self.pr(`conn`)
- self.session2 = conn.open_session()
- return conn
+ def conn_config(self):
+ return 'log=(archive=false,enabled=%s),' % int(self.log_enabled) + \
+ 'transaction_sync=(enabled=false)'
# Check that a cursor (optionally started in a new transaction), sees the
# expected values.
@@ -141,6 +131,7 @@ class test_txn09(wttest.WiredTigerTestCase, suite_subprocess):
# Close and reopen the connection and cursor, toggling the log
self.log_enabled = not self.log_enabled
self.reopen_conn()
+ self.session2 = self.conn.open_session()
c = self.session.open_cursor(self.uri, None, 'overwrite')
self.session.begin_transaction(
diff --git a/src/third_party/wiredtiger/test/suite/test_txn11.py b/src/third_party/wiredtiger/test/suite/test_txn11.py
index 147bf3a76c0..3c02b1e86e3 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn11.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn11.py
@@ -44,7 +44,7 @@ class test_txn11(wttest.WiredTigerTestCase, suite_subprocess):
uri = 'table:' + tablename
# Turn on logging for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'log=(archive=%s,' % self.archive + \
'enabled,file_max=%s,prealloc=false),' % self.logmax + \
'transaction_sync=(enabled=false),'
diff --git a/src/third_party/wiredtiger/test/suite/test_txn13.py b/src/third_party/wiredtiger/test/suite/test_txn13.py
index ae0250c06e8..2bf49486b3a 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn13.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn13.py
@@ -50,7 +50,7 @@ class test_txn13(wttest.WiredTigerTestCase, suite_subprocess):
])
# Turn on logging for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'log=(archive=false,enabled,file_max=%s)' % self.logmax + \
',cache_size=8G'
diff --git a/src/third_party/wiredtiger/test/suite/test_txn15.py b/src/third_party/wiredtiger/test/suite/test_txn15.py
index c061c093b02..a2bfb626338 100644
--- a/src/third_party/wiredtiger/test/suite/test_txn15.py
+++ b/src/third_party/wiredtiger/test/suite/test_txn15.py
@@ -41,7 +41,7 @@ class test_txn15(wttest.WiredTigerTestCase, suite_subprocess):
create_params = 'key_format=i,value_format=i'
entries = 100
# Turn on logging for this test.
- def conn_config(self, dir):
+ def conn_config(self):
return 'statistics=(fast),' + \
'log=(archive=false,enabled,file_max=100K),' + \
'use_environment=false,' + \
diff --git a/src/third_party/wiredtiger/test/suite/test_util14.py b/src/third_party/wiredtiger/test/suite/test_util14.py
new file mode 100644
index 00000000000..e2a9f41f0d4
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_util14.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2017 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import os
+from suite_subprocess import suite_subprocess
+import wiredtiger, wttest
+
+# test_util14.py
+# Utilities: wt truncate
+class test_util14(wttest.WiredTigerTestCase, suite_subprocess):
+ tablename = 'test_util14.a'
+ nentries = 1000
+
+ def test_truncate_process(self):
+ """
+ Test truncate in a 'wt' process
+ """
+ params = 'key_format=S,value_format=S'
+ self.session.create('table:' + self.tablename, params)
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+ cursor = self.session.open_cursor('table:' + self.tablename, None, None)
+ for i in range(0, self.nentries):
+ cursor[str(i)] = str(i)
+ cursor.close()
+
+ self.runWt(["truncate", "table:" + self.tablename])
+
+ """
+ Test to confirm table exists and is empty
+ """
+ outfile="outfile.txt"
+ errfile="errfile.txt"
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+ self.runWt(["read", 'table:' + self.tablename, 'NoMatch'],
+ outfilename=outfile, errfilename=errfile, failure=True)
+ self.check_empty_file(outfile)
+ self.check_file_contains(errfile, 'NoMatch: not found\n')
+
+ """
+ Tests for error cases
+ 1. Missing URI
+ 2. Invalid URI
+ 3. Valid but incorrect URI
+ 4. Double URI
+ """
+ self.runWt(["truncate"],
+ outfilename=outfile, errfilename=errfile, failure=True)
+ self.check_empty_file(outfile)
+ self.check_file_contains(errfile, 'usage:')
+
+ self.runWt(["truncate", "foobar"],
+ outfilename=outfile, errfilename=errfile, failure=True)
+ self.check_empty_file(outfile)
+ self.check_file_contains(errfile, 'No such file or directory')
+
+ self.runWt(["truncate", 'table:xx' + self.tablename],
+ outfilename=outfile, errfilename=errfile, failure=True)
+ self.check_empty_file(outfile)
+ self.check_file_contains(errfile, 'No such file or directory')
+
+ self.runWt(["truncate", 'table:' + self.tablename, 'table:' + self.tablename],
+ outfilename=outfile, errfilename=errfile, failure=True)
+ self.check_empty_file(outfile)
+ self.check_file_contains(errfile, 'usage:')
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/test_util15.py b/src/third_party/wiredtiger/test/suite/test_util15.py
new file mode 100644
index 00000000000..33096e71bee
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_util15.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2017 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import os
+from suite_subprocess import suite_subprocess
+import wiredtiger, wttest
+
+# test_util15.py
+# Utilities: wt alter
+class test_util15(wttest.WiredTigerTestCase, suite_subprocess):
+ tablename = 'test_util15.a'
+
+ def test_alter_process(self):
+ """
+ Test alter in a 'wt' process
+ """
+ params = 'key_format=S,value_format=S'
+ self.session.create('table:' + self.tablename, params)
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+
+ """
+ Alter access pattern and confirm
+ """
+ acc_pat_seq="access_pattern_hint=sequential"
+ self.runWt(["alter", "table:" + self.tablename, acc_pat_seq])
+ cursor = self.session.open_cursor("metadata:create", None, None)
+ cursor.set_key("table:" + self.tablename)
+ self.assertEqual(cursor.search(),0)
+ string = cursor.get_value()
+ cursor.close()
+ self.assertTrue(acc_pat_seq in string)
+
+ """
+ Alter access pattern again and confirm
+ """
+ acc_pat_rand="access_pattern_hint=random"
+ self.runWt(["alter", "table:" + self.tablename, acc_pat_rand])
+ cursor = self.session.open_cursor("metadata:create", None, None)
+ cursor.set_key("table:" + self.tablename)
+ self.assertEqual(cursor.search(),0)
+ string = cursor.get_value()
+ cursor.close()
+ self.assertTrue(acc_pat_rand in string)
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/test_util16.py b/src/third_party/wiredtiger/test/suite/test_util16.py
new file mode 100644
index 00000000000..00e68c1017a
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_util16.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2017 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import os
+from suite_subprocess import suite_subprocess
+import wiredtiger, wttest
+
+# test_util16.py
+# Utilities: wt rename
+class test_util16(wttest.WiredTigerTestCase, suite_subprocess):
+ tablename = 'test_util16.a'
+ tablename2 = 'test_util16.b'
+ nentries = 1000
+
+ def test_rename_process(self):
+ """
+ Test alter in a 'wt' process
+ """
+ params = 'key_format=S,value_format=S'
+ self.session.create('table:' + self.tablename, params)
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+ cursor = self.session.open_cursor('table:' + self.tablename, None, None)
+ for i in range(0, self.nentries):
+ cursor[str(i)] = str(i)
+ cursor.close()
+
+ self.runWt(["rename", "table:" + self.tablename, "table:" + self.tablename2])
+ self.assertTrue(os.path.exists(self.tablename2 + ".wt"))
+ cursor = self.session.open_cursor('table:' + self.tablename2, None, None)
+ count = 0
+ while cursor.next() == 0:
+ count +=1
+ cursor.close()
+ self.assertEquals(self.nentries, count)
+
+ self.runWt(["rename", "table:" + self.tablename2, "table:" + self.tablename])
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+ cursor = self.session.open_cursor('table:' + self.tablename, None, None)
+ count = 0
+ while cursor.next() == 0:
+ count +=1
+ cursor.close()
+ self.assertEquals(self.nentries, count)
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/test_util17.py b/src/third_party/wiredtiger/test/suite/test_util17.py
new file mode 100644
index 00000000000..decc1fabf1d
--- /dev/null
+++ b/src/third_party/wiredtiger/test/suite/test_util17.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2017 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import os
+from suite_subprocess import suite_subprocess
+import wiredtiger, wttest
+
+# test_util17.py
+# Utilities: wt stat
+class test_util17(wttest.WiredTigerTestCase, suite_subprocess):
+ tablename = 'test_util17.a'
+
+ def test_stat_process(self):
+ """
+ Test stat in a 'wt' process
+ This test is just here to confirm that stat produces a correct looking
+ output, it isn't here to do statistics validation.
+ """
+ params = 'key_format=S,value_format=S'
+ outfile = "wt-stat.out"
+ expected_string = "cursor: cursor create calls="
+ self.session.create('table:' + self.tablename, params)
+ self.assertTrue(os.path.exists(self.tablename + ".wt"))
+ self.runWt(["stat"], outfilename=outfile)
+ self.check_file_contains(outfile, expected_string)
+
+ expected_string = "cache_walk: Entries in the root page=1"
+ self.runWt(["stat", "table:" + self.tablename ], outfilename=outfile)
+ self.check_file_contains(outfile, expected_string)
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/src/third_party/wiredtiger/test/suite/wtdataset.py b/src/third_party/wiredtiger/test/suite/wtdataset.py
index 74e07e24e93..946b97d995f 100644
--- a/src/third_party/wiredtiger/test/suite/wtdataset.py
+++ b/src/third_party/wiredtiger/test/suite/wtdataset.py
@@ -41,6 +41,7 @@ class BaseDataSet(object):
self.key_format = kwargs.get('key_format', 'S')
self.value_format = kwargs.get('value_format', 'S')
self.config = kwargs.get('config', '')
+ self.projection = kwargs.get('projection', '')
def create(self):
self.testcase.session.create(self.uri, 'key_format=' + self.key_format
@@ -103,7 +104,8 @@ class BaseDataSet(object):
def check(self):
self.testcase.pr('check: ' + self.uri)
- cursor = self.testcase.session.open_cursor(self.uri, None)
+ cursor = self.testcase.session.open_cursor(
+ self.uri + self.projection, None, None)
self.check_cursor(cursor)
cursor.close()
@@ -289,6 +291,94 @@ class ComplexLSMDataSet(ComplexDataSet):
def is_lsm(cls):
return True
+class ProjectionDataSet(SimpleDataSet):
+ """
+ ProjectionDataSet creates a table with predefined data identical to
+ SimpleDataSet (single key and value), but when checking it, uses
+ a cursor with a projection.
+ """
+ def __init__(self, testcase, uri, rows, **kwargs):
+ kwargs['config'] = kwargs.get('config', '') + ',columns=(k,v0)'
+ kwargs['projection'] = '(v0,v0,v0)'
+ super(ProjectionDataSet, self).__init__(testcase, uri, rows, **kwargs)
+
+ # A value suitable for checking the value returned by a cursor.
+ def comparable_value(self, i):
+ v0 = self.value(i)
+ return [v0, v0, v0]
+
+ def check_cursor(self, cursor):
+ i = 0
+ for key, got0, got1, got2 in cursor:
+ i += 1
+ self.testcase.assertEqual(key, self.key(i))
+ if cursor.value_format == '8t' and got0 == 0: # deleted
+ continue
+ self.testcase.assertEqual([got0, got1, got2],
+ self.comparable_value(i))
+ self.testcase.assertEqual(i, self.rows)
+
+class ProjectionIndexDataSet(BaseDataSet):
+ """
+ ProjectionIndexDataSet creates a table with three values and
+ an index. Checks are made against a projection of the main table
+ and a projection of the index.
+ """
+ def __init__(self, testcase, uri, rows, **kwargs):
+ self.origconfig = kwargs.get('config', '')
+ self.indexname = 'index:' + uri.split(":")[1] + ':index0'
+ kwargs['config'] = self.origconfig + ',columns=(k,v0,v1,v2)'
+ kwargs['value_format'] = kwargs.get('value_format', 'SiS')
+ kwargs['projection'] = '(v1,v2,v0)'
+ super(ProjectionIndexDataSet, self).__init__(
+ testcase, uri, rows, **kwargs)
+
+ def value(self, i):
+ return ('v0:' + str(i), i*i, 'v2:' + str(i))
+
+ # Suitable for checking the value returned by a cursor using a projection.
+ def comparable_value(self, i):
+ return [i*i, 'v2:' + str(i), 'v0:' + str(i)]
+
+ def create(self):
+ super(ProjectionIndexDataSet, self).create()
+ self.testcase.session.create(self.indexname, 'columns=(v2,v1),' +
+ self.origconfig)
+
+ def check_cursor(self, cursor):
+ i = 0
+ for key, got0, got1, got2 in cursor:
+ i += 1
+ self.testcase.assertEqual(key, self.key(i))
+ if cursor.value_format == '8t' and got0 == 0: # deleted
+ continue
+ self.testcase.assertEqual([got0, got1, got2],
+ self.comparable_value(i))
+ self.testcase.assertEqual(i, self.rows)
+
+ def check_index_cursor(self, cursor):
+ for i in xrange(1, self.rows + 1):
+ k = self.key(i)
+ v = self.value(i)
+ ik = (v[2], v[1]) # The index key is (v2,v2)
+ expect = [v[1],k,v[2],v[0]]
+ self.testcase.assertEqual(expect, cursor[ik])
+
+ def check(self):
+ BaseDataSet.check(self)
+
+ # Check values in the index.
+ idxcursor = self.testcase.session.open_cursor(
+ self.indexname + '(v1,k,v2,v0)')
+ self.check_index_cursor(idxcursor)
+ idxcursor.close()
+
+ def index_count(self):
+ return 1
+
+ def index_name(self, i):
+ return self.indexname
+
# create a key based on a cursor as a shortcut to creating a SimpleDataSet
def simple_key(cursor, i):
return BaseDataSet.key_by_format(i, cursor.key_format)
diff --git a/src/third_party/wiredtiger/test/suite/wttest.py b/src/third_party/wiredtiger/test/suite/wttest.py
index 4d6df0bc8bd..0dce51f07d5 100644
--- a/src/third_party/wiredtiger/test/suite/wttest.py
+++ b/src/third_party/wiredtiger/test/suite/wttest.py
@@ -37,9 +37,8 @@ except ImportError:
import unittest
from contextlib import contextmanager
-import os, re, shutil, sys, time, traceback
-import wtscenario
-import wiredtiger
+import glob, os, re, shutil, sys, time, traceback
+import wiredtiger, wtscenario
def shortenWithEllipsis(s, maxlen):
if len(s) > maxlen:
@@ -152,6 +151,14 @@ class TestSuiteConnection(object):
else:
return getattr(self._conn, attr)
+# Just like a list of strings, but with a convenience function
+class ExtensionList(list):
+ skipIfMissing = False
+ def extension(self, dirname, name, extarg=None):
+ if name != None and name != 'none':
+ ext = '' if extarg == None else '=' + extarg
+ self.append(dirname + '/' + name + ext)
+
class WiredTigerTestCase(unittest.TestCase):
_globalSetup = False
_printOnceSeen = {}
@@ -160,9 +167,16 @@ class WiredTigerTestCase(unittest.TestCase):
# Can be a string or a callable function or lambda expression.
conn_config = ''
+ # conn_extensions can be overridden to add a list of extensions to load.
+ # Each entry is a string (directory and extension name) and optional config.
+ # Example:
+ # conn_extensions = ('extractors/csv_extractor',
+ # 'test/fail_fs={allow_writes=100}')
+ conn_extensions = ()
+
@staticmethod
def globalSetup(preserveFiles = False, useTimestamp = False,
- gdbSub = False, verbose = 1, dirarg = None,
+ gdbSub = False, verbose = 1, builddir = None, dirarg = None,
longtest = False):
WiredTigerTestCase._preserveFiles = preserveFiles
d = 'WT_TEST' if dirarg == None else dirarg
@@ -172,6 +186,7 @@ class WiredTigerTestCase(unittest.TestCase):
os.makedirs(d)
wtscenario.set_long_run(longtest)
WiredTigerTestCase._parentTestdir = d
+ WiredTigerTestCase._builddir = builddir
WiredTigerTestCase._origcwd = os.getcwd()
WiredTigerTestCase._resultfile = open(os.path.join(d, 'results.txt'), "w", 0) # unbuffered
WiredTigerTestCase._gdbSubprocess = gdbSub
@@ -224,12 +239,66 @@ class WiredTigerTestCase(unittest.TestCase):
return "%s.%s.%s" % (self.__module__,
self.className(), self._testMethodName)
- # Can be overridden, but first consider setting self.conn_config .
+ # Return the wiredtiger_open extension argument for
+ # any needed shared library.
+ def extensionsConfig(self):
+ exts = self.conn_extensions
+ if hasattr(exts, '__call__'):
+ exts = ExtensionList()
+ self.conn_extensions(exts)
+ result = ''
+ extfiles = {}
+ skipIfMissing = False
+ if hasattr(exts, 'skip_if_missing'):
+ skipIfMissing = exts.skip_if_missing
+ for ext in exts:
+ extconf = ''
+ if '=' in ext:
+ splits = ext.split('=', 1)
+ ext = splits[0]
+ extconf = '=' + splits[1]
+ splits = ext.split('/')
+ if len(splits) != 2:
+ raise Exception(self.shortid() +
+ ": " + ext +
+ ": extension is not named <dir>/<name>")
+ libname = splits[1]
+ dirname = splits[0]
+ pat = os.path.join(WiredTigerTestCase._builddir, 'ext',
+ dirname, libname, '.libs', 'libwiredtiger_*.so')
+ filenames = glob.glob(pat)
+ if len(filenames) == 0:
+ if skipIfMissing:
+ self.skipTest('extension "' + ext + '" not built')
+ continue
+ else:
+ raise Exception(self.shortid() +
+ ": " + ext +
+ ": no extensions library found matching: " + pat)
+ elif len(filenames) > 1:
+ raise Exception(self.shortid() +
+ ": " + ext +
+ ": multiple extensions libraries found matching: " + pat)
+ complete = '"' + filenames[0] + '"' + extconf
+ if ext in extfiles:
+ if extfiles[ext] != complete:
+ raise Exception(self.shortid() +
+ ": non-matching extension arguments in " +
+ str(exts))
+ else:
+ extfiles[ext] = complete
+ if len(extfiles) != 0:
+ result = ',extensions=[' + ','.join(extfiles.values()) + ']'
+ return result
+
+ # Can be overridden, but first consider setting self.conn_config
+ # or self.conn_extensions
def setUpConnectionOpen(self, home):
self.home = home
config = self.conn_config
if hasattr(config, '__call__'):
- config = config(home)
+ config = self.conn_config()
+ config += self.extensionsConfig()
# In case the open starts additional threads, flush first to
# avoid confusion.
sys.stdout.flush()
@@ -287,6 +356,7 @@ class WiredTigerTestCase(unittest.TestCase):
self.testsubdir = self.className() + '.' + str(self.__class__.wt_ntests)
self.testdir = os.path.join(WiredTigerTestCase._parentTestdir, self.testsubdir)
self.__class__.wt_ntests += 1
+ self.starttime = time.time()
if WiredTigerTestCase._verbose > 2:
self.prhead('started in ' + self.testdir, True)
# tearDown needs connections list, set it here in case the open fails.
@@ -355,6 +425,9 @@ class WiredTigerTestCase(unittest.TestCase):
else:
self.pr('preserving directory ' + self.testdir)
+ elapsed = time.time() - self.starttime
+ if elapsed > 0.001 and WiredTigerTestCase._verbose >= 2:
+ print "%s: %.2f seconds" % (str(self), elapsed)
if not passed and not skipped:
print "ERROR in " + str(self)
self.pr('FAIL')
diff --git a/src/third_party/wiredtiger/test/wtperf/test_conf_dump.py b/src/third_party/wiredtiger/test/wtperf/test_conf_dump.py
new file mode 100644
index 00000000000..ef7f276a1d0
--- /dev/null
+++ b/src/third_party/wiredtiger/test/wtperf/test_conf_dump.py
@@ -0,0 +1,296 @@
+# Usage: python test_conf_dump.py <optional-wtperf-config>
+#
+# This script tests if the config file dumped in the test directory corresponds
+# correctly to the wtperf config file used. Command line options to wtperf are
+# also taken into account.
+#
+# Following expectations are checked for:
+# 1. If provided through multiple sources, "conn_config" and "table_config"
+# configuration options are appended to each other. All other options get
+# replaced by a higher precedent source.
+# 2. The precedence order for the options in an increasing order is as follows:
+# default option,
+# provided through config file,
+# provided through option -o
+# provided through option -C (for conn_config) or -T (for table_config)
+#
+# Test fails if any config option is missing or has a wrong value. Test also
+# fails if the value for the option is not replaced/appended in the correct
+# order of precedence as stated above.
+
+import os, re, subprocess, sys
+
+OP_FILE = "WT_TEST/CONFIG.wtperf"
+TMP_CONF = "__tmp.wtperf"
+WTPERF_BIN = "./wtperf"
+WTPERF_DIR = "../../build_posix/bench/wtperf/"
+
+CONF_NOT_PROVIDED = -2
+
+# Generate a wtperf conf file to use
+def generate_conf_file(file_name):
+ f = open(file_name, 'w')
+ f.write(
+'''conn_config="cache_size=16GB,eviction=(threads_max=4),log=(enabled=false),session_max=33"
+table_config="leaf_page_max=32k,internal_page_max=16k,allocation_size=4k,split_pct=90,type=file"
+close_conn=false
+icount=1500
+create=true
+compression="snappy"
+checkpoint_interval=5
+checkpoint_threads=1
+populate_threads=1
+report_interval=5
+session_count_idle=50
+session_count_idle=60
+session_count_idle=70
+session_count_idle=80
+run_time=5
+sample_interval=5
+sample_rate=1
+table_count=2
+threads=((count=6,updates=1))
+value_sz=1000
+warmup=2
+''')
+ f.close()
+
+# Build a command from the given options and execute wtperf
+def execute_wtperf(conf_file, option_C = "", option_T = "", option_o = ""):
+ # Generate the command to run, execute wtperf
+ cmd = WTPERF_BIN + " -O " + conf_file
+ if option_C:
+ cmd += " -C " + option_C
+ if option_T:
+ cmd += " -T " + option_T
+ if option_o:
+ # Any quotes in option_o need to be escaped before providing it as part
+ # of the command
+ option_o_cmd_str = option_o.replace('"', '\\"')
+ cmd += " -o " + option_o_cmd_str
+
+ print "Running: ", cmd
+ subprocess.check_call(cmd, shell=True)
+ print "=========================\n"
+
+# Build a dictionary of config key and it's value from the given config file.
+# Optionally take -C, -T and -o and overwrite/append values as per correct
+# precedence
+def build_dict_from_conf(
+ conf_file, option_C = "", option_T = "", option_o = ""):
+ # Open given conf file and make a dictionary of passed arguments and values
+ with open(conf_file) as f:
+ lines = f.read().splitlines()
+
+ # Maintain precedence order of config file, -o, -C/-T
+ # Build a dict of config options, appending values for table_config and
+ # conn_config, if specified multiple times. Replace with the latest in
+ # case of all other configuration keys.
+ key_val_dict = {}
+ for line in lines:
+ if re.match('^\s*#', line) is None:
+ key_val_pair = line.split('=', 1)
+ if ((key_val_pair[0] == 'table_config' or
+ key_val_pair[0] == 'conn_config') and
+ key_val_pair[0] in key_val_dict):
+ tmp_val = key_val_dict[key_val_pair[0]][:-1]
+ tmp_val += ","
+ tmp_val += key_val_pair[1][1:]
+ key_val_dict[key_val_pair[0]] = tmp_val
+ else:
+ key_val_dict[key_val_pair[0]] = key_val_pair[1]
+
+ # If provided, put option o in the dict
+ if option_o:
+ opt_o_key_val_list = option_o.split(',')
+ for op_o_key_val in opt_o_key_val_list:
+ key_val_pair = op_o_key_val.split('=', 1)
+ if ((key_val_pair[0] == 'table_config' or
+ key_val_pair[0] == 'conn_config') and
+ key_val_pair[0] in key_val_dict):
+ tmp_val = key_val_dict[key_val_pair[0]][:-1]
+ tmp_val += ","
+ tmp_val += key_val_pair[1][1:]
+ key_val_dict[key_val_pair[0]] = tmp_val
+ else:
+ key_val_dict[key_val_pair[0]] = key_val_pair[1]
+
+ # If provided, put option C in the dict
+ if option_C:
+ tmp_val = key_val_dict["conn_config"][:-1]
+ tmp_val += ","
+ tmp_val += option_C[1:]
+ key_val_dict["conn_config"] = tmp_val
+
+ # If provided, put option T in the dict
+ if option_T:
+ tmp_val = key_val_dict["table_config"][:-1]
+ tmp_val += ","
+ tmp_val += option_T[1:]
+ key_val_dict["table_config"] = tmp_val
+
+ return key_val_dict
+
+# Extract configuration value for the given key from the given config file
+def extract_config_from_file(conf_file, key):
+ ret_val = ""
+ with open(conf_file) as f:
+ lines = f.read().splitlines()
+ for line in lines:
+ if re.match('^\s*#', line) is None:
+ key_val_pair = line.split('=', 1)
+ if key_val_pair[0] == key:
+ ret_val = key_val_pair[1]
+ return ret_val
+
+# Extract configuration value for the given key from the given "-o" string
+def extract_config_from_opt_o(option_o, key):
+ ret_val = ""
+ opt_o_key_val_list = option_o.split(',')
+ for op_o_key_val in opt_o_key_val_list:
+ key_val_pair = op_o_key_val.split('=', 1)
+ if key_val_pair[0] == key:
+ ret_val = key_val_pair[1]
+ return ret_val
+
+# Execute test:
+# Run wtperf with given config and check if the dumped config file matches the
+# given inputs
+def run_test(conf_file, option_C = "", option_T = "", option_o = ""):
+ # Run wtperf
+ execute_wtperf(conf_file, option_C, option_T, option_o)
+
+ key_val_dict_ip = build_dict_from_conf(
+ conf_file, option_C, option_T, option_o)
+ key_val_dict_op = build_dict_from_conf(OP_FILE)
+
+ conn_config_from_file = extract_config_from_file(conf_file, "conn_config")
+ table_config_from_file = extract_config_from_file(conf_file, "table_config")
+ conn_config_from_opt_o = ""
+ table_config_from_opt_o = ""
+ if option_o:
+ conn_config_from_opt_o = extract_config_from_opt_o(
+ option_o, "conn_config")
+ table_config_from_opt_o = extract_config_from_opt_o(
+ option_o, "table_config")
+
+ # Check if dumped output conf matches with input file and options
+ match = True
+ for key in key_val_dict_ip:
+ match_itr = True
+
+ # Check if we see this config key in the dumped file
+ if not key in key_val_dict_op:
+ print "Key '", key, "' not found in dumped file ", OP_FILE
+ match = match_itr = False
+ continue
+
+ # Check if values from all sources of conn_config are presented in the
+ # conn_config in dumped file. Also check of their relative ordering as
+ # per precedence rules defined.
+ if (key == 'conn_config' and
+ (conn_config_from_file or conn_config_from_opt_o or option_C)):
+ # Should find these config in order: file < option o < option C
+ file_loc = CONF_NOT_PROVIDED
+ option_o_loc = CONF_NOT_PROVIDED
+ option_C_loc = CONF_NOT_PROVIDED
+ op_conn_config = key_val_dict_op['conn_config']
+
+ if conn_config_from_file:
+ file_loc = op_conn_config.find(conn_config_from_file[1:-1])
+ if conn_config_from_opt_o:
+ option_o_loc = op_conn_config.find(conn_config_from_opt_o[1:-1])
+ if option_C:
+ option_C_loc = op_conn_config.find(option_C[1:-1])
+
+ # Check if value from any of the sources is missing
+ if ((conn_config_from_file and file_loc == -1) or
+ (conn_config_from_opt_o and option_o_loc == -1) or
+ (option_C and option_C_loc == -1)):
+ print "Part of conn_config missing in dumped file ", OP_FILE
+ match_itr = False
+
+ # Check if the values got appended in the correct order
+ if match_itr:
+ if ((option_o_loc != CONF_NOT_PROVIDED and
+ option_o_loc < file_loc) or
+ (option_C_loc != CONF_NOT_PROVIDED and
+ (option_C_loc < file_loc or option_C_loc < option_o_loc))):
+ print "Detected incorrect config append order:"
+ match_itr = False
+
+ # Check if values from all sources of table_config are presented in the
+ # table_config in dumped file. Also check of their relative ordering as
+ # per precedence rules defined.
+ if (key == 'table_config' and
+ (table_config_from_file or table_config_from_opt_o or option_T)):
+ # Should find these config in order: file < option o < option T
+ file_loc = CONF_NOT_PROVIDED
+ option_o_loc = CONF_NOT_PROVIDED
+ option_T_loc = CONF_NOT_PROVIDED
+ op_table_config = key_val_dict_op['table_config']
+
+ if table_config_from_file:
+ file_loc = op_table_config.find(table_config_from_file[1:-1])
+ if table_config_from_opt_o:
+ option_o_loc = op_table_config.find(
+ table_config_from_opt_o[1:-1])
+ if option_T:
+ option_T_loc = op_table_config.find(option_T[1:-1])
+
+ # Check if value from any of the sources is missing
+ if ((table_config_from_file and file_loc == -1) or
+ (table_config_from_opt_o and option_o_loc == -1) or
+ (option_T and option_T_loc == -1)):
+ print "Part of table_config missing in dumped file ", OP_FILE
+ match_itr = False
+
+ # Check if the values got appended in the correct order
+ if match_itr:
+ if ((option_o_loc != CONF_NOT_PROVIDED and
+ option_o_loc < file_loc) or
+ (option_T_loc != CONF_NOT_PROVIDED and
+ (option_T_loc < file_loc or option_T_loc < option_o_loc))):
+ print "Detected incorrect config append order:"
+ match_itr = False
+
+ if (key != 'table_config' and key != 'conn_config' and
+ key_val_dict_ip[key] != key_val_dict_op[key]):
+ print "Config mismatch between:"
+ match_itr = False
+
+ if match_itr is False:
+ print "Input Config:", key, '=', key_val_dict_ip[key]
+ print "Dumped Config:", key, '=', key_val_dict_op[key]
+ print "\n"
+
+ match = match and match_itr
+
+ return match
+
+# ----------------- Execute Test --------------
+# If a wtperf conf file is provided use it, else generate a temp conf file
+os.chdir(WTPERF_DIR)
+if len(sys.argv) == 2:
+ conf_file = sys.argv[1]
+else:
+ conf_file = TMP_CONF
+ generate_conf_file(conf_file)
+
+# Run a test with no options
+if not run_test(conf_file):
+ exit(-1)
+
+# Run a test with -C, -T, -o provided
+option_o = "verbose=2,conn_config=\"session_max=135\",table_config=\"type=lsm\",sample_interval=2,run_time=0,sample_rate=2,readonly=false"
+option_C = "\"cache_size=10GB,session_max=115\""
+option_T = "\"allocation_size=8k,split_pct=92\""
+if not run_test(conf_file, option_C, option_T, option_o):
+ exit(-1)
+
+# Cleanup generated temp files
+subprocess.check_call("rm -rf WT_TEST/", shell=True)
+if len(sys.argv) == 1 and conf_file == TMP_CONF:
+ subprocess.check_call("rm " + TMP_CONF, shell=True)
+
+print "All tests succeeded"