From fd9a7e719d3c1f236908a9c356cb90110aed24d7 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 7 Aug 2020 17:20:24 +0200 Subject: fixed wextra --- test/unittests/unit_preallocable.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/unittests/unit_preallocable.c') diff --git a/test/unittests/unit_preallocable.c b/test/unittests/unit_preallocable.c index b0963a15..ea16da85 100644 --- a/test/unittests/unit_preallocable.c +++ b/test/unittests/unit_preallocable.c @@ -29,6 +29,7 @@ extern void exit(int status); extern void __real_exit(int status); void __wrap_exit(int status); void __wrap_exit(int status) { + (void)status; assert(0); } @@ -36,8 +37,9 @@ void __wrap_exit(int status) { #undef printf extern int printf(const char *format, ...); extern int __real_printf(const char *format, ...); -int __wrap_printf(const char *format, ...); +//int __wrap_printf(const char *format, ...); int __wrap_printf(const char *format, ...) { + (void)format; return 1; } @@ -51,9 +53,10 @@ typedef struct prealloc_me #define PREALLOCED_BUF_SIZE (64) prealloc_me_t prealloc_me_buf[PREALLOCED_BUF_SIZE]; -size_t prealloc_me_size = 0; +s32 prealloc_me_size = 0; static void test_alloc_free(void **state) { + (void)state; prealloc_me_t *prealloced = NULL; PRE_ALLOC(prealloced, prealloc_me_buf, PREALLOCED_BUF_SIZE, prealloc_me_size); @@ -63,6 +66,7 @@ static void test_alloc_free(void **state) { } static void test_prealloc_overflow(void **state) { + (void)state; u32 i = 0; prealloc_me_t *prealloced[PREALLOCED_BUF_SIZE + 10]; @@ -102,6 +106,8 @@ static void test_prealloc_overflow(void **state) { } int main(int argc, char **argv) { + (void)argc; + (void)argv; const struct CMUnitTest tests[] = { cmocka_unit_test(test_alloc_free), -- cgit 1.4.1 From 543765bc0df02ef7d2db3690383a857ca7963286 Mon Sep 17 00:00:00 2001 From: van Hauser Date: Thu, 10 Sep 2020 16:41:40 +0200 Subject: fix unittests --- test/test-unittests.sh | 2 +- test/unittests/unit_preallocable.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test/unittests/unit_preallocable.c') diff --git a/test/test-unittests.sh b/test/test-unittests.sh index 58c2eea9..9a405e2f 100755 --- a/test/test-unittests.sh +++ b/test/test-unittests.sh @@ -5,7 +5,7 @@ $ECHO "$BLUE[*] Execution cmocka Unit-Tests $GREY" unset AFL_CC make -C .. unit || CODE=1 INCOMPLETE=1 : +rm -rf unittests/unit_hash unittests/unit_rand . ./test-post.sh -rm -rf unittests/unit_hash unittests/unit_rand diff --git a/test/unittests/unit_preallocable.c b/test/unittests/unit_preallocable.c index ea16da85..2f9c0b91 100644 --- a/test/unittests/unit_preallocable.c +++ b/test/unittests/unit_preallocable.c @@ -49,16 +49,16 @@ typedef struct prealloc_me u8 *content[128]; -} prealloc_me_t; +} element_t; #define PREALLOCED_BUF_SIZE (64) -prealloc_me_t prealloc_me_buf[PREALLOCED_BUF_SIZE]; +element_t prealloc_me_buf[PREALLOCED_BUF_SIZE]; s32 prealloc_me_size = 0; static void test_alloc_free(void **state) { (void)state; - prealloc_me_t *prealloced = NULL; + element_t *prealloced = NULL; PRE_ALLOC(prealloced, prealloc_me_buf, PREALLOCED_BUF_SIZE, prealloc_me_size); assert_non_null(prealloced); PRE_FREE(prealloced, prealloc_me_size); @@ -69,7 +69,7 @@ static void test_prealloc_overflow(void **state) { (void)state; u32 i = 0; - prealloc_me_t *prealloced[PREALLOCED_BUF_SIZE + 10]; + element_t *prealloced[PREALLOCED_BUF_SIZE + 10]; for (i = 0; i < PREALLOCED_BUF_SIZE + 10; i++) { -- cgit 1.4.1