Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent regressions #1243

Merged
merged 2 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
43 changes: 0 additions & 43 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,49 +68,6 @@ task:
- 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: 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=AddressSanitizer -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

# 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: 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=UndefinedBehaviorSanitizer -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: Build Doxygen Documentation
container:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,3 +568,63 @@ jobs:
flags: xdp,unittest
fail_ci_if_error: false
verbose: true

test_regressions:
name: Run ${{ matrix.engine }}-${{ matrix.sanitizer }} fuzzer for regressions
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
sanitizer: [address, undefined, memory]
engine: [libfuzzer]
container:
image: gcr.io/oss-fuzz-base/base-builder
steps:
- uses: actions/checkout@v4
- name: Install prerequisites
run: |
apt-get update && apt-get install -y cmake autoconf flex bison
cd ..
cp -r PcapPlusPlus/ $SRC/PcapPlusPlus
git clone --depth=1 https://github.com/the-tcpdump-group/libpcap.git $SRC/libpcap
cd $SRC/PcapPlusPlus/
- name: Compile fuzzer
run: |
export FUZZING_LANGUAGE=c
export ARCHITECTURE=x86_64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but I'm not fan of using environment variable to pass value to a script.

I prefer to properly pass it as parameters, so we can properly check the input, have default and explain what we want.

But not a big deal as it's only for CI and not related to this MR

export FUZZING_ENGINE=${{ matrix.engine }}
export SANITIZER=${{ matrix.sanitizer }}
$SRC/PcapPlusPlus/Tests/Fuzzers/ossfuzz.sh
- name: Check for regressions
run: |
export BINARY="$OUT/FuzzTarget"
export SAMPLES="Tests/Fuzzers/RegressionTests/regression_samples"
Tests/Fuzzers/RegressionTests/run_tests.sh

Fuzzing:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
sanitizer: [address, undefined, memory]
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'pcapplusplus'
dry-run: false
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'pcapplusplus'
fuzz-seconds: 600
dry-run: false
sanitizer: ${{ matrix.sanitizer }}
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts