]> git.proxmox.com Git - mirror_edk2.git/blob - UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
db5402d6a2109313683875b377aa9f54cf1b0c7d
[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 EFIAPI
16 ReportPrint (
17 IN CONST CHAR8 *Format,
18 ...
19 )
20 {
21 VA_LIST Marker;
22 CHAR16 String[256];
23 UINTN Length;
24
25 VA_START (Marker, Format);
26 Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);
27 if (Length == 0) {
28 DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__));
29 } else {
30 gST->ConOut->OutputString (gST->ConOut, String);
31 }
32 VA_END (Marker);
33 }
34
35 VOID
36 ReportOutput (
37 IN CONST CHAR8 *Output
38 )
39 {
40 CHAR8 AsciiString[128];
41 UINTN Length;
42 UINTN Index;
43
44 Length = AsciiStrLen (Output);
45 for (Index = 0; Index < Length; Index += (sizeof (AsciiString) - 1)) {
46 AsciiStrnCpyS (AsciiString, sizeof (AsciiString), &Output[Index], sizeof (AsciiString) - 1);
47 ReportPrint ("%a", AsciiString);
48 }
49 }