mirror of https://github.com/status-im/nim-eth.git
rename to fuzztest & change standalone define
This commit is contained in:
parent
e101902aa5
commit
1148f773d1
|
@ -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
|
||||
|
|
|
@ -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".} =
|
|
@ -1,4 +1,4 @@
|
|||
import chronicles, eth/rlp, ../fuzz_helpers
|
||||
import chronicles, eth/rlp, ../fuzztest
|
||||
|
||||
# TODO: have a default init as such
|
||||
init:
|
||||
|
|
Loading…
Reference in New Issue