| 17865 | } |
| 17866 | |
| 17867 | static bool fixture_file_matches(const char *path, const char *expected) { |
| 17868 | FILE *file = cbm_fopen(path, "rb"); |
| 17869 | if (!file) { |
| 17870 | return false; |
| 17871 | } |
| 17872 | char actual[1024]; |
| 17873 | size_t expected_length = strlen(expected); |
| 17874 | size_t offset = 0; |
| 17875 | size_t bytes = 0; |
| 17876 | bool matched = true; |
| 17877 | while ((bytes = fread(actual, 1, sizeof(actual), file)) != 0) { |
| 17878 | if (bytes > expected_length - offset || memcmp(actual, expected + offset, bytes) != 0) { |
| 17879 | matched = false; |
| 17880 | break; |
| 17881 | } |
| 17882 | offset += bytes; |
| 17883 | } |
| 17884 | matched = matched && !ferror(file) && feof(file) && offset == expected_length; |
| 17885 | if (fclose(file) != 0) { |
| 17886 | matched = false; |
| 17887 | } |
| 17888 | return matched; |
| 17889 | } |
| 17890 | |
| 17891 | /* #2034: no manual mkdir may make an absent deep fixture look indexed. */ |
| 17892 | TEST(pipeline_nested_fixture_files_are_written) { |
no test coverage detected