Commit e6256121 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4804] change run.stress-tests.py to work with cmake, hopefully, but untested


git-svn-id: file:///svn/toku/tokudb@43568 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0182766a
...@@ -53,9 +53,10 @@ class Killed(Exception): ...@@ -53,9 +53,10 @@ class Killed(Exception):
pass pass
class TestRunnerBase(object): class TestRunnerBase(object):
def __init__(self, scheduler, tokudb, rev, jemalloc, execf, tsize, csize, test_time, savedir): def __init__(self, scheduler, builddir, installdir, rev, jemalloc, execf, tsize, csize, test_time, savedir):
self.scheduler = scheduler self.scheduler = scheduler
self.tokudb = tokudb self.builddir = builddir
self.installdir = installdir
self.rev = rev self.rev = rev
self.execf = execf self.execf = execf
self.tsize = tsize self.tsize = tsize
...@@ -64,7 +65,7 @@ class TestRunnerBase(object): ...@@ -64,7 +65,7 @@ class TestRunnerBase(object):
self.savedir = savedir self.savedir = savedir
self.env = os.environ self.env = os.environ
libpath = os.path.join(self.tokudb, 'lib') libpath = os.path.join(self.installdir, 'lib')
if 'LD_LIBRARY_PATH' in self.env: if 'LD_LIBRARY_PATH' in self.env:
self.env['LD_LIBRARY_PATH'] = '%s:%s' % (libpath, self.env['LD_LIBRARY_PATH']) self.env['LD_LIBRARY_PATH'] = '%s:%s' % (libpath, self.env['LD_LIBRARY_PATH'])
else: else:
...@@ -145,7 +146,7 @@ class TestRunnerBase(object): ...@@ -145,7 +146,7 @@ class TestRunnerBase(object):
copytree(self.envdir, self.prepareloc) copytree(self.envdir, self.prepareloc)
def run(self): def run(self):
srctests = os.path.join(self.tokudb, 'src', 'tests') srctests = os.path.join(self.builddir, 'src', 'tests')
self.rundir = mkdtemp(dir=srctests) self.rundir = mkdtemp(dir=srctests)
try: try:
...@@ -185,9 +186,9 @@ class TestRunnerBase(object): ...@@ -185,9 +186,9 @@ class TestRunnerBase(object):
copytree(f, targetfor(f)) copytree(f, targetfor(f))
else: else:
copy(f, targetfor(f)) copy(f, targetfor(f))
fullexecf = os.path.join(self.tokudb, 'src', 'tests', self.execf) fullexecf = os.path.join(self.builddir, 'src', 'tests', self.execf)
copy(fullexecf, targetfor(fullexecf)) copy(fullexecf, targetfor(fullexecf))
for lib in glob(os.path.join(self.tokudb, 'lib', '*.so')): for lib in glob(os.path.join(self.installdir, 'lib', '*.so')):
copy(lib, targetfor(lib)) copy(lib, targetfor(lib))
return savedir return savedir
...@@ -412,10 +413,7 @@ def compiler_works(cc): ...@@ -412,10 +413,7 @@ def compiler_works(cc):
exception('Error running %s.', cc) exception('Error running %s.', cc)
return False return False
def rebuild(tokudb, cc, tests): def rebuild(tokudb, builddir, installdir, cc, tests):
env = os.environ
env['CC'] = cc
env['DEBUG'] = '0'
info('Updating from svn.') info('Updating from svn.')
devnull = open(os.devnull, 'w') devnull = open(os.devnull, 'w')
call(['svn', 'up'], stdout=devnull, stderr=STDOUT, cwd=tokudb) call(['svn', 'up'], stdout=devnull, stderr=STDOUT, cwd=tokudb)
...@@ -423,19 +421,20 @@ def rebuild(tokudb, cc, tests): ...@@ -423,19 +421,20 @@ def rebuild(tokudb, cc, tests):
if not compiler_works(cc): if not compiler_works(cc):
error('Cannot find working compiler named "%s". Try sourcing the icc env script or providing another compiler with --cc.', cc) error('Cannot find working compiler named "%s". Try sourcing the icc env script or providing another compiler with --cc.', cc)
sys.exit(r) sys.exit(r)
if cc == 'icc':
iccstr = 'ON'
else:
iccstr = 'OFF'
info('Building tokudb.') info('Building tokudb.')
r = call(['make', '-s', 'clean'], if not os.path.exists(builddir):
cwd=tokudb, env=env) os.mkdir(builddir)
if r != 0: r = call(['cmake',
error('Cleaning the source tree failed.') '-DCMAKE_BUILD_TYPE=Debug',
sys.exit(r) '-DINTELCC=%s' % iccstr,
r = call(['make', '-s', 'fastbuild'], '-DCMAKE_INSTALL_DIR=%s' % installdir,
cwd=tokudb, env=env) tokudb]
if r != 0: cwd=builddir)
error('Building the fractal tree failed.') r = call(['make', '-s'] + tests, cwd=builddir)
sys.exit(r)
r = call(['make', '-s'] + tests,
cwd=os.path.join(tokudb, 'src', 'tests'), env=env)
if r != 0: if r != 0:
error('Building the tests failed.') error('Building the tests failed.')
sys.exit(r) sys.exit(r)
...@@ -449,8 +448,10 @@ def revfor(tokudb): ...@@ -449,8 +448,10 @@ def revfor(tokudb):
return rev return rev
def main(opts): def main(opts):
builddir = os.path.join(opts.tokudb, 'build')
installdir = os.path.join(opts.tokudb, 'install')
if opts.build: if opts.build:
rebuild(opts.tokudb, opts.cc, opts.testnames + opts.recover_testnames) rebuild(opts.tokudb, builddir, installdir, opts.cc, opts.testnames + opts.recover_testnames)
rev = revfor(opts.tokudb) rev = revfor(opts.tokudb)
if not os.path.exists(opts.savedir): if not os.path.exists(opts.savedir):
...@@ -471,7 +472,8 @@ def main(opts): ...@@ -471,7 +472,8 @@ def main(opts):
for csize in [50 * tsize, 1000 ** 3]: for csize in [50 * tsize, 1000 ** 3]:
kwargs = { kwargs = {
'scheduler': scheduler, 'scheduler': scheduler,
'tokudb': opts.tokudb, 'builddir': builddir,
'installdir': installdir,
'rev': rev, 'rev': rev,
'jemalloc': opts.jemalloc, 'jemalloc': opts.jemalloc,
'tsize': tsize, 'tsize': tsize,
...@@ -534,7 +536,7 @@ def main(opts): ...@@ -534,7 +536,7 @@ def main(opts):
if scheduler.error is not None: if scheduler.error is not None:
error('Scheduler reported an error.') error('Scheduler reported an error.')
raise scheduler.error raise scheduler.error
rebuild(opts.tokudb, opts.cc, opts.testnames + opts.recover_testnames) rebuild(opts.tokudb, builddir, installdir, opts.cc, opts.testnames + opts.recover_testnames)
rev = revfor(opts.tokudb) rev = revfor(opts.tokudb)
for runner in runners: for runner in runners:
runner.rev = rev runner.rev = rev
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment