Skip to content

Conversation

@arthurscchan
Copy link
Contributor

OSS-Fuzz has a new Chronos feature that allows fast rebuilding of OSS-Fuzz-integrated projects and checks whether the project code or fuzzers still pass their unit tests after patching. To enable this feature, the unit tests of integrated projects need to be built. Therefore, this PR modifies the build script used by OSS-Fuzz to also build the unit tests for this project. The OSS-Fuzz-side changes for this project's integration can be found here: google/oss-fuzz#14639.

zip -q -j $OUT/toml_fuzzer_seed_corpus.zip corpus/*

# Build unit test
clang++ -std=c++17 -O2 -DUSE_VENDORED_LIBS=1 \
Copy link
Owner

@marzer marzer Dec 24, 2025

Choose a reason for hiding this comment

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

Explicitly invoking the compiler seems unnecessary here, given CMake is available and used above. Can't you just turn tests on in the CMake configure on line 3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thank you for your comments. I have reviewed the CMake configuration in the root CMakeLists.txt, but found that it does not enable or define any unit testing settings for this project. I did notice that the meson.build file in the tests directory defines unit testing. However, this requires additional meson and ninja-build tools to be installed in the OSS-Fuzz image, which is not ideal. Therefore, I examined how the unit testing is set up in meson.build and used only the compiler to build those unit tests.
Please do suggest if I am missing something here. Thanks.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, sorry, nope you're not missing anything. I didn't realize the CMake integration didn't also build the tests (that integration was provided by a contributor, been a while since I looked at it).

No worries, this is fine as-is. I guess at some point I'll have to do a pass over the build systems and normalize them to fix this inconsistency.

@marzer marzer merged commit 7807a31 into marzer:master Dec 24, 2025
3 checks passed
@marzer
Copy link
Owner

marzer commented Dec 24, 2025

Thanks :)

@arthurscchan arthurscchan deleted the oss-fuzz-build-unit-test branch December 24, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants