Run the scan; returns the records it wrote (caller frees), CRs kept. */
| 24634 | |
| 24635 | /* Run the scan; returns the records it wrote (caller frees), CRs kept. */ |
| 24636 | static char *scan_fixture_run(const scan_fixture_t *fx, const char *pattern, bool use_regex, |
| 24637 | size_t output_limit, int *cause) { |
| 24638 | *cause = cbm_mcp_search_scan_for_test(NULL, fx->list, pattern, use_regex, fx->out, |
| 24639 | output_limit, UINT64_MAX); |
| 24640 | FILE *fp = cbm_fopen(fx->out, "rb"); |
| 24641 | if (!fp) { |
| 24642 | return NULL; |
| 24643 | } |
| 24644 | char *text = calloc(CBM_SZ_64K, 1); |
| 24645 | size_t length = text ? fread(text, 1, CBM_SZ_64K - 1, fp) : 0; |
| 24646 | (void)fclose(fp); |
| 24647 | if (text) { |
| 24648 | text[length] = '\0'; |
| 24649 | } |
| 24650 | return text; |
| 24651 | } |
| 24652 | |
| 24653 | /* Append one expected record to `buf`. */ |
| 24654 | static void scan_expect(char *buf, size_t cap, const char *path, int line, const char *content) { |
no test coverage detected