| 1391 | } |
| 1392 | |
| 1393 | void tf_coverage_test_begin(const char *test) { |
| 1394 | #ifndef _WIN32 |
| 1395 | tf_coverage_channel_observe(); |
| 1396 | if (tf_coverage_channel_blocked()) { |
| 1397 | return; |
| 1398 | } |
| 1399 | #endif |
| 1400 | char suite_dir[TF_COVERAGE_PATH_CAP]; |
| 1401 | char own[CBM_SZ_512]; |
| 1402 | if (!tf_coverage_dir[0] || tf_coverage_write_failed) { |
| 1403 | return; |
| 1404 | } |
| 1405 | int own_length = snprintf(own, sizeof(own), "%s.parent", test); |
| 1406 | if (own_length <= 0 || (size_t)own_length >= sizeof(own) || |
| 1407 | !tf_coverage_suite_dir(suite_dir, sizeof(suite_dir)) || |
| 1408 | !tf_coverage_route_setup(suite_dir)) { |
| 1409 | tf_coverage_lost(test); |
| 1410 | return; |
| 1411 | } |
| 1412 | if (!tf_coverage_flush()) { |
| 1413 | return; |
| 1414 | } |
| 1415 | tf_coverage_setup_index++; |
| 1416 | /* Named before the test runs, not after: a forked child that leaves through |
| 1417 | * exit() writes to the name it inherited, which must not be the setup file. */ |
| 1418 | if (!tf_coverage_route(suite_dir, own, test)) { |
| 1419 | tf_coverage_lost(test); |
| 1420 | } |
| 1421 | } |
| 1422 | |
| 1423 | void tf_coverage_test_end(const char *test) { |
| 1424 | #ifndef _WIN32 |
nothing calls this directly
no test coverage detected