Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
Signed-off-by: Cole Miller <[email protected]>
  • Loading branch information
cole-miller committed Jul 17, 2024
1 parent b4d705b commit 0959b3d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
22 changes: 11 additions & 11 deletions test/integration/test_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ TEST(fsm, snapshotFreshDb, setUp, tearDown, 0, snapshot_params)
unsigned n_bufs = 0;
int rv;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

rv = fsm->snapshot(fsm, &bufs, &n_bufs);
munit_assert_int(rv, ==, 0);
Expand Down Expand Up @@ -128,7 +128,7 @@ TEST(fsm, snapshotWrittenDb, setUp, tearDown, 0, snapshot_params)
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -166,7 +166,7 @@ TEST(fsm, snapshotHeapFaultSingleDB, setUp, tearDown, 0, snapshot_params)
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -218,7 +218,7 @@ TEST(fsm,
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

if (!disk_mode) {
return MUNIT_SKIP;
Expand Down Expand Up @@ -261,7 +261,7 @@ TEST(fsm, snapshotHeapFaultTwoDB, setUp, tearDown, 0, snapshot_params)
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Open 2 databases and add data to them */
HANDSHAKE;
Expand Down Expand Up @@ -325,7 +325,7 @@ TEST(fsm, snapshotHeapFaultTwoDBAsync, setUp, tearDown, 0, snapshot_params)
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");
if (!disk_mode) {
return MUNIT_SKIP;
}
Expand Down Expand Up @@ -390,7 +390,7 @@ TEST(fsm, snapshotNewDbAddedBeforeFinalize, setUp, tearDown, 0, snapshot_params)
uint64_t last_insert_id;
uint64_t rows_affected;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -440,7 +440,7 @@ TEST(fsm, snapshotWritesBeforeFinalize, setUp, tearDown, 0, snapshot_params)
char sql[128];
int rv;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -491,7 +491,7 @@ TEST(fsm, concurrentSnapshots, setUp, tearDown, 0, snapshot_params)
uint64_t rows_affected;
int rv;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -583,7 +583,7 @@ TEST(fsm, snapshotRestore, setUp, tearDown, 0, restore_params)
int rv;
char sql[128];

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Add some data to database */
HANDSHAKE;
Expand Down Expand Up @@ -649,7 +649,7 @@ TEST(fsm, snapshotRestoreMultipleDBs, setUp, tearDown, 0, snapshot_params)
char *msg;
int rv;

bool disk_mode = param_bool(params, "disk_mode");
bool disk_mode = param_get_bool(params, "disk_mode");

/* Create 2 databases and add data to them. */
HANDSHAKE;
Expand Down
7 changes: 6 additions & 1 deletion test/lib/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
} \
} while (0)

static inline bool param_bool(const MunitParameter *params, const char *name)
/**
* Parse a numeric test parameter as a boolean. The result is false
* if the parameter is unset or set to "0", and true otherwise.
*/
static inline bool param_get_bool(const MunitParameter *params,
const char *name)
{
const char *param = munit_parameters_get(params, name);
return param != NULL && (bool)atoi(param);
Expand Down

0 comments on commit 0959b3d

Please sign in to comment.