summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2016-09-13 12:50:23 +1000
committerDon Anderson <dda@mongodb.com>2016-09-12 22:50:23 -0400
commit07b6e5d4bef3ca46adfbdda012e35bd2937c49ec (patch)
tree95bfef7b09c350659a827faee7a060388073d446
parent5380283215a8977ea33acd393fe8cfef2437eae9 (diff)
downloadmongo-07b6e5d4bef3ca46adfbdda012e35bd2937c49ec.tar.gz
WT-2908 Add a dry-run option to python suite (#3033)
-rw-r--r--test/suite/run.py20
-rw-r--r--test/suite/wttest.py6
2 files changed, 23 insertions, 3 deletions
diff --git a/test/suite/run.py b/test/suite/run.py
index c37093a2a55..ba6d9f78503 100644
--- a/test/suite/run.py
+++ b/test/suite/run.py
@@ -82,6 +82,8 @@ Options:\n\
-D dir | --dir dir use dir rather than WT_TEST.\n\
dir is removed/recreated as a first step.\n\
-d | --debug run with \'pdb\', the python debugger\n\
+ -n | --dry-run perform a dry-run, listing all scenarios to\n\
+ be run without executing any.\n\
-g | --gdb all subprocesses (like calls to wt) use gdb\n\
-h | --help show this message\n\
-j N | --parallel N run all tests in parallel using N processes\n\
@@ -236,7 +238,7 @@ if __name__ == '__main__':
tests = unittest.TestSuite()
# Turn numbers and ranges into test module names
- preserve = timestamp = debug = gdbSub = longtest = False
+ preserve = timestamp = debug = dryRun = gdbSub = longtest = False
parallel = 0
configfile = None
configwrite = False
@@ -261,6 +263,9 @@ if __name__ == '__main__':
if option == '-debug' or option == 'd':
debug = True
continue
+ if option == '-dry-run' or option == 'n':
+ dryRun = True
+ continue
if option == '-gdb' or option == 'g':
gdbSub = True
continue
@@ -341,6 +346,15 @@ if __name__ == '__main__':
if debug:
import pdb
pdb.set_trace()
+ if dryRun:
+ # We have to de-dupe here as some scenarios overlap in the same suite
+ dryOutput = set()
+ for test in tests:
+ dryOutput.add(test.shortDesc())
+ for line in dryOutput:
+ print line
+ else:
+ result = wttest.runsuite(tests, parallel)
+ sys.exit(0 if result.wasSuccessful() else 1)
- result = wttest.runsuite(tests, parallel)
- sys.exit(0 if result.wasSuccessful() else 1)
+ sys.exit(0)
diff --git a/test/suite/wttest.py b/test/suite/wttest.py
index 788dd5d0307..4a90bce96df 100644
--- a/test/suite/wttest.py
+++ b/test/suite/wttest.py
@@ -216,6 +216,12 @@ class WiredTigerTestCase(unittest.TestCase):
' (' + self.scenario_name + ')'
return self.simpleName() + scen
+ def shortDesc(self):
+ ret_str = ''
+ if hasattr(self, 'scenario_number'):
+ ret_str = ' -s ' + str(self.scenario_number)
+ return self.className() + ret_str
+
def simpleName(self):
return "%s.%s.%s" % (self.__module__,
self.className(), self._testMethodName)