Skip to content

Commit

Permalink
Exclude unit tests from fuzzing builds
Browse files Browse the repository at this point in the history
Needed to exclude unrelated GTest source files and headers from the coverage report
  • Loading branch information
kyakdan committed Mar 25, 2024
1 parent d416de4 commit 1df8899
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/explore_me/complex_checks_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <cifuzz/cifuzz.h>
#include <fuzzer/FuzzedDataProvider.h>
#include <gtest/gtest.h>

#include "explore_me.h"

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#include <gtest/gtest.h>

TEST(ExploreComplexChecksTests, DeveloperTest) {
EXPECT_NO_THROW(ExploreComplexChecks(0, 10, "Developer"));
}
Expand All @@ -12,6 +14,8 @@ TEST(ExploreComplexChecksTests, MaintainerTest) {
EXPECT_NO_THROW(ExploreComplexChecks(20, -10, "Maintainer"));
}

#endif

FUZZ_TEST(const uint8_t *data, size_t size) {
FuzzedDataProvider fdp(data, size);
long a = fdp.ConsumeIntegral<long>();
Expand Down
6 changes: 5 additions & 1 deletion src/explore_me/simple_checks_test.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <cifuzz/cifuzz.h>
#include <fuzzer/FuzzedDataProvider.h>
#include <gtest/gtest.h>

#include "explore_me.h"

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#include <gtest/gtest.h>

TEST(ExploreSimpleChecksTests, DeveloperTest) {
EXPECT_NO_THROW(ExploreSimpleChecks(0, 10, "Developer"));
}
Expand All @@ -12,6 +14,8 @@ TEST(ExploreSimpleChecksTests, MaintainerTest) {
EXPECT_NO_THROW(ExploreSimpleChecks(20, -10, "Maintainer"));
}

#endif

FUZZ_TEST(const uint8_t *data, size_t size) {
FuzzedDataProvider fdp(data, size);
int a = fdp.ConsumeIntegral<int>();
Expand Down

0 comments on commit 1df8899

Please sign in to comment.