• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2024 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TESTING_LIBFUZZER_FUZZTEST_INIT_HELPER_H_
6 #define TESTING_LIBFUZZER_FUZZTEST_INIT_HELPER_H_
7 
8 namespace fuzztest_init_helper {
9 
10 extern void (*initialization_function)(int argc, char** argv);
11 }
12 
13 // If we're in a test suite which really has fuzztests,
14 // the above function pointer will have been populated with
15 // a function that knows how to initialize FuzzTests. Otherwise,
16 // it won't, to avoid bringing all of FuzzTests's dependencies
17 // into all the other Chromium test suites.
MaybeInitFuzztest(int argc,char ** argv)18 inline void MaybeInitFuzztest(int argc, char** argv) {
19   if (fuzztest_init_helper::initialization_function) {
20     fuzztest_init_helper::initialization_function(argc, argv);
21   }
22 }
23 
24 #endif  // TESTING_LIBFUZZER_FUZZTEST_INIT_HELPER_H_
25