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
|
import
|
||||||
chronicles, eth/p2p/[discovery, enode], eth/[keys, rlp],
|
chronicles, eth/p2p/[discovery, enode], eth/[keys, rlp],
|
||||||
../../p2p/p2p_test_helper, ../fuzz_helpers
|
../../p2p/p2p_test_helper, ../fuzztest
|
||||||
|
|
||||||
const DefaultListeningPort = 30303
|
const DefaultListeningPort = 30303
|
||||||
var targetNode: DiscoveryProtocol
|
var targetNode: DiscoveryProtocol
|
||||||
|
|
|
@ -3,7 +3,7 @@ import streams, posix, strutils, chronicles, macros
|
||||||
template fuzz(body) =
|
template fuzz(body) =
|
||||||
# For code we want to fuzz, SIGSEGV is needed on unwanted exceptions.
|
# For code we want to fuzz, SIGSEGV is needed on unwanted exceptions.
|
||||||
# However, this is only needed when fuzzing with afl.
|
# However, this is only needed when fuzzing with afl.
|
||||||
when defined(afl):
|
when defined(standalone):
|
||||||
try:
|
try:
|
||||||
body
|
body
|
||||||
except Exception as e:
|
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[]))
|
cast[ptr type(p[])](cast[ByteAddress](p) +% off * sizeof(p[]))
|
||||||
|
|
||||||
template test*(body: untyped): untyped =
|
template test*(body: untyped): untyped =
|
||||||
when defined(afl):
|
when defined(standalone):
|
||||||
var payload {.inject.} = readStdin()
|
var payload {.inject.} = readStdin()
|
||||||
|
|
||||||
fuzz: `body`
|
fuzz: `body`
|
||||||
|
@ -48,7 +48,7 @@ template test*(body: untyped): untyped =
|
||||||
`body`
|
`body`
|
||||||
|
|
||||||
template init*(body: untyped): untyped =
|
template init*(body: untyped): untyped =
|
||||||
when defined(afl):
|
when defined(standalone):
|
||||||
fuzz: `body`
|
fuzz: `body`
|
||||||
else:
|
else:
|
||||||
proc fuzzerInit(): cint {.exportc: "LLVMFuzzerInitialize".} =
|
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
|
# TODO: have a default init as such
|
||||||
init:
|
init:
|
||||||
|
|
Loading…
Reference in New Issue