|
|
@ -14,7 +14,6 @@ import subprocess |
|
|
|
# checks can be performed. |
|
|
|
# checks can be performed. |
|
|
|
# |
|
|
|
# |
|
|
|
def main(argv): |
|
|
|
def main(argv): |
|
|
|
os.system("make -C ~/rocksdb db_stress") |
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
opts, args = getopt.getopt(argv, "hd:t:k:o:b:") |
|
|
|
opts, args = getopt.getopt(argv, "hd:t:k:o:b:") |
|
|
|
except getopt.GetoptError: |
|
|
|
except getopt.GetoptError: |
|
|
@ -60,6 +59,11 @@ def main(argv): |
|
|
|
|
|
|
|
|
|
|
|
dirpath = tempfile.mkdtemp() |
|
|
|
dirpath = tempfile.mkdtemp() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("Running whitebox-crash-test with \ntotal-duration=" + str(duration) |
|
|
|
|
|
|
|
+ "\nthreads=" + str(threads) + "\nops_per_thread=" |
|
|
|
|
|
|
|
+ str(ops_per_thread) + "\nwrite_buffer_size=" |
|
|
|
|
|
|
|
+ str(write_buf_size) + "\n") |
|
|
|
|
|
|
|
|
|
|
|
# kill in every alternate run. toggle tracks which run we are doing. |
|
|
|
# kill in every alternate run. toggle tracks which run we are doing. |
|
|
|
toggle = True |
|
|
|
toggle = True |
|
|
|
|
|
|
|
|
|
|
@ -77,7 +81,7 @@ def main(argv): |
|
|
|
|
|
|
|
|
|
|
|
toggle = not toggle |
|
|
|
toggle = not toggle |
|
|
|
|
|
|
|
|
|
|
|
cmd = ['~/rocksdb/db_stress \ |
|
|
|
cmd = ['./db_stress \ |
|
|
|
--test_batches_snapshots=1 \ |
|
|
|
--test_batches_snapshots=1 \ |
|
|
|
--ops_per_thread=0' + str(new_ops_per_thread) + ' \ |
|
|
|
--ops_per_thread=0' + str(new_ops_per_thread) + ' \ |
|
|
|
--threads=0' + str(threads) + ' \ |
|
|
|
--threads=0' + str(threads) + ' \ |
|
|
@ -87,19 +91,31 @@ def main(argv): |
|
|
|
--readpercent=50 \ |
|
|
|
--readpercent=50 \ |
|
|
|
--db=' + dirpath + ' \ |
|
|
|
--db=' + dirpath + ' \ |
|
|
|
--max_key=10000'] |
|
|
|
--max_key=10000'] |
|
|
|
try: |
|
|
|
|
|
|
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) |
|
|
|
popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
|
|
|
if killoption != '': |
|
|
|
stderr=subprocess.STDOUT, |
|
|
|
logging.warn("WARNING: db_stress did not kill itself\n") |
|
|
|
shell=True) |
|
|
|
continue |
|
|
|
stdoutdata, stderrdata = popen.communicate() |
|
|
|
|
|
|
|
retncode = popen.returncode |
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
msg = ("kill option = {0}, exitcode = {1}".format( |
|
|
|
msg = "db_stress retncode {0} output {1}".format(e.returncode, |
|
|
|
killoption, retncode)) |
|
|
|
e.output) |
|
|
|
|
|
|
|
logging.info(msg) |
|
|
|
|
|
|
|
print msg |
|
|
|
print msg |
|
|
|
msglower = msg.lower() |
|
|
|
print stdoutdata |
|
|
|
if ('error' in msglower) or ('fail' in msglower): |
|
|
|
|
|
|
|
|
|
|
|
expected = False |
|
|
|
|
|
|
|
if (killoption == '') and (retncode == 0): |
|
|
|
|
|
|
|
# we expect zero retncode if no kill option |
|
|
|
|
|
|
|
expected = True |
|
|
|
|
|
|
|
elif killoption != '' and retncode < 0: |
|
|
|
|
|
|
|
# we expect negative retncode if kill option was given |
|
|
|
|
|
|
|
expected = True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not expected: |
|
|
|
|
|
|
|
print "TEST FAILED!!!\n" |
|
|
|
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stdoutdata = stdoutdata.lower() |
|
|
|
|
|
|
|
if ('error' in stdoutdata) or ('fail' in stdoutdata): |
|
|
|
print "TEST FAILED!!!\n" |
|
|
|
print "TEST FAILED!!!\n" |
|
|
|
sys.exit(2) |
|
|
|
sys.exit(2) |
|
|
|
time.sleep(1) # time to stabilize after a kill |
|
|
|
time.sleep(1) # time to stabilize after a kill |
|
|
|