From eacc413c84b69aac5af45d0fa243e9cc64f2a2ea Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 30 Nov 2024 21:03:03 +0800 Subject: [PATCH 1/8] case: add check error code case --- tests/army/sys/checkErrorCode.py | 181 +++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 tests/army/sys/checkErrorCode.py diff --git a/tests/army/sys/checkErrorCode.py b/tests/army/sys/checkErrorCode.py new file mode 100644 index 0000000000..71aa43b02d --- /dev/null +++ b/tests/army/sys/checkErrorCode.py @@ -0,0 +1,181 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import random +import taos + +import frame +import frame.eos +import frame.etime +import frame.etool +from frame.log import * +from frame.sql import * +from frame.cases import * +from frame.caseBase import * +from frame.srvCtl import * +from frame import * + + +class TDTestCase(TBase): + # parse line + def parseLine(self, line): + line = line.strip() + PRE_DEFINE = "#define TSDB_CODE_" + n = len(PRE_DEFINE) + if line[:n] != PRE_DEFINE: + return None + # TAOS_DEF_ERROR_CODE(0, 0x000B) + pos = line.find("TAOS_DEF_ERROR_CODE(0, 0x", n) + if pos == -1: + tdLog.info(f"not found \"TAOS_DEF_ERROR_CODE(0, \" line={line}") + return None + + code = line[pos:].strip() + pos = code.find(")") + if pos == -1: + tdLog.info(f"not found \")\", line={line}") + return None + code = code[:pos] + if len(code) != 4: + tdLog.info(f"code is len not 4 len:{len(code)} subcode={code}\")\", line={line}") + return None + + # return + return "0x8000" + code + + # ignore error + def ignoreCode(self, code): + ignoreCodes = {"0x00008, 0x000009"} + if code in ignoreCodes: + return True + else: + return False + + # read valid code + def readHeadCodes(self, hFile): + codes = [] + start = False + # read + with open(hFile) as file: + for line in file: + code = self.parseLine(line) + # invalid + if code == None: + continue + # ignore + if self.ignoreCode(code): + tdLog.info(f"ignore error {code}\n") + # valid + if code == 0: + start = True + if start: + codes.append(code) + # return + return codes + + # parse doc lines + def parseDocLine(self, line): + line = line.strip() + PRE_DEFINE = "| 0x8000" + n = len(PRE_DEFINE) + if line[:n] != PRE_DEFINE: + return None + line = line[2:] + cols = line.split("|") + # remove blank + cols = [col.strip() for col in cols] + + # return + return cols + + + # read valid code + def readDocCodes(self, docFile): + codes = [] + start = False + # read + with open(docFile) as file: + for line in file: + code = self.parseDocLine(line) + # invalid + if code == None: + continue + # valid + if start: + codes.append(code) + # return + return codes + + # check + def checkConsistency(self, docCodes, codes): + diff = False + # len + docLen = len(docCodes) + len = len(codes) + tdLog.info("head file codes = {len} doc file codes={docLen} \n") + + if docLen > len: + maxLen = docLen + else: + maxLen = len + + for i in range(maxLen): + if i < len and i < docLen: + if codes[i] == docCodes[i][0]: + tdLog.info(f" i={i} same head code: {codes[i]} doc code:{docCodes[i][0]}\n") + else: + tdLog.info(f" i={i} diff head code: {codes[i]} doc code:{docCodes[i][0]}\n") + diff = True + elif i < len: + tdLog.info(f" i={i} diff head code: {codes[i]} doc code: None\n") + diff = True + elif i < docLen: + tdLog.info(f" i={i} diff head code: None doc code: {docCodes[i][0]}\n") + diff = True + + # result + if diff: + tdLog.exit("check error code consistency failed.\n") + + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # read head error code + hFile = "../../include/util/taoserror.h" + codes = self.readHeadCodes(hFile) + + # read zh codes + zhDoc = "../../docs/zh/14-reference/09-error-code.md" + zhCodes = self.readDocCodes(zhDoc, codes) + + # read en codes + enDoc = "../../docs/en/14-reference/09-error-code.md" + enCodes = self.readDocCodes(enDoc, codes) + + # check zh + tdLog.info(f"check zh docs ...\n") + self.checkConsistency(zhCodes, codes) + + # check en + tdLog.info(f"check en docs ...\n") + self.checkConsistency(enCodes, codes) + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 652d4f83498b2f1ca83c998cb97fb1dfe1a1124d Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 1 Dec 2024 12:26:04 +0800 Subject: [PATCH 2/8] check error code case completed --- tests/army/whole/checkErrorCode.py | 194 +++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 tests/army/whole/checkErrorCode.py diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py new file mode 100644 index 0000000000..cb9fc5588c --- /dev/null +++ b/tests/army/whole/checkErrorCode.py @@ -0,0 +1,194 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import random +import taos + +import frame +import frame.eos +import frame.etime +import frame.etool +from frame.log import * +from frame.sql import * +from frame.cases import * +from frame.caseBase import * +from frame.srvCtl import * +from frame import * + + +class TDTestCase(TBase): + # parse line + def parseLine(self, line): + line = line.strip() + # PRE_DEFINE + PRE_DEFINE = "#define TSDB_CODE_" + n = len(PRE_DEFINE) + if line[:n] != PRE_DEFINE: + return None + # MID_DEFINE + MID_DEFINE = "TAOS_DEF_ERROR_CODE(0, 0x" + pos = line.find(MID_DEFINE, n) + if pos == -1: + tdLog.info(f"not found \"{MID_DEFINE}\" line={line}") + return None + start = pos + len(MID_DEFINE) + code = line[start:].strip() + # ) + pos = code.find(")") + if pos == -1: + tdLog.info(f"not found \")\", code={code}") + return None + # check len + code = code[:pos] + if len(code) != 4: + tdLog.info(f"code is len not 4 len:{len(code)} subcode={code}\")\", line={line}") + return None + + # return + return "0x8000" + code + + # ignore error + def ignoreCode(self, code): + ignoreCodes = {"0x00008, 0x000009"} + if code in ignoreCodes: + return True + else: + return False + + # read valid code + def readHeadCodes(self, hFile): + codes = [] + start = False + # read + with open(hFile) as file: + for line in file: + code = self.parseLine(line) + # invalid + if code == None: + continue + # ignore + if self.ignoreCode(code): + tdLog.info(f"ignore error {code}\n") + print(code) + # valid + if code == "0x8000000B": + start = True + if start: + codes.append(code) + # return + return codes + + # parse doc lines + def parseDocLine(self, line): + line = line.strip() + PRE_DEFINE = "| 0x8000" + n = len(PRE_DEFINE) + if line[:n] != PRE_DEFINE: + return None + line = line[2:] + cols = line.split("|") + # remove blank + cols = [col.strip() for col in cols] + #print(cols) + + # return + return cols + + + # read valid code + def readDocCodes(self, docFile): + codes = [] + start = False + # read + with open(docFile) as file: + for line in file: + code = self.parseDocLine(line) + # invalid + if code == None: + continue + # valid + codes.append(code) + + # return + return codes + + # check + def checkConsistency(self, docCodes, codes, checkCol2=False, checkCol3=False): + failed = 0 + # len + hLen = len(codes) + docLen = len(docCodes) + tdLog.info(f"head file codes items= {hLen} doc file codes items={docLen} \n") + for i in range(hLen): + problem = True + action = "not found" + for j in range(docLen): + if codes[i] == docCodes[j][0]: + #tdLog.info(f" i={i} error code: {codes[i]} found in doc code:{docCodes[j][0]}\n") + problem = False + if docCodes[j][1] == "": + # describe col1 must not empty + problem = True + action = "found but \"Error Description\" column is empty" + # check col2 empty + elif checkCol2 and docCodes[j][2] == "": + problem = True + action = "found but \"Possible Cause\" column is empty" + # check col3 empty + elif checkCol3 and docCodes[j][3] == "": + problem = True + action = "found but \"Suggested Actions\" column is empty" + + # found stop search next + break + + if problem: + tdLog.info(f" i={i} error code: {codes[i]} {action} in doc.") + failed +=1 + + # result + if failed > 0: + tdLog.exit(f"Check the consistency of error codes between header and doc. failed items={failed}. all items={hLen}\n") + + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # read head error code + hFile = "../../include/util/taoserror.h" + codes = self.readHeadCodes(hFile) + + # read zh codes + zhDoc = "../../docs/zh/14-reference/09-error-code.md" + zhCodes = self.readDocCodes(zhDoc) + + # read en codes + enDoc = "../../docs/en/14-reference/09-error-code.md" + enCodes = self.readDocCodes(enDoc) + + # check zh + tdLog.info(f"check zh docs ...\n") + self.checkConsistency(zhCodes, codes) + + # check en + tdLog.info(f"check en docs ...\n") + self.checkConsistency(enCodes, codes) + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From bc093517e986b4f0c425bab9a97162b8ff72fd18 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 1 Dec 2024 12:28:35 +0800 Subject: [PATCH 3/8] test: add checkErrorCode.py case to cases.task --- tests/parallel_test/cases.task | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index db0339381e..56e7bc4028 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -53,6 +53,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/test_having.py ,,n,army,python3 ./test.py -f tmq/drop_lost_comsumers.py ,,y,army,./pytest.sh python3 ./test.py -f cmdline/taosCli.py +,,n,army,python3 ./test.py -f whole/checkErrorCode.py # # system test From 8da1ca041675d0a27be99ce6fcb1cfd610f523b8 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 1 Dec 2024 12:30:43 +0800 Subject: [PATCH 4/8] fix: remove debug output info --- tests/army/whole/checkErrorCode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py index cb9fc5588c..376ee4cda8 100644 --- a/tests/army/whole/checkErrorCode.py +++ b/tests/army/whole/checkErrorCode.py @@ -61,7 +61,7 @@ class TDTestCase(TBase): # ignore error def ignoreCode(self, code): - ignoreCodes = {"0x00008, 0x000009"} + ignoreCodes = {"0x0000000"} if code in ignoreCodes: return True else: @@ -81,7 +81,7 @@ class TDTestCase(TBase): # ignore if self.ignoreCode(code): tdLog.info(f"ignore error {code}\n") - print(code) + #print(code) # valid if code == "0x8000000B": start = True From 72895fea0f80b66f643fcf3e0af3c00277addee5 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 1 Dec 2024 12:42:51 +0800 Subject: [PATCH 5/8] fix: modify taoserror.h format --- include/util/taoserror.h | 30 +++++++++++++++--------------- tests/army/whole/checkErrorCode.py | 13 ++++++++----- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 6caac066de..38d68589ee 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -195,21 +195,21 @@ int32_t taosGetErrSize(); #define TSDB_CODE_TSC_INVALID_JSON TAOS_DEF_ERROR_CODE(0, 0x0221) #define TSDB_CODE_TSC_INVALID_JSON_TYPE TAOS_DEF_ERROR_CODE(0, 0x0222) #define TSDB_CODE_TSC_VALUE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0224) -#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0X0229) -#define TSDB_CODE_TSC_STMT_API_ERROR TAOS_DEF_ERROR_CODE(0, 0X022A) -#define TSDB_CODE_TSC_STMT_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0X022B) -#define TSDB_CODE_TSC_STMT_CLAUSE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022C) -#define TSDB_CODE_TSC_QUERY_KILLED TAOS_DEF_ERROR_CODE(0, 0X022D) -#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0X022E) -#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F) -#define TSDB_CODE_TSC_STMT_CACHE_ERROR TAOS_DEF_ERROR_CODE(0, 0X0230) -#define TSDB_CODE_TSC_ENCODE_PARAM_ERROR TAOS_DEF_ERROR_CODE(0, 0X0231) -#define TSDB_CODE_TSC_ENCODE_PARAM_NULL TAOS_DEF_ERROR_CODE(0, 0X0232) -#define TSDB_CODE_TSC_COMPRESS_PARAM_ERROR TAOS_DEF_ERROR_CODE(0, 0X0233) -#define TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR TAOS_DEF_ERROR_CODE(0, 0X0234) -#define TSDB_CODE_TSC_FAIL_GENERATE_JSON TAOS_DEF_ERROR_CODE(0, 0X0235) -#define TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR TAOS_DEF_ERROR_CODE(0, 0X0236) -#define TSDB_CODE_TSC_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0X02FF) +#define TSDB_CODE_TSC_INVALID_INPUT TAOS_DEF_ERROR_CODE(0, 0x0229) +#define TSDB_CODE_TSC_STMT_API_ERROR TAOS_DEF_ERROR_CODE(0, 0x022A) +#define TSDB_CODE_TSC_STMT_TBNAME_ERROR TAOS_DEF_ERROR_CODE(0, 0x022B) +#define TSDB_CODE_TSC_STMT_CLAUSE_ERROR TAOS_DEF_ERROR_CODE(0, 0x022C) +#define TSDB_CODE_TSC_QUERY_KILLED TAOS_DEF_ERROR_CODE(0, 0x022D) +#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0x022E) +#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0x022F) +#define TSDB_CODE_TSC_STMT_CACHE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0230) +#define TSDB_CODE_TSC_ENCODE_PARAM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0231) +#define TSDB_CODE_TSC_ENCODE_PARAM_NULL TAOS_DEF_ERROR_CODE(0, 0x0232) +#define TSDB_CODE_TSC_COMPRESS_PARAM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0233) +#define TSDB_CODE_TSC_COMPRESS_LEVEL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0234) +#define TSDB_CODE_TSC_FAIL_GENERATE_JSON TAOS_DEF_ERROR_CODE(0, 0x0235) +#define TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR TAOS_DEF_ERROR_CODE(0, 0x0236) +#define TSDB_CODE_TSC_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x02FF) // mnode-common #define TSDB_CODE_MND_REQ_REJECTED TAOS_DEF_ERROR_CODE(0, 0x0300) diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py index 376ee4cda8..9697035b26 100644 --- a/tests/army/whole/checkErrorCode.py +++ b/tests/army/whole/checkErrorCode.py @@ -30,7 +30,7 @@ from frame import * class TDTestCase(TBase): # parse line - def parseLine(self, line): + def parseLine(self, line, show): line = line.strip() # PRE_DEFINE PRE_DEFINE = "#define TSDB_CODE_" @@ -41,19 +41,22 @@ class TDTestCase(TBase): MID_DEFINE = "TAOS_DEF_ERROR_CODE(0, 0x" pos = line.find(MID_DEFINE, n) if pos == -1: - tdLog.info(f"not found \"{MID_DEFINE}\" line={line}") + if show: + tdLog.info(f"not found \"{MID_DEFINE}\" line={line}") return None start = pos + len(MID_DEFINE) code = line[start:].strip() # ) pos = code.find(")") if pos == -1: - tdLog.info(f"not found \")\", code={code}") + if show: + tdLog.info(f"not found \")\", code={code}") return None # check len code = code[:pos] if len(code) != 4: - tdLog.info(f"code is len not 4 len:{len(code)} subcode={code}\")\", line={line}") + if show: + tdLog.info(f"code is len not 4 len:{len(code)} subcode={code}\")\", line={line}") return None # return @@ -74,7 +77,7 @@ class TDTestCase(TBase): # read with open(hFile) as file: for line in file: - code = self.parseLine(line) + code = self.parseLine(line, start) # invalid if code == None: continue From f2285408df5b245e79d9dae00f1aaaa55037942a Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 3 Dec 2024 15:17:56 +0800 Subject: [PATCH 6/8] enh: add ignore error code list --- tests/army/whole/checkErrorCode.py | 64 +++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py index 9697035b26..72478cb76f 100644 --- a/tests/army/whole/checkErrorCode.py +++ b/tests/army/whole/checkErrorCode.py @@ -20,6 +20,7 @@ import frame import frame.eos import frame.etime import frame.etool + from frame.log import * from frame.sql import * from frame.cases import * @@ -27,6 +28,41 @@ from frame.caseBase import * from frame.srvCtl import * from frame import * +ignoreCodes = [ + '0x80000023', '0x80000024', '0x80000025', '0x80000026', '0x80000027', '0x80000028', '0x80000029', '0x8000002A', '0x80000109', '0x80000110', + '0x80000129', '0x8000012C', '0x8000012D', '0x8000012E', '0x8000012F', '0x80000136', '0x80000137', '0x80000138', '0x80000139', '0x8000013A', + '0x8000013B', '0x80000200', '0x80000201', '0x80000202', '0x80000203', '0x80000204', '0x80000205', '0x80000206', '0x8000020B', '0x8000020E', + '0x80000210', '0x80000212', '0x80000214', '0x80000215', '0x80000217', '0x8000021B', '0x8000021C', '0x8000021D', '0x8000021E', '0x80000220', + '0x80000221', '0x8000022C', '0x80000232', '0x80000233', '0x80000234', '0x80000235', '0x80000236', '0x800002FF', '0x80000300', '0x80000316', + '0x80000317', '0x80000338', '0x80000339', '0x8000033F', '0x80000343', '0x80000345', '0x80000356', '0x80000359', '0x8000035A', '0x8000035B', + '0x8000035C', '0x8000035D', '0x80000362', '0x8000038C', '0x8000038E', '0x8000039B', '0x8000039C', '0x8000039D', '0x8000039E', '0x800003A6', + '0x800003A7', '0x800003AA', '0x800003AB', '0x800003AC', '0x800003AD', '0x800003B0', '0x800003B2', '0x800003B4', '0x800003B5', '0x800003BA', + '0x800003C0', '0x800003C1', '0x800003D0', '0x800003D8', '0x800003D9', '0x800003E2', '0x800003F4', '0x800003F8', '0x80000412', '0x80000413', + '0x80000414', '0x80000415', '0x80000416', '0x80000417', '0x80000418', '0x80000419', '0x80000420', '0x80000421', '0x80000422', '0x80000423', + '0x80000424', '0x80000425', '0x80000426', '0x80000427', '0x80000428', '0x80000429', '0x8000042A', '0x80000430', '0x80000431', '0x80000432', + '0x80000433', '0x80000434', '0x80000435', '0x80000436', '0x80000437', '0x80000438', '0x80000440', '0x80000441', '0x80000442', '0x80000443', + '0x80000444', '0x80000445', '0x80000446', '0x80000447', '0x80000485', '0x80000486', '0x800004A0', '0x800004A1', '0x800004B1', '0x800004B2', + '0x800004B3', '0x80000504', '0x80000528', '0x80000532', '0x80000533', '0x80000534', '0x80000535', '0x80000536', '0x80000537', '0x80000538', + '0x80000539', '0x80000601', '0x80000607', '0x8000060A', '0x8000060D', '0x8000060E', '0x8000060F', '0x80000610', '0x80000611', '0x80000612', + '0x80000613', '0x80000614', '0x80000615', '0x80000616', '0x8000061C', '0x8000061E', '0x80000701', '0x80000705', '0x80000706', '0x80000707', + '0x80000708', '0x8000070B', '0x8000070C', '0x8000070E', '0x8000070F', '0x80000712', '0x80000723', '0x80000724', '0x80000725', '0x80000726', + '0x80000727', '0x80000728', '0x8000072A', '0x8000072C', '0x8000072D', '0x8000072E', '0x80000730', '0x80000731', '0x80000732', '0x80000733', + '0x80000734', '0x80000735', '0x80000736', '0x80000737', '0x80000738', '0x8000080E', '0x8000080F', '0x80000810', '0x80000811', '0x80000812', + '0x80000813', '0x80000814', '0x80000815', '0x80000816', '0x80000817', '0x80000818', '0x80000819', '0x80000820', '0x80000821', '0x80000822', + '0x80000823', '0x80000824', '0x80000825', '0x80000826', '0x80000827', '0x80000828', '0x80000829', '0x8000082A', '0x8000082B', '0x8000082C', + '0x8000082D', '0x80000907', '0x80000919', '0x8000091A', '0x8000091B', '0x8000091C', '0x8000091D', '0x8000091E', '0x8000091F', '0x80000A00', + '0x80000A01', '0x80000A03', '0x80000A06', '0x80000A07', '0x80000A08', '0x80000A09', '0x80000A0A', '0x80000A0B', '0x80000A0E', '0x80002206', + '0x80002207', '0x80002406', '0x80002407', '0x80002503', '0x80002506', '0x80002507', '0x8000261B', '0x80002653', '0x80002668', '0x80002669', + '0x8000266A', '0x8000266B', '0x8000266C', '0x8000266D', '0x8000266E', '0x8000266F', '0x80002670', '0x80002671', '0x80002672', '0x80002673', + '0x80002674', '0x80002675', '0x80002676', '0x80002677', '0x80002678', '0x80002679', '0x8000267A', '0x8000267B', '0x8000267C', '0x8000267D', + '0x8000267E', '0x8000267F', '0x80002680', '0x80002681', '0x80002682', '0x80002683', '0x80002684', '0x80002685', '0x80002703', '0x80002806', + '0x80002807', '0x80002808', '0x80002809', '0x8000280A', '0x8000280B', '0x8000280C', '0x8000280D', '0x8000280E', '0x8000280F', '0x80002810', + '0x80002811', '0x80002812', '0x80002813', '0x80002814', '0x80002815', '0x8000290B', '0x80002920', '0x80003003', '0x80003006', '0x80003106', + '0x80003107', '0x80003108', '0x80003109', '0x80003110', '0x80003111', '0x80003112', '0x80003250', '0x80004003', '0x80004004', '0x80004005', + '0x80004006', '0x80004007', '0x80004008', '0x80004009', '0x80004010', '0x80004011', '0x80004012', '0x80004013', '0x80004014', '0x80004015', + '0x80004016', '0x80004102', '0x80004103', '0x80004104', '0x80004105', '0x80004106', '0x80004107', '0x80004108', '0x80004109', '0x80005100', + '0x80005101', '0x80006000', '0x80006100', '0x80006101', '0x80006102'] + class TDTestCase(TBase): # parse line @@ -64,7 +100,6 @@ class TDTestCase(TBase): # ignore error def ignoreCode(self, code): - ignoreCodes = {"0x0000000"} if code in ignoreCodes: return True else: @@ -81,9 +116,6 @@ class TDTestCase(TBase): # invalid if code == None: continue - # ignore - if self.ignoreCode(code): - tdLog.info(f"ignore error {code}\n") #print(code) # valid if code == "0x8000000B": @@ -130,10 +162,12 @@ class TDTestCase(TBase): # check def checkConsistency(self, docCodes, codes, checkCol2=False, checkCol3=False): failed = 0 + ignored = 0 # len hLen = len(codes) docLen = len(docCodes) - tdLog.info(f"head file codes items= {hLen} doc file codes items={docLen} \n") + #errCodes = [] + #tdLog.info(f"head file codes items= {hLen} doc file codes items={docLen} \n") for i in range(hLen): problem = True action = "not found" @@ -158,12 +192,22 @@ class TDTestCase(TBase): break if problem: - tdLog.info(f" i={i} error code: {codes[i]} {action} in doc.") - failed +=1 + # ignore + if self.ignoreCode(codes[i]): + #tdLog.info(f" i={i} error code: {codes[i]} ignore ...") + ignored += 1 + else: + tdLog.info(f" i={i} error code: {codes[i]} {action} in doc.") + failed +=1 + #errCodes.append(codes[i]) + #print(errCodes) # result if failed > 0: - tdLog.exit(f"Check the consistency of error codes between header and doc. failed items={failed}. all items={hLen}\n") + tdLog.exit("Failed to Check the consistency of error codes between header and doc. " + f"failed:{failed}, ignored:{ignored}, all:{hLen}\n") + + tdLog.info(f"Check consistency successfully. ok items={hLen - ignored}, ignored items={ignored}\n") # run @@ -183,11 +227,11 @@ class TDTestCase(TBase): enCodes = self.readDocCodes(enDoc) # check zh - tdLog.info(f"check zh docs ...\n") + tdLog.info(f"check zh docs ...") self.checkConsistency(zhCodes, codes) # check en - tdLog.info(f"check en docs ...\n") + tdLog.info(f"check en docs ...") self.checkConsistency(enCodes, codes) tdLog.success(f"{__file__} successfully executed") From dd3601bb8e1df33b56981e9c065534deb23c439e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 3 Dec 2024 15:20:24 +0800 Subject: [PATCH 7/8] enh: word case modify to lower --- tests/army/whole/checkErrorCode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py index 72478cb76f..d01dc16e6a 100644 --- a/tests/army/whole/checkErrorCode.py +++ b/tests/army/whole/checkErrorCode.py @@ -204,7 +204,7 @@ class TDTestCase(TBase): #print(errCodes) # result if failed > 0: - tdLog.exit("Failed to Check the consistency of error codes between header and doc. " + tdLog.exit("Failed to check the consistency of error codes between header and doc. " f"failed:{failed}, ignored:{ignored}, all:{hLen}\n") tdLog.info(f"Check consistency successfully. ok items={hLen - ignored}, ignored items={ignored}\n") From 55882f85b61f4f181ad441c9bdd6ab5a72eb2d67 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 3 Dec 2024 19:30:56 +0800 Subject: [PATCH 8/8] check possible cause and advise column empty --- tests/army/whole/checkErrorCode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/army/whole/checkErrorCode.py b/tests/army/whole/checkErrorCode.py index d01dc16e6a..156cacb482 100644 --- a/tests/army/whole/checkErrorCode.py +++ b/tests/army/whole/checkErrorCode.py @@ -61,7 +61,7 @@ ignoreCodes = [ '0x80003107', '0x80003108', '0x80003109', '0x80003110', '0x80003111', '0x80003112', '0x80003250', '0x80004003', '0x80004004', '0x80004005', '0x80004006', '0x80004007', '0x80004008', '0x80004009', '0x80004010', '0x80004011', '0x80004012', '0x80004013', '0x80004014', '0x80004015', '0x80004016', '0x80004102', '0x80004103', '0x80004104', '0x80004105', '0x80004106', '0x80004107', '0x80004108', '0x80004109', '0x80005100', - '0x80005101', '0x80006000', '0x80006100', '0x80006101', '0x80006102'] + '0x80005101', '0x80006000', '0x80006100', '0x80006101', '0x80006102', '0x80000019', '0x80002639', '0x80002666'] class TDTestCase(TBase): @@ -160,7 +160,7 @@ class TDTestCase(TBase): return codes # check - def checkConsistency(self, docCodes, codes, checkCol2=False, checkCol3=False): + def checkConsistency(self, docCodes, codes, checkCol2=True, checkCol3=True): failed = 0 ignored = 0 # len