From dd8f31b9ac7c9bdcc0675cb00325163c2d146c30 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 27 Aug 2013 08:04:45 +0200 Subject: [PATCH] t/: Make the test-suite compile with strict compiler flags. --- t/Makefile.am | 3 ++- t/libsysdb_test.c | 4 +++- t/utils/llist_test.c | 18 +++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/t/Makefile.am b/t/Makefile.am index 0afba64..338ecbc 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -1,3 +1,4 @@ +AM_CFLAGS = @STRICT_CFLAGS@ AM_CPPFLAGS = -I$(top_builddir)/src/include TESTS = libsysdb_test @@ -6,7 +7,7 @@ check_PROGRAMS = libsysdb_test libsysdb_test_SOURCES = \ libsysdb_test.c libsysdb_test.h \ utils/llist_test.c -libsysdb_test_CFLAGS = @CHECK_CFLAGS@ +libsysdb_test_CFLAGS = $(AM_CFLAGS) @CHECK_CFLAGS@ libsysdb_test_LDADD = $(top_builddir)/src/libsysdb.la @CHECK_LIBS@ test: check diff --git a/t/libsysdb_test.c b/t/libsysdb_test.c index dd5ce8e..ab24149 100644 --- a/t/libsysdb_test.c +++ b/t/libsysdb_test.c @@ -33,11 +33,13 @@ int main(void) { int failed = 0; + + SRunner *sr; Suite *s; /* t/utils/llist_test */ s = util_llist_suite(); - SRunner *sr = srunner_create(s); + sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); failed += srunner_ntests_failed(sr); srunner_free(sr); diff --git a/t/utils/llist_test.c b/t/utils/llist_test.c index 7745204..b01dd0e 100644 --- a/t/utils/llist_test.c +++ b/t/utils/llist_test.c @@ -71,7 +71,7 @@ teardown(void) static void populate(void) { - int i; + size_t i; for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { int check = sdb_llist_append(list, &golden_data[i]); fail_unless(check == 0, @@ -83,7 +83,7 @@ populate(void) START_TEST(test_clone) { sdb_llist_t *clone; - int i; + size_t i; populate(); @@ -102,7 +102,7 @@ END_TEST START_TEST(test_destroy) { - int i; + size_t i; populate(); sdb_llist_destroy(list); list = NULL; @@ -117,7 +117,7 @@ END_TEST START_TEST(test_append) { - int i; + size_t i; for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { int check = sdb_llist_append(list, &golden_data[i]); fail_unless(check == 0, @@ -132,7 +132,7 @@ END_TEST START_TEST(test_insert) { - int i; + size_t i; for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { int check = sdb_llist_insert(list, &golden_data[i], 0); fail_unless(check == 0, @@ -147,7 +147,7 @@ END_TEST START_TEST(test_insert_invalid) { - int i; + size_t i; for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { /* none of these operations will succeed * => 1 is invalid for each case */ @@ -164,7 +164,7 @@ END_TEST START_TEST(test_search) { - int i; + size_t i; populate(); for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { sdb_object_t *check = sdb_llist_search_by_name(list, @@ -186,7 +186,7 @@ END_TEST START_TEST(test_shift) { - int i; + size_t i; populate(); for (i = 0; i < SDB_STATIC_ARRAY_LEN(golden_data); ++i) { sdb_object_t *check = sdb_llist_shift(list); @@ -207,7 +207,7 @@ END_TEST START_TEST(test_iter) { sdb_llist_iter_t *iter; - int i; + size_t i; populate(); -- 2.30.2