Name Date Size #Lines LOC

..--

ConfigFiles/H06-Mar-2024-1,090418

FreeRTOS_ARP/H06-Mar-2024-3,4342,251

FreeRTOS_ARP_DataLenLessThanMinPacket/H06-Mar-2024-710350

FreeRTOS_BitConfig/H06-Mar-2024-758451

FreeRTOS_DHCP/H06-Mar-2024-6,5213,673

FreeRTOS_DHCPv6/H06-Mar-2024-5,0943,270

FreeRTOS_DNS/H06-Mar-2024-2,7551,646

FreeRTOS_DNS_Cache/H06-Mar-2024-976621

FreeRTOS_DNS_Callback/H06-Mar-2024-730465

FreeRTOS_DNS_ConfigNoCallback/H06-Mar-2024-808368

FreeRTOS_DNS_Networking/H06-Mar-2024-415245

FreeRTOS_DNS_Parser/H06-Mar-2024-3,9542,586

FreeRTOS_ICMP/H06-Mar-2024-537331

FreeRTOS_ICMP_wo_assert/H06-Mar-2024-403237

FreeRTOS_IP/H06-Mar-2024-4,1192,377

FreeRTOS_IP_DiffConfig/H06-Mar-2024-1,387676

FreeRTOS_IP_DiffConfig1/H06-Mar-2024-1,455747

FreeRTOS_IP_DiffConfig2/H06-Mar-2024-957423

FreeRTOS_IP_DiffConfig3/H06-Mar-2024-1,020447

FreeRTOS_IP_Timers/H06-Mar-2024-1,349742

FreeRTOS_IP_Utils/H06-Mar-2024-3,7482,148

FreeRTOS_IP_Utils_DiffConfig/H06-Mar-2024-1,086484

FreeRTOS_IPv4/H06-Mar-2024-1,004598

FreeRTOS_IPv4_DiffConfig/H06-Mar-2024-993455

FreeRTOS_IPv4_DiffConfig1/H06-Mar-2024-1,307652

FreeRTOS_IPv4_Sockets/H06-Mar-2024-525335

FreeRTOS_IPv4_Utils/H06-Mar-2024-312199

FreeRTOS_IPv6/H06-Mar-2024-1,478741

FreeRTOS_IPv6_ConfigDriverCheckChecksum/H06-Mar-2024-952411

FreeRTOS_IPv6_Utils/H06-Mar-2024-1,255637

FreeRTOS_ND/H06-Mar-2024-2,1501,315

FreeRTOS_RA/H06-Mar-2024-1,478920

FreeRTOS_Routing/H06-Mar-2024-4,1782,029

FreeRTOS_Routing_ConfigCompatibleWithSingle/H06-Mar-2024-1,656729

FreeRTOS_Routing_ConfigV4Only/H06-Mar-2024-727289

FreeRTOS_Sockets/H06-Mar-2024-10,4826,520

FreeRTOS_Sockets_DiffConfig/H06-Mar-2024-878357

FreeRTOS_Sockets_DiffConfig1/H06-Mar-2024-889362

FreeRTOS_Sockets_DiffConfig2/H06-Mar-2024-1,394626

FreeRTOS_Sockets_IPv6/H06-Mar-2024-1,503894

FreeRTOS_Stream_Buffer/H06-Mar-2024-1,463804

FreeRTOS_TCP_IP/H06-Mar-2024-2,7721,720

FreeRTOS_TCP_IP_DiffConfig/H06-Mar-2024-956409

FreeRTOS_TCP_Reception/H06-Mar-2024-1,180807

FreeRTOS_TCP_State_Handling/H06-Mar-2024-2,0531,384

FreeRTOS_TCP_State_Handling_IPv4/H06-Mar-2024-536322

FreeRTOS_TCP_State_Handling_IPv6/H06-Mar-2024-612377

FreeRTOS_TCP_Transmission/H06-Mar-2024-2,7862,004

FreeRTOS_TCP_Transmission_IPv6/H06-Mar-2024-800487

FreeRTOS_TCP_Utils/H06-Mar-2024-372189

FreeRTOS_TCP_Utils_IPv6/H06-Mar-2024-231138

FreeRTOS_TCP_Utils_IPv6_ConfigLowTCPMSS/H06-Mar-2024-533200

FreeRTOS_TCP_WIN/H06-Mar-2024-3,0242,116

FreeRTOS_Tiny_TCP/H06-Mar-2024-1,184705

FreeRTOS_UDP_IP/H06-Mar-2024-459263

FreeRTOS_UDP_IPv4/H06-Mar-2024-2,4071,477

FreeRTOS_UDP_IPv6/H06-Mar-2024-2,1331,268

cmock/H06-Mar-2024-314284

CMakeLists.txtHD06-Mar-202418.4 KiB383336

README.mdHD06-Mar-20244 KiB9178

