From 44f6700bb619c87078403e3b5f1eba6fe5f994c5 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Fri, 6 Mar 2020 11:36:42 +0100 Subject: [PATCH] Try to get rid of all warnings and errors in the travis tests --- .../12-unit-tests-dnssec.Makefile.in | 1 + .../12-unit-tests-dnssec.c | 4 ++-- .../13-unit-tests-base.Makefile.in | 1 + test/13-unit-tests-base.tpkg/13-unit-tests-base.c | 15 +++++++++------ .../15-unit-tests-rrtypes.Makefile.in | 1 + .../15-unit-tests-rrtypes.c | 12 ++++++------ 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in index e58c4688..ed01b268 100644 --- a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in +++ b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in @@ -8,6 +8,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ +datarootdir = @datarootdir@ CC = @CC@ CFLAGS = @CFLAGS@ diff --git a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.c b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.c index b69bbba2..c80ea659 100644 --- a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.c +++ b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.c @@ -37,7 +37,7 @@ check_ldns_calc_keytag_part(const char *key_str, uint16_t expected_keytag) } ldns_status -check_ldns_calc_keytag() +check_ldns_calc_keytag(void) { const char *key_str; uint16_t expected_keytag; @@ -74,7 +74,7 @@ check_ldns_calc_keytag() } ldns_status -check_ldns_canonicalization() +check_ldns_canonicalization(void) { const char rr_str1[] = "bla.nl. 1000 IN NS ns1.bla.nl."; const char rr_str2[] = "BLA.NL. 1000 IN NS NS1.BlA.Nl."; diff --git a/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in b/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in index 0a84fbab..9875cdb7 100644 --- a/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in +++ b/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in @@ -8,6 +8,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ +dataroot = @dataroot@ CC = @CC@ CFLAGS = @CFLAGS@ diff --git a/test/13-unit-tests-base.tpkg/13-unit-tests-base.c b/test/13-unit-tests-base.tpkg/13-unit-tests-base.c index 01508dda..eb8572e0 100644 --- a/test/13-unit-tests-base.tpkg/13-unit-tests-base.c +++ b/test/13-unit-tests-base.tpkg/13-unit-tests-base.c @@ -65,7 +65,8 @@ test_base64_decode(const char *str, const uint8_t *expect_data, size_t expect_da data_len = ldns_b64_pton_calculate_size(strlen(str)); - data = malloc(data_len); + if(!(data = malloc(data_len))) + return -1; result = ldns_b64_pton(str, data, data_len); @@ -102,7 +103,7 @@ test_base64_decode(const char *str, const uint8_t *expect_data, size_t expect_da } } } - + free(data); return result; } @@ -155,7 +156,8 @@ test_base32_decode(const char *str, const uint8_t *expect_data, size_t expect_da data_len = ldns_b32_pton_calculate_size(strlen(str)) + 10; - data = malloc(data_len); + if (!(data = malloc(data_len))) + return -1; result = ldns_b32_pton(str, strlen(str), data, data_len); @@ -192,7 +194,7 @@ test_base32_decode(const char *str, const uint8_t *expect_data, size_t expect_da } } } - + free(data); return result; } @@ -247,7 +249,8 @@ test_base32_decode_extended_hex(const char *str, const uint8_t *expect_data, siz data_len = ldns_b32_pton_calculate_size(strlen(str)) + 10; - data = malloc(data_len); + if (!(data = malloc(data_len))) + return -1; result = ldns_b32_pton_extended_hex(str, strlen(str), data, data_len); @@ -284,7 +287,7 @@ test_base32_decode_extended_hex(const char *str, const uint8_t *expect_data, siz } } } - + free(data); return result; } diff --git a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in index 030207c4..aca0b050 100644 --- a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in +++ b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in @@ -8,6 +8,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ +dataroot = @dataroot@ CC = @CC@ CFLAGS = @CFLAGS@ diff --git a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.c b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.c index 9937f0ef..2450f05a 100644 --- a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.c +++ b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.c @@ -13,7 +13,7 @@ err(const ldns_rr_descriptor* desc, const char* why) } static int -check_desc(const ldns_rr_descriptor* desc, int type) +check_desc(const ldns_rr_descriptor* desc, ldns_rr_type type) { int i; int dcount = 0; @@ -49,14 +49,14 @@ check_desc(const ldns_rr_descriptor* desc, int type) } static int -check_descriptors() +check_descriptors(void) { - int start = 0; - int end = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON /* 250 */; - int i; + ldns_rr_type start = LDNS_RR_TYPE_FIRST; + ldns_rr_type end = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON /* 250 */; + ldns_rr_type i; for(i=start; i