summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/suite/test_bug015.py48
-rw-r--r--test/suite/test_reconfig01.py (renamed from test/suite/test_reconfig.py)4
-rw-r--r--test/suite/test_reconfig02.py108
-rw-r--r--test/suite/test_txn02.py9
4 files changed, 167 insertions, 2 deletions
diff --git a/test/suite/test_bug015.py b/test/suite/test_bug015.py
new file mode 100644
index 00000000000..65b5b8e1755
--- /dev/null
+++ b/test/suite/test_bug015.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2015 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 wiredtiger, wttest
+from helper import copy_wiredtiger_home, key_populate, simple_populate
+
+# test_bug015.py
+# JIRA WT-2162: index drop in a certain order triggers NULL pointer deref
+class test_bug015(wttest.WiredTigerTestCase):
+ def test_bug015(self):
+ table = 'table:test_bug015'
+ idx1 = 'index:test_bug015:aab'
+ idx2 = 'index:test_bug015:aaa'
+ self.session.create(table, "columns=(k,v)")
+ self.session.create(idx1, "columns=(v)")
+ self.session.create(idx2, "columns=(v)")
+ self.session.drop(idx1, "force=true")
+ self.session.create(idx1, "columns=(v)")
+ self.session.drop(idx2, "force=true")
+ self.session.create(idx2, "columns=(v)")
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/test/suite/test_reconfig.py b/test/suite/test_reconfig01.py
index b464895f155..2528f856a08 100644
--- a/test/suite/test_reconfig.py
+++ b/test/suite/test_reconfig01.py
@@ -30,9 +30,9 @@ import time
import wiredtiger, wttest
from helper import simple_populate
-# test_reconfig.py
+# test_reconfig01.py
# Smoke-test the connection reconfiguration operations.
-class test_reconfig(wttest.WiredTigerTestCase):
+class test_reconfig01(wttest.WiredTigerTestCase):
def test_reconfig_shared_cache(self):
self.conn.reconfigure("shared_cache=(name=pool,size=300M)")
diff --git a/test/suite/test_reconfig02.py b/test/suite/test_reconfig02.py
new file mode 100644
index 00000000000..e0981a887fb
--- /dev/null
+++ b/test/suite/test_reconfig02.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2015 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 fnmatch, os, time
+import wiredtiger, wttest
+from helper import simple_populate
+
+# test_reconfig02.py
+# Smoke-test the connection reconfiguration operations.
+class test_reconfig02(wttest.WiredTigerTestCase):
+ init_config = 'log=(archive=false,enabled,file_max=100K,prealloc=false,zero_fill=false)'
+ uri = "table:reconfig02"
+ entries = 1000
+
+ def setUpConnectionOpen(self, dir):
+ self.conn_config = self.init_config
+ return wttest.WiredTigerTestCase.setUpConnectionOpen(self, dir)
+
+ # Call reconfigure for zero filling a file. There is nothing
+ # we can actually look for to confirm it did anything.
+ # Also changing the log file size is a no-op, but should not fail.
+ def test_reconfig02_simple(self):
+ self.conn.reconfigure("log=(zero_fill=true)")
+ self.conn.reconfigure("log=(file_max=1MB)")
+
+ # Test that we get an error if we try to turn logging off.
+ def test_reconfig02_disable(self):
+ msg = 'Invalid argument'
+ gotException = False
+ try:
+ self.conn.reconfigure("log=(enabled=false)")
+ except wiredtiger.WiredTigerError as e:
+ gotException = True
+ self.pr('got exception: ' + str(e))
+ self.assertTrue(str(e).find(msg) >= 0)
+ self.assertTrue(gotException)
+
+ # Logging starts on, but prealloc is off. Verify it is off.
+ # Reconfigure it on and run again, making sure that log files
+ # get pre-allocated.
+ def test_reconfig02_prealloc(self):
+ # Create a table just to write something into the log. Sleep
+ # to give the worker thread a chance to run.
+ self.session.create(self.uri, 'key_format=i,value_format=i')
+ time.sleep(2)
+ prep_logs = fnmatch.filter(os.listdir('.'), "*Prep*")
+ # Make sure no pre-allocated log files exist.
+ self.assertEqual(0, len(prep_logs))
+
+ # Now turn on pre-allocation. Sleep to give the worker thread
+ # a chance to run and verify pre-allocated log files exist.
+ self.conn.reconfigure("log=(prealloc=true)")
+ time.sleep(2)
+ prep_logs = fnmatch.filter(os.listdir('.'), "*Prep*")
+ self.assertNotEqual(0, len(prep_logs))
+
+ # Logging starts on, but archive is off. Verify it is off.
+ # Reconfigure it on and run again, making sure that log files
+ # get archived.
+ def test_reconfig02_archive(self):
+ self.session.create(self.uri, 'key_format=i,value_format=i')
+ c = self.session.open_cursor(self.uri, None, None)
+ for i in range(self.entries):
+ c[i] = i + 1
+ c.close()
+ # Close and reopen connection to write a checkpoint, move to the
+ # next log file and verify that archive did not run.
+ orig_logs = fnmatch.filter(os.listdir('.'), "*Log*")
+ self.reopen_conn()
+ cur_logs = fnmatch.filter(os.listdir('.'), "*Log*")
+ for o in orig_logs:
+ self.assertEqual(True, o in cur_logs)
+
+ # 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)")
+ time.sleep(2)
+ cur_logs = fnmatch.filter(os.listdir('.'), "*Log*")
+ for o in orig_logs:
+ self.assertEqual(False, o in cur_logs)
+
+if __name__ == '__main__':
+ wttest.run()
diff --git a/test/suite/test_txn02.py b/test/suite/test_txn02.py
index 83c10f41244..17d0b97b50f 100644
--- a/test/suite/test_txn02.py
+++ b/test/suite/test_txn02.py
@@ -104,9 +104,18 @@ class test_txn02(wttest.WiredTigerTestCase, suite_subprocess):
# deterministic manner.
self.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
+ # as archive or sync, which are an even number of options.
+ #
+ freq = 3
+ 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)