From: Michael D Kinney Date: Mon, 31 Oct 2022 17:09:09 +0000 (-0700) Subject: BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output X-Git-Tag: edk2-stable202211~8 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=31377aba8f4e126266251bc53bc148599bb4565a;hp=80f097711b6887caec1b67e04ddf8779acb92883;p=mirror_edk2.git 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 Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Michael D Kinney Reviewed-by: Bob Feng --- diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index c1eeaf2625..a8220aacd3 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -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)