Skip to content

Commit 8d2d948

Browse files
authored
Merge pull request #119 from danielinux/unit-test-cases
Added new clusters of unit tests, removed dead branches
2 parents d96ccb3 + ab57a34 commit 8d2d948

23 files changed

Lines changed: 13016 additions & 15 deletions

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,15 @@ UNIT_TEST_SRCS:=src/test/unit/unit.c \
439439
src/test/unit/unit_tests_tcp_flow.c \
440440
src/test/unit/unit_tests_proto.c \
441441
src/test/unit/unit_tests_multicast.c \
442-
src/test/unit/unit_tests_tftp.c
442+
src/test/unit/unit_tests_tftp.c \
443+
src/test/unit/unit_tests_branches.c \
444+
src/test/unit/unit_tests_socket_api_arms.c \
445+
src/test/unit/unit_tests_tcp_state.c \
446+
src/test/unit/unit_tests_poll_dispatcher.c \
447+
src/test/unit/unit_tests_dhcp_edges.c \
448+
src/test/unit/unit_tests_ip_arp_recv.c \
449+
src/test/unit/unit_tests_dns_edges.c \
450+
src/test/unit/unit_tests_misc_edges.c
443451

444452
unit: build/test/unit
445453

@@ -574,6 +582,18 @@ autocov-multicast: unit-multicast $(COV_MCAST_UNIT)
574582
--merge-mode-functions=merge-use-line-min \
575583
--html-details -o build/coverage/multicast.html
576584

585+
cov-multicast: unit-multicast $(COV_MCAST_UNIT)
586+
@echo "[RUN] unit multicast (coverage)"
587+
@rm -f $(COV_DIR)/*.gcda
588+
@$(COV_MCAST_UNIT)
589+
@echo "[COV] gcovr multicast html"
590+
@mkdir -p build/coverage
591+
@gcovr -r . --exclude "src/test/unit/.*" \
592+
--gcov-ignore-errors=no_working_dir_found \
593+
--merge-mode-functions=merge-use-line-min \
594+
--html-details -o build/coverage/multicast.html
595+
@$(OPEN_CMD) build/coverage/multicast.html
596+
577597
# Install dynamic library to re-link linux applications
578598
#
579599
install:
@@ -672,7 +692,7 @@ build/test/test-wolfguard-interop: src/test/test_wolfguard_interop.c src/port/po
672692
clean-test-wolfguard-interop:
673693
@rm -f build/test/test-wolfguard-interop build/test/test_wolfguard_interop.o build/test/linux_tun.o
674694

675-
.PHONY: clean all static cppcheck cov autocov autocov-multicast unit-multicast unit-asan unit-ubsan unit-leaksan clean-unit \
695+
.PHONY: clean all static cppcheck cov autocov autocov-multicast cov-multicast unit-multicast unit-asan unit-ubsan unit-leaksan clean-unit \
676696
unit-esp-asan unit-esp-ubsan unit-esp-leaksan clean-unit-esp \
677697
unit-wolfguard unit-wolfguard-asan unit-wolfguard-ubsan clean-unit-wolfguard \
678698
test-wolfguard-loopback test-wolfguard-loopback-asan test-wolfguard-loopback-ubsan \

src/test/unit/unit.c

Lines changed: 572 additions & 0 deletions
Large diffs are not rendered by default.

src/test/unit/unit_esp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* unit_esp.c
22
*
3-
* Copyright (C) 2026 wolfSSL Inc.
3+
* Copyright (C) 2024 wolfSSL Inc.
44
*
55
* This file is part of wolfIP TCP/IP stack.
66
*
@@ -18,7 +18,6 @@
1818
* along with this program; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*/
21-
2221
#ifndef WOLFIP_ESP
2322
#define WOLFIP_ESP
2423
#endif

src/test/unit/unit_noeth.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/* unit_noeth.c
2+
*
3+
* Copyright (C) 2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfIP TCP/IP stack.
6+
*
7+
* wolfIP is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfIP is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
122
#include "../../../config.h"
223
#ifdef ETHERNET
324
#undef ETHERNET

src/test/unit/unit_shared.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* unit_shared.c
22
*
3-
* Copyright (C) 2026 wolfSSL Inc.
3+
* Copyright (C) 2024 wolfSSL Inc.
44
*
55
* This file is part of wolfIP TCP/IP stack.
66
*

src/test/unit/unit_tests_api.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
/* unit_tests_api.c
2+
*
3+
* Copyright (C) 2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfIP TCP/IP stack.
6+
*
7+
* wolfIP is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfIP is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
122
static struct wolfIP *poll_rearm_stack;
223
static int poll_rearm_cb_calls;
324
static int poll_rearm_recv_len;

0 commit comments

Comments
 (0)