Skip to content

Commit

Permalink
Merge branch 'seladb:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
kolbex authored Apr 1, 2023
2 parents 30fa58a + f132cda commit 8fa9f6f
Show file tree
Hide file tree
Showing 592 changed files with 197,506 additions and 55,583 deletions.
89 changes: 63 additions & 26 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
env:
BUILD_DIR: "build"
GCOVR_FLAGS: "--gcov-ignore-parse-errors --exclude-throw-branches --filter Common --filter Pcap --filter Packet --xml"

task:
name: Test FreeBSD
freebsd_instance:
matrix:
image_family: freebsd-12-3
image_family: freebsd-13-0
install_script:
- pkg install -y libpcap bash gsed gmake tcpreplay
- pkg install -y bash cmake git gmake gsed libpcap tcpreplay
configure_script:
- ./configure-freebsd.sh --default
# Ensure user have access to network devices instead of giving super-user right
- chmod a+rw /dev/bpf*
- cmake -S . -B Dist
build_script:
- gmake all
- cmake --build Dist -j 2
test_pcapplusplus_script:
- ifconfig vtnet0 promisc
- python -m ensurepip
Expand All @@ -19,60 +25,91 @@ task:
- cd Tests/ExamplesTest
- python -m ensurepip
- python -m pip install -r requirements.txt
- python -m pytest --interface vtnet0 --use-sudo
- python -m pytest --interface vtnet0 --root-path=../../Dist/examples_bin

task:
name: Test Zstd Linux
container:
image: seladb/ubuntu2004-zstd:latest
configure_script:
- ./configure-linux.sh --use-zstd
- ldconfig
- cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
build_script:
- make all
- cmake --build Dist -j 2
test_pcapplusplus_script:
- python3 -m pip install gcovr
- python3 -m pip install -r ci/run_tests/requirements.txt
- python3 ci/run_tests/run_tests.py --interface eth0
coverage_report_script:
- gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- ./codecov -v -f coverage.xml -F zstd -F ubuntu2004 -F unittest || true

task:
name: Test Zstd MacOS
osx_instance:
image: monterey-xcode
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-xcode:14.1
configure_script:
- brew install zstd
- ./configure-mac_os_x.sh --use-zstd
# Ensure user have access to network devices instead of giving super-user right
- sudo chmod a+rw /dev/bpf*
- cmake -DLIGHT_PCAPNG_ZSTD=ON -DPCAPPP_BUILD_COVERAGE=ON -S . -B Dist
build_script:
- make all
install_tcpreplay_script:
- brew install tcpreplay
- cmake --build Dist -j 2
install_tcpreplay_gcovr_script:
- brew install tcpreplay gcovr
test_pcapplusplus_script:
- python3 -m ensurepip
- python3 -m pip install -r ci/run_tests/requirements.txt
- python3 ci/run_tests/run_tests.py --interface en0 --use-sudo --test-args="-x TestPcapLiveDeviceSpecialCfg"
- python3 ci/run_tests/run_tests.py --interface en0 --test-args="-x TestPcapLiveDeviceSpecialCfg"
coverage_report_script:
- gcovr -v -r . $GCOVR_FLAGS -o coverage.xml
- curl -Os https://uploader.codecov.io/latest/macos/codecov
- chmod +x codecov
- ./codecov -v -f coverage.xml -F zstd -F macos-ventura -F unittest || true

task:
name: Regression Tests Linux (Address Sanitizer)
container:
image: seladb/ubuntu1804:latest
image: gcr.io/oss-fuzz-base/base-clang
configure_script:
- ./configure-fuzzing.sh --sanitizer address
- ldconfig
- apt-get update && apt-get install -y cmake git libpcap-dev
- cmake -S . -B $BUILD_DIR -DPCAPPP_USE_SANITIZER=AddressSanitizer -DPCAPPP_BUILD_FUZZERS=ON -DPCAPPP_BUILD_EXAMPLES=OFF
build_script:
- make fuzzers
- cmake --build $BUILD_DIR -j 2
test_script:
- cd Tests/Fuzzers/RegressionTests && ./run_tests.sh
- export BINARY="$BUILD_DIR/Tests/Fuzzers/FuzzTarget"
- export SAMPLES="Tests/Fuzzers/RegressionTests/regression_samples"
- Tests/Fuzzers/RegressionTests/run_tests.sh

# Compilation failed due too issue w/ MemPlumber
# task:
# name: Regression Tests Linux (Memory Sanitizer)
# container:
# image: gcr.io/oss-fuzz-base/base-clang
# configure_script:
# - apt-get update && apt-get install -y cmake git libpcap-dev
# - cmake -S . -B $BUILD_DIR -DPCAPPP_USE_SANITIZER=MemorySanitizer -DPCAPPP_BUILD_FUZZERS=ON -DPCAPPP_BUILD_EXAMPLES=OFF
# build_script:
# - cmake --build $BUILD_DIR -j 2
# test_script:
# - export BINARY="$BUILD_DIR/Tests/Fuzzers/FuzzTarget"
# - export SAMPLES="Tests/Fuzzers/RegressionTests/regression_samples"
# - Tests/Fuzzers/RegressionTests/run_tests.sh