TCPFilePaths.cmakeHD06-Mar-20243.7 KiB6460

catch_assert.hHD06-Mar-20242.9 KiB7839

cmock_build.cmakeHD06-Mar-20242.1 KiB5949

README.md

1# Unit Tests for FreeRTOS-Plus-TCP library
2This directory is made for the purpose of Unit testing and tries to provide the tools for developing unit tests. To that end, this directory submodules the [CMock](https://github.com/ThrowTheSwitch/CMock) framework (which submodules [Unity](https://github.com/throwtheswitch/unity/tree/cf949f45ca6d172a177b00da2.3.1607b97bc7a7)) and the [FreeRTOS-Kernel](https://github.com/FreeRTOS/FreeRTOS-Kernel/).
3
4## Getting Started
5### Prerequisites
6You can run this on any GNU Make compatible systems. But in case of DOS based systems some tweaking is required with the makefile.
7To compile and run this project successfully, you must have the following:
81. Make (You can check whether you have this by typing `make --version`)
9    - Not found? Try `apt-get install make`.
102. Ruby (You can check whether you have this by typing `ruby --version`)
11    - Not found? Try `apt-get install ruby`.
123. CMake version > 3.13.0 (You can check whether you have this by typing `cmake --version`)
13    - Not found? Try `apt-get install cmake`
14    - Try the `cmake --version` command. If still the version number is >= 3.13.0, skip to (4.) or else, continue.
15    - You will need to get the latest CMake version using curl or wget (or similar command).
16        - Uninstall the current version of CMake using `sudo apt remove --purge --auto-remove cmake`.
17        - Download the 3.13.0 version using `wget https://cmake.org/files/v3.13/cmake-3.13.0.tar.gz`.
18        - Extract the cmake download using `tar -xzvf cmake-3.13.0.tar.gz`.
19        - Go to the extracted folder (`cd cmake-3.13.0`) and run `./bootstrap`.
20        - Run `make -j$(nproc)' and then run `sudo make install`.
21        - Check the version using `cmake --version` command.
224. lcov version 1.14 ( check with --version option )
23    - 'sudo apt-get install lcov'
245. unifdef version 2.10 ( check with -V option )
25    - 'sudo apt-get install unifdef'
266. Download the repo and include the submodules using the following commands.
27    - `git clone https://github.com/FreeRTOS/FreeRTOS.git ./FreeRTOS_Dir`
28    - `git submodule update --checkout --init --recursive tools/CMock test/FreeRTOS-Kernel`
29
30### To run the Unit tests:
31Go to the root directory of the FreeRTOS+TCP repo and run the following script:
32~~~
33#!/bin/bash
34# This script should be run from the root directory of the FreeRTOS+TCP repo.
35
36if [[ ! -d source ]]; then
37    echo "Please run this script from the root directory of the FreeRTOS+TCP repo."
38    exit 1
39fi
40
41UNIT_TEST_DIR="test/unit-test"
42BUILD_DIR="${UNIT_TEST_DIR}/build/"
43
44# Create the build directory using CMake:
45rm -rf ${BUILD_DIR}
46cmake -S ${UNIT_TEST_DIR} -B ${BUILD_DIR}
47
48# Create the executables:
49make -C ${BUILD_DIR} all
50
51pushd ${BUILD_DIR}
52# Run the tests for all units
53ctest -E system --output-on-failure
54popd
55
56# Calculate the coverage
57make -C ${BUILD_DIR} coverage
58lcov --list --rc lcov_branch_coverage=1 ${BUILD_DIR}coverage.info
59~~~
60
61You should see an output similar to this:
62
63```
64-----------------------
656 Tests 0 Failures 0 Ignored
66OK
67Capturing coverage data from .
68... <Skipped some lines here for the sake of brevity>
69Overall coverage rate:
70  lines......: 84.8% (56 of 66 lines)
71  functions..: 85.7% (12 of 14 functions)
72  branches...: 50.0% (2 of 4 branches)
73```
74
75And also:
76
77```
78Reading tracefile test/unit-test/build/coverage.info
79                                |Lines       |Functions  |Branches
80Filename                        |Rate     Num|Rate    Num|Rate     Num
81======================================================================
82[/home/hein/freertos_plus_tcp/]
83FreeRTOS_ARP.c                  | 100%    238| 100%    14|99.3%    137
84FreeRTOS_DHCP.c                 |98.7%    314|92.9%    14| 100%    150
85FreeRTOS_Sockets.c              | 3.5%   1150| 1.6%    61| 4.2%    722
86FreeRTOS_Stream_Buffer.c        | 100%    107| 100%    12| 100%     54
87FreeRTOS_UDP_IP.c               | 100%     97| 100%     2| 100%     58
88======================================================================
89                          Total:|41.6%   1906|40.8%   103|38.2%   1121
90```
91