summaryrefslogtreecommitdiffstats
path: root/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
diff options
context:
space:
mode:
Diffstat (limited to 'UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c')
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
new file mode 100644
index 0000000000..139360ee16
--- /dev/null
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
@@ -0,0 +1,48 @@
+/** @file
+ Implement UnitTestResultReportLib doing plain txt out to console
+
+ Copyright (c) Microsoft Corporation.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+VOID
+ReportPrint (
+ IN CONST CHAR8 *Format,
+ ...
+ )
+{
+ VA_LIST Marker;
+ CHAR16 String[256];
+ UINTN Length;
+
+ VA_START (Marker, Format);
+ Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);
+ if (Length == 0) {
+ DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __FUNCTION__));
+ } else {
+ gST->ConOut->OutputString (gST->ConOut, String);
+ }
+ VA_END (Marker);
+}
+
+VOID
+ReportOutput (
+ IN CONST CHAR8 *Output
+ )
+{
+ CHAR8 AsciiString[128];
+ UINTN Length;
+ UINTN Index;
+
+ Length = AsciiStrLen (Output);
+ for (Index = 0; Index < Length; Index += (sizeof (AsciiString) - 1)) {
+ AsciiStrCpyS (AsciiString, sizeof (AsciiString), &Output[Index]);
+ ReportPrint ("%a", AsciiString);
+ }
+}