numam-spdk/test/lvol/lvol_test.py
Chen Wang 1f0bff73df test: refactor the run_test function to add detailed information
1.Refactor the run_test function which used to add detailed information
  during run test suites and test cases.
2.Refactor the lvol feature test scripts to make sure their log is the same.
3.Users can use "run_test suite command" to run test suites
  and use "run_test case command" to run test cases.
4.Update the vhost and lvol test as example.

Change-Id: I7b6387019a861bd1c4f89b9a7712e53150aea8fa
Signed-off-by: Chen Wang <chenx.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/403610
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-08-15 17:24:01 +00:00

45 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python
import sys
from test_cases import *
if __name__ == "__main__":
rpc_py = None
total_size = None
block_size = None
num_test = None
fail_count = 0
tc_failed = []
tc_list = []
if len(sys.argv) == 7 and len(sys.argv[6].split(',')) <= test_counter():
rpc_py = sys.argv[1]
total_size = int(sys.argv[2])
block_size = int(sys.argv[3])
base_dir_path = sys.argv[4]
app_path = sys.argv[5]
tc_list = sys.argv[6].split(',')
else:
print("Invalid argument")
try:
tc = TestCases(rpc_py, total_size, block_size, base_dir_path, app_path)
if "all" in tc_list:
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)
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)
except BaseException:
print("Test: {num_test} - FAIL".format(num_test=num_test))
sys.exit(1)