Apply suggestions from code review
Co-authored-by: Andrey Kashchikhin <andrey.kashchikhin@intel.com>
This commit is contained in:
parent
7a6c48cb1a
commit
b537b9cdf5
@ -338,11 +338,11 @@ class TestParallelRunner:
|
|||||||
test_suite = test_name[:test_name.find(".")]
|
test_suite = test_name[:test_name.find(".")]
|
||||||
|
|
||||||
if (self._split_unit == "test"):
|
if (self._split_unit == "test"):
|
||||||
if not constants.DISABLED_PREFIX 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 == "suite"):
|
||||||
if not constants.DISABLED_PREFIX 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)
|
||||||
else:
|
else:
|
||||||
@ -360,7 +360,7 @@ class TestParallelRunner:
|
|||||||
cached_test_dict[test] = test_dict_cache[test] if test_dict_cache[test] != -1 else test_dict_runtime.get(test, -1)
|
cached_test_dict[test] = test_dict_cache[test] if test_dict_cache[test] != -1 else test_dict_runtime.get(test, -1)
|
||||||
|
|
||||||
for test in test_dict_runtime:
|
for test in test_dict_runtime:
|
||||||
if not test in cached_test_dict:
|
if test not in cached_test_dict:
|
||||||
runtime_test_dict[test] = test_dict_runtime[test]
|
runtime_test_dict[test] = test_dict_runtime[test]
|
||||||
|
|
||||||
if len(runtime_test_dict) > 0:
|
if len(runtime_test_dict) > 0:
|
||||||
@ -397,7 +397,8 @@ class TestParallelRunner:
|
|||||||
else:
|
else:
|
||||||
while (len(tasks) > 0):
|
while (len(tasks) > 0):
|
||||||
t_time, t_pattern = tasks[0]
|
t_time, t_pattern = tasks[0]
|
||||||
if len(t_pattern) + def_length + len(test_pattern.replace(self._device, longest_device)) < MAX_LENGHT :
|
length = len(t_pattern) + def_length + len(test_pattern.replace(self._device, longest_device))
|
||||||
|
if length < MAX_LENGHT:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
tasks_full.append(tasks.pop())
|
tasks_full.append(tasks.pop())
|
||||||
@ -659,7 +660,7 @@ class TestParallelRunner:
|
|||||||
if self._is_save_cache:
|
if self._is_save_cache:
|
||||||
test_times.sort(reverse=True)
|
test_times.sort(reverse=True)
|
||||||
with open(self._cache_path, "w") as cache_file:
|
with open(self._cache_path, "w") as cache_file:
|
||||||
cache_file.writelines([f"{time}:" + test_name + "\n" for time, test_name in test_times])
|
cache_file.writelines([f"{time}:{test_name}\n" for time, test_name in test_names])
|
||||||
cache_file.close()
|
cache_file.close()
|
||||||
logger.info(f"Test cache test is saved to: {self._cache_path}")
|
logger.info(f"Test cache test is saved to: {self._cache_path}")
|
||||||
hash_table_path = os.path.join(logs_dir, "hash_table.csv")
|
hash_table_path = os.path.join(logs_dir, "hash_table.csv")
|
||||||
@ -767,7 +768,7 @@ class TestParallelRunner:
|
|||||||
logger.info(f"disabled test counter is: {len(self._disabled_tests)}")
|
logger.info(f"disabled test counter is: {len(self._disabled_tests)}")
|
||||||
|
|
||||||
diff_set = set(saved_tests).difference(set(test_list_runtime))
|
diff_set = set(saved_tests).difference(set(test_list_runtime))
|
||||||
if (diff_set) :
|
if diff_set:
|
||||||
logger.error(f"Total test count is {test_cnt} is different with expected {self._total_test_cnt} tests")
|
logger.error(f"Total test count is {test_cnt} is different with expected {self._total_test_cnt} tests")
|
||||||
[logger.error(f'Missed test: {test}') for test in diff_set]
|
[logger.error(f'Missed test: {test}') for test in diff_set]
|
||||||
is_successfull_run = False
|
is_successfull_run = False
|
||||||
|
Loading…
Reference in New Issue
Block a user