UnitTestResultReportLibDebugLib.c 1.1 KB

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