]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output
authorMichael D Kinney <michael.d.kinney@intel.com>
Mon, 31 Oct 2022 17:09:09 +0000 (10:09 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 11 Nov 2022 05:46:51 +0000 (05:46 +0000)
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>
BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py

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