diff --git a/tests/fuzzing/discovery/fuzz.nim b/tests/fuzzing/discovery/fuzz.nim index ba45379..2ff232c 100644 --- a/tests/fuzzing/discovery/fuzz.nim +++ b/tests/fuzzing/discovery/fuzz.nim @@ -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 diff --git a/tests/fuzzing/fuzz_helpers.nim b/tests/fuzzing/fuzztest.nim similarity index 93% rename from tests/fuzzing/fuzz_helpers.nim rename to tests/fuzzing/fuzztest.nim index c6ac227..a0f2ba4 100644 --- a/tests/fuzzing/fuzz_helpers.nim +++ b/tests/fuzzing/fuzztest.nim @@ -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".} = diff --git a/tests/fuzzing/rlp/fuzz.nim b/tests/fuzzing/rlp/fuzz.nim index 861dcf3..64788f7 100644 --- a/tests/fuzzing/rlp/fuzz.nim +++ b/tests/fuzzing/rlp/fuzz.nim @@ -1,4 +1,4 @@ -import chronicles, eth/rlp, ../fuzz_helpers +import chronicles, eth/rlp, ../fuzztest # TODO: have a default init as such init: