From 57bf238cba4d69e3114b9056b5b7b4c30e2559c3 Mon Sep 17 00:00:00 2001 From: duerpei Date: Sun, 16 Oct 2022 10:42:13 +0800 Subject: agl-test-framework: add new functions for LTP class Add new function of "get_log_path" and "get_log_file" for LTP class. Change the judgment rule in "run_test_fun" to make it more reasonable. Bug-AGL: SPEC-4345 Signed-off-by: duerpei Change-Id: Id2e805046fe48551f910f04ad1dcfca5c76b8019 --- tests/LTP/agl_test_ltp_base.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/LTP/agl_test_ltp_base.py b/tests/LTP/agl_test_ltp_base.py index 1e6eac9..be78a4c 100644 --- a/tests/LTP/agl_test_ltp_base.py +++ b/tests/LTP/agl_test_ltp_base.py @@ -19,13 +19,19 @@ class LTPBase(AGLBaseTest): super().__init__(name = ("ltp/" + test_name)) #Check and clean exit log - tmp_log_dir = self.get_temp_logdir() + "/log/" - log_file = tmp_log_dir + self.test_name + ".log" + tmp_log_dir = self.get_log_path() + log_file = self.get_log_file() log_path = pathlib.Path(log_file) check_log_path = log_path.is_file() if check_log_path: subprocess.run("rm " + tmp_log_dir + "*", shell = True) + def get_log_path(self): + return self.get_temp_logdir() + "/log/" + + def get_log_file(self): + return self.get_log_path() + self.test_name + ".log" + def get_test_case_list(self): case_list = list() reObj = re.compile('^([\\w\-]+)(\\s+)(\\w+)', re.MULTILINE) @@ -45,7 +51,7 @@ class LTPBase(AGLBaseTest): #Run test by runltp def run_test_fun(self, case_name): - tmp_log_dir = self.get_temp_logdir() + "/log/" + tmp_log_dir = self.get_log_path() run_test_cmd = self.RUNLTP + \ " -f " + self.test_name + \ " -s "+ "^" + case_name + "\\\\b" + \ @@ -69,13 +75,13 @@ class LTPBase(AGLBaseTest): case_info[2] = "passed" elif (case_info[1] == "FAIL"): case_info[2] = "failed" - elif (case_info[1] == "CONF"): - case_info[2] = "skipped" + #The following situations will be determined as "skipped" + # "CONF" "UNRESOLVED" "UNSUPPORTED" "UNTESTED" "" else: - case_info[2] = "failed" + case_info[2] = "skipped" self.update_caseinfo_by_name(case_id, case_info) - assert case_info[2] == "passed" or case_info[2] == "skipped" or case_info[2] == "xpassed" + assert case_info[2] == "passed" or case_info[2] == "skipped" def precheck(self): # Check for common @@ -92,8 +98,7 @@ class LTPBase(AGLBaseTest): return check_common and check_runltp_script and check_test_file def log_process(self): - tmp_log_dir = conf.get_tmp_log_dir(self.name) - log_file = tmp_log_dir + self.test_name + ".log" + log_file = self.get_log_file() case_result = self.log_parser(log_file) self.case_info_list[case_result[0]] = [case_result[0], case_result[2], ""] -- cgit 1.2.3-korg