2018-09-11 13:26:14 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2017-08-22 15:38:30 +00:00
|
|
|
import sys
|
|
|
|
from test_cases import *
|
|
|
|
|
2017-10-04 12:36:10 +00:00
|
|
|
|
2017-08-22 15:38:30 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
rpc_py = None
|
|
|
|
total_size = None
|
|
|
|
block_size = None
|
|
|
|
num_test = None
|
|
|
|
fail_count = 0
|
|
|
|
tc_failed = []
|
|
|
|
tc_list = []
|
|
|
|
|
2018-07-27 13:55:19 +00:00
|
|
|
if len(sys.argv) == 7 and len(sys.argv[6].split(',')) <= test_counter():
|
2017-08-22 15:38:30 +00:00
|
|
|
rpc_py = sys.argv[1]
|
|
|
|
total_size = int(sys.argv[2])
|
|
|
|
block_size = int(sys.argv[3])
|
2018-07-27 13:55:19 +00:00
|
|
|
base_dir_path = sys.argv[4]
|
|
|
|
app_path = sys.argv[5]
|
|
|
|
tc_list = sys.argv[6].split(',')
|
2017-08-22 15:38:30 +00:00
|
|
|
else:
|
|
|
|
print("Invalid argument")
|
|
|
|
try:
|
2018-07-27 13:55:19 +00:00
|
|
|
tc = TestCases(rpc_py, total_size, block_size, base_dir_path, app_path)
|
2017-08-22 15:38:30 +00:00
|
|
|
if "all" in tc_list:
|
2018-04-06 00:05:40 +00:00
|
|
|
tc_list = sorted([i.split("test_case")[1] for i in dir(TestCases) if "test_case" in i], key=int)
|
|
|
|
|
|
|
|
for num_test in tc_list:
|
|
|
|
fail_count = 0
|
|
|
|
exec("fail_count += tc.test_case{num_test}"
|
|
|
|
"()".format(num_test=num_test))
|
|
|
|
if fail_count:
|
|
|
|
tc_failed.append(num_test)
|
2017-08-22 15:38:30 +00:00
|
|
|
|
|
|
|
if not tc_failed:
|
|
|
|
print("RESULT: All test cases - PASS")
|
|
|
|
elif tc_failed:
|
|
|
|
print("RESULT: Some test cases FAIL")
|
|
|
|
print(tc_failed)
|
|
|
|
sys.exit(1)
|
2018-06-21 19:29:12 +00:00
|
|
|
except BaseException:
|
2017-08-22 15:38:30 +00:00
|
|
|
print("Test: {num_test} - FAIL".format(num_test=num_test))
|
|
|
|
sys.exit(1)
|