Skip to content

Commit

Permalink
Make all-clusters be able to fuzz (#25968)
Browse files Browse the repository at this point in the history
* Fix typo: fuzzer should enable fuzzer, not tsan

* Add fixes

* Restyle

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Nov 18, 2023
1 parent 50238d9 commit 5379756
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/all-clusters-app/linux/fuzzing-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@
#include "AppMain.h"
#include <app/server/Server.h>

#include <CommissionableInit.h>

using namespace chip;
using namespace chip::DeviceLayer;

namespace {

LinuxCommissionableDataProvider gCommissionableDataProvider;

}

void CleanShutdown()
{
Server::GetInstance().Shutdown();
Expand All @@ -40,6 +48,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize)
VerifyOrDie(Platform::MemoryInit() == CHIP_NO_ERROR);
VerifyOrDie(PlatformMgr().InitChipStack() == CHIP_NO_ERROR);

VerifyOrDie(chip::examples::InitCommissionableDataProvider(gCommissionableDataProvider,
LinuxDeviceOptions::GetInstance()) == CHIP_NO_ERROR);
SetCommissionableDataProvider(&gCommissionableDataProvider);

// ChipLinuxAppMainLoop blocks, and we don't want that here.
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();
Expand Down

0 comments on commit 5379756

Please sign in to comment.