Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16251 tests: Fix various memory issues #15147

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/tests/suite/daos_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,7 @@ basic_byte_array(void **state)
char *bulk_buf_out = NULL;
char *buf;
char *buf_out;
char *buf_out_tmp;
int buf_len, tmp_len;
int step = 1;
int rc;
Expand Down Expand Up @@ -2287,8 +2288,11 @@ basic_byte_array(void **state)
assert_memory_equal(buf, buf_out, buf_len);

print_message("short read should get iov_len with tail hole trimmed\n");
memset(buf_out, 0, buf_len);
tmp_len = buf_len / 3;
buf_out_tmp = buf_out;
D_ALLOC(buf_out, max(buf_len, tmp_len + 99));
D_ASSERT(buf_out != NULL);
memset(buf_out, 0, buf_len);
knard-intel marked this conversation as resolved.
Show resolved Hide resolved
sgl.sg_nr_out = 0;
sgl.sg_nr = 1;
d_iov_set(&sg_iov[0], buf_out, tmp_len + 99);
Expand All @@ -2306,6 +2310,8 @@ basic_byte_array(void **state)
assert_int_equal(sgl.sg_nr_out, 1);
assert_int_equal(sgl.sg_iovs[0].iov_len, tmp_len);
assert_memory_equal(buf, buf_out, tmp_len);
D_FREE(buf_out);
buf_out = buf_out_tmp;

if (step++ == 1)
goto next_step;
Expand Down
4 changes: 2 additions & 2 deletions src/tests/suite/daos_obj_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,8 +1421,8 @@ test_async_io(void *arg)
d_iov_t sg_iovs[NUM_IOS];
daos_iod_t iods[NUM_IOS];
daos_recx_t recx[NUM_IOS];
char akey_str[NUM_IOS][10];
char dkey_str[NUM_IOS][10];
char akey_str[NUM_IOS][16];
char dkey_str[NUM_IOS][16];
char buf[NUM_IOS][IO_SIZE];
daos_handle_t eqh;
int i, rc;
Expand Down
9 changes: 3 additions & 6 deletions src/tests/suite/daos_obj_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,15 @@ ec_rec_list_punch(void **state)
daos_obj_id_t oid;
int num_rec;
int i;
daos_recx_t recx;
knard-intel marked this conversation as resolved.
Show resolved Hide resolved
char data[16];

if (!test_runable(arg, 6))
return;

oid = daos_test_oid_gen(arg->coh, ec_obj_class, 0, 0, arg->myrank);
ioreq_init(&req, arg->coh, oid, DAOS_IOD_ARRAY, arg);
for (i = 0; i < 100; i++) {
daos_recx_t recx;
char data[16];

/* Make dkey on different shards */
req.iod_type = DAOS_IOD_ARRAY;
recx.rx_nr = 5;
Expand All @@ -313,8 +312,6 @@ ec_rec_list_punch(void **state)

/* punch the akey */
for (i = 0; i < 100; i++) {
daos_recx_t recx;

recx.rx_nr = 5;
recx.rx_idx = i * EC_CELL_SIZE;

Expand Down Expand Up @@ -2402,7 +2399,7 @@ ec_dkey_enum_fail(void **state)
recx.rx_nr = 5;
recx.rx_idx = 0;
memset(data, 'a', 5);
insert_recxs(dkey, "a_key", 1, DAOS_TX_NONE, &recx, 1, data, 16, &req);
insert_recxs(dkey, "a_key", 1, DAOS_TX_NONE, &recx, 1, data, 5, &req);
}

print_message("iterate dkey...\n");
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite/daos_rebuild_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ rebuild_snap_update_recs(void **state)
struct ioreq req;
daos_recx_t recx;
int tgt = DEFAULT_FAIL_TGT;
char string[100] = { 0 };
char string[100 * SNAP_CNT] = { 0 };
daos_epoch_t snap_epoch[SNAP_CNT];
int i;
int rc;
Expand Down
6 changes: 4 additions & 2 deletions src/tests/suite/daos_test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,10 @@ daos_start_server(test_arg_t *arg, const uuid_t pool_uuid,
{
int rc;

if (d_rank_in_rank_list(svc, rank))
svc->rl_nr++;
if (!d_rank_in_rank_list(svc, rank)) {
rc = d_rank_list_append(svc, rank);
D_ASSERTF(rc == 0, DF_RC "\n", DP_RC(rc));
}

print_message("\tstart rank %d (svc->rl_nr %d)!\n", rank, svc->rl_nr);

Expand Down
Loading