Bug 1751497 - adjust wpt test-verify and test-coverage tasks to be fission only....
[gecko.git] / mfbt / Fuzzing.h
blob1150bfa263cb3de5c2bb44850c139f0e986cda4f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* Additional definitions and implementation for fuzzing code */
9 #ifndef mozilla_Fuzzing_h
10 #define mozilla_Fuzzing_h
12 #ifdef FUZZING_SNAPSHOT
13 # include "mozilla/fuzzing/NyxWrapper.h"
15 # ifdef __cplusplus
16 # include "mozilla/fuzzing/Nyx.h"
17 # include "mozilla/ScopeExit.h"
19 # define MOZ_FUZZING_NYX_RELEASE(id) \
20 if (mozilla::fuzzing::Nyx::instance().is_enabled(id)) { \
21 mozilla::fuzzing::Nyx::instance().release(); \
24 # define MOZ_FUZZING_NYX_GUARD(id) \
25 auto nyxGuard = mozilla::MakeScopeExit([&] { \
26 if (mozilla::fuzzing::Nyx::instance().is_enabled(id)) { \
27 mozilla::fuzzing::Nyx::instance().release(); \
28 } \
29 });
30 # endif
32 # define MOZ_FUZZING_HANDLE_CRASH_EVENT2(aType, aReason) \
33 do { \
34 nyx_handle_event(aType, __FILE__, __LINE__, aReason); \
35 } while (false)
37 # define MOZ_FUZZING_HANDLE_CRASH_EVENT4(aType, aFilename, aLine, aReason) \
38 do { \
39 nyx_handle_event(aType, aFilename, aLine, aReason); \
40 } while (false)
42 #else
43 # define MOZ_FUZZING_NYX_RELEASE(id)
44 # define MOZ_FUZZING_NYX_GUARD(id)
45 # define MOZ_FUZZING_HANDLE_CRASH_EVENT2(aType, aReason) \
46 do { \
47 } while (false)
48 # define MOZ_FUZZING_HANDLE_CRASH_EVENT4(aType, aFilename, aLine, aReason) \
49 do { \
50 } while (false)
51 #endif
53 #endif /* mozilla_Fuzzing_h */