UnitTestPersistenceLib.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /** @file
  2. This header file describes a library that contains functions to save and
  3. restore unit test internal state, in case the test needs to pause and resume
  4. (eg. a reboot-based test).
  5. Copyright (c) Microsoft Corporation.<BR>
  6. Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
  7. SPDX-License-Identifier: BSD-2-Clause-Patent
  8. **/
  9. #ifndef _UNIT_TEST_PERSISTENCE_LIB_H_
  10. #define _UNIT_TEST_PERSISTENCE_LIB_H_
  11. #include <UnitTestFrameworkTypes.h>
  12. #define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
  13. /**
  14. Determines whether a persistence cache already exists for
  15. the given framework.
  16. @param[in] FrameworkHandle A pointer to the framework that is being persisted.
  17. @retval TRUE
  18. @retval FALSE Cache doesn't exist or an error occurred.
  19. **/
  20. BOOLEAN
  21. EFIAPI
  22. DoesCacheExist (
  23. IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
  24. );
  25. /**
  26. Will save the data associated with an internal Unit Test Framework
  27. state in a manner that can persist a Unit Test Application quit or
  28. even a system reboot.
  29. @param[in] FrameworkHandle A pointer to the framework that is being persisted.
  30. @param[in] SaveData A pointer to the buffer containing the serialized
  31. framework internal state.
  32. @retval EFI_SUCCESS Data is persisted and the test can be safely quit.
  33. @retval Others Data is not persisted and test cannot be resumed upon exit.
  34. **/
  35. EFI_STATUS
  36. EFIAPI
  37. SaveUnitTestCache (
  38. IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
  39. IN UNIT_TEST_SAVE_HEADER *SaveData
  40. );
  41. /**
  42. Will retrieve any cached state associated with the given framework.
  43. Will allocate a buffer to hold the loaded data.
  44. @param[in] FrameworkHandle A pointer to the framework that is being persisted.
  45. @param[in] SaveData A pointer pointer that will be updated with the address
  46. of the loaded data buffer.
  47. @retval EFI_SUCCESS Data has been loaded successfully and SaveData is updated
  48. with a pointer to the buffer.
  49. @retval Others An error has occurred and no data has been loaded. SaveData
  50. is set to NULL.
  51. **/
  52. EFI_STATUS
  53. EFIAPI
  54. LoadUnitTestCache (
  55. IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
  56. OUT UNIT_TEST_SAVE_HEADER **SaveData
  57. );
  58. #endif