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
This commit is contained in:
Igor Canadi 2014-03-20 11:11:08 -07:00
parent f681030c80
commit 4cfb0eb40f
2 changed files with 13 additions and 3 deletions

View File

@ -8,9 +8,10 @@ import getopt
import logging import logging
import tempfile import tempfile
import subprocess import subprocess
import shutil
# This script runs and kills db_stress multiple times. It checks consistency # 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): def main(argv):
try: try:
@ -59,6 +60,8 @@ def main(argv):
+ str(ops_per_thread) + "\nwrite_buffer_size=" + str(ops_per_thread) + "\nwrite_buffer_size="
+ str(write_buf_size) + "\n") + str(write_buf_size) + "\n")
dbname = tempfile.mkdtemp(prefix='rocksdb_crashtest_')
while time.time() < exit_time: while time.time() < exit_time:
run_had_errors = False run_had_errors = False
killtime = time.time() + interval killtime = time.time() + interval
@ -98,7 +101,7 @@ def main(argv):
""" % (ops_per_thread, """ % (ops_per_thread,
threads, threads,
write_buf_size, write_buf_size,
tempfile.mkdtemp(), dbname,
random.randint(0, 1), random.randint(0, 1),
random.randint(0, 1), 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 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__": if __name__ == "__main__":
sys.exit(main(sys.argv[1:])) sys.exit(main(sys.argv[1:]))

View File

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