Invoke crash test from the Makefile

Summary: make crash_test will now invoke the crash_test. Also some cleanup in the db_crashtest.py file

Test Plan: make crash_test

Reviewers: akushner, vamsi, sheki, dhruba

Reviewed By: vamsi

Differential Revision: https://reviews.facebook.net/D9987
main
Mayank Agarwal 12 years ago
parent 574b76f710
commit faa32a72a6
  1. 3
      Makefile
  2. 11
      tools/db_crashtest.py

@ -115,6 +115,9 @@ check: all $(PROGRAMS) $(TESTS) $(TOOLS) ldb_tests
ldb_tests: all $(PROGRAMS) $(TOOLS) ldb_tests: all $(PROGRAMS) $(TOOLS)
python tools/ldb_test.py python tools/ldb_test.py
crash_test: db_stress
python tools/db_crashtest.py
valgrind_check: all $(PROGRAMS) $(TESTS) valgrind_check: all $(PROGRAMS) $(TESTS)
echo TESTS THAT HAVE VALGRIND ERRORS > $(VALGRIND_DIR)/valgrind_failed_tests; \ echo TESTS THAT HAVE VALGRIND ERRORS > $(VALGRIND_DIR)/valgrind_failed_tests; \
echo TIMES in seconds TAKEN BY TESTS ON VALGRIND > $(VALGRIND_DIR)/valgrind_tests_times; \ echo TIMES in seconds TAKEN BY TESTS ON VALGRIND > $(VALGRIND_DIR)/valgrind_tests_times; \

@ -1,9 +1,11 @@
#! /usr/bin/env python
import os import os
import sys import sys
import time import time
import shlex import shlex
import getopt import getopt
import logging import logging
import tempfile
import subprocess import subprocess
# This python script runs and kills db_stress multiple times with # This python script runs and kills db_stress multiple times with
@ -13,7 +15,6 @@ import subprocess
# This checks consistency in case of unsafe crashes in Rocksdb # This checks consistency in case of unsafe crashes in Rocksdb
def main(argv): def main(argv):
os.system("make -C ~/rocksdb db_stress")
try: try:
opts, args = getopt.getopt(argv, "hd:t:i:o:b:") opts, args = getopt.getopt(argv, "hd:t:i:o:b:")
except getopt.GetoptError: except getopt.GetoptError:
@ -53,19 +54,21 @@ def main(argv):
exit_time = time.time() + duration exit_time = time.time() + duration
dirpath = tempfile.mkdtemp()
while time.time() < exit_time: while time.time() < exit_time:
run_had_errors = False run_had_errors = False
print "Running db_stress \n" print "Running db_stress \n"
os.system("mkdir -p /tmp/rocksdb/crashtest")
killtime = time.time() + interval killtime = time.time() + interval
child = subprocess.Popen(['~/rocksdb/db_stress \ child = subprocess.Popen(['./db_stress \
--test_batches_snapshots=1 \ --test_batches_snapshots=1 \
--ops_per_thread=0' + str(ops_per_thread) + ' \ --ops_per_thread=0' + str(ops_per_thread) + ' \
--threads=0' + str(threads) + ' \ --threads=0' + str(threads) + ' \
--write_buffer_size=' + str(write_buf_size) + '\ --write_buffer_size=' + str(write_buf_size) + '\
--destroy_db_initially=0 \
--reopen=0 \ --reopen=0 \
--readpercent=50 \ --readpercent=50 \
--db=/tmp/rocksdb/crashtest \ --db=' + dirpath + '\
--max_key=1000'], stderr=subprocess.PIPE, shell=True) --max_key=1000'], stderr=subprocess.PIPE, shell=True)
time.sleep(interval) time.sleep(interval)
while True: while True:

Loading…
Cancel
Save