Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
- wip: fix (fuzz) test
  • Loading branch information
abeimler committed Mar 2, 2024
1 parent 07cc900 commit 7d2cb31
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cpmaddpackage(
GITHUB_REPOSITORY
aminya/project_options
VERSION
0.34.0
0.35.0
# GIT_TAG main
DOWNLOAD_ONLY)
if(project_options_ADDED)
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ Or run `task generate`

You can now find the benchmark-results in [`reports/`](reports/).

_You need python (>=3.8.0) and some [dependencies](scripts/gen-benchmark-report/requirements.txt) to run [gen-benchmark-report](scripts/gen-benchmark-report) (plotting), install [pipx](https://pipx.pypa.io/stable/installation/) and [poetry](https://python-poetry.org/docs/#installing-with-pipx)._
_You need python (>=3.9.0) and some [dependencies](scripts/gen-benchmark-report/requirements.txt) to run [gen-benchmark-report](scripts/gen-benchmark-report) (plotting), install [pipx](https://pipx.pypa.io/stable/installation/) and [poetry](https://python-poetry.org/docs/#installing-with-pipx)._

Then install the dependencies for the script:
```bash
Expand Down Expand Up @@ -563,6 +563,16 @@ task generate:readme
2. `pipx run --spec ./scripts/gen-benchmark-report gen-benchmark-report -i ./info.json gen-results-md ./reports/entityx.json ./reports/entt.json ./reports/ginseng.json ./reports/mustache.json ./reports/openecs.json ./reports/flecs.json` _(generate full report)_


### Run a single benchmark

```bash
cmake -G Ninja -S . -B build
cmake --build build --target ecs-benchmark-entt -j 4
./build/benchmark/benchmarks/entt/ecs-benchmark-entt
```

You can use `-DCMAKE_BUILD_TYPE=Debug` to enable Sanitizers.

## Links and More

- [Dependency Setup](doc/README_dependencies.md)
Expand Down
4 changes: 3 additions & 1 deletion cmake/CMakeOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ if(LIBFUZZER_SUPPORTED
else()
set(DEFAULT_ENABLE_FUZZING OFF)
endif()
option(ENABLE_FUZZING "Enable Fuzzing Builds" ${DEFAULT_ENABLE_FUZZING})
#option(ENABLE_FUZZING "Enable Fuzzing Builds" ${DEFAULT_ENABLE_FUZZING})
option(ENABLE_FUZZING "Enable Fuzzing Builds" OFF)
# TODO: add/fix fuzz tests
14 changes: 8 additions & 6 deletions fuzz_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# A fuzz test runs until it finds an error. This particular one is going to rely on libFuzzer.
#
add_executable(ecs-benchmark-fuzz-tester)
target_sources(ecs-benchmark-fuzz-tester PRIVATE ${${CMAKE_PROJECT_NAME}_FUZZ_TEST_SOURCE} ${${CMAKE_PROJECT_NAME}_FUZZ_TEST_HEADERS})
target_sources(ecs-benchmark-fuzz-tester PRIVATE fuzz_tester.cpp)
target_include_directories(ecs-benchmark-fuzz-tester PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

# @NOTE: add libs here
set(THREADS_PREFER_PTHREAD_FLAG ON)
target_link_libraries(${CMAKE_PROJECT_NAME}-fuzz-tester Threads::Threads)
find_package(Threads REQUIRED)
target_link_libraries(ecs-benchmark-fuzz-tester PRIVATE Threads::Threads)

target_link_options(${CMAKE_PROJECT_NAME}-fuzz-tester PRIVATE project_options project_warnings -coverage
-fsanitize=fuzzer,undefined,address)
target_compile_options(${CMAKE_PROJECT_NAME}-fuzz-tester PRIVATE -fsanitize=fuzzer,undefined,address)
target_link_libraries(ecs-benchmark-fuzz-tester PRIVATE project_warnings project_options)
#target_link_options(ecs-benchmark-fuzz-tester PRIVATE -coverage -fsanitize=fuzzer,undefined,address)
#target_compile_options(ecs-benchmark-fuzz-tester PRIVATE -fsanitize=fuzzer,undefined,address)
# @FIXME: c++: error: unrecognized argument to '-fsanitize=' option: 'fuzzer'

# Allow short runs during automated testing to see if something new breaks
set(FUZZ_RUNTIME
10
CACHE STRING "Number of seconds to run fuzz tests during ctest run") # Default of 10 seconds

add_test(NAME ${CMAKE_PROJECT_NAME}-fuzz-tester-run COMMAND ${CMAKE_PROJECT_NAME}-fuzz-tester -max_total_time=${FUZZ_RUNTIME})
add_test(NAME ecs-benchmark-fuzz-tester-run COMMAND ecs-benchmark-fuzz-tester -max_total_time=${FUZZ_RUNTIME})
1 change: 1 addition & 0 deletions fuzz_test/fuzz_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <iostream>
#include <iterator>
#include <utility>
#include <cstdint>

[[nodiscard]] auto sum_values(const uint8_t* Data, size_t Size) {
constexpr auto scale = 1000;
Expand Down
2 changes: 1 addition & 1 deletion src/ginseng/ginseng/systems/RenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace ecs::benchmarks::ginseng::systems {

void RenderSystem::update(EntityManager& registry, TimeDelta dt) {
void RenderSystem::update(EntityManager& registry, TimeDelta /*dt*/) {
registry.visit([&](const ecs::benchmarks::base::components::PositionComponent& position,
const ecs::benchmarks::base::components::SpriteComponent& spr) {
renderSprite(position, spr);
Expand Down

0 comments on commit 7d2cb31

Please sign in to comment.