]> git.proxmox.com Git - mirror_edk2.git/blob - UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
UnitTestFrameworkPkg/Library: Add library instances
[mirror_edk2.git] / UnitTestFrameworkPkg / Library / UnitTestResultReportLib / UnitTestResultReportLibConOut.c
1 /** @file
2 Implement UnitTestResultReportLib doing plain txt out to console
3
4 Copyright (c) Microsoft Corporation.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 **/
7
8 #include <Uefi.h>
9 #include <Library/BaseLib.h>
10 #include <Library/PrintLib.h>
11 #include <Library/UefiBootServicesTableLib.h>
12 #include <Library/DebugLib.h>
13
14 VOID
15 ReportPrint (
16 IN CONST CHAR8 *Format,
17 ...
18 )
19 {
20 VA_LIST Marker;
21 CHAR16 String[256];
22 UINTN Length;
23
24 VA_START (Marker, Format);
25 Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);
26 if (Length == 0) {
27 DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__));
28 } else {
29 gST->ConOut->OutputString (gST->ConOut, String);
30 }
31 VA_END (Marker);
32 }
33
34 VOID
35 ReportOutput (
36 IN CONST CHAR8 *Output
37 )
38 {
39 CHAR8 AsciiString[128];
40 UINTN Length;
41 UINTN Index;
42
43 Length = AsciiStrLen (Output);
44 for (Index = 0; Index < Length; Index += (sizeof (AsciiString) - 1)) {
45 AsciiStrCpyS (AsciiString, sizeof (AsciiString), &Output[Index]);
46 ReportPrint ("%a", AsciiString);
47 }
48 }