|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| ConfigFiles/ | H | 06-Mar-2024 | - | 1,085 | 414 |
| FreeRTOS_ARP/ | H | 06-Mar-2024 | - | 2,060 | 1,330 |
| FreeRTOS_ARP_DataLenLessThanMinPacket/ | H | 06-Mar-2024 | - | 619 | 311 |
| FreeRTOS_DHCP/ | H | 06-Mar-2024 | - | 4,322 | 2,326 |
| FreeRTOS_DNS/ | H | 06-Mar-2024 | - | 821 | 495 |
| FreeRTOS_DNS_Cache/ | H | 06-Mar-2024 | - | 482 | 292 |
| FreeRTOS_DNS_Callback/ | H | 06-Mar-2024 | - | 587 | 356 |
| FreeRTOS_DNS_Networking/ | H | 06-Mar-2024 | - | 398 | 236 |
| FreeRTOS_DNS_Parser/ | H | 06-Mar-2024 | - | 2,002 | 1,355 |
| FreeRTOS_ICMP/ | H | 06-Mar-2024 | - | 535 | 330 |
| FreeRTOS_ICMP_wo_assert/ | H | 06-Mar-2024 | - | 407 | 239 |
| FreeRTOS_IP/ | H | 06-Mar-2024 | - | 3,413 | 2,266 |
| FreeRTOS_IP_DiffConfig/ | H | 06-Mar-2024 | - | 1,880 | 1,077 |
| FreeRTOS_IP_Timers/ | H | 06-Mar-2024 | - | 929 | 603 |
| FreeRTOS_IP_Utils/ | H | 06-Mar-2024 | - | 2,146 | 1,513 |
| FreeRTOS_IP_Utils_DiffConfig/ | H | 06-Mar-2024 | - | 908 | 411 |
| FreeRTOS_Sockets/ | H | 06-Mar-2024 | - | 9,457 | 5,940 |
| FreeRTOS_Sockets_DiffConfig/ | H | 06-Mar-2024 | - | 922 | 418 |
| FreeRTOS_Sockets_DiffConfig1/ | H | 06-Mar-2024 | - | 892 | 400 |
| FreeRTOS_Stream_Buffer/ | H | 06-Mar-2024 | - | 1,463 | 804 |
| FreeRTOS_TCP_IP/ | H | 06-Mar-2024 | - | 2,307 | 1,546 |
| FreeRTOS_TCP_IP_DiffConfig/ | H | 06-Mar-2024 | - | 907 | 400 |
| FreeRTOS_TCP_Reception/ | H | 06-Mar-2024 | - | 1,073 | 742 |
| FreeRTOS_TCP_State_Handling/ | H | 06-Mar-2024 | - | 1,943 | 1,393 |
| FreeRTOS_TCP_Transmission/ | H | 06-Mar-2024 | - | 2,113 | 1,588 |
| FreeRTOS_TCP_Utils/ | H | 06-Mar-2024 | - | 285 | 172 |
| FreeRTOS_TCP_WIN/ | H | 06-Mar-2024 | - | 3,026 | 2,119 |
| FreeRTOS_Tiny_TCP/ | H | 06-Mar-2024 | - | 1,176 | 700 |
| FreeRTOS_UDP_IP/ | H | 06-Mar-2024 | - | 1,182 | 705 |
| cmock/ | H | 06-Mar-2024 | - | 314 | 284 |
| CMakeLists.txt | HD | 06-Mar-2024 | 12.4 KiB | 244 | 199 |
| README.md | HD | 06-Mar-2024 | 4 KiB | 91 | 78 |
| TCPFilePaths.cmake | HD | 06-Mar-2024 | 2.3 KiB | 44 | 40 |
| catch_assert.h | HD | 06-Mar-2024 | 2.9 KiB | 78 | 39 |
| cmock_build.cmake | HD | 06-Mar-2024 | 2.1 KiB | 59 | 49 |
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 [[ ! -f FreeRTOS_IP.c ]]; 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