Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHERRY-PICK] [REBASE & FF] Cherry Pick Final 2311 Commits to 2405 #1112

Merged
merged 21 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
346a6db
Added MockPciIoProtocol and MockLocalApicLib (#890)
v-bhavanisu Jun 5, 2024
5cb42df
Set EFI_MEMORY_SP as System Memory (#886)
os-d Jun 5, 2024
10e0f50
BaseTools/Plugin/HostBasedUnitTestRunner: Fix invalid escape in HostB…
antklein Jun 12, 2024
7d70568
Added mock functions for UefiBootServicesTableLib
v-bhavanisu Jun 19, 2024
c099235
Added mock functions for PciExpressLib
v-bhavanisu Jun 19, 2024
91d3ed1
Added mock functions for TimerLib
v-bhavanisu Jun 19, 2024
9bfd0d6
Host Based Unit Test updates (#837)
Javagedes Jun 27, 2024
2e4d763
Added mock functions on UefiLib
TsunFeng Jul 22, 2024
cc8c47b
Added MockUefiDevicePathLib and gBS_AllocatePool under MockUefiBootSe…
v-bhavanisu Jul 23, 2024
5b8c598
Update BaseCryptLib tests to reference the PCDs before running (#1034)
kenlautner Jul 26, 2024
068ca73
Add deprecation warning support to OverrideValidation plugin (#742)
NishanthSanjeevi Jul 29, 2024
a6aaff3
Added MockServiceBinding and Add mock functions under MockUefiBootSer…
TsunFeng Jul 29, 2024
1363b01
Create Mock for IsaHc protocol
TsunFeng Aug 2, 2024
b4bde39
Add mock functions under MockPciIoProtocol and Create Mock for Smbio,…
TsunFeng Aug 1, 2024
d2f9620
Create the Google Test mocks for SmmBase2 Protocol.
yhsu3 Aug 2, 2024
9f8c72d
[Cherry-Pick] UefiCpuPkg: Add PcdCpuSmmApSyncTimeout2 PCD (#1096)
apop5 Aug 7, 2024
e90c80a
[CHERRY-PICK] UefiCpuPkg: Refine the PCD usage comment
jiaxinwu May 31, 2024
3fe63d0
[CHERRY-PICK] UefiCpuPkg/PiSmmCpuDxeSmm: Consume PcdCpuSmmApSyncTimeout2
shuishouqiaozhi Jul 5, 2024
1f00008
Create mocks for PlatformHookLib and PciLib (#1094)
TsunFeng Aug 16, 2024
dfa281a
UefiCpuPkg: CpuPageTableLib: Remove Empty Test Suite
os-d Aug 23, 2024
76bf8d3
Merge branch 'release/202405' into 2405_cps
apop5 Aug 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def do_post_build(self, thebuilder):
""").strip())
return 0

error_messages = [] # MU_CHANGE- Check for invalid tests
for test in testList:
# Configure output name if test uses cmocka.
shell_env.set_shell_var(
Expand All @@ -121,7 +122,20 @@ def do_post_build(self, thebuilder):
for xml_result_file in xml_results_list:
root = xml.etree.ElementTree.parse(
xml_result_file).getroot()
# MU_CHANGE [BEGIN] - Check for invalid tests
if len(root) == 0:
error_messages.append(f'{os.path.basename(test)} did not generate a test suite(s).')
error_messages.append(' Review source code to ensure Test suites are created and tests '
' are registered!')
failure_count += 1
for suite in root:
if len(suite) == 0:
error_messages.append(f'TestSuite [{suite.attrib["name"]}] for test {test} did not '
'contain a test case(s).')
error_messages.append(' Review source code to ensure test cases are registered to '
'the suite!')
failure_count += 1
# MU_CHANGE [END] - Check for invalid tests
for case in suite:
for result in case:
if result.tag == 'failure':
Expand All @@ -131,7 +145,7 @@ def do_post_build(self, thebuilder):
" %s - %s" % (case.attrib['name'], result.text))
failure_count += 1

if thebuilder.env.GetValue("CODE_COVERAGE") != "FALSE":
if thebuilder.env.GetValue("CODE_COVERAGE", "FALSE") == "TRUE": # MU_CHANGE
if thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
ret = self.gen_code_coverage_gcc(thebuilder)
if ret != 0:
Expand All @@ -152,13 +166,20 @@ def do_post_build(self, thebuilder):
return -1
# MU_CHANGE end - reformat coverage data

# MU_CHANGE [BEGIN] - Check for invalid tests
for error in error_messages:
logging.error(error)
# MU_CHANGE [END] - Check for invalid tests
return failure_count

def gen_code_coverage_gcc(self, thebuilder):
logging.info("Generating UnitTest code coverage")

buildOutputBase = thebuilder.env.GetValue("BUILD_OUTPUT_BASE")
workspace = thebuilder.env.GetValue("WORKSPACE")
# MU_CHANGE begin - regex string for exclude paths
regex_exclude = r"^.*UnitTest\|^.*MU\|^.*Mock\|^.*DEBUG"
# MU_CHANGE end - regex string for exclude paths

# Generate base code coverage for all source files
ret = RunCmd("lcov", f"--no-external --capture --initial --directory {buildOutputBase} --output-file {buildOutputBase}/cov-base.info --rc lcov_branch_coverage=1")
Expand All @@ -181,7 +202,7 @@ def gen_code_coverage_gcc(self, thebuilder):
# Filter out auto-generated and test code
# MU_CHANGE begin - reformat coverage data
file_out = thebuilder.env.GetValue("CI_PACKAGE_NAME", "") + "_coverage.xml"
ret = RunCmd("lcov_cobertura",f"{buildOutputBase}/total-coverage.info --excludes ^.*UnitTest\|^.*MU\|^.*Mock\|^.*DEBUG -o {buildOutputBase}/{file_out}")
ret = RunCmd("lcov_cobertura",f"{buildOutputBase}/total-coverage.info --excludes {regex_exclude} -o {buildOutputBase}/{file_out}")
# MU_CHANGE end - reformat coverage data
if ret != 0:
logging.error("UnitTest Coverage: Failed generate filtered coverage XML.")
Expand All @@ -201,7 +222,9 @@ def gen_code_coverage_gcc(self, thebuilder):
# Generate and XML file if requested.for all package
if os.path.isfile(f"{workspace}/Build/coverage.xml"):
os.remove(f"{workspace}/Build/coverage.xml")
ret = RunCmd("lcov_cobertura",f"{workspace}/Build/all-coverage.info --excludes ^.*UnitTest\|^.*MU\|^.*Mock\|^.*DEBUG -o {workspace}/Build/coverage.xml")
# MU_CHANGE begin - regex string for exclude paths
ret = RunCmd("lcov_cobertura",f"{workspace}/Build/all-coverage.info --excludes {regex_exclude} -o {workspace}/Build/coverage.xml")
# MU_CHANGE end - regex string for exclude paths
if ret != 0:
logging.error("UnitTest Coverage: Failed generate all coverage XML.")
return 1
Expand Down
Loading
Loading