mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
CI: fix bug of duplicated unit test case ID:
need to compare if different file names has the same hash value. use relative path to IDF to keep test case ID consist.
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import CreateSectionTable
|
import CreateSectionTable
|
||||||
@@ -132,15 +133,22 @@ class Parser(object):
|
|||||||
"""
|
"""
|
||||||
prop = self.parse_case_properities(description)
|
prop = self.parse_case_properities(description)
|
||||||
|
|
||||||
if file_name in self.file_name_cache:
|
idf_path = os.getenv("IDF_PATH")
|
||||||
self.file_name_cache[file_name] += 1
|
|
||||||
|
# use relative file path to IDF_PATH, to make sure file path is consist
|
||||||
|
relative_file_path = os.path.relpath(file_name, idf_path)
|
||||||
|
|
||||||
|
file_name_hash = int(hashlib.sha256(relative_file_path).hexdigest(), base=16) % 1000
|
||||||
|
|
||||||
|
if file_name_hash in self.file_name_cache:
|
||||||
|
self.file_name_cache[file_name_hash] += 1
|
||||||
else:
|
else:
|
||||||
self.file_name_cache[file_name] = 1
|
self.file_name_cache[file_name_hash] = 1
|
||||||
|
|
||||||
tc_id = "UT_%s_%s_%03d%02d" % (self.module_map[prop["module"]]['module abbr'],
|
tc_id = "UT_%s_%s_%03d%02d" % (self.module_map[prop["module"]]['module abbr'],
|
||||||
self.module_map[prop["module"]]['sub module abbr'],
|
self.module_map[prop["module"]]['sub module abbr'],
|
||||||
hash(file_name) % 1000,
|
file_name_hash,
|
||||||
self.file_name_cache[file_name])
|
self.file_name_cache[file_name_hash])
|
||||||
test_case = deepcopy(TEST_CASE_PATTERN)
|
test_case = deepcopy(TEST_CASE_PATTERN)
|
||||||
test_case.update({"module": self.module_map[prop["module"]]['module'],
|
test_case.update({"module": self.module_map[prop["module"]]['module'],
|
||||||
"CI ready": "No" if prop["ignore"] == "Yes" else "Yes",
|
"CI ready": "No" if prop["ignore"] == "Yes" else "Yes",
|
||||||
|
Reference in New Issue
Block a user