Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.1 KiB

  1. #ifndef _TESTAUDIT_H_
  2. #define _TESTAUDIT_H_
  3. /*++
  4. Copyright (c) 2001 Microsoft Corporation
  5. Module Name:
  6. testaudit.h
  7. Abstract:
  8. Test Auditing routines. Used by development to document the locations
  9. and reach conditions for code checkpoints that test should be sure to cover.
  10. Used by test to ensure that the test meets the expectations of the developer
  11. and to locate points of interest in the source files.
  12. These routines disappear altogether if the build is not a debug build and
  13. if the symbol TESTAUDIT is not defined. To accomplish this, the command
  14. file buildx.cmd in the tools directory, is modified to provide for setting
  15. this flag.
  16. To use testaudit.h/cpp in your project, you must run the MAKEAUDIT.EXE utility,
  17. which processes files in the current directory, and generates an AUDIT.H file
  18. which is included in testaudit.cpp. This file defines the descriptive strings
  19. for the checkpoints unreached by the code. It should be rebuilt whenever changes
  20. in the source files result in material changes to the line numbers associated
  21. with checkpoints.
  22. Usage examples:
  23. CHECKPOINTINIT; Initializes the test auditing data structure - appears
  24. once in an executable unit
  25. CHECKPOINT(3,"Print page"); Defines checkpoint 3 as "Print page" - Produces an entry
  26. in AUDIT.H with the file, linenumber, and this
  27. description.
  28. CHECKPOINTFINISH; Prints statistics to the debug output and cleans up -
  29. Called when the executable exits. Shows the checkpoint
  30. number, file, line number, and description for all
  31. unreached checkpoints.
  32. Statement blocks can be conditionally compiled in test auditing builds by use of
  33. the preprocessor #if directive and the TESTAUDIT symbol. The usual use is to preface
  34. conditional checkpoints to permit testing for different conditions passing the same
  35. checkpoint, something like this:
  36. #if TESTAUDIT
  37. if (mode_one) CHECKPOINT(3,"Print page portrait mode");
  38. if (Mode_two) CHECKPOINT(4,"Print page landscape mode");
  39. #endif
  40. Author:
  41. georgema Nov., 2001 created
  42. Environment:
  43. Revision History:
  44. --*/
  45. // These macros disappear if the build is not debug or if the symbol TESTAUDIT
  46. // is not defined.
  47. #if DBG
  48. #if TESTAUDIT
  49. typedef struct _AuditData
  50. {
  51. INT iPoint;
  52. WCHAR *pszDescription;
  53. } AUDITDATA;
  54. #define CHECKPOINT(x,y) BranchTouch(x)
  55. #define CHECKPOINTINIT BranchInit()
  56. #define CHECKPOINTFINISH BranchSummary()
  57. #else
  58. #define CHECKPOINT(x,y)
  59. #define CHECKPOINTINIT
  60. #define CHECKPOINTFINISH
  61. #endif
  62. #else
  63. #define CHECKPOINT(x,y)
  64. #define CHECKPOINTINIT
  65. #define CHECKPOINTFINISH
  66. #endif
  67. #define NCHECKPOINT(x,y)
  68. #if defined (__cplusplus)
  69. extern "C" {
  70. #endif
  71. void BranchTouch(INT);
  72. void BranchInit(void);
  73. void BranchSummary(void);
  74. #if defined (__cplusplus)
  75. }
  76. #endif
  77. #endif