summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2015-04-21 10:02:23 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-05-26 17:33:29 +0200
commit9fc3f9b382e354fcdcd9e8cc202ab2c576d1b162 (patch)
treec4933bcbf824d723d85040d74cf6c6e2ef23ea92 /tests
parentzebra: silence zebra_serv_un unused warning (diff)
downloadfrr-9fc3f9b382e354fcdcd9e8cc202ab2c576d1b162.tar.xz
frr-9fc3f9b382e354fcdcd9e8cc202ab2c576d1b162.zip
tests: fix warnings
While I don't see -Werror being used on tests anytime soon, there's no reason to keep the warnings in tests unfixed. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit c313895dec3c176584d99f7b8684ddc3f9141d88)
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/bgp_mp_attr_test.c2
-rw-r--r--tests/bgp_mpath_test.c2
-rw-r--r--tests/ecommunity_test.c2
-rw-r--r--tests/heavy-thread.c2
-rw-r--r--tests/heavy-wq.c2
-rw-r--r--tests/heavy.c2
-rw-r--r--tests/main.c2
-rw-r--r--tests/test-checksum.c35
-rw-r--r--tests/test-segv.c2
-rw-r--r--tests/test-sig.c6
-rw-r--r--tests/test-timer-correctness.c9
-rw-r--r--tests/tests.h31
13 files changed, 53 insertions, 48 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7e9ebd060..bf1a912f2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,14 +33,14 @@ check_PROGRAMS = testsig testsegv testbuffer testmemory heavy heavywq heavythrea
test-commands-defun.c: ../vtysh/vtysh_cmd.c
sed \
- -e '/"vtysh.h"/d' \
+ -e 's/"vtysh\.h"/"tests.h"/' \
-e 's/vtysh_init_cmd/test_init_cmd/' \
-e 's/VTYSH_[A-Z][A-Z_0-9]*/0/g' \
< ../vtysh/vtysh_cmd.c \
> test-commands-defun.c
BUILT_SOURCES = test-commands-defun.c
-noinst_HEADERS = prng.h
+noinst_HEADERS = prng.h tests.h
testsig_SOURCES = test-sig.c
testsegv_SOURCES = test-segv.c
diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c
index bf3d0a9c6..ba619916d 100644
--- a/tests/bgp_mp_attr_test.c
+++ b/tests/bgp_mp_attr_test.c
@@ -543,7 +543,7 @@ main (void)
return -1;
peer = peer_create_accept (bgp);
- peer->host = "foo";
+ peer->host = (char *)"foo";
for (i = AFI_IP; i < AFI_MAX; i++)
for (j = SAFI_UNICAST; j < SAFI_MAX; j++)
diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c
index 1c6eaf7cb..af62308b8 100644
--- a/tests/bgp_mpath_test.c
+++ b/tests/bgp_mpath_test.c
@@ -250,7 +250,7 @@ run_bgp_mp_list (testcase_t *t)
bgp_mp_list_add (&mp_list, &test_mp_list_info[3]);
bgp_mp_list_add (&mp_list, &test_mp_list_info[0]);
- for (i = 0, mp_node = listhead(&mp_list); i < test_mp_list_info_count;
+ for (i = 0, mp_node = mp_list.head; i < test_mp_list_info_count;
i++, mp_node = listnextnode(mp_node))
{
info = listgetdata(mp_node);
diff --git a/tests/ecommunity_test.c b/tests/ecommunity_test.c
index 604a83bd8..1d4f6a186 100644
--- a/tests/ecommunity_test.c
+++ b/tests/ecommunity_test.c
@@ -133,7 +133,7 @@ parse_test (struct test_segment *t)
printf ("%s: %s\n", t->name, t->desc);
- ecom = ecommunity_parse (t->data, t->len);
+ ecom = ecommunity_parse ((u_int8_t *)t->data, t->len);
printf ("ecom: %s\nvalidating...:\n", ecommunity_str (ecom));
diff --git a/tests/heavy-thread.c b/tests/heavy-thread.c
index cd3a3b9d0..c2e71c17d 100644
--- a/tests/heavy-thread.c
+++ b/tests/heavy-thread.c
@@ -37,6 +37,8 @@
#include "memory.h"
#include "log.h"
+#include "tests.h"
+
extern struct thread_master *master;
enum
diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c
index e5f688c21..2f133cc5d 100644
--- a/tests/heavy-wq.c
+++ b/tests/heavy-wq.c
@@ -36,6 +36,8 @@
#include "workqueue.h"
#include <math.h>
+#include "tests.h"
+
extern struct thread_master *master;
static struct work_queue *heavy_wq;
diff --git a/tests/heavy.c b/tests/heavy.c
index 577a4816f..9af46c88f 100644
--- a/tests/heavy.c
+++ b/tests/heavy.c
@@ -36,6 +36,8 @@
#include "memory.h"
#include <math.h>
+#include "tests.h"
+
enum
{
ITERS_FIRST = 0,
diff --git a/tests/main.c b/tests/main.c
index 5e7bdcb15..5396c7d50 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -52,7 +52,7 @@ DEFUN (daemon_exit,
}
static int timer_count;
-int
+static int
test_timer (struct thread *thread)
{
int *count = THREAD_ARG(thread);
diff --git a/tests/test-checksum.c b/tests/test-checksum.c
index 9672e95a1..b6741f305 100644
--- a/tests/test-checksum.c
+++ b/tests/test-checksum.c
@@ -46,41 +46,6 @@ typedef uint16_t testoff_t;
/* Fletcher Checksum -- Refer to RFC1008. */
#define MODX 4102
-/* Accumulator phase of checksum */
-static
-struct acc_vals
-accumulate (u_char *buffer, testsz_t len, testoff_t off)
-{
- u_int8_t *p;
- u_int16_t *csum;
- int i, partial_len;
- struct acc_vals ret;
-
- csum = (u_int16_t *) (buffer + off);
- *(csum) = 0;
-
- p = buffer;
- ret.c0 = 0;
- ret.c1 = 0;
-
- while (len != 0)
- {
- partial_len = MIN(len, MODX);
-
- for (i = 0; i < partial_len; i++)
- {
- ret.c0 = ret.c0 + *(p++);
- ret.c1 += ret.c0;
- }
-
- ret.c0 = ret.c0 % 255;
- ret.c1 = ret.c1 % 255;
-
- len -= partial_len;
- }
- return ret;
-}
-
/* The final reduction phase.
* This one should be the original ospfd version
*/
diff --git a/tests/test-segv.c b/tests/test-segv.c
index 87692e7b6..1810c5f4b 100644
--- a/tests/test-segv.c
+++ b/tests/test-segv.c
@@ -35,7 +35,7 @@ struct quagga_signal_t sigs[] =
struct thread_master *master;
-int
+static int
threadfunc (struct thread *thread)
{
int *null = NULL;
diff --git a/tests/test-sig.c b/tests/test-sig.c
index d80f3900e..4a0424030 100644
--- a/tests/test-sig.c
+++ b/tests/test-sig.c
@@ -22,19 +22,19 @@
#include "lib/log.h"
#include "lib/memory.h"
-void
+static void
sighup (void)
{
printf ("processed hup\n");
}
-void
+static void
sigusr1 (void)
{
printf ("processed usr1\n");
}
-void
+static void
sigusr2 (void)
{
printf ("processed usr2\n");
diff --git a/tests/test-timer-correctness.c b/tests/test-timer-correctness.c
index 94c8f1df2..47c0b7376 100644
--- a/tests/test-timer-correctness.c
+++ b/tests/test-timer-correctness.c
@@ -140,8 +140,9 @@ int main(int argc, char **argv)
interval_msec = prng_rand(prng) % 5000;
arg = XMALLOC(MTYPE_TMP, TIMESTR_LEN + 1);
timers[i] = thread_add_timer_msec(master, timer_func, arg, interval_msec);
- ret = snprintf(arg, TIMESTR_LEN + 1, "%ld.%06ld",
- timers[i]->u.sands.tv_sec, timers[i]->u.sands.tv_usec);
+ ret = snprintf(arg, TIMESTR_LEN + 1, "%lld.%06lld",
+ (long long)timers[i]->u.sands.tv_sec,
+ (long long)timers[i]->u.sands.tv_usec);
assert(ret > 0);
assert((size_t)ret < TIMESTR_LEN + 1);
timers_pending++;
@@ -180,7 +181,9 @@ int main(int argc, char **argv)
ret = snprintf(expected_buf + expected_buf_pos,
expected_buf_len - expected_buf_pos,
- "%ld.%06ld\n", alarms[i]->tv_sec, alarms[i]->tv_usec);
+ "%lld.%06lld\n",
+ (long long)alarms[i]->tv_sec,
+ (long long)alarms[i]->tv_usec);
assert(ret > 0);
expected_buf_pos += ret;
assert(expected_buf_pos < expected_buf_len);
diff --git a/tests/tests.h b/tests/tests.h
new file mode 100644
index 000000000..a528e55f0
--- /dev/null
+++ b/tests/tests.h
@@ -0,0 +1,31 @@
+/*
+ * Test wrappers common header file
+ *
+ * Copyright (C) 2015 by David Lamparter,
+ * for Open Source Routing./ NetDEF, Inc.
+ *
+ * This file is part of Quagga
+ *
+ * Quagga is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * Quagga is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Quagga; see the file COPYING. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _QUAGGA_TESTS_H
+#define _QUAGGA_TESTS_H
+
+extern void test_init (void);
+extern void test_init_cmd (void);
+
+#endif /* _QUAGGA_TESTS_H */