Reads the selection once. False means the selection itself is unusable: the * caller stops before any suite, because falling back to "everything" or to * "nothing" would decide a gate by accident. An empty variable is unset, as it * is in a shell; a selection that is set and names no test is an error, since * a caller who wants every test leaves both variables unset. */
| 994 | * is in a shell; a selection that is set and names no test is an error, since |
| 995 | * a caller who wants every test leaves both variables unset. */ |
| 996 | static bool tf_only_init(void) { |
| 997 | const char *list = getenv("CBM_TEST_ONLY"); |
| 998 | const char *path = getenv("CBM_TEST_ONLY_FILE"); |
| 999 | bool has_list = list && list[0]; |
| 1000 | bool has_path = path && path[0]; |
| 1001 | if (!has_list && !has_path) { |
| 1002 | return true; |
| 1003 | } |
| 1004 | if ((has_list && !tf_only_add_list(list)) || (has_path && !tf_only_add_file(path))) { |
| 1005 | return false; |
| 1006 | } |
| 1007 | if (tf_only_count == 0) { |
| 1008 | fprintf(stderr, "test selection names no test (CBM_TEST_ONLY, CBM_TEST_ONLY_FILE)\n"); |
| 1009 | return false; |
| 1010 | } |
| 1011 | qsort(tf_only_tokens, tf_only_count, sizeof(*tf_only_tokens), tf_only_compare); |
| 1012 | tf_only_active = true; |
| 1013 | return true; |
| 1014 | } |
| 1015 | |
| 1016 | /* Returns the first token of `suite` and stores one past its last. */ |
| 1017 | static size_t tf_only_suite_run(const char *suite, size_t *end_out) { |
no test coverage detected