def stop_during_io(read_or_write): global bringup_argument for sleep_time in range(5, 10): test_name = "STOP During IO" + str(sleep_time) common_test_lib.print_start(test_name) common_test_lib.bringup_multiple_volume(**bringup_argument) process = execute_fio_pipe(readwrite=read_or_write, offset=0, verify="0") time.sleep(sleep_time) pos_util.pci_detach(nvme_device_0) print("Device Detached!!!!!") time.sleep(sleep_time * 0.1) pos_util.pci_detach(nvme_device_1) print("Other Device Detached!!!!!") ret = process.wait() clear_env() #fio can failed by floating point 0 issue. it is natural. #if there is no hang issue, just pass. common_test_lib.print_result(test_name, True)
def run_test(): test_name = "Watchdog run test" common_test_lib.print_start(test_name) common_test_lib.clear_env() execute_watchdog(deamon=0) executed = wait_ibofos_execution() common_test_lib.terminate_ibofos(ibof_root, subprocess.DEVNULL) common_test_lib.clear_env() common_test_lib.print_result(test_name, executed) return executed
def read_out_range_fail_test(): test_name = "Read out of range" common_test_lib.print_start(test_name) common_test_lib.bringup_pos(**bringup_argument) ret = execute_fio(readwrite="read", offset=volume_size, verify=False) common_test_lib.terminate_pos(pos_root, stdout_type) success = (ret == 1) common_test_lib.print_result(test_name, success) return success
def verify_test(): test_name = "Verify" common_test_lib.print_start(test_name) common_test_lib.bringup_pos(**bringup_argument) ret = execute_fio(readwrite="write", offset=0, verify=True) common_test_lib.terminate_pos(pos_root, stdout_type) success = (ret == 0) common_test_lib.print_result(test_name, success) return success
def read_test(): test_name = "Read" common_test_lib.print_start(test_name) common_test_lib.bringup_ibofos(**bringup_argument) ret = execute_fio(readwrite="read", offset=0, verify=False) common_test_lib.terminate_ibofos(ibof_root, stdout_type) success = (ret == 0) common_test_lib.print_result(test_name, success) return success
def log_path_test(): test_name = "Log path test" common_test_lib.print_start(test_name) common_test_lib.clear_env() log_file_name = "watchdog_test.log" execute_watchdog(deamon=1, log_path=log_file_name) wait_deamonize() found = find_log_file(log_file_name) common_test_lib.terminate_ibofos(ibof_root, subprocess.DEVNULL) common_test_lib.clear_env() success = (found == True) common_test_lib.print_result(test_name, success) return success
def unmount_volume_during_io(read_or_write): for sleep_time in range(5,10): test_name = "Unmount During IO" + str(sleep_time) common_test_lib.print_start(test_name) common_test_lib.bringup_multiple_volume(**bringup_argument) verify_flag = "1" if("read" in read_or_write): verify_flag = "0" process = execute_fio_pipe(readwrite=read_or_write, offset=0, verify=verify_flag) time.sleep(7 + sleep_time) print("Volume Unmounted!!!!!") subprocess.call(ibof_cli + " volume unmount --name vol1 --array POSArray", shell="True") ret = process.wait() clear_env() common_test_lib.print_result(test_name, True)
def detaching_device_during_io(read_or_write): for sleep_time in range(5,10): test_name = "Detaching During IO" + str(sleep_time) common_test_lib.print_start(test_name) common_test_lib.bringup_multiple_volume(**bringup_argument) verify_flag = "1" if("read" in read_or_write): verify_flag = "0" process = execute_fio_pipe(readwrite=read_or_write, offset=0, verify=verify_flag) time.sleep(7 + sleep_time) pos_util.pci_detach(nvme_device_0) print("Device Detached!!!!!") ret = process.wait() clear_env() common_test_lib.print_result(test_name, ret == 0)
def build_and_test(fabric_ip): current_path = os.getcwd() for test_path in unittest_path: common_test_lib.print_start(test_path) os.chdir(ibof_root) os.chdir(ibof_root + test_path) ret = subprocess.call(["make"]) if (ret != 0): print("\tMake failed for %s" % (test_path)) exit(-1) test_name = test_path.split('/')[-1] common_test_lib.kill_and_wait([test_name, "ibofos", "fio"]) ret = subprocess.call(["./" + test_name, fabric_ip]) if (ret != 0 and ret != -9): #Sigkill is correct. print("\tTest failed for %s, ret : %d" % (test_path, ret)) exit(-1) os.chdir(current_path)