| 111 | } |
| 112 | |
| 113 | static test_status_t |
| 114 | p_test_impl(bool do_malloc_init, bool do_reentrant, test_t *t, va_list ap) { |
| 115 | test_status_t ret; |
| 116 | |
| 117 | if (do_malloc_init) { |
| 118 | /* |
| 119 | * Make sure initialization occurs prior to running tests. |
| 120 | * Tests are special because they may use internal facilities |
| 121 | * prior to triggering initialization as a side effect of |
| 122 | * calling into the public API. |
| 123 | */ |
| 124 | if (nallocx(1, 0) == 0) { |
| 125 | malloc_printf("Initialization error"); |
| 126 | return test_status_fail; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | ret = test_status_pass; |
| 131 | for (; t != NULL; t = va_arg(ap, test_t *)) { |
| 132 | /* Non-reentrant run. */ |
| 133 | reentrancy = non_reentrant; |
| 134 | hooks_arena_new_hook = hooks_libc_hook = NULL; |
| 135 | t(); |
| 136 | if (test_status > ret) { |
| 137 | ret = test_status; |
| 138 | } |
| 139 | /* Reentrant run. */ |
| 140 | if (do_reentrant) { |
| 141 | reentrancy = libc_reentrant; |
| 142 | hooks_arena_new_hook = NULL; |
| 143 | hooks_libc_hook = &libc_reentrancy_hook; |
| 144 | t(); |
| 145 | if (test_status > ret) { |
| 146 | ret = test_status; |
| 147 | } |
| 148 | |
| 149 | reentrancy = arena_new_reentrant; |
| 150 | hooks_libc_hook = NULL; |
| 151 | hooks_arena_new_hook = &arena_new_reentrancy_hook; |
| 152 | t(); |
| 153 | if (test_status > ret) { |
| 154 | ret = test_status; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | malloc_printf("--- %s: %u/%u, %s: %u/%u, %s: %u/%u ---\n", |
| 160 | test_status_string(test_status_pass), |
| 161 | test_counts[test_status_pass], test_count, |
| 162 | test_status_string(test_status_skip), |
| 163 | test_counts[test_status_skip], test_count, |
| 164 | test_status_string(test_status_fail), |
| 165 | test_counts[test_status_fail], test_count); |
| 166 | |
| 167 | return ret; |
| 168 | } |
| 169 | |
| 170 | test_status_t |
no test coverage detected