rename to fuzztest & change standalone define

This commit is contained in:
kdeme 2019-09-30 15:34:11 +02:00 committed by zah
parent e101902aa5
commit 1148f773d1
3 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import
chronicles, eth/p2p/[discovery, enode], eth/[keys, rlp],
../../p2p/p2p_test_helper, ../fuzz_helpers
../../p2p/p2p_test_helper, ../fuzztest
const DefaultListeningPort = 30303
var targetNode: DiscoveryProtocol

View File

@ -3,7 +3,7 @@ import streams, posix, strutils, chronicles, macros
template fuzz(body) =
# For code we want to fuzz, SIGSEGV is needed on unwanted exceptions.
# However, this is only needed when fuzzing with afl.
when defined(afl):
when defined(standalone):
try:
body
except Exception as e:
@ -31,7 +31,7 @@ template `+`*[T](p: ptr T, off: int): ptr T =
cast[ptr type(p[])](cast[ByteAddress](p) +% off * sizeof(p[]))
template test*(body: untyped): untyped =
when defined(afl):
when defined(standalone):
var payload {.inject.} = readStdin()
fuzz: `body`
@ -48,7 +48,7 @@ template test*(body: untyped): untyped =
`body`
template init*(body: untyped): untyped =
when defined(afl):
when defined(standalone):
fuzz: `body`
else:
proc fuzzerInit(): cint {.exportc: "LLVMFuzzerInitialize".} =

View File

@ -1,4 +1,4 @@
import chronicles, eth/rlp, ../fuzz_helpers
import chronicles, eth/rlp, ../fuzztest
# TODO: have a default init as such
init: