-
Notifications
You must be signed in to change notification settings - Fork 95
Feature/add fuzzing #799
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
Merged
Merged
Feature/add fuzzing #799
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
888de35
Add enable fuzzing build option
pnoltes 69ce5e1
Add fuzzing code
pnoltes 8ae7acd
Add fuzzing workflow and enable benchmarking options in CI configurat…
pnoltes a60479b
Add documentation for building benchmarks, fuzz testing, and running …
pnoltes 1273863
Merge branch 'master' into feature/add-fuzzing
pnoltes e4a8a83
Remove C++ flag for macos, resulted in undefined symbols
pnoltes a6f9ab1
Increase celix error buffer size for fuzz testing
pnoltes b8e6e86
Eliminate clang warnings -Werror,-Wvla-cxx-extension
PengZheng b230f0e
Add validation for enabling fuzzing with clang compiler only.
PengZheng c197720
Expand fuzzing validation to include Apple Clang.
PengZheng 4d3af6c
Refactor `benchmark` dependency to `test_requires` when `enable_bench…
PengZheng fe77a13
Fix formatting issue in README under "C Patterns" section.
PengZheng 7b15c75
Update to actions/cache 4.3.0
pnoltes 1f61d32
Add asan and ubsan for fuzz testing builds
pnoltes d645fa9
Merge branch 'master' into feature/add-fuzzing
pnoltes f6ffa19
Apply linux clang asan libpath issue for fuzz testing
pnoltes 5ee1a96
change cmake function to macro
pnoltes 3878ee8
fix cmake error
pnoltes 0cbee96
Use LD_PRELOAD for fuzz testing action
pnoltes 2eb5f69
Enable ubsan with asan for linux ci
pnoltes 9344b89
Remove LD_PRELOAD for fuzz testing and simplify sanitizer options.
PengZheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Celix Fuzzing | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
| schedule: | ||
| - cron: '0 3 * * *' | ||
|
|
||
| jobs: | ||
| fuzz-utils: | ||
| runs-on: ubuntu-22.04 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout source code | ||
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c #v4.9.1 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Set Compiler Environment Variables | ||
| run: | | ||
| echo "CC=clang" >> $GITHUB_ENV | ||
| echo "CXX=clang++" >> $GITHUB_ENV | ||
| - name: Install Conan | ||
| run: pip install conan | ||
| - name: Cache Conan | ||
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 #v4.3.0 | ||
| with: | ||
| path: ~/.conan2/p | ||
| key: ${{ runner.os }}-conan-${{ hashFiles('conanfile.py', 'libs/utils/**') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-conan- | ||
| - name: Setup Conan Profile | ||
| run: | | ||
| conan profile detect | ||
| - name: Conan install | ||
| run: conan install . --output-folder=build --build=missing -o "celix/*:build_utils=True" -o "celix/*:enable_fuzzing=True" -o "celix/*:enable_address_sanitizer=True" -o "celix/*:enable_undefined_sanitizer=True" | ||
| - name: Conan build | ||
| run: conan build . --output-folder=build -o "celix/*:build_utils=True" -o "celix/*:enable_fuzzing=True" -o "celix/*:enable_address_sanitizer=True" -o "celix/*:enable_undefined_sanitizer=True" -o "celix/*:celix_err_buffer_size=5120" | ||
| - name: Set fuzzer run time | ||
| id: set-runtime | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "schedule" ]]; then | ||
| echo "FUZZ_TIME=600" >> ${GITHUB_ENV} | ||
| else | ||
| echo "FUZZ_TIME=30" >> ${GITHUB_ENV} | ||
| fi | ||
| - name: Run properties fuzzer | ||
| run: | | ||
| source build/conanrun.sh | ||
| ./build/libs/utils/fuzzing/celix_properties_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/properties_corpus | ||
| - name: Run version fuzzer | ||
| run: | | ||
| source build/conanrun.sh | ||
| ./build/libs/utils/fuzzing/celix_version_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/version_corpus | ||
| - name: Run filter fuzzer | ||
| run: | | ||
| source build/conanrun.sh | ||
| ./build/libs/utils/fuzzing/celix_filter_fuzzer -max_total_time=$FUZZ_TIME ./build/libs/utils/fuzzing/filter_corpus | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| title: Benchmarks in Apache Celix | ||
| --- | ||
|
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed with | ||
| this work for additional information regarding copyright ownership. | ||
| The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
|
|
||
|
|
||
| # Benchmarks in Apache Celix | ||
|
|
||
| This document describes how to build and run benchmarks for Apache Celix. | ||
|
|
||
| ## Building Benchmarks | ||
|
|
||
| Benchmarks can be built using the CMake option `ENABLE_BENCHMARKING` | ||
| The Apache Celix benchmarks uses Google benchmark library. | ||
|
|
||
| To build benchmarks run: | ||
|
|
||
| ```sh | ||
| cmake -B build -DENABLE_BENCHMARKING=ON | ||
| cmake --build build | ||
| ``` | ||
|
|
||
| ## Benchmarks | ||
|
|
||
| The following benchmark executables are available after building the utils and framework benchmarks: | ||
|
|
||
| **Utils Benchmarks:** | ||
| - `build/libs/utils/benchmark/celix_filter_benchmark` | ||
| - `build/libs/utils/benchmark/celix_long_hashmap_benchmark` | ||
| - `build/libs/utils/benchmark/celix_string_hashmap_benchmark` | ||
| - `build/libs/utils/benchmark/celix_utils_benchmark` | ||
|
|
||
| **Framework Benchmarks:** | ||
| - `build/libs/framework/benchmark/celix_framework_benchmark` | ||
|
|
||
| Paths may vary depending on your configuration and enabled options. | ||
|
|
||
| ## Running Benchmarks | ||
|
|
||
| Benchmark executables are located in the `build` directory, typically under the relevant bundle or library subdirectory. To run a benchmark: | ||
|
|
||
| ```sh | ||
| ./build/libs/utils/benchmarks/celix_utils_benchmark | ||
| ## Command-Line Options | ||
| The benchmark executables accept standard Google Benchmark command-line options. | ||
| For example, to run only benchmarks matching a specific pattern and output results in JSON format: | ||
|
|
||
| ```bash | ||
| ./build/libs/utils/benchmark/celix_filter_benchmark --benchmark_filter=complexFilter --benchmark_format=json | ||
| ``` | ||
|
|
||
| Replace `celix_utils_benchmark` and the filter pattern as needed. To see a list of supported command-line flags, run the benchmark executable with the `--help` option: | ||
|
|
||
| ```bash | ||
| ./build/libs/utils/benchmarks/./celix_filter_benchmark --help | ||
| ``` | ||
|
|
||
| This will display all available Google Benchmark options. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.