BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134

Set environment variable GTEST_OUTPUT to specify the output
format of XML and the output file name.  Both CMOCKA_XML_FILE
and GTEST_OUTPUT are set for each host based unit test to
support both cmocka unit tests and gtest unit tests.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Michael D Kinney 2022-10-31 10:09:09 -07:00 committed by mergify[bot]
parent 80f097711b
commit 31377aba8f
1 changed files with 5 additions and 2 deletions

View File

@ -85,9 +85,12 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
raise NotImplementedError("Unsupported Operating System")
for test in testList:
# Configure output name.
# Configure output name if test uses cmocka.
shell_env.set_shell_var(
'CMOCKA_XML_FILE', test + ".%g." + arch + ".result.xml")
'CMOCKA_XML_FILE', test + ".CMOCKA.%g." + arch + ".result.xml")
# Configure output name if test uses gtest.
shell_env.set_shell_var(
'GTEST_OUTPUT', "xml:" + test + ".GTEST." + arch + ".result.xml")
# Run the test.
ret = RunCmd('"' + test + '"', "", workingdir=cp)