Helper: write a file inside a temp dir */
| 17841 | |
| 17842 | /* Helper: write a file inside a temp dir */ |
| 17843 | static void write_temp_file(const char *dir, const char *name, const char *content) { |
| 17844 | char path[512]; |
| 17845 | /* Create subdirectories if needed */ |
| 17846 | snprintf(path, sizeof(path), "%s/%s", dir, name); |
| 17847 | char *slash = strrchr(path, '/'); |
| 17848 | if (slash) { |
| 17849 | char parent[512]; |
| 17850 | size_t plen = slash - path; |
| 17851 | memcpy(parent, path, plen); |
| 17852 | parent[plen] = '\0'; |
| 17853 | cbm_mkdir_p(parent, 0755); |
| 17854 | } |
| 17855 | /* Binary, matching test_helpers.h/repro_harness.h: text mode turns "\n" |
| 17856 | * into "\r\n" on Windows, so the bytes on disk stop matching the source |
| 17857 | * string the test hashes or measures -- the semantic-manifest tests |
| 17858 | * compare cbm_sha256_hex(string) against the pipeline's hash of this |
| 17859 | * file, and the quarantine test compares byte sizes. */ |
| 17860 | FILE *f = cbm_fopen(path, "wb"); |
| 17861 | if (f) { |
| 17862 | fputs(content, f); |
| 17863 | fclose(f); |
| 17864 | } |
| 17865 | } |
| 17866 | |
| 17867 | static bool fixture_file_matches(const char *path, const char *expected) { |
| 17868 | FILE *file = cbm_fopen(path, "rb"); |
no test coverage detected