aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-08-07 17:20:24 +0200
committerDominik Maier <domenukk@gmail.com>2020-08-07 17:20:24 +0200
commitfd9a7e719d3c1f236908a9c356cb90110aed24d7 (patch)
tree76d890f05c0eeb971e6ae4789041464aca2642f8 /test
parente51f1ea5a5dd630dec9bfcd668db4ea583fa72d1 (diff)
downloadAFLplusplus-fd9a7e719d3c1f236908a9c356cb90110aed24d7.tar.gz
fixed wextra
Diffstat (limited to 'test')
-rw-r--r--test/unittests/unit_hash.c5
-rw-r--r--test/unittests/unit_list.c11
-rw-r--r--test/unittests/unit_maybe_alloc.c11
-rw-r--r--test/unittests/unit_preallocable.c10
-rw-r--r--test/unittests/unit_rand.c8
5 files changed, 39 insertions, 6 deletions
diff --git a/test/unittests/unit_hash.c b/test/unittests/unit_hash.c
index 041d107a..22245ed6 100644
--- a/test/unittests/unit_hash.c
+++ b/test/unittests/unit_hash.c
@@ -30,6 +30,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);
}
@@ -39,11 +40,13 @@ 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, ...) {
+ (void)format;
return 1;
}
/* Rand with 0 seed would broke in the past */
static void test_hash(void **state) {
+ (void)state;
char bitmap[64] = {0};
u64 hash0 = hash64(bitmap, sizeof(bitmap), 0xa5b35705);
@@ -62,6 +65,8 @@ static void test_hash(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_hash)
diff --git a/test/unittests/unit_list.c b/test/unittests/unit_list.c
index 4c2063b6..43665f1a 100644
--- a/test/unittests/unit_list.c
+++ b/test/unittests/unit_list.c
@@ -27,23 +27,26 @@ extern void mock_assert(const int result, const char* const expression,
(compile with `--wrap=exit`) */
extern void exit(int status);
extern void __real_exit(int status);
-void __wrap_exit(int status);
+//void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
/* ignore all printfs */
#undef printf
extern int printf(const char *format, ...);
-extern int __real_printf(const char *format, ...);
+//extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
static list_t testlist = {.element_prealloc_count = 0};
static void test_contains(void **state) {
+ (void)state;
u32 one = 1;
u32 two = 2;
@@ -56,6 +59,7 @@ static void test_contains(void **state) {
}
static void test_foreach(void **state) {
+ (void)state;
u32 one = 1;
u32 two = 2;
@@ -75,6 +79,7 @@ static void test_foreach(void **state) {
}
static void test_long_list(void **state) {
+ (void)state;
u32 result1 = 0;
u32 result2 = 0;
@@ -118,6 +123,8 @@ static void test_long_list(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_contains),
diff --git a/test/unittests/unit_maybe_alloc.c b/test/unittests/unit_maybe_alloc.c
index 429d38ed..889ced8a 100644
--- a/test/unittests/unit_maybe_alloc.c
+++ b/test/unittests/unit_maybe_alloc.c
@@ -28,6 +28,7 @@ void __wrap_exit(int status);
extern void exit(int status);
extern void __real_exit(int status);
void __wrap_exit(int status) {
+ (void) status;
assert(0);
}
@@ -35,8 +36,9 @@ int __wrap_printf(const char *format, ...);
/* ignore all printfs */
#undef printf
extern int printf(const char *format, ...);
-extern int __real_printf(const char *format, ...);
+//extern int __real_printf(const char *format, ...);
int __wrap_printf(const char *format, ...) {
+ (void)format;
return 1;
}
@@ -51,6 +53,7 @@ static int setup(void **state) {
*/
static void test_null_allocs(void **state) {
+ (void)state;
void *buf = NULL;
size_t size = 0;
@@ -62,6 +65,7 @@ static void test_null_allocs(void **state) {
}
static void test_nonpow2_size(void **state) {
+ (void)state;
char *buf = ck_alloc(150);
size_t size = 150;
@@ -75,6 +79,7 @@ static void test_nonpow2_size(void **state) {
}
static void test_zero_size(void **state) {
+ (void)state;
char *buf = NULL;
size_t size = 0;
@@ -95,6 +100,7 @@ static void test_zero_size(void **state) {
}
static void test_unchanged_size(void **state) {
+ (void)state;
void *buf = ck_alloc(100);
size_t size = 100;
@@ -107,6 +113,7 @@ static void test_unchanged_size(void **state) {
}
static void test_grow_multiple(void **state) {
+ (void)state;
char *buf = NULL;
size_t size = 0;
@@ -146,6 +153,8 @@ static int teardown(void **state) {
*/
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_null_allocs),
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),
diff --git a/test/unittests/unit_rand.c b/test/unittests/unit_rand.c
index 0a90d8d1..1ad02a80 100644
--- a/test/unittests/unit_rand.c
+++ b/test/unittests/unit_rand.c
@@ -29,8 +29,9 @@ extern void mock_assert(const int result, const char* const expression,
(compile with `--wrap=exit`) */
extern void exit(int status);
extern void __real_exit(int status);
-void __wrap_exit(int status);
+//void __wrap_exit(int status);
void __wrap_exit(int status) {
+ (void)status;
assert(0);
}
@@ -40,11 +41,13 @@ 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, ...) {
+ (void)format;
return 1;
}
/* Rand with 0 seed would broke in the past */
static void test_rand_0(void **state) {
+ (void)state;
afl_state_t afl = {0};
rand_set_seed(&afl, 0);
@@ -58,6 +61,7 @@ static void test_rand_0(void **state) {
}
static void test_rand_below(void **state) {
+ (void)state;
afl_state_t afl = {0};
rand_set_seed(&afl, 1337);
@@ -70,6 +74,8 @@ static void test_rand_below(void **state) {
}
int main(int argc, char **argv) {
+ (void)argc;
+ (void)argv;
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_rand_0),