Skip to content

Commit

Permalink
Fixed unused and signedness in tests/
Browse files Browse the repository at this point in the history
  • Loading branch information
00pauln00 committed May 31, 2024
1 parent ddfb552 commit 069e511
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/binary-hist-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ dump_hist(const struct binary_hist *bh)
}

static void
fill_bh(int start_bit, int num_buckets)
fill_bh(unsigned int start_bit, unsigned int num_buckets)
{
struct binary_hist bh;

NIOVA_ASSERT(!binary_hist_init(&bh, start_bit, num_buckets));
NIOVA_ASSERT(bh.bh_start_bit == start_bit);
NIOVA_ASSERT(bh.bh_num_buckets == num_buckets);
NIOVA_ASSERT(binary_hist_size(&bh) == num_buckets);
NIOVA_ASSERT(binary_hist_size(&bh) == (int)num_buckets);

for (int i = 0; i < binary_hist_size(&bh); i++)
{
Expand Down
12 changes: 6 additions & 6 deletions test/bitmap-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ niova_bitmap_merge_test(void)
rc = niova_bitmap_exclusive(&x, &y);
FATAL_IF(rc, "niova_bitmap_exclusive(): %s", strerror(-rc));

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
x.nb_map[i] = 0xa55555555555555aULL;
y.nb_map[i] = 0x5aaaaaaaaaaaaaa5ULL;
Expand Down Expand Up @@ -254,7 +254,7 @@ niova_bitmap_bulk_unset_test(void)
rc = niova_bitmap_shared(&y, &x);
FATAL_IF(rc != -ENOENT, "niova_bitmap_shared(): %s", strerror(-rc));

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
x.nb_map[i] = -1ULL;
y.nb_map[i] = 0x5555555555555555ULL;
Expand All @@ -272,7 +272,7 @@ niova_bitmap_bulk_unset_test(void)
rc = niova_bitmap_bulk_unset(&x, &y);
FATAL_IF(rc, "niova_bitmap_unset(): %s", strerror(-rc));

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
niova_bitmap_init(&y);

Expand Down Expand Up @@ -424,7 +424,7 @@ niova_bitmap_iterate_test(void)
NIOVA_ASSERT(rc == 0);
NIOVA_ASSERT(xarg.cnt == 0 && xarg.total_bits == 0);

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
x_map[i] = -1ULL;

rc = niova_bitmap_iterate(&x, niova_bitmap_iterate_cb, &xarg);
Expand All @@ -435,7 +435,7 @@ niova_bitmap_iterate_test(void)
xarg.cnt = 0;
xarg.total_bits = 0;

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
x_map[i] = 0x1010101010101010;

rc = niova_bitmap_iterate(&x, niova_bitmap_iterate_cb, &xarg);
Expand All @@ -449,7 +449,7 @@ niova_bitmap_iterate_test(void)
xarg.cnt = 0;
xarg.total_bits = 0;

for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
x_map[i] = 0x7070707070707070;

rc = niova_bitmap_iterate(&x, niova_bitmap_iterate_cb, &xarg);
Expand Down
4 changes: 2 additions & 2 deletions test/buffer-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ buffer_test(bool serialize, bool lreg)

struct buffer_item *bi_array[n - 1];

for (int i = 0; i < (n - 1); i++)
for (unsigned int i = 0; i < (n - 1); i++)
{
bi_array[i] = buffer_set_allocate_item_from_pending(&bs);
NIOVA_ASSERT(bi_array[i]);
Expand All @@ -74,7 +74,7 @@ buffer_test(bool serialize, bool lreg)
rc = buffer_set_destroy(&bs);
NIOVA_ASSERT(rc == -EBUSY);

for (int i = 0; i < (n - 1); i++)
for (unsigned int i = 0; i < (n - 1); i++)
buffer_set_release_item(bi_array[i]);

rc = buffer_set_destroy(&bs);
Expand Down
4 changes: 2 additions & 2 deletions test/common-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ highest_set_bit_pos_from_val_test(void)
{
NIOVA_ASSERT(highest_set_bit_pos_from_val(128) == 8);

for (int i = 0; i < TYPE_SZ_BITS(unsigned long long); i++)
for (unsigned int i = 0; i < TYPE_SZ_BITS(unsigned long long); i++)
{
const unsigned long long val = 1ULL << i;
NIOVA_ASSERT(i + 1 == highest_set_bit_pos_from_val(val));
Expand All @@ -32,7 +32,7 @@ highest_set_bit_pos_from_val_test(void)
static void
highest_power_of_two_test(void)
{
for (int i = 0; i < TYPE_SZ_BITS(unsigned long long); i++)
for (unsigned int i = 0; i < TYPE_SZ_BITS(unsigned long long); i++)
{
const unsigned long long val = 1ULL << i;

Expand Down
5 changes: 5 additions & 0 deletions test/epoll-mgr-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static void
foo_cb(const struct epoll_handle *eph, uint32_t events)
{
(void)eph;
(void)events;
return;
}

Expand Down Expand Up @@ -84,6 +85,8 @@ epoll_mgr_thread_test_cb(const struct epoll_handle *eph, uint32_t events)
{
NIOVA_ASSERT(eph && eph->eph_arg);

(void)events;

struct epm_test_handle *eth = (struct epm_test_handle *)eph->eph_arg;

// Sanity check
Expand Down Expand Up @@ -484,6 +487,8 @@ epm_ctx_test_ref_cb(void *arg, enum epoll_handle_ref_op op)
static void
epoll_mgr_context_event_cb(const struct epoll_handle *_eph, uint32_t _ev)
{
(void)_eph;
(void)_ev;
FATAL_MSG("unexpected event received");
}

Expand Down
1 change: 1 addition & 0 deletions test/ev-pipe-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ev_pipe_test_cb(const struct epoll_handle *eph, uint32_t events)

EV_PIPE_RESET(evp);

(void)events;
struct item *item = NULL, *tmp = NULL;
size_t num_completed = 0;

Expand Down
4 changes: 2 additions & 2 deletions test/queue-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ circleq_splice_tail_test(void)


// Basic head insert operation
int i;
unsigned int i;
for (i = 0; i < NUM_CES; i++)
{
ce[i].ce_value = i;
Expand All @@ -45,7 +45,7 @@ circleq_splice_tail_test(void)
}

// Foreach in both directions
int j = NUM_CES;
unsigned int j = NUM_CES;
CIRCLEQ_FOREACH(tmp, &qx, ce_lentry)
NIOVA_ASSERT(tmp->ce_value == --j);

Expand Down
2 changes: 1 addition & 1 deletion test/raft-net-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ vote_sort(void)
rc = raft_server_get_majority_entry_idx(mix2, ARRAY_SIZE(mix2), &idx);
NIOVA_ASSERT(!rc && idx == 127);

for (int i = 0; i < ARRAY_SIZE(mix2); i++)
for (unsigned int i = 0; i < ARRAY_SIZE(mix2); i++)
{
switch (i)
{
Expand Down
2 changes: 1 addition & 1 deletion test/tcp-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static niova_atomic64_t numPingPongsDone;
#define DEFAULT_RUN_TIME 10;
#define DEFAULT_TCP_SIZE 1024*1024;

static size_t tcpSize = DEFAULT_TCP_SIZE;
static ssize_t tcpSize = DEFAULT_TCP_SIZE;
static size_t runTime = DEFAULT_RUN_TIME;

/**
Expand Down
2 changes: 1 addition & 1 deletion test/udp-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static niova_atomic64_t numPingPongsDone;

#define OPTS "ht:s:"

static size_t udpSize = 5000;
static ssize_t udpSize = 5000;
static size_t runTime = 1;

/**
Expand Down
2 changes: 1 addition & 1 deletion test/work-dispatch-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <sys/epoll.h>
#include <fcntl.h>

#define NUM_SECONDS_TO_RUN_TEST 2ULL
#define NUM_SECONDS_TO_RUN_TEST 2L

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
Expand Down

0 comments on commit 069e511

Please sign in to comment.