task:
name: Regression Tests Linux (Undefined Behavior Sanitizer)
container:
image: seladb/ubuntu1804:latest
image: gcr.io/oss-fuzz-base/base-clang
configure_script:
- ./configure-fuzzing.sh --sanitizer undefined
- ldconfig
- apt-get update && apt-get install -y cmake git libpcap-dev
- cmake -S . -B $BUILD_DIR -DPCAPPP_USE_SANITIZER=UndefinedBehaviorSanitizer -DPCAPPP_BUILD_FUZZERS=ON -DPCAPPP_BUILD_EXAMPLES=OFF
build_script:
- make fuzzers
- cmake --build $BUILD_DIR -j 2
test_script:
- cd Tests/Fuzzers/RegressionTests && ./run_tests.sh
- export BINARY="$BUILD_DIR/Tests/Fuzzers/FuzzTarget"
- export SAMPLES="Tests/Fuzzers/RegressionTests/regression_samples"
- Tests/Fuzzers/RegressionTests/run_tests.sh

task:
name: Build Doxygen Documentation
Expand All @@ -84,9 +121,9 @@ task:
get_code_script:
- git clone https://github.com/PcapPlusPlus/pcapplusplus.github.io.git
configure_script:
- ./configure-linux.sh --default
- cmake -DPCAPPP_BUILD_EXAMPLES=OFF -DPCAPPP_BUILD_TESTS=OFF -B build -S .
build_script:
- make libs
- cmake --build build -j 2
build_documentation_script:
- cd pcapplusplus.github.io/static/api-docs/next/doxygen
- doxygen Doxyfile-ci
Expand Down
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
BasedOnStyle: Microsoft
UseTab: Always
AllowShortFunctionsOnASingleLine: All
NamespaceIndentation: All

...
75 changes: 75 additions & 0 deletions .cmake-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# --------------------------
# General Formatting Options
# --------------------------
# How wide to allow formatted cmake files
line_width = 120

# How many spaces to tab for indent
tab_size = 2

# If an argument group contains more than this many sub-groups (parg or kwarg
# groups), then force it to a vertical layout.
max_subgroups_hwrap = 2

# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 3

# If true, separate flow control names from their parentheses with a space
separate_ctrl_name_with_space = False

# If true, separate function names from parentheses with a space
separate_fn_name_with_space = False

# If a statement is wrapped to more than one line, than dangle the closing
# parenthesis on it's own line.
dangle_parens = False

# If the trailing parenthesis must be 'dangled' on it's on line, then align it
# to this reference: `prefix`: the start of the statement, `prefix-indent`: the
# start of the statement, plus one indentation level, `child`: align to the
# column of the arguments
dangle_align = 'prefix'

min_prefix_chars = 4

# If the statement spelling length (including space and parenthesis) is larger
# than the tab width by more than this amount, then force reject un-nested
# layouts.
max_prefix_chars = 10

# If a candidate layout is wrapped horizontally but it exceeds this many lines,
# then reject the layout.
max_lines_hwrap = 2

# What style line endings to use in the output.
line_ending = 'unix'

# Format command names consistently as 'lower' or 'upper' case
command_case = 'lower'

# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'unchanged'

# If true, the argument lists which are known to be sortable will be sorted
# lexicographicall
enable_sort = True

# If true, the parsers may infer whether or not an argument list is sortable
# (without annotation).
autosort = True

# By default, if cmake-format cannot successfully fit everything into the
# desired linewidth it will apply the last, most aggressive attempt that it
# made. If this flag is True, however, cmake-format will print error, exit
# with non-zero status code, and write-out nothing
require_valid_layout = False

# Specify structure for custom cmake functions
additional_commands = {
"pkg_find": {
"kwargs": {
"PKG": "*"
}
}
}
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
skip = *.dat,typos-config.toml,.git,./ci,./Dist,./mk,./Tests/ExamplesTest/expected_output,./Tests/ExamplesTest/pcap_examples,./Tests/Packet++Test/PacketExamples,./Tests/Pcap++Test/PcapExamples
skip = *.dat,typos-config.toml,.git,./ci,./Dist,./mk,./Tests/ExamplesTest/expected_output,./Tests/ExamplesTest/pcap_examples,./Tests/Packet++Test/PacketExamples,./Tests/Pcap++Test/PcapExamples,./3rdParty/json,./3rdParty/OUIDataset/PCPP_OUIDataset.json
ignore-words = codespell-ignore-list.txt
count =
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @seladb
70 changes: 70 additions & 0 deletions .github/workflows/auto_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Auto Update

on:
schedule:
- cron: '10 10 1 * *'

jobs:
precommit-update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: dev
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8.x"
- name: Run update
run: |
pip install pre-commit
pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
author: GitHub <[email protected]>
add-paths: .pre-commit-config.yaml
commit-message: Auto pre-commit update
body: |
Update pre-commit hooks to latest
Auto generated
branch: auto-update/precommit_update
delete-branch: true
title: Auto precommit update
labels: automated-pr
assignees: seladb

oui-update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: dev
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.8.x"
- name: Run update
run: |
python3 3rdParty/OUIDataset/create_oui_data.py
mv -f PCPP_OUIDataset.json 3rdParty/OUIDataset/PCPP_OUIDataset.json
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
author: GitHub <[email protected]>
add-paths: 3rdParty/OUIDataset/PCPP_OUIDataset.json
commit-message: Auto OUI Database Update
body: |
Update OUI database to latest
Auto generated
branch: auto-update/oui_update
delete-branch: true
title: Auto OUI Database Update
labels: automated-pr
assignees: seladb
Loading

0 comments on commit 8fa9f6f

Please sign in to comment.