Delete rocksdb dir after crashtest

Summary:
We should clean up after ourselves. Last crashtest failed because the disk on the cibuild machine was full.

Also, db_crashtest is supposed to run the test on the same database in every iteration. This isn't the case currently, because every run creates a new tmp directory. It's fixed with this diff.

Test Plan: ran it

Reviewers: ljin

Reviewed By: ljin

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17073
main
Igor Canadi 11 years ago
parent f681030c80
commit 4cfb0eb40f
  1. 10
      tools/db_crashtest.py
  2. 6
      tools/db_crashtest2.py

@ -8,9 +8,10 @@ import getopt
import logging
import tempfile
import subprocess
import shutil
# This script runs and kills db_stress multiple times. It checks consistency
# in case of unsafe crashes in Rocksdb.
# in case of unsafe crashes in RocksDB.
def main(argv):
try:
@ -59,6 +60,8 @@ def main(argv):
+ str(ops_per_thread) + "\nwrite_buffer_size="
+ str(write_buf_size) + "\n")
dbname = tempfile.mkdtemp(prefix='rocksdb_crashtest_')
while time.time() < exit_time:
run_had_errors = False
killtime = time.time() + interval
@ -98,7 +101,7 @@ def main(argv):
""" % (ops_per_thread,
threads,
write_buf_size,
tempfile.mkdtemp(),
dbname,
random.randint(0, 1),
random.randint(0, 1),
random.randint(0, 1)))
@ -139,5 +142,8 @@ def main(argv):
time.sleep(1) # time to stabilize before the next run
# we need to clean up after ourselves -- only do this on test success
shutil.rmtree(dbname, True)
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))

@ -8,6 +8,7 @@ import getopt
import logging
import tempfile
import subprocess
import shutil
# This python script runs db_stress multiple times. Some runs with
# kill_random_test that causes rocksdb to crash at various points in code.
@ -78,6 +79,7 @@ def main(argv):
# nomral run
additional_opts = "--ops_per_thread=" + str(ops_per_thread)
dbname = tempfile.mkdtemp(prefix='rocksdb_crashtest_')
cmd = re.sub('\s+', ' ', """
./db_stress
--test_batches_snapshots=%s
@ -113,7 +115,7 @@ def main(argv):
""" % (random.randint(0, 1),
threads,
write_buf_size,
tempfile.mkdtemp(),
dbname,
random.randint(0, 1),
random.randint(0, 1),
random.randint(0, 1),
@ -154,6 +156,8 @@ def main(argv):
if (stdoutdata.find('fail') >= 0):
print "TEST FAILED. Output has 'fail'!!!\n"
sys.exit(2)
# we need to clean up after ourselves -- only do this on test success
shutil.rmtree(dbname, True)
check_mode = (check_mode + 1) % total_check_mode

Loading…
Cancel
Save