Skip to content

Commit

Permalink
Fix CBT mockatests
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Syms <[email protected]>
  • Loading branch information
MarkSymsCtx committed Nov 28, 2024
1 parent 30dbe71 commit b327995
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cbt/cbt-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ read_cbt_metadata(char *name, FILE *f, struct cbt_log_metadata *log_meta)
ret = fread(log_meta, sizeof(struct cbt_log_metadata), 1, f);

if (!ret) {
fprintf(stderr, "Failed to read CBT metadata from file %s\n", name);
fprintf(stderr, "Failed to read CBT metadata from file %s, error %s\n", name, strerror(ferror(f)));
err = -EIO;
}

Expand Down
6 changes: 3 additions & 3 deletions mockatests/cbt/test-cbt-util-coalesce.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,19 @@ void test_cbt_util_coalesce_set_file_pointer_failure(void **state)
((struct cbt_log_metadata*)parent_data)->size = size;
//Fill bitmap with random bytes
memcpy(parent_data + sizeof(struct cbt_log_metadata), (void*)memcpy, bmsize );
FILE *parent_log = fmemopen((void*)parent_data, file_size, "w+");
FILE *parent_log = fmemopen((void*)parent_data, file_size, "r");

//Intialise size in metadata file
((struct cbt_log_metadata*)child_data)->size = size;
//Fill bitmap with random bytes
memcpy(child_data + sizeof(struct cbt_log_metadata), (void*)memcpy, bmsize );
FILE *child_log = fmemopen((void*)child_data, file_size, "w+");
FILE *child_log = fmemopen((void*)child_data, file_size, "r+");

will_return(__wrap_fopen, parent_log);
expect_value(__wrap_fclose, fp, parent_log);
will_return(__wrap_fopen, child_log);
expect_value(__wrap_fclose, fp, child_log);

fail_fseek(EIO);

result = cbt_util_coalesce(6, args);
Expand Down

0 comments on commit b327995

Please sign in to comment.