Add benches to the test suite to prevent forgetting about updating them
This commit is contained in:
parent
ce350d1dac
commit
d7e170288f
|
@ -26,6 +26,17 @@ proc test(flags, path: string) =
|
||||||
echo "========================================================================================"
|
echo "========================================================================================"
|
||||||
exec "nim " & lang & cc & " " & flags & " --verbosity:0 --outdir:build -r --hints:off --warnings:off " & path
|
exec "nim " & lang & cc & " " & flags & " --verbosity:0 --outdir:build -r --hints:off --warnings:off " & path
|
||||||
|
|
||||||
|
proc runBench(benchName: string, compiler = "") =
|
||||||
|
if not dirExists "build":
|
||||||
|
mkDir "build"
|
||||||
|
|
||||||
|
var cc = ""
|
||||||
|
if compiler != "":
|
||||||
|
cc = "--cc:" & compiler
|
||||||
|
exec "nim c " & cc &
|
||||||
|
" -d:danger --verbosity:0 -o:build/" & benchName & "_" & compiler &
|
||||||
|
" -r --hints:off --warnings:off benchmarks/" & benchName & ".nim"
|
||||||
|
|
||||||
### tasks
|
### tasks
|
||||||
task test, "Run all tests":
|
task test, "Run all tests":
|
||||||
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
||||||
|
@ -85,6 +96,13 @@ task test, "Run all tests":
|
||||||
# Elliptic curve arithmetic
|
# Elliptic curve arithmetic
|
||||||
test "-d:Constantine32", "tests/test_ec_weierstrass_projective_g1.nim"
|
test "-d:Constantine32", "tests/test_ec_weierstrass_projective_g1.nim"
|
||||||
|
|
||||||
|
# Benchmarks compile and run
|
||||||
|
runBench("bench_fp")
|
||||||
|
runBench("bench_fp2")
|
||||||
|
runBench("bench_fp6")
|
||||||
|
runBench("bench_fp12")
|
||||||
|
runBench("bench_ec_swei_proj_g1")
|
||||||
|
|
||||||
task test_no_gmp, "Run tests that don't require GMP":
|
task test_no_gmp, "Run tests that don't require GMP":
|
||||||
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
||||||
|
|
||||||
|
@ -135,16 +153,12 @@ task test_no_gmp, "Run tests that don't require GMP":
|
||||||
# Elliptic curve arithmetic
|
# Elliptic curve arithmetic
|
||||||
test "-d:Constantine32", "tests/test_ec_weierstrass_projective_g1.nim"
|
test "-d:Constantine32", "tests/test_ec_weierstrass_projective_g1.nim"
|
||||||
|
|
||||||
proc runBench(benchName: string, compiler = "") =
|
# Benchmarks compile and run
|
||||||
if not dirExists "build":
|
runBench("bench_fp")
|
||||||
mkDir "build"
|
runBench("bench_fp2")
|
||||||
|
runBench("bench_fp6")
|
||||||
var cc = ""
|
runBench("bench_fp12")
|
||||||
if compiler != "":
|
runBench("bench_ec_swei_proj_g1")
|
||||||
cc = "--cc:" & compiler
|
|
||||||
exec "nim c " & cc &
|
|
||||||
" -d:danger --verbosity:0 -o:build/" & benchName & "_" & compiler &
|
|
||||||
" -r --hints:off --warnings:off benchmarks/" & benchName & ".nim"
|
|
||||||
|
|
||||||
task bench_fp, "Run benchmark 𝔽p with your default compiler":
|
task bench_fp, "Run benchmark 𝔽p with your default compiler":
|
||||||
runBench("bench_fp")
|
runBench("bench_fp")
|
||||||
|
|
Loading…
Reference in New Issue