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.

285 lines
11 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: tdmacros.hxx
  3. //
  4. // Contents: public test driver macros
  5. //
  6. // History: 2-Feb-98 BogdanT Created
  7. //-----------------------------------------------------------------------------
  8. #ifndef __TDMACROS_HXX__
  9. #define __TDMACROS_HXX__
  10. //-----------------------------------------------------------------------------
  11. // commonly used switches
  12. //-----------------------------------------------------------------------------
  13. #define TD_SWITCH_TEST TEXT("test")
  14. #define TD_SWITCH_SKIP TEXT("skip")
  15. #define TD_SWITCH_SEED TEXT("seed")
  16. #define TD_SWITCH_FS TEXT("fs")
  17. #define TD_SWITCH_LOOP TEXT("loop")
  18. #define TD_SWITCH_STARTAT TEXT("startat")
  19. #define TD_SWITCH_SLEEPLOCAL TEXT("sleeptest")
  20. #define TD_SWITCH_SLEEPGLOBAL TEXT("sleeploop")
  21. //-----------------------------------------------------------------------------
  22. // file systems
  23. //-----------------------------------------------------------------------------
  24. typedef enum tagFileSystem
  25. {
  26. FS_UNKNOWN = 0,
  27. FS_FAT,
  28. FS_NTFS4,
  29. FS_NTFS5
  30. }FileSystem;
  31. extern LPTSTR FileSystemNames[];
  32. //-----------------------------------------------------------------------------
  33. // MessageId: TESTSTG_E_FAIL
  34. //
  35. // MessageText: Unspecified test error
  36. //-----------------------------------------------------------------------------
  37. #define TESTSTG_E_FAIL _HRESULT_TYPEDEF_(0xA0030001L)
  38. //-----------------------------------------------------------------------------
  39. // MessageId: TESTSTG_E_ABORT
  40. //
  41. // MessageText: Test aborted
  42. //-----------------------------------------------------------------------------
  43. #define TESTSTG_E_ABORT _HRESULT_TYPEDEF_(0xA0030002L)
  44. //-----------------------------------------------------------------------------
  45. // data types for test function, group setup/cleanup
  46. //-----------------------------------------------------------------------------
  47. typedef HRESULT (*TESTENTRY) (LPVOID);
  48. typedef HRESULT (*SETUPENTRY) (void);
  49. typedef HRESULT (*CLEANUPENTRY)(void);
  50. //-----------------------------------------------------------------------------
  51. // switch types
  52. //-----------------------------------------------------------------------------
  53. typedef enum tagSwitchType
  54. {
  55. ST_UNDEFINED = 0,
  56. ST_BOOL,
  57. ST_STR,
  58. ST_INT,
  59. ST_ULONG
  60. } SwitchType;
  61. //-----------------------------------------------------------------------------
  62. // Macro: TD_DECLARETEST(name, ptest, ptestparam, description)
  63. //
  64. // Synopsis: Declares a new test
  65. //
  66. // Arguments: [name] - test name
  67. // [ptest] - test entry function
  68. // [ptestparam] - test parameter
  69. // [description] - test description
  70. //
  71. // History: 05-Feb-98 BogdanT Created
  72. //-----------------------------------------------------------------------------
  73. #define TD_DECLARETEST(name, ptest, ptestparam, description)\
  74. hr = g_TestDrv.AddTest(name, \
  75. ptest, \
  76. ptestparam, \
  77. description); \
  78. DH_HRCHECK_ABORT(hr, TEXT("CTDTestDrv::AddTest"))
  79. //-----------------------------------------------------------------------------
  80. // Macro: TD_DECLAREGROUP((name, setup, cleanup, description,
  81. // test1, test2, ...))
  82. //
  83. // Synopsis: Declares a new group of tests
  84. //
  85. // Arguments: [name] - group name
  86. // [setup] - group setup function
  87. // [cleanup] - group cleanup function
  88. // [description] - group description
  89. // [test1,...] - list of test names
  90. //
  91. // History: 05-Feb-98 BogdanT Created
  92. //
  93. // Comments: - the test list must end with a NULL name, e.g.
  94. //
  95. // TD_DECLAREGROUP((TEXT("GROUP1"),
  96. // pSetup,
  97. // pCleanup,
  98. // TEXT("comments"),
  99. // TEXT("TEST1"),
  100. // TEXT("TEST2"),
  101. // TEXT("TEST3"),
  102. // NULL))
  103. //
  104. // - this macro must be called with double paranthesis
  105. // - text parameters must use TEXT()
  106. //-----------------------------------------------------------------------------
  107. #define TD_DECLAREGROUP(paramlist) \
  108. hr = g_TestDrv.AddGroup paramlist; \
  109. DH_HRCHECK_ABORT(hr, TEXT("CTDTestDrv::AddGroup"))
  110. //-----------------------------------------------------------------------------
  111. // Macro: TD_DECLARESWITCH(type, name, defval, description)
  112. //
  113. // Synopsis: Declares a new command line switch
  114. //
  115. // Arguments: [type] - switch type
  116. // [name] - switch name
  117. // [defval] - default value
  118. // [description] - switch description
  119. //
  120. // History: 05-Feb-98 BogdanT Created
  121. //-----------------------------------------------------------------------------
  122. #define TD_DECLARESWITCH(type, name, defval, description) \
  123. hr = g_TestDrv.AddSwitch(type, \
  124. name, \
  125. defval, \
  126. description); \
  127. DH_HRCHECK_ABORT(hr, TEXT("CTDTestDrv::AddSwitch"))
  128. //-----------------------------------------------------------------------------
  129. // Macro: TD_GETSWITCH(name)
  130. //
  131. // Synopsis: Returns a pointer to switch data
  132. //
  133. // Arguments: [name] - switch name
  134. //
  135. // Returns: void pointer to actual switch data
  136. //
  137. // History: 05-Feb-98 BogdanT Created
  138. //-----------------------------------------------------------------------------
  139. #define TD_GETSWITCH(name) \
  140. g_TestDrv.GetSwitch(name)
  141. //-----------------------------------------------------------------------------
  142. // Macro: TD_SWITCHFOUND(name)
  143. //
  144. // Synopsis: Returns a pointer to switch data
  145. //
  146. // Arguments: [name] - switch name
  147. //
  148. // Returns: TRUE if the switch has been found in the command line
  149. //
  150. // History: 05-Feb-98 BogdanT Created
  151. //-----------------------------------------------------------------------------
  152. #define TD_SWITCHFOUND(name) \
  153. g_TestDrv.SwitchFound(name)
  154. //-----------------------------------------------------------------------------
  155. // Macro: TD_SETRESULTLOGGINGINFO(info)
  156. //
  157. // Synopsis: Stores test custom information; the driver will use this
  158. // text when logging test results
  159. //
  160. // Arguments: [info] - text to be stored
  161. //
  162. // History: 05-Feb-98 BogdanT Created
  163. //-----------------------------------------------------------------------------
  164. #define TD_SETRESULTLOGGINGINFO(text) \
  165. g_TestDrv.SetTestLogInfo text
  166. //-----------------------------------------------------------------------------
  167. // Macro: TD_ENABLERESULTLOGGING(set)
  168. //
  169. // Synopsis: Turns test logging on/off
  170. //
  171. // Arguments: [set] - logging flag; TRUE turns logging on
  172. //
  173. // History: 26-Mar-98 BogdanT Created
  174. //-----------------------------------------------------------------------------
  175. #define TD_ENABLERESULTLOGGING(set) \
  176. g_TestDrv.EnableLogging(set)
  177. //-----------------------------------------------------------------------------
  178. // Macro: TD_INIT
  179. //
  180. // Synopsis: Initializes the test driver
  181. //
  182. // Arguments: none
  183. //
  184. // History: 05-Feb-98 BogdanT Created
  185. //-----------------------------------------------------------------------------
  186. #define TD_INIT \
  187. hr = g_TestDrv.Init(); \
  188. DH_HRCHECK_ABORT(hr, TEXT("CTDTestDrv::Init"))
  189. //-----------------------------------------------------------------------------
  190. // Macro: TD_RUN
  191. //
  192. // Synopsis: Runs the tests
  193. //
  194. // Arguments: none
  195. //
  196. // History: 05-Feb-98 BogdanT Created
  197. //-----------------------------------------------------------------------------
  198. #define TD_RUN \
  199. hr = g_TestDrv.Run(); \
  200. DH_HRCHECK_ABORT(hr, TEXT("CTDTestDrv::RunTests"))
  201. //-----------------------------------------------------------------------------
  202. // Macro: TD_GLOBALSEED
  203. //
  204. // Synopsis: returns the global seed value
  205. //
  206. // Arguments: none
  207. //
  208. // Returns seed value
  209. //
  210. // History: 05-Feb-98 BogdanT Created
  211. //-----------------------------------------------------------------------------
  212. #define TD_GLOBALSEED \
  213. g_TestDrv.GetGlobalSeed()
  214. //-----------------------------------------------------------------------------
  215. // Macro: TD_DEFINE
  216. //
  217. // Synopsis: Defines the global test driver object
  218. //
  219. // Arguments: none
  220. //
  221. // History: 05-Feb-98 BogdanT Created
  222. //-----------------------------------------------------------------------------
  223. #define TD_DEFINE \
  224. CTDTestDrv g_TestDrv
  225. //-----------------------------------------------------------------------------
  226. // Macro: TD_DECLARE
  227. //
  228. // Synopsis: Declares the global test driver object
  229. //
  230. // Arguments: none
  231. //
  232. // History: 05-Feb-98 BogdanT Created
  233. //-----------------------------------------------------------------------------
  234. #define TD_DECLARE \
  235. extern CTDTestDrv g_TestDrv
  236. //-----------------------------------------------------------------------------
  237. // Macro: TD_TESTDRV
  238. //
  239. // Synopsis: generic name for the test driver
  240. //
  241. // Arguments: none
  242. //
  243. // History: 05-Feb-98 BogdanT Created
  244. //-----------------------------------------------------------------------------
  245. #define TD_TESTDRV g_TestDrv
  246. //-----------------------------------------------------------------------------
  247. // Macro: TD_GETCURRENTFILESYSTEM
  248. //
  249. // Synopsis: returns file system type
  250. //
  251. // Arguments: none
  252. //
  253. // Returns: one of the FileSystem's
  254. //
  255. // History: 24-Mar-98 BogdanT Created
  256. //-----------------------------------------------------------------------------
  257. #define TD_GETCURRENTFILESYSTEM \
  258. g_TestDrv.GetCurrentFileSystem()
  259. #endif //__TDMACROS_HXX__