Commit 2f35e5ab authored by Jan Včelák's avatar Jan Včelák 🚀

tests: eliminate warnings when compiled with NDEBUG

parent 3ed2540b
......@@ -134,8 +134,7 @@ int main(int argc, char *argv[])
break;
}
prev = cur;
int strl = strlen(cur);
assert(strl + 1 == len);
assert(strlen(cur) + 1 == len);
hhash_iter_next(&it);
}
ok(hhash_iter_finished(&it), "hhash: passed order index checks");
......
......@@ -68,7 +68,7 @@ static void test_int(const char *in, int expected, int errcode)
// mute warn_unused_result
#define asprintf(args, ...) do { \
int r = (asprintf)(args, ##__VA_ARGS__); assert(r >= 0); \
int r = (asprintf)(args, ##__VA_ARGS__); assert(r >= 0); (void)r; \
} while (0);
int main(int argc, char *argv[])
......
......@@ -50,6 +50,7 @@ static void init_soa(knot_rrset_t *rr, const uint32_t serial, const knot_dname_t
assert(serial < 256);
uint8_t soa_data[MIN_SOA_SIZE] = { 0, 0, 0, 0, 0, serial };
int ret = knot_rrset_add_rdata(rr, soa_data, sizeof(soa_data), 3600, NULL);
(void)ret;
assert(ret == KNOT_EOK);
}
......@@ -71,6 +72,7 @@ static void init_random_rr(knot_rrset_t *rr , const knot_dname_t *apex)
randstr((char *)(txt + 1), RAND_RR_PAYLOAD);
int ret = knot_rrset_add_rdata(rr, txt, RAND_RR_PAYLOAD, 3600, NULL);
(void)ret;
assert(ret == KNOT_EOK);
}
......@@ -78,6 +80,7 @@ static void init_random_rr(knot_rrset_t *rr , const knot_dname_t *apex)
static void init_random_changeset(changeset_t *ch, const uint32_t from, const uint32_t to, const size_t size, const knot_dname_t *apex)
{
int ret = changeset_init(ch, apex);
(void)ret;
assert(ret == KNOT_EOK);
// Add SOAs
......@@ -98,6 +101,7 @@ static void init_random_changeset(changeset_t *ch, const uint32_t from, const ui
knot_rrset_t rr;
init_random_rr(&rr, apex);
int ret = changeset_add_rrset(ch, &rr, 0);
(void)ret;
assert(ret == KNOT_EOK);
knot_rrset_clear(&rr, NULL);
}
......@@ -107,6 +111,7 @@ static void init_random_changeset(changeset_t *ch, const uint32_t from, const ui
knot_rrset_t rr;
init_random_rr(&rr, apex);
int ret = changeset_rem_rrset(ch, &rr, 0);
(void)ret;
assert(ret == KNOT_EOK);
knot_rrset_clear(&rr, NULL);
}
......@@ -220,6 +225,7 @@ static void test_store_load(const char *jfilename)
changeset_t ch;
init_random_changeset(&ch, 0, 1, 128, apex);
int ret = journal_store_changeset(&ch, jfilename, filesize);
(void)ret;
ok(ret == KNOT_EOK, "journal: store changeset");
list_t l;
init_list(&l);
......
......@@ -31,6 +31,7 @@ static knot_rrset_t *create_dummy_rrset(const knot_dname_t *owner,
memcpy(wire, "testtest", strlen("testtest"));
int ret = knot_rrset_add_rdata(r, wire, strlen("testtest"), 3600, NULL);
assert(ret == KNOT_EOK);
(void)ret;
return r;
}
......@@ -44,6 +45,7 @@ static knot_rrset_t *create_dummy_rrsig(const knot_dname_t *owner,
wire_write_u16(wire, type);
int ret = knot_rrset_add_rdata(r, wire, sizeof(uint16_t), 3600, NULL);
assert(ret == KNOT_EOK);
(void)ret;
return r;
}
......
......@@ -142,6 +142,7 @@ int main(int argc, char *argv[])
/* Start responder. */
int ret = listen(responder_fd, 10);
(void)ret;
assert(ret == 0);
pthread_t thread;
pthread_create(&thread, 0, responder_thread, &responder_fd);
......
......@@ -60,6 +60,7 @@ static void process_rr(zs_scanner_t *scanner)
int ret = knot_rrset_add_rdata(&rrset, scanner->r_data,
scanner->r_data_length,
scanner->r_ttl, NULL);
(void)ret;
assert(ret == KNOT_EOK);
}
......@@ -296,6 +297,7 @@ int main(int argc, char *argv[])
/* Load test configuration. */
int ret = test_conf(conf_str, NULL);
(void)ret;
assert(ret == KNOT_EOK);
/* Set up empty zone */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment