Skip to content
Open
Show file tree
Hide file tree
Changes from 98 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
5f02028
Added Common++ unit test project based on Gtest.
Dimi1010 Jul 21, 2024
0687ddd
Fixed includes.
Dimi1010 Jul 21, 2024
a004e3c
Changed gtest version to 1.12 which is the last to support Cpp11.
Dimi1010 Jul 21, 2024
94a3b0e
Added Gmock in addition to Gtest.
Dimi1010 Jul 21, 2024
be20d78
Added IPv6 tests.
Dimi1010 Jul 21, 2024
3395ac7
Added IPAddress tests.
Dimi1010 Jul 21, 2024
55fdf10
Lint
Dimi1010 Jul 21, 2024
f447d9c
Fixed matcher error.
Dimi1010 Jul 21, 2024
5b37a1f
Added _ipv4 and _ipv6 string literals.
Dimi1010 Jul 21, 2024
12e4599
Added IPv4 Network unit tests.
Dimi1010 Jul 21, 2024
0f20bb9
Added IPv6 Network unit tests.
Dimi1010 Jul 21, 2024
a2718d8
Added IPNetwork unit tests.
Dimi1010 Jul 21, 2024
e29190a
Added more unit tests.
Dimi1010 Jul 22, 2024
0f3f927
Added IP(v4/v6)Address match network tests.
Dimi1010 Jul 22, 2024
c8d04de
Lint
Dimi1010 Jul 22, 2024
a67ebe7
Added MacAddress constructor from std::array.
Dimi1010 Jul 22, 2024
a93a202
Added MacAddress unit tests.
Dimi1010 Jul 22, 2024
66d1937
Added MacAddress tests for output to stream.
Dimi1010 Jul 22, 2024
aa92f72
Added unit tests for PointerVector and test fixture with built-in mem…
Dimi1010 Jul 22, 2024
d191cdb
Lint
Dimi1010 Jul 22, 2024
bd8ecd9
Included 'googletest' configuration for cppcheck.
Dimi1010 Jul 24, 2024
70708fd
Fixed include of MemoryLeakDetectorFixture... hopefully the correct way.
Dimi1010 Jul 24, 2024
d45b54d
Fixed wrong variable assert.
Dimi1010 Jul 24, 2024
a9cd1b8
Added unit test for functions in the general utilities header.
Dimi1010 Jul 24, 2024
4803471
Added unit tests for LRUList.
Dimi1010 Jul 24, 2024
9e77c18
Lint
Dimi1010 Jul 24, 2024
63a8fbe
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Jul 30, 2024
d503bcd
Added cast to ptr type because direct nullptr is deleted function.
Dimi1010 Jul 30, 2024
bf9c3ca
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Aug 15, 2024
f1baa83
Lint
Dimi1010 Aug 15, 2024
6b50130
Fixed issue with temporary.
Dimi1010 Aug 15, 2024
706fb4b
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Sep 7, 2024
012df84
Lint - hopefully.
Dimi1010 Sep 7, 2024
e875c0b
Pulled operator << overloads into the 'pcpp' namespace to leverage AD…
Dimi1010 Sep 8, 2024
3a97325
Renamed MacAddress ToStream test to be consistent with IPAddress test…
Dimi1010 Sep 8, 2024
f07b0bf
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Sep 8, 2024
01b5cc1
CMakeLists lint...
Dimi1010 Sep 8, 2024
ddf1d3a
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Oct 24, 2024
c20e5d3
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Nov 5, 2024
4b71919
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Nov 14, 2024
2c461f0
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Jan 22, 2025
db34edb
Split common unit tests into smaller tests.
Dimi1010 Jan 22, 2025
84d7d32
Added const qualifier to MacAddress::Zero.
Dimi1010 Jan 22, 2025
e9f7930
Lint
Dimi1010 Jan 22, 2025
1b02e45
Added basic single threaded logger unit tests.
Dimi1010 Jan 22, 2025
b09fc3c
Simplified logger fixture setup and teardown.
Dimi1010 Jan 23, 2025
977abb4
Added explicit main file.
Dimi1010 Jan 23, 2025
67c6a22
Added conditional skipping of memory leak checks for MSVC Release bui…
Dimi1010 Jan 23, 2025
e5cf5fb
Added build information to the test executable.
Dimi1010 Jan 23, 2025
5076d29
Added tests for CoreMask transformations.
Dimi1010 Jan 23, 2025
4d0c5d1
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Jan 23, 2025
d7046d7
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Apr 3, 2025
3fa3dfd
Removed make_unique usage.
Dimi1010 Apr 3, 2025
fc0ea18
Lint
Dimi1010 Apr 3, 2025
3c7285b
Added const to MacAddress::Broadcast static variable.
Dimi1010 Apr 3, 2025
e45d5a9
Added Broadcast unit test.
Dimi1010 Apr 3, 2025
6a88fd8
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Jun 28, 2025
6fb03e8
Bump googletest to v1.16.0
Dimi1010 Jun 28, 2025
6722666
Added unit tests for DynamicObjectPool
Dimi1010 Jun 28, 2025
453943a
cmake formatting.
Dimi1010 Jun 28, 2025
21f16f5
Include cleanup
Dimi1010 Jun 28, 2025
4df5ddb
Added precompiled header
Dimi1010 Jun 28, 2025
2b9a148
Added unit tests for timespec to timeval conversions.
Dimi1010 Jun 28, 2025
3b4d4d3
Updated logger tests.
Dimi1010 Jun 28, 2025
782623d
Lint
Dimi1010 Jun 28, 2025
62d48da
Version print formatting.
Dimi1010 Jun 28, 2025
58aa8ec
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Jul 12, 2025
bf81cbe
Added todo for googletest fetch content.
Dimi1010 Jul 12, 2025
5f8a763
Added common unit test to run_tests CI script.
Dimi1010 Jul 12, 2025
37cb883
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Jul 12, 2025
dae7b6b
Lint
Dimi1010 Jul 12, 2025
40efcd5
Updated packet only to run common + packet suites.
Dimi1010 Jul 12, 2025
b76fa62
Fixed explicit ctor
Dimi1010 Jul 12, 2025
247da32
Updated run_tests_windows to have separate functions for calls to sub…
Dimi1010 Jul 12, 2025
463b632
Added common test to windows CI.
Dimi1010 Jul 12, 2025
bc03910
Lint
Dimi1010 Jul 12, 2025
44f6094
Delayed startup of tcpreplay until pcap++ tests.
Dimi1010 Jul 12, 2025
3d57ddd
Added tests for new functions.
Dimi1010 Jul 12, 2025
00e8f94
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Jul 29, 2025
2b9a0ba
Fixed memory leak fixture not respecting mem leak checks.
Dimi1010 Jul 29, 2025
7a1d6d7
Changed MemoryLeak Fixture to default fixture under TEST macro.
Dimi1010 Jul 29, 2025
a3fddb8
Temporarely disabled memory leak fixture testing due to false positiv…
Dimi1010 Jul 29, 2025
68eaf83
Changed MemoryLeakFixture into a gtest listener.
Dimi1010 Jul 29, 2025
36bea65
Updated log tests to utilize functor object instead of static function.
Dimi1010 Jul 29, 2025
480f802
Reverted on test end back to free all memory.
Dimi1010 Jul 29, 2025
86a0e5b
Fixed visibility.
Dimi1010 Aug 1, 2025
a6cd38b
Lint
Dimi1010 Aug 1, 2025
5d8e0af
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Aug 2, 2025
ac73ed8
Fix cppcheck warnings.
Dimi1010 Aug 2, 2025
1e0df40
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Aug 2, 2025
532678a
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Aug 3, 2025
fc2873d
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Aug 4, 2025
a0f005a
Commented out memory leak warning as it is disabled in all modes.
Dimi1010 Aug 4, 2025
789a17e
Added googletest 1.16 to 3rdParty dependencies.
Dimi1010 Aug 4, 2025
9b4db8b
Added googletest to pre-commit exclusions.
Dimi1010 Aug 4, 2025
888a5a1
Fixup regex string.
Dimi1010 Aug 4, 2025
c98dff8
Disabled clang format for commented line.
Dimi1010 Aug 4, 2025
3f78f4d
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Aug 8, 2025
5e477f1
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Sep 11, 2025
29ff777
Merge remote-tracking branch 'upstream/dev' into feature/gtest-framework
Dimi1010 Sep 14, 2025
449c523
Revert "Added googletest 1.16 to 3rdParty dependencies."
Dimi1010 Sep 14, 2025
340e2af
Merge branch 'dev' into feature/gtest-framework
Dimi1010 Sep 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
- name: Test PcapPlusPlus
run: |
. .venv/bin/activate
python3 ci/run_tests/run_tests.py --interface eth0 --test-suites "packet"
python3 ci/run_tests/run_tests.py --interface eth0 --test-suites "common" "packet"

- name: Check installation
run: |
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: '.*\.(pcap|pcapng|dat)|(PacketExamples|PcapExamples|expected_output|pcap_examples).*\.txt'
exclude: '.*\.(pcap|pcapng|dat)|(PacketExamples|PcapExamples|expected_output|pcap_examples).*\.txt|3rdParty/googletest-1.16.0/googletest/'
fail_fast: false
repos:
- repo: local
Expand Down Expand Up @@ -36,7 +36,7 @@ repos:
args: ["--style=file", "-i"] # Use the .clang-format file for configuration and apply all fixes
files: ^(Common\+\+|Packet\+\+|Pcap\+\+|Tests|Examples)/.*\.(cpp|h)$
- id: cppcheck
args: ["--std=c++14", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"]
args: ["--std=c++14", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force", "--library=googletest"]
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.21.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions 3rdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_subdirectory(hash-library)
add_subdirectory(json)
add_subdirectory(LightPcapNg)
add_subdirectory(MemPlumber/MemPlumber)
add_subdirectory(googletest-1.16.0)

if(PCAPPP_INSTALL)
install(
Expand Down
11 changes: 11 additions & 0 deletions 3rdParty/googletest-1.16.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.14)

if(WIN32)
# Prevent overriding the parent project's compiler/linker settings.
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()

# Disable installation of googletest
set(INSTALL_GTEST OFF)

add_subdirectory(googletest)
89 changes: 89 additions & 0 deletions 3rdParty/googletest-1.16.0/googletest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Ignore CI build directory
build/
xcuserdata
cmake-build-debug/
.idea/
bazel-bin
bazel-genfiles
bazel-googletest
bazel-out
bazel-testlogs
MODULE.bazel.lock
# python
*.pyc

# Visual Studio files
.vs
*.sdf
*.opensdf
*.VC.opendb
*.suo
*.user
_ReSharper.Caches/
Win32-Debug/
Win32-Release/
x64-Debug/
x64-Release/

# VSCode files
.cache/
cmake-variants.yaml

# Ignore autoconf / automake files
Makefile.in
aclocal.m4
configure
build-aux/
autom4te.cache/
googletest/m4/libtool.m4
googletest/m4/ltoptions.m4
googletest/m4/ltsugar.m4
googletest/m4/ltversion.m4
googletest/m4/lt~obsolete.m4
googlemock/m4

# Ignore generated directories.
googlemock/fused-src/
googletest/fused-src/

# macOS files
.DS_Store
googletest/.DS_Store
googletest/xcode/.DS_Store

# Ignore cmake generated directories and files.
CMakeFiles
CTestTestfile.cmake
Makefile
cmake_install.cmake
googlemock/CMakeFiles
googlemock/CTestTestfile.cmake
googlemock/Makefile
googlemock/cmake_install.cmake
googlemock/gtest
/bin
/googlemock/gmock.dir
/googlemock/gmock_main.dir
/googlemock/RUN_TESTS.vcxproj.filters
/googlemock/RUN_TESTS.vcxproj
/googlemock/INSTALL.vcxproj.filters
/googlemock/INSTALL.vcxproj
/googlemock/gmock_main.vcxproj.filters
/googlemock/gmock_main.vcxproj
/googlemock/gmock.vcxproj.filters
/googlemock/gmock.vcxproj
/googlemock/gmock.sln
/googlemock/ALL_BUILD.vcxproj.filters
/googlemock/ALL_BUILD.vcxproj
/lib
/Win32
/ZERO_CHECK.vcxproj.filters
/ZERO_CHECK.vcxproj
/RUN_TESTS.vcxproj.filters
/RUN_TESTS.vcxproj
/INSTALL.vcxproj.filters
/INSTALL.vcxproj
/googletest-distribution.sln
/CMakeCache.txt
/ALL_BUILD.vcxproj.filters
/ALL_BUILD.vcxproj
36 changes: 36 additions & 0 deletions 3rdParty/googletest-1.16.0/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Note: CMake support is community-based. The maintainers do not use CMake
# internally.

cmake_minimum_required(VERSION 3.13)

project(googletest-distribution)
set(GOOGLETEST_VERSION 1.16.0)

if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

enable_testing()

include(CMakeDependentOption)
include(GNUInstallDirs)

# Note that googlemock target already builds googletest.
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
option(GTEST_HAS_ABSL "Use Abseil and RE2. Requires Abseil and RE2 to be separately added to the build." OFF)

if(GTEST_HAS_ABSL)
if(NOT TARGET absl::base)
find_package(absl REQUIRED)
endif()
if(NOT TARGET re2::re2)
find_package(re2 REQUIRED)
endif()
endif()

if(BUILD_GMOCK)
add_subdirectory( googlemock )
else()
add_subdirectory( googletest )
endif()
141 changes: 141 additions & 0 deletions 3rdParty/googletest-1.16.0/googletest/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# How to become a contributor and submit your own code

## Contributor License Agreements

We'd love to accept your patches! Before we can take them, we have to jump a
couple of legal hurdles.

Please fill out either the individual or corporate Contributor License Agreement
(CLA).

* If you are an individual writing original source code and you're sure you
own the intellectual property, then you'll need to sign an
[individual CLA](https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work,
then you'll need to sign a
[corporate CLA](https://developers.google.com/open-source/cla/corporate).

Follow either of the two links above to access the appropriate CLA and
instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.

## Are you a Googler?

If you are a Googler, please make an attempt to submit an internal contribution
rather than a GitHub Pull Request. If you are not able to submit internally, a
PR is acceptable as an alternative.

## Contributing A Patch

1. Submit an issue describing your proposed change to the
[issue tracker](https://github.com/google/googletest/issues).
2. Please don't mix more than one logical change per submittal, because it
makes the history hard to follow. If you want to make a change that doesn't
have a corresponding issue in the issue tracker, please create one.
3. Also, coordinate with team members that are listed on the issue in question.
This ensures that work isn't being duplicated and communicating your plan
early also generally leads to better patches.
4. If your proposed change is accepted, and you haven't already done so, sign a
Contributor License Agreement
([see details above](#contributor-license-agreements)).
5. Fork the desired repo, develop and test your code changes.
6. Ensure that your code adheres to the existing style in the sample to which
you are contributing.
7. Ensure that your code has an appropriate set of unit tests which all pass.
8. Submit a pull request.

## The Google Test and Google Mock Communities

The Google Test community exists primarily through the
[discussion group](https://groups.google.com/group/googletestframework) and the
GitHub repository. Likewise, the Google Mock community exists primarily through
their own [discussion group](https://groups.google.com/group/googlemock). You
are definitely encouraged to contribute to the discussion and you can also help
us to keep the effectiveness of the group high by following and promoting the
guidelines listed here.

### Please Be Friendly

Showing courtesy and respect to others is a vital part of the Google culture,
and we strongly encourage everyone participating in Google Test development to
join us in accepting nothing less. Of course, being courteous is not the same as
failing to constructively disagree with each other, but it does mean that we
should be respectful of each other when enumerating the 42 technical reasons
that a particular proposal may not be the best choice. There's never a reason to
be antagonistic or dismissive toward anyone who is sincerely trying to
contribute to a discussion.

Sure, C++ testing is serious business and all that, but it's also a lot of fun.
Let's keep it that way. Let's strive to be one of the friendliest communities in
all of open source.

As always, discuss Google Test in the official GoogleTest discussion group. You
don't have to actually submit code in order to sign up. Your participation
itself is a valuable contribution.

## Style

To keep the source consistent, readable, diffable and easy to merge, we use a
fairly rigid coding style, as defined by the
[google-styleguide](https://github.com/google/styleguide) project. All patches
will be expected to conform to the style outlined
[here](https://google.github.io/styleguide/cppguide.html). Use
[.clang-format](https://github.com/google/googletest/blob/main/.clang-format) to
check your formatting.

## Requirements for Contributors

If you plan to contribute a patch, you need to build Google Test, Google Mock,
and their own tests from a git checkout, which has further requirements:

* [Python](https://www.python.org/) v3.6 or newer (for running some of the
tests and re-generating certain source files from templates)
* [CMake](https://cmake.org/) v2.8.12 or newer

## Developing Google Test and Google Mock

This section discusses how to make your own changes to the Google Test project.

### Testing Google Test and Google Mock Themselves

To make sure your changes work as intended and don't break existing
functionality, you'll want to compile and run Google Test and GoogleMock's own
tests. For that you can use CMake:

```
mkdir mybuild
cd mybuild
cmake -Dgtest_build_tests=ON -Dgmock_build_tests=ON ${GTEST_REPO_DIR}
```

To choose between building only Google Test or Google Mock, you may modify your
cmake command to be one of each

```
cmake -Dgtest_build_tests=ON ${GTEST_DIR} # sets up Google Test tests
cmake -Dgmock_build_tests=ON ${GMOCK_DIR} # sets up Google Mock tests
```

Make sure you have Python installed, as some of Google Test's tests are written
in Python. If the cmake command complains about not being able to find Python
(`Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)`), try telling it
explicitly where your Python executable can be found:

```
cmake -DPYTHON_EXECUTABLE=path/to/python ...
```

Next, you can build Google Test and / or Google Mock and all desired tests. On
\*nix, this is usually done by

```
make
```

To run the tests, do

```
make test
```

All tests should pass.
66 changes: 66 additions & 0 deletions 3rdParty/googletest-1.16.0/googletest/CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This file contains a list of people who've made non-trivial
# contribution to the Google C++ Testing Framework project. People
# who commit code to the project are encouraged to add their names
# here. Please keep the list sorted by first names.

Ajay Joshi <[email protected]>
Balázs Dán <[email protected]>
Benoit Sigoure <[email protected]>
Bharat Mediratta <[email protected]>
Bogdan Piloca <[email protected]>
Chandler Carruth <[email protected]>
Chris Prince <[email protected]>
Chris Taylor <[email protected]>
Dan Egnor <[email protected]>
Dave MacLachlan <[email protected]>
David Anderson <[email protected]>
Dean Sturtevant
Eric Roman <[email protected]>
Gene Volovich <[email protected]>
Hady Zalek <[email protected]>
Hal Burch <[email protected]>
Jeffrey Yasskin <[email protected]>
Jim Keller <[email protected]>
Joe Walnes <[email protected]>
Jon Wray <[email protected]>
Jói Sigurðsson <[email protected]>
Keir Mierle <[email protected]>
Keith Ray <[email protected]>
Kenton Varda <[email protected]>
Kostya Serebryany <[email protected]>
Krystian Kuzniarek <[email protected]>
Lev Makhlis
Manuel Klimek <[email protected]>
Mario Tanev <[email protected]>
Mark Paskin
Markus Heule <[email protected]>
Martijn Vels <[email protected]>
Matthew Simmons <[email protected]>
Mika Raento <[email protected]>
Mike Bland <[email protected]>
Miklós Fazekas <[email protected]>
Neal Norwitz <[email protected]>
Nermin Ozkiranartli <[email protected]>
Owen Carlsen <[email protected]>
Paneendra Ba <[email protected]>
Pasi Valminen <[email protected]>
Patrick Hanna <[email protected]>
Patrick Riley <[email protected]>
Paul Menage <[email protected]>
Peter Kaminski <[email protected]>
Piotr Kaminski <[email protected]>
Preston Jackson <[email protected]>
Rainer Klaffenboeck <[email protected]>
Russ Cox <[email protected]>
Russ Rufer <[email protected]>
Sean Mcafee <[email protected]>
Sigurður Ásgeirsson <[email protected]>
Soyeon Kim <[email protected]>
Sverre Sundsdal <[email protected]>
Szymon Sobik <[email protected]>
Takeshi Yoshino <[email protected]>
Tracy Bialik <[email protected]>
Vadim Berman <[email protected]>
Vlad Losev <[email protected]>
Wolfgang Klier <[email protected]>
Zhanyong Wan <[email protected]>
Loading
Loading