nim-drchaos/drchaos.nimble

54 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-08-25 20:18:38 +00:00
mode = ScriptMode.Verbose
version = "0.1.0"
author = "Dr. Chaos Team"
description = "A powerful and easy-to-use fuzzing framework in Nim for C/C++/Obj-C targets"
2022-08-26 08:19:49 +00:00
license = "Apache License 2.0"
2022-08-25 20:18:38 +00:00
srcDir = "."
skipDirs = @["tests", "benchmarks", "examples", "experiments"]
2022-08-25 20:18:38 +00:00
requires "nim >= 1.4.0"
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
when compiles(commandLineParams):
for param in commandLineParams:
extra_params &= " " & param
else:
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
2022-08-26 06:08:03 +00:00
proc test(name: string, srcDir = "tests/", args = "", lang = "c") =
2022-08-27 09:46:19 +00:00
buildBinary name, srcDir, "--mm:arc -d:release"
withDir("build/"):
exec "./" & name & " -max_total_time=3 -runs=10000" & args
2022-08-25 20:18:38 +00:00
task testDrChaosExamples, "Build & run Dr. Chaos examples":
let examples = @["fuzz_graph"]
2022-08-25 20:18:38 +00:00
for ex in examples:
test ex, "examples/"
task testDrChaos, "Build & run Dr. Chaos tests":
for filePath in listFiles("tests/"):
if filePath[^4..^1] == ".nim":
2022-08-26 06:08:03 +00:00
test filePath[len("tests/")..^5], args = " -error_exitcode=0"
2022-08-25 20:18:38 +00:00
task testDrChaosNoCrash, "Build & run Dr. Chaos tests that should not crash":
for filePath in listFiles("tests/no_crash/"):
2022-08-25 20:18:38 +00:00
if filePath[^4..^1] == ".nim":
test filePath[len("tests/no_crash/")..^5], "tests/no_crash/"
2022-08-25 20:18:38 +00:00
task test, "Run basic tests":
testDrChaosTask()
2022-08-26 06:08:03 +00:00
testDrChaosNoCrashTask()
2022-08-25 20:18:38 +00:00
task testAll, "Run all tests":
testDrChaosTask()
2022-08-26 06:08:03 +00:00
testDrChaosNoCrashTask()
testDrChaosExamplesTask()