Пример #1
0
 def globalSetup(preserveFiles = False, removeAtStart = True, useTimestamp = False,
                 gdbSub = False, lldbSub = False, verbose = 1, builddir = None, dirarg = None,
                 longtest = False, zstdtest = False, ignoreStdout = False, seedw = 0, seedz = 0, hookmgr = None):
     WiredTigerTestCase._preserveFiles = preserveFiles
     d = 'WT_TEST' if dirarg == None else dirarg
     if useTimestamp:
         d += '.' + time.strftime('%Y%m%d-%H%M%S', time.localtime())
     if removeAtStart:
         shutil.rmtree(d, ignore_errors=True)
     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", 1)  # line buffered
     WiredTigerTestCase._gdbSubprocess = gdbSub
     WiredTigerTestCase._lldbSubprocess = lldbSub
     WiredTigerTestCase._longtest = longtest
     WiredTigerTestCase._zstdtest = zstdtest
     WiredTigerTestCase._verbose = verbose
     WiredTigerTestCase._ignoreStdout = ignoreStdout
     WiredTigerTestCase._dupout = os.dup(sys.stdout.fileno())
     WiredTigerTestCase._stdout = sys.stdout
     WiredTigerTestCase._stderr = sys.stderr
     WiredTigerTestCase._concurrent = False
     WiredTigerTestCase._globalSetup = True
     WiredTigerTestCase._seeds = [521288629, 362436069]
     WiredTigerTestCase._randomseed = False
     if hookmgr == None:
         hookmgr = wthooks.WiredTigerHookManager()
     WiredTigerTestCase._hookmgr = hookmgr
     if seedw != 0 and seedz != 0:
         WiredTigerTestCase._randomseed = True
         WiredTigerTestCase._seeds = [seedw, seedz]
Пример #2
0
            # Restart python!
            python = sys.executable
            os.execl(python, python, *sys.argv)
        elif verbose >= 2:
            print('Python restarted for ASAN')

    # We don't import wttest until after ASAN environment variables are set.
    import wttest
    # Use the same version of unittest found by wttest.py
    unittest = wttest.unittest
    tests = unittest.TestSuite()
    from testscenarios.scenarios import generate_scenarios

    import wthooks
    hookmgr = wthooks.WiredTigerHookManager(hook_names)
    # 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, removeAtStart, timestamp,
                                          gdbSub, lldbSub, verbose,
                                          wt_builddir, dirarg, longtest,
                                          ignoreStdout, seedw, seedz, hookmgr)

    # Without any tests listed as arguments, do discovery
    if len(testargs) == 0:
        if scenario != '':
            sys.stderr.write(
                'run.py: specifying a scenario requires a test name\n')
            usage()
            sys.exit(2)
        from discover import defaultTestLoader as loader