test.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*
  2. * test.h
  3. *
  4. * Useful definitions and declarations for tests.
  5. *
  6. *
  7. * --------------------------------------------------------------------------
  8. *
  9. * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
  10. * Copyright(C) 2008 Jason Schmidlapp
  11. *
  12. * Contact Email: [email protected]
  13. *
  14. *
  15. * Based upon Pthreads-win32 - POSIX Threads Library for Win32
  16. * Copyright(C) 1998 John E. Bossom
  17. * Copyright(C) 1999,2005 Pthreads-win32 contributors
  18. *
  19. * Contact Email: [email protected]
  20. *
  21. * The original list of contributors to the Pthreads-win32 project
  22. * is contained in the file CONTRIBUTORS.ptw32 included with the
  23. * source code distribution. The list can also be seen at the
  24. * following World Wide Web location:
  25. * http://sources.redhat.com/pthreads-win32/contributors.html
  26. *
  27. * This library is free software; you can redistribute it and/or
  28. * modify it under the terms of the GNU Lesser General Public
  29. * License as published by the Free Software Foundation; either
  30. * version 2 of the License, or (at your option) any later version.
  31. *
  32. * This library is distributed in the hope that it will be useful,
  33. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  35. * Lesser General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU Lesser General Public
  38. * License along with this library in the file COPYING.LIB;
  39. * if not, write to the Free Software Foundation, Inc.,
  40. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  41. *
  42. */
  43. #ifndef _PTHREAD_TEST_H_
  44. #define _PTHREAD_TEST_H_
  45. #include <stdio.h>
  46. #include <stdlib.h>
  47. #include "pte_osal.h"
  48. #include "pthread.h"
  49. #include "sched.h"
  50. #include "semaphore.h"
  51. //#include <windows.h>
  52. #define PTW32_THREAD_NULL_ID {NULL,0}
  53. #if defined(__MINGW32__)
  54. #include <stdint.h>
  55. #elif defined(__BORLANDC__)
  56. #define int64_t ULONGLONG
  57. #else
  58. #define int64_t _int64
  59. #endif
  60. extern const char * error_string;
  61. /*
  62. * The Mingw32 assert macro calls the CRTDLL _assert function
  63. * which pops up a dialog. We want to run in batch mode so
  64. * we define our own assert macro.
  65. */
  66. #ifdef assert
  67. # undef assert
  68. #endif
  69. #ifndef ASSERT_TRACE
  70. # define ASSERT_TRACE 0
  71. #else
  72. # undef ASSERT_TRACE
  73. # define ASSERT_TRACE 1
  74. #endif
  75. # define assert(e) \
  76. ((e) ? ((ASSERT_TRACE) ? fprintf(stdout, \
  77. "Assertion succeeded: (%s), file %s, line %d\n", \
  78. #e, __FILE__, (int) __LINE__), \
  79. fflush(stdout) : \
  80. 0) : \
  81. (fprintf(stderr, "Assertion failed: (%s), file %s, line %d\n", \
  82. #e, __FILE__, (int) __LINE__), exit(1), 0))
  83. extern int assertE;
  84. # define assert_e(e, o, r) \
  85. (((assertE = e) o (r)) ? ((ASSERT_TRACE) ? fprintf(stdout, \
  86. "Assertion succeeded: (%s), file %s, line %d\n", \
  87. #e, __FILE__, (int) __LINE__), \
  88. fflush(stdout) : \
  89. 0) : \
  90. (fprintf(stderr, "Assertion failed: (%s %s %s), file %s, line %d, error %s\n", \
  91. #e,#o,#r, __FILE__, (int) __LINE__, error_string[assertE]), exit(1), 0))
  92. #endif
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif /* __cplusplus */
  96. int pthread_test_mutex1();
  97. int pthread_test_mutex1e();
  98. int pthread_test_mutex1n();
  99. int pthread_test_mutex1r();
  100. int pthread_test_mutex2();
  101. int pthread_test_mutex2e();
  102. int pthread_test_mutex2r();
  103. int pthread_test_mutex3();
  104. int pthread_test_mutex3e();
  105. int pthread_test_mutex3r();
  106. int pthread_test_mutex4();
  107. int pthread_test_mutex5();
  108. int pthread_test_mutex6();
  109. int pthread_test_mutex6e();
  110. int pthread_test_mutex6es();
  111. int pthread_test_mutex6n();
  112. int pthread_test_mutex6r();
  113. int pthread_test_mutex6rs();
  114. int pthread_test_mutex6s();
  115. int pthread_test_mutex7();
  116. int pthread_test_mutex7e();
  117. int pthread_test_mutex7n();
  118. int pthread_test_mutex7r();
  119. int pthread_test_mutex8();
  120. int pthread_test_mutex8e();
  121. int pthread_test_mutex8n();
  122. int pthread_test_mutex8r();
  123. int pthread_test_valid1();
  124. int pthread_test_valid2();
  125. int pthread_test_self1();
  126. int pthread_test_self2();
  127. int pthread_test_equal1();
  128. int pthread_test_create1();
  129. int pthread_test_create2();
  130. int pthread_test_create3();
  131. int pthread_test_semaphore1();
  132. int pthread_test_semaphore2();
  133. int pthread_test_semaphore3();
  134. int pthread_test_semaphore4();
  135. int pthread_test_semaphore4t();
  136. int pthread_test_semaphore5();
  137. int pthread_test_semaphore6();
  138. int pthread_test_barrier1();
  139. int pthread_test_barrier2();
  140. int pthread_test_barrier3();
  141. int pthread_test_barrier4();
  142. int pthread_test_barrier5();
  143. int pthread_test_count1();
  144. int pthread_test_create1();
  145. int pthread_test_create2();
  146. int pthread_test_create3();
  147. int pthread_test_delay1();
  148. int pthread_test_delay2();
  149. int pthread_test_errno1();
  150. int pthread_test_join0();
  151. int pthread_test_join1();
  152. int pthread_test_join2();
  153. int pthread_test_join3();
  154. int pthread_test_join4();
  155. int pthread_test_kill1();
  156. int pthread_test_once1();
  157. int pthread_test_once2();
  158. int pthread_test_once3();
  159. int pthread_test_once4();
  160. int pthread_test_spin1();
  161. int pthread_test_spin2();
  162. int pthread_test_spin3();
  163. int pthread_test_spin4();
  164. int pthread_test_tsd1();
  165. int pthread_test_tsd2();
  166. int pthread_test_condvar1_1();
  167. int pthread_test_condvar1_2();
  168. int pthread_test_condvar1();
  169. int pthread_test_condvar2_1();
  170. int pthread_test_condvar2();
  171. int pthread_test_condvar3();
  172. int pthread_test_condvar3_1();
  173. int pthread_test_condvar3_2();
  174. int pthread_test_condvar3_3();
  175. int pthread_test_condvar4();
  176. int pthread_test_condvar5();
  177. int pthread_test_condvar6();
  178. int pthread_test_condvar7();
  179. int pthread_test_condvar8();
  180. int pthread_test_condvar9();
  181. int pthread_test_stress1();
  182. int pthread_test_detach1();
  183. int pthread_test_exit1();
  184. int pthread_test_exit2();
  185. int pthread_test_exit3();
  186. int pthread_test_exit4();
  187. int pthread_test_exit5();
  188. int pthread_test_reuse1();
  189. int pthread_test_reuse2();
  190. int pthread_test_rwlock1();
  191. int pthread_test_rwlock2();
  192. int pthread_test_rwlock2t();
  193. int pthread_test_rwlock3();
  194. int pthread_test_rwlock3t();
  195. int pthread_test_rwlock4();
  196. int pthread_test_rwlock4t();
  197. int pthread_test_rwlock5();
  198. int pthread_test_rwlock5t();
  199. int pthread_test_rwlock6();
  200. int pthread_test_rwlock6t();
  201. int pthread_test_rwlock6t2();
  202. int pthread_test_rwlock7();
  203. int pthread_test_rwlock8();
  204. int pthread_test_priority1();
  205. int pthread_test_priority2();
  206. int pthread_test_inherit1();
  207. int pthread_test_cancel1();
  208. int pthread_test_cancel2();
  209. int pthread_test_cancel3();
  210. int pthread_test_cancel4();
  211. int pthread_test_cancel5();
  212. int pthread_test_cancel6a();
  213. int pthread_test_cancel6d();
  214. int pthread_test_cancel7();
  215. int pthread_test_cancel8();
  216. int pthread_test_cancel9();
  217. int pthread_test_cleanup0();
  218. int pthread_test_cleanup1();
  219. int pthread_test_cleanup2();
  220. int pthread_test_cleanup3();
  221. int pthread_test_bench1();
  222. int pthread_test_bench2();
  223. int pthread_test_bench3();
  224. int pthread_test_bench4();
  225. int pthread_test_exception1();
  226. int pthread_test_exception2();
  227. int pthread_test_exception3();
  228. #ifdef __cplusplus
  229. }
  230. #endif /* __cplusplus */