-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZSTOR-3513 add mock for munit and increase code coverage
- Loading branch information
hongwei.wu
committed
Dec 6, 2022
1 parent
ed4b017
commit d9b999c
Showing
13 changed files
with
684 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
*.trs | ||
*.dirstamp | ||
*.gcno | ||
*.gcda | ||
test/unit/core | ||
test/unit/uv | ||
test/fuzzy/core | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "../lib/munit_mock.h" | ||
#include "../../src/log.h" | ||
#include "../../src/request.h" | ||
#include "../../src/replication.h" | ||
#include "../../src/configuration.h" | ||
|
||
extern int __real_logAppendCommands(struct raft_log *l, | ||
const raft_term term, | ||
const struct raft_buffer bufs[], | ||
const unsigned n); | ||
|
||
int __wrap_logAppendCommands(struct raft_log *l, | ||
const raft_term term, | ||
const struct raft_buffer bufs[], | ||
const unsigned n) | ||
{ | ||
return mock_type_args(int, logAppendCommands, l, term, bufs, n); | ||
} | ||
|
||
extern int __real_requestRegEnqueue(struct request_registry *reg, | ||
struct request *req); | ||
|
||
int __wrap_requestRegEnqueue(struct request_registry *reg, struct request *req) | ||
{ | ||
return mock_type_args(int, requestRegEnqueue, reg, req); | ||
} | ||
|
||
extern int __real_replicationTrigger(struct raft *r, raft_index index); | ||
|
||
int __wrap_replicationTrigger(struct raft *r, raft_index index) | ||
{ | ||
return mock_type_args(int, replicationTrigger, r, index); | ||
} | ||
|
||
extern int __real_logAppend(struct raft_log *l, | ||
const raft_term term, | ||
const unsigned short type, | ||
const struct raft_buffer *buf, | ||
void *batch); | ||
|
||
int __wrap_logAppend(struct raft_log *l, | ||
const raft_term term, | ||
const unsigned short type, | ||
const struct raft_buffer *buf, | ||
void *batch) | ||
{ | ||
return mock_type_args(int, logAppend, l, term, type, buf, batch); | ||
} | ||
|
||
|
||
extern int __real_configurationCopy(const struct raft_configuration *src, | ||
struct raft_configuration *dst); | ||
|
||
|
||
int __wrap_configurationCopy(const struct raft_configuration *src, | ||
struct raft_configuration *dst) | ||
{ | ||
return mock_type_args(int, configurationCopy, src, dst); | ||
} | ||
|
||
extern int __real_logAcquire(struct raft_log *l, const raft_index index, | ||
struct raft_entry *entries[], unsigned *n); | ||
|
||
int __wrap_logAcquire(struct raft_log *l, const raft_index index, | ||
struct raft_entry *entries[], unsigned *n) | ||
{ | ||
return mock_type_args(int, logAcquire, l, index, entries, n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.