Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d7d83bd
update workflow
May 6, 2024
ac588cd
Update build.yml
jvishnefske May 6, 2024
14b68c9
Update build.yml
jvishnefske May 6, 2024
852d6f5
Update build.yml
jvishnefske May 6, 2024
68ce2cd
update ci output dir
May 6, 2024
1588efb
Fix major C++ compilation errors across multiple modules
jvishnefske Aug 14, 2025
49a0cea
Refactor actorReturningVoid: rename .cc to .cpp and improve implement…
jvishnefske Aug 14, 2025
78c3086
tests pass
jvishnefske Aug 14, 2025
b1f2a9d
tests pass, but some files got deleted due to misra violation.
jvishnefske Aug 14, 2025
947c263
update workflow and radio app
jvishnefske Aug 14, 2025
c19db04
add files to build
jvishnefske Aug 14, 2025
0486b3d
consolidate boost to fetched
jvishnefske Aug 14, 2025
a983679
added http3 header
jvishnefske Aug 23, 2025
55a8f14
fix: Resolve std::array aggregate initialization errors and [[nodisca…
jvishnefske Aug 23, 2025
c5829c9
chore: Suppress unused return value warnings for client.disconnect()
jvishnefske Aug 23, 2025
3531cd3
fix: Add missing headers for std::string and std::vector
jvishnefske Aug 23, 2025
00c43b3
fix: Close anonymous namespace in http3 fuzzer
jvishnefske Aug 23, 2025
3d2c74b
fix: Declare long_name variable in http3_client_test
jvishnefske Aug 23, 2025
1880b00
build: Configure fuzzer and test sanitizers for http3 client
jvishnefske Aug 24, 2025
d69b2f5
build: Configure http3_fuzzer for LibFuzzer with sanitizers
jvishnefske Aug 24, 2025
c28932c
test: Add LibFuzzer entry point and fuzzing logic for HTTP/3 client
jvishnefske Aug 24, 2025
2e75c07
fix: Expose QpackProcessor dynamic table access for fuzzer
jvishnefske Aug 24, 2025
a5e11cf
fix: Fix std::string_view default parameter initialization
jvishnefske Aug 24, 2025
dcf499c
fix: Update test result var and handle empty QPACK headers in tests
jvishnefske Aug 24, 2025
1d56ba2
fuzzer runs
jvishnefske Aug 24, 2025
cba954d
first attempt at code coverage
jvishnefske Aug 25, 2025
a65e0c5
refactor tests
jvishnefske Aug 25, 2025
5e60e22
makefile for test, analysis and coverage
jvishnefske Sep 29, 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
6 changes: 3 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Checks: '-*,cppcoreguidelines-*'
# ,performance-*,cppcoreguidelines-*,bugprone-*,misc-*,modernize-*,readability-*,cert-*'
WarningsAsErrors: 'hicpp-*'
# do while is present in catch macro
Checks: 'hicpp-*,cppcoreguidelines-*,-cppcoreguidelines-avoid-do-while'
WarningsAsErrors: 'hicpp-*,cppcoreguidelines-*,-cppcoreguidelines-avoid-do-while'
HeaderFilterRegex: ''
FormatStyle: file
InheritParentConfig: true
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libfftw3-dev libpoco-dev
- name: cmake
run: cmake -B cmake-build -S . -GNinja && cmake --build cmake-build
- name: install meson
run: python3 -m pip install https://github.com/mesonbuild/meson/releases/download/1.0.0/meson-1.0.0.tar.gz && which meson
- name: Run tests
run: ctest --test-dir cmake-build --output-on-failure
- name: Generate coverage report
run: |
python3 -m pip install gcovr
make coverage
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir cmake-build-sonarcube-wrap cmake --build cmake-build
- name: run tox
run: python3 -m pip install tox && tox -e py
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Testing/
#vim
*.swp
build

#reports
coverage.xml
Expand Down Expand Up @@ -45,3 +46,4 @@ coverage.xml
cmake-build*
.aider*
.idea
coverage_report*
12 changes: 11 additions & 1 deletion .idea/cpp-examples.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 90 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Build and Development Commands

### Building the project
```bash
# Initial build setup with Ninja generator
cmake -B build -S . -G Ninja

# Build all targets
cmake --build build

# Alternative: Use the provided test script (includes build + test + coverage)
./test.sh
```

### Running tests
```bash
# Run all tests
ctest --test-dir build --output-on-failure

# Run specific test
ctest --test-dir build -R <test_name>
```

### Coverage and Analysis
```bash
# Generate coverage report (requires build with coverage enabled)
gcovr --fail-under-line 10 --exclude build/_deps build

# Run static analysis (clang-tidy)
clang-tidy -p build `find middleware -name *.cpp`

# Run Python tests (via tox)
tox -e py39
```

## Project Architecture

This is a C++ examples repository with the following key structure:

### Main Components
- **Root level**: Contains basic RAII examples and main CMakeLists.txt
- **cjunk/**: Collection of experimental C++ code and examples
- **trivialJson/**: Custom JSON library implementation with SmallMemoryModel and standard versions
- **practice/**: Various C++ learning examples (async, networking, algorithms, etc.)
- **swradio/**: Software-defined radio examples
- **glFrontEnd/**: OpenGL frontend examples
- **pocoJunk/**: Poco library experiments
- **middleware/**: FFT and signal processing utilities
- **example_streambuffer/**: Stream buffer examples
- **serialization/**: Serialization examples including FlatBuffers

### Key Libraries and Dependencies
- **Testing**: Catch2 (v3.5.4) for unit testing
- **Formatting**: fmt library for string formatting
- **Boost**: Header-only Boost libraries (v1.81.0)
- **Build**: CMake with Ninja generator preferred
- **Coverage**: gcovr for coverage reporting
- **Static Analysis**: clang-tidy integration

### Build Configuration
- C++17 standard
- Strict compiler warnings (-Werror on all warnings)
- Stack protection and security features enabled
- Coverage builds enabled by default
- Both shared and static analysis builds supported

### Testing Strategy
- Catch2-based unit tests in relevant subdirectories
- CTest integration for test discovery and execution
- Python tests via tox for any Python components
- Coverage reporting with minimum 10% line coverage requirement

## Development Notes

### CMake Structure
The project uses a modular CMake setup:
- Dependencies fetched via FetchContent from `cmake/dependencies.cmake`
- Each major component has its own CMakeLists.txt
- Libraries are built as separate targets (trivialJson, smallTrivialJson, etc.)
- commit after changes when all test pass.
- all commits should have exactly one author.

### CI/CD
- GitHub Actions workflow builds with Ubuntu + Ninja
- SonarCloud integration for code quality analysis
- Automatic dependency management via CMake FetchContent
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ if (STATIC_ANALYSIS)
endif ()
include(cmake/dependencies.cmake)
declare_dependencies()
FetchContent_MakeAvailable(Boost Catch2 fmt)
FetchContent_MakeAvailable(Boost Catch2 fmt GoogleTest)
# boost 1.81 has a warning on gcc 13
target_compile_options(test_main PRIVATE -Wno-dangling-reference)
target_compile_options(json PRIVATE -Wno-dangling-reference)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "13")
target_compile_options(test_main PRIVATE -Wno-dangling-reference)
target_compile_options(json PRIVATE -Wno-dangling-reference)
endif()
enable_testing()
#include(cmake/pmm.cmake)

Expand Down Expand Up @@ -89,6 +91,10 @@ set(libraries_to_link
)

add_executable(raii raii.cc)
target_link_libraries(raii PRIVATE Catch2::Catch2WithMain)
add_test(NAME raii COMMAND $<TARGET_FILE:raii>)
target_link_libraries(raii PRIVATE Catch2::Catch2WithMain)
add_subdirectory(cjunk)
add_subdirectory(example_streambuffer)
add_subdirectory(middleware)
add_subdirectory(nonHosted/http3Client)

147 changes: 147 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
.PHONY: all build test coverage coverage-check clean help configure lint ci tox perf perf-record perf-report perf-stat perf-mem

BUILD_DIR = build

# Default target
all: build test coverage

# Configure cmake
configure:
@echo "=== Configuring project ==="
@cmake -B $(BUILD_DIR) -S . -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang

# Build the project
build:
@echo "=== Building project ==="
@test -f $(BUILD_DIR)/build.ninja || $(MAKE) configure
@cmake --build $(BUILD_DIR)

# Run tests
test: build
@echo "=== Running tests ==="
@ctest --test-dir $(BUILD_DIR) --output-on-failure

# Generate coverage report
coverage: test
@echo "=== Generating coverage report ==="
@gcovr --gcov-executable "llvm-cov gcov" --gcov-ignore-errors=no_working_dir_found --fail-under-line 10 --exclude ".*_deps.*" --exclude ".*catch2.*" --root . $(BUILD_DIR)/nonHosted $(BUILD_DIR)/cjunk $(BUILD_DIR)/example_streambuffer $(BUILD_DIR)/middleware $(BUILD_DIR)/CMakeFiles/raii.dir

# Check coverage completeness (files in git vs coverage report)
coverage-check:
@echo "=== Checking coverage completeness ==="
@./check_coverage_completeness.py

# Run static analysis
lint: configure
@echo "=== Running static analysis ==="
@files=$$(find middleware cjunk -name "*.cpp" -o -name "*.cc" 2>/dev/null); \
if [ -n "$$files" ]; then \
clang-tidy -p $(BUILD_DIR) $$files; \
else \
echo "No C++ files found for static analysis"; \
fi

# Run Python tests via tox
tox:
@echo "=== Running Python tests via tox ==="
@tox -e py39

# Performance profiling targets
# Run performance analysis on tests
perf: build
@echo "=== Running performance analysis ==="
@echo "Recording performance data..."
@perf record --call-graph=dwarf -o perf.data -- ctest --test-dir $(BUILD_DIR) --output-on-failure
@echo "Generating performance report..."
@perf report -i perf.data --stdio > perf-report.txt
@echo "Performance report saved to perf-report.txt"
@echo "Raw data available in perf.data"

# Record performance data only
perf-record: build
@echo "=== Recording performance data ==="
@if [ -n "$(TARGET)" ]; then \
echo "Recording performance for target: $(TARGET)"; \
perf record --call-graph=dwarf -o perf.data -- $(BUILD_DIR)/$(TARGET); \
else \
echo "Recording performance for all tests"; \
perf record --call-graph=dwarf -o perf.data -- ctest --test-dir $(BUILD_DIR) --output-on-failure; \
fi
@echo "Performance data recorded to perf.data"

# Generate performance report from existing perf.data
perf-report:
@echo "=== Generating performance report ==="
@if [ -f perf.data ]; then \
perf report -i perf.data --stdio > perf-report.txt; \
echo "Performance report saved to perf-report.txt"; \
echo "For interactive report, run: perf report -i perf.data"; \
else \
echo "No perf.data file found. Run 'make perf-record' first."; \
fi

# Get performance statistics
perf-stat: build
@echo "=== Running performance statistics ==="
@if [ -n "$(TARGET)" ]; then \
echo "Performance stats for target: $(TARGET)"; \
perf stat -d -d -d $(BUILD_DIR)/$(TARGET); \
else \
echo "Performance stats for all tests"; \
perf stat -d -d -d -- ctest --test-dir $(BUILD_DIR) --output-on-failure; \
fi

# Memory profiling with perf
perf-mem: build
@echo "=== Running memory profiling ==="
@if [ -n "$(TARGET)" ]; then \
echo "Memory profiling for target: $(TARGET)"; \
perf mem record -o perf-mem.data -- $(BUILD_DIR)/$(TARGET); \
perf mem report -i perf-mem.data --stdio > perf-mem-report.txt; \
else \
echo "Memory profiling for all tests"; \
perf mem record -o perf-mem.data -- ctest --test-dir $(BUILD_DIR) --output-on-failure; \
perf mem report -i perf-mem.data --stdio > perf-mem-report.txt; \
fi
@echo "Memory profiling report saved to perf-mem-report.txt"

# Full CI pipeline
ci: all lint tox
@echo "=== All CI checks passed! ==="

# Clean build directory
clean:
@echo "=== Cleaning build directory ==="
@rm -rf $(BUILD_DIR)

# Clean everything including Python cache and perf data
clean-all: clean
@echo "=== Cleaning all build artifacts ==="
@rm -rf .tox __pycache__ **/__pycache__ *.egg-info .pytest_cache .coverage
@rm -f perf.data perf-mem.data perf-report.txt perf-mem-report.txt

# Show help
help:
@echo "Available targets:"
@echo " all - Build, test, and generate coverage (default)"
@echo " configure - Configure cmake build"
@echo " build - Build the project"
@echo " test - Run tests"
@echo " coverage - Generate coverage report"
@echo " coverage-check - Check which git files are missing from coverage"
@echo " lint - Run static analysis"
@echo " tox - Run Python tests via tox"
@echo " ci - Full CI pipeline (build + test + coverage + lint + tox)"
@echo " perf - Run complete performance analysis (record + report)"
@echo " perf-record - Record performance data (use TARGET=executable for specific binary)"
@echo " perf-report - Generate report from existing perf.data"
@echo " perf-stat - Get performance statistics (use TARGET=executable for specific binary)"
@echo " perf-mem - Run memory profiling (use TARGET=executable for specific binary)"
@echo " clean - Clean build directory"
@echo " clean-all - Clean all build artifacts"
@echo " help - Show this help message"
@echo ""
@echo "Performance profiling examples:"
@echo " make perf # Profile all tests"
@echo " make perf-record TARGET=middleware/test_demodulator # Profile specific test"
@echo " make perf-stat TARGET=cjunk/cjunk_tests # Get stats for cjunk tests"
Loading
Loading