fixed review comments
This commit is contained in:
parent
aba622cf31
commit
e9fdf6a317
@ -236,7 +236,7 @@ class Conformance:
|
|||||||
worker_num=self._workers,
|
worker_num=self._workers,
|
||||||
working_dir=logs_dir,
|
working_dir=logs_dir,
|
||||||
cache_path=self._cache_path,
|
cache_path=self._cache_path,
|
||||||
split_unit="test",
|
split_unit=constants.TEST_UNIT_NAME,
|
||||||
repeat_failed=1,
|
repeat_failed=1,
|
||||||
is_parallel_devices=self._is_parallel_over_devices,
|
is_parallel_devices=self._is_parallel_over_devices,
|
||||||
excluded_tests=self._expected_failures if not self._expected_failures_update else set())
|
excluded_tests=self._expected_failures if not self._expected_failures_update else set())
|
||||||
|
@ -56,11 +56,11 @@ def parse_arguments():
|
|||||||
|
|
||||||
parser.add_argument("-e", "--exec_file", help=exec_file_path_help, type=str, required=True)
|
parser.add_argument("-e", "--exec_file", help=exec_file_path_help, type=str, required=True)
|
||||||
parser.add_argument("-c", "--cache_path", help=cache_path_help, type=str, required=False, default="")
|
parser.add_argument("-c", "--cache_path", help=cache_path_help, type=str, required=False, default="")
|
||||||
parser.add_argument("-j", "--workers", help=worker_num_help, type=int, required=False, default=(os.cpu_count()) if os.cpu_count() > 2 else 1)
|
parser.add_argument("-j", "--workers", help=worker_num_help, type=int, required=False, default=os.cpu_count())
|
||||||
parser.add_argument("-p", "--parallel_devices", help=parallel_help, type=int, required=False, default=0)
|
parser.add_argument("-p", "--parallel_devices", help=parallel_help, type=int, required=False, default=0)
|
||||||
parser.add_argument("-w", "--working_dir", help=working_dir_num_help, type=str, required=False, default=".")
|
parser.add_argument("-w", "--working_dir", help=working_dir_num_help, type=str, required=False, default=".")
|
||||||
parser.add_argument("-t", "--process_timeout", help=process_timeout_help, type=int, required=False, default=DEFAULT_PROCESS_TIMEOUT)
|
parser.add_argument("-t", "--process_timeout", help=process_timeout_help, type=int, required=False, default=DEFAULT_PROCESS_TIMEOUT)
|
||||||
parser.add_argument("-s", "--split_unit", help=split_unit_help, type=str, required=False, default="suite")
|
parser.add_argument("-s", "--split_unit", help=split_unit_help, type=str, required=False, default=constants.SUITE_UNIT_NAME)
|
||||||
parser.add_argument("-rf", "--repeat_failed", help=repeat_help, type=int, required=False, default=1)
|
parser.add_argument("-rf", "--repeat_failed", help=repeat_help, type=int, required=False, default=1)
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
@ -235,7 +235,11 @@ class TestParallelRunner:
|
|||||||
if not os.path.exists(head):
|
if not os.path.exists(head):
|
||||||
os.mkdir(head)
|
os.mkdir(head)
|
||||||
self._is_save_cache = True
|
self._is_save_cache = True
|
||||||
|
if split_unit in constants.UNIT_NAMES:
|
||||||
self._split_unit = split_unit
|
self._split_unit = split_unit
|
||||||
|
else:
|
||||||
|
logger.error(f"Incorrect split_unit argument: {split_unit}. Please use the following values: {','.join(constants.UNIT_NAMES)}")
|
||||||
|
sys.exit(-1)
|
||||||
self._repeat_failed = repeat_failed
|
self._repeat_failed = repeat_failed
|
||||||
self._disabled_tests = list()
|
self._disabled_tests = list()
|
||||||
self._total_test_cnt = 0
|
self._total_test_cnt = 0
|
||||||
@ -278,7 +282,7 @@ class TestParallelRunner:
|
|||||||
input_string = input_string.replace(symbol, '*')
|
input_string = input_string.replace(symbol, '*')
|
||||||
return input_string
|
return input_string
|
||||||
|
|
||||||
def __get_test_list_by_runtime(self, test_unit = "test"):
|
def __get_test_list_by_runtime(self, test_unit = constants.TEST_UNIT_NAME):
|
||||||
self._total_test_cnt = 0
|
self._total_test_cnt = 0
|
||||||
self._disabled_tests.clear()
|
self._disabled_tests.clear()
|
||||||
test_list_file_name = os.path.join(self._working_dir, "test_list.lst")
|
test_list_file_name = os.path.join(self._working_dir, "test_list.lst")
|
||||||
@ -312,10 +316,10 @@ class TestParallelRunner:
|
|||||||
real_test_name = test_suite + "." + (test_name[2:pos-1] if pos > 0 else test_name[2:])
|
real_test_name = test_suite + "." + (test_name[2:pos-1] if pos > 0 else test_name[2:])
|
||||||
if constants.DISABLED_PREFIX in real_test_name:
|
if constants.DISABLED_PREFIX in real_test_name:
|
||||||
self._disabled_tests.append(real_test_name)
|
self._disabled_tests.append(real_test_name)
|
||||||
elif (test_unit == "test"):
|
elif test_unit == constants.TEST_UNIT_NAME:
|
||||||
tests_dict[real_test_name] = 1
|
tests_dict[real_test_name] = 1
|
||||||
self._total_test_cnt += 1
|
self._total_test_cnt += 1
|
||||||
elif (test_unit == "suite"):
|
elif test_unit == constants.SUITE_UNIT_NAME:
|
||||||
tests_dict[test_suite] = tests_dict.get(test_suite, 0) + 1
|
tests_dict[test_suite] = tests_dict.get(test_suite, 0) + 1
|
||||||
self._total_test_cnt += 1
|
self._total_test_cnt += 1
|
||||||
test_list_file.close()
|
test_list_file.close()
|
||||||
@ -337,11 +341,11 @@ class TestParallelRunner:
|
|||||||
test_name = line[pos+1:].replace("\n", "")
|
test_name = line[pos+1:].replace("\n", "")
|
||||||
test_suite = test_name[:test_name.find(".")]
|
test_suite = test_name[:test_name.find(".")]
|
||||||
|
|
||||||
if (self._split_unit == "test"):
|
if self._split_unit == constants.TEST_UNIT_NAME:
|
||||||
if constants.DISABLED_PREFIX not in test_name:
|
if constants.DISABLED_PREFIX not in test_name:
|
||||||
if (time != -1):
|
if (time != -1):
|
||||||
tests_dict_cache[test_name] = tests_dict_cache.get(test_name, 0) + time
|
tests_dict_cache[test_name] = tests_dict_cache.get(test_name, 0) + time
|
||||||
elif (self._split_unit == "suite"):
|
elif self._split_unit == constants.SUITE_UNIT_NAME:
|
||||||
if constants.DISABLED_PREFIX not in test_suite:
|
if constants.DISABLED_PREFIX not in test_suite:
|
||||||
if (time == -1):
|
if (time == -1):
|
||||||
tests_dict_cache[test_suite] = tests_dict_cache.get(test_suite, -1)
|
tests_dict_cache[test_suite] = tests_dict_cache.get(test_suite, -1)
|
||||||
@ -387,7 +391,7 @@ class TestParallelRunner:
|
|||||||
test_pattern = f'{self.__replace_restricted_symbols(test_pattern)}'
|
test_pattern = f'{self.__replace_restricted_symbols(test_pattern)}'
|
||||||
|
|
||||||
# fix the suite filters to execute the right amount of the tests
|
# fix the suite filters to execute the right amount of the tests
|
||||||
if (self._split_unit == "suite"):
|
if (self._split_unit == constants.SUITE_UNIT_NAME):
|
||||||
test_pattern = get_suite_filter(self._gtest_filter, test_pattern) + "*"
|
test_pattern = get_suite_filter(self._gtest_filter, test_pattern) + "*"
|
||||||
# add quotes and pattern splitter
|
# add quotes and pattern splitter
|
||||||
test_pattern = f'"{test_pattern}":'
|
test_pattern = f'"{test_pattern}":'
|
||||||
@ -500,7 +504,7 @@ class TestParallelRunner:
|
|||||||
worker_cnt += self.__execute_tests(test_filters, worker_cnt)
|
worker_cnt += self.__execute_tests(test_filters, worker_cnt)
|
||||||
# 15m for one test in one process
|
# 15m for one test in one process
|
||||||
if TaskManager.process_timeout == -1 or TaskManager.process_timeout == DEFAULT_PROCESS_TIMEOUT:
|
if TaskManager.process_timeout == -1 or TaskManager.process_timeout == DEFAULT_PROCESS_TIMEOUT:
|
||||||
TaskManager.process_timeout = DEFAULT_SUITE_TIMEOUT if self._split_unit == "suite" else DEFAULT_TEST_TIMEOUT
|
TaskManager.process_timeout = DEFAULT_SUITE_TIMEOUT if self._split_unit == constants.SUITE_UNIT_NAME else DEFAULT_TEST_TIMEOUT
|
||||||
|
|
||||||
not_runned_tests, interapted_tests = self.__find_not_runned_tests()
|
not_runned_tests, interapted_tests = self.__find_not_runned_tests()
|
||||||
if (self._repeat_failed > 0):
|
if (self._repeat_failed > 0):
|
||||||
@ -633,7 +637,7 @@ class TestParallelRunner:
|
|||||||
if __save_log(logs_dir, dir, test_name):
|
if __save_log(logs_dir, dir, test_name):
|
||||||
interapted_tests.add(test_name)
|
interapted_tests.add(test_name)
|
||||||
|
|
||||||
if (split_unit == "suite"):
|
if (split_unit == constants.SUITE_UNIT_NAME):
|
||||||
test_cnt_real = len(test_suites)
|
test_cnt_real = len(test_suites)
|
||||||
else:
|
else:
|
||||||
test_cnt_real = test_cnt_real_saved_now
|
test_cnt_real = test_cnt_real_saved_now
|
||||||
|
@ -16,6 +16,9 @@ DISABLED_PREFIX = "DISABLED_"
|
|||||||
PG_ERR = "PG ERROR"
|
PG_ERR = "PG ERROR"
|
||||||
PG_WARN = "PG WARN"
|
PG_WARN = "PG WARN"
|
||||||
REF_COEF = "[ CONFORMANCE ] Influence coefficient: "
|
REF_COEF = "[ CONFORMANCE ] Influence coefficient: "
|
||||||
|
TEST_UNIT_NAME = "test"
|
||||||
|
SUITE_UNIT_NAME = "suite"
|
||||||
|
UNIT_NAMES = [TEST_UNIT_NAME, SUITE_UNIT_NAME]
|
||||||
|
|
||||||
IS_WIN = "windows" in platform or "win32" in platform
|
IS_WIN = "windows" in platform or "win32" in platform
|
||||||
IS_MACOS = "darwin" in platform
|
IS_MACOS = "darwin" in platform
|
||||||
|
Loading…
Reference in New Issue
Block a user