Fix test suite (#116)

* Pin nim-serialization. Workaround #113 and https://github.com/status-im/nim-serialization/issues/33

* Need to workaround nimble installing dependency multiple times

* non-interactive

* UB sanitizer missing on mingw

* Fix OpenSSL benchmark on non-Linux platforms

* Accelerate CI:
- Skip 32-bit on 64-bit tests
- Only test leaf functionality.

* Don't define -fstack-protector-all with MinGW

* skip line functions and cyclotomic tests (already tested in pairing) + only compile the benches don't run them.
This commit is contained in:
Mamy Ratsimbazafy 2021-01-21 21:25:42 +01:00 committed by GitHub
parent 023e690efc
commit ac6300555a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 166 additions and 140 deletions

View File

@ -199,9 +199,14 @@ jobs:
rm -rf .git rm -rf .git
- name: Install test dependencies - name: Install test dependencies
shell: bash shell: bash
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
run: | run: |
nimble refresh nimble refresh
nimble install -y gmp stew serialization json_serialization nimble install -y gmp stew json_serialization
nimble uninstall -y serialization
nimble install serialization@#217d78a
- name: Run Constantine tests (with Assembler & with GMP) - name: Run Constantine tests (with Assembler & with GMP)
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.cpu == 'amd64' if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.target.cpu == 'amd64'
shell: bash shell: bash

View File

@ -127,7 +127,13 @@ before_script:
- export PATH="$PWD/nim-${CHANNEL}/bin${PATH:+:$PATH}" - export PATH="$PWD/nim-${CHANNEL}/bin${PATH:+:$PATH}"
script: script:
- nimble refresh - nimble refresh
- nimble install -y gmp stew serialization json_serialization - nimble install -y gmp stew json_serialization
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
- nimble uninstall -y serialization
- nimble install serialization@#217d78a
# Installing Clang9.0 or later is a pain in Travis # Installing Clang9.0 or later is a pain in Travis
# for inline assembly "flag output constraint" # for inline assembly "flag output constraint"
# Also MacOS build is timing out with 2 series of tests. # Also MacOS build is timing out with 2 series of tests.

View File

@ -216,10 +216,15 @@ steps:
displayName: 'Downloading GMP (Linux 32-bit)' displayName: 'Downloading GMP (Linux 32-bit)'
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['UCPU'], 'i686')) condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['UCPU'], 'i686'))
# Workaround #113 and https://github.com/status-im/nim-serialization/issues/33
# and nimble flaky pinning / dependency resolution,
# json_serialization install would override nim-serialization pinning
- bash: | - bash: |
echo "PATH=${PATH}" echo "PATH=${PATH}"
nimble refresh nimble refresh
nimble install -y gmp stew serialization json_serialization nimble install -y gmp stew json_serialization
nimble uninstall -y serialization
nimble install serialization@#217d78a
displayName: 'Installing package and testing dependencies' displayName: 'Installing package and testing dependencies'
- bash: | - bash: |

View File

@ -7,16 +7,41 @@ import
proc separator*() = separator(69) proc separator*() = separator(69)
# Deal with platform mess
# --------------------------------------------------------------------
when defined(windows):
when sizeof(int) == 8:
const DLLSSLName* = "(libssl-1_1-x64|ssleay64|libssl64).dll"
else:
const DLLSSLName* = "(libssl-1_1|ssleay32|libssl32).dll"
else:
when defined(macosx):
const versions = "(.1.1|.38|.39|.41|.43|.44|.45|.46|.47|.48|.10|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|)"
else:
const versions = "(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.48|.47|.46|.45|.44|.43|.41|.39|.38|.10|)"
when defined(macosx):
const DLLSSLName* = "libssl" & versions & ".dylib"
elif defined(genode):
const DLLSSLName* = "libssl.lib.so"
else:
const DLLSSLName* = "libssl.so" & versions
# OpenSSL wrapper
# --------------------------------------------------------------------
proc SHA256[T: byte|char]( proc SHA256[T: byte|char](
msg: openarray[T], msg: openarray[T],
digest: ptr array[32, byte] = nil digest: ptr array[32, byte] = nil
): ptr array[32, byte] {.cdecl, dynlib: "libssl.so", importc.} ): ptr array[32, byte] {.cdecl, dynlib: DLLSSLName, importc.}
proc SHA256_OpenSSL[T: byte|char]( proc SHA256_OpenSSL[T: byte|char](
digest: var array[32, byte], digest: var array[32, byte],
s: openarray[T]) = s: openarray[T]) =
discard SHA256(s, digest.addr) discard SHA256(s, digest.addr)
# --------------------------------------------------------------------
proc report(op: string, bytes: int, startTime, stopTime: MonoTime, startClk, stopClk: int64, iters: int) = proc report(op: string, bytes: int, startTime, stopTime: MonoTime, startClk, stopClk: int64, iters: int) =
let ns = inNanoseconds((stopTime-startTime) div iters) let ns = inNanoseconds((stopTime-startTime) div iters)
let throughput = 1e9 / float64(ns) let throughput = 1e9 / float64(ns)

View File

@ -14,11 +14,19 @@ requires "nim >= 1.1.0"
const buildParallel = "test_parallel.txt" const buildParallel = "test_parallel.txt"
# Testing strategy: to reduce CI time we test leaf functionality
# and skip testing codepath that would be exercised by leaves.
# While debugging, relevant unit-test can be reactivated.
# New features should stay on.
# Code refactoring requires re-enabling the full suite.
# Basic primitives should stay on to catch compiler regressions.
const testDesc: seq[tuple[path: string, useGMP: bool]] = @[ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
# Primitives # Primitives
# ----------------------------------------------------------
("tests/t_primitives.nim", false), ("tests/t_primitives.nim", false),
("tests/t_primitives_extended_precision.nim", false), ("tests/t_primitives_extended_precision.nim", false),
# Big ints # Big ints
# ----------------------------------------------------------
("tests/t_io_bigints.nim", false), ("tests/t_io_bigints.nim", false),
("tests/t_bigints.nim", false), ("tests/t_bigints.nim", false),
("tests/t_bigints_multimod.nim", false), ("tests/t_bigints_multimod.nim", false),
@ -26,6 +34,7 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
("tests/t_bigints_mul_vs_gmp.nim", true), ("tests/t_bigints_mul_vs_gmp.nim", true),
("tests/t_bigints_mul_high_words_vs_gmp.nim", true), ("tests/t_bigints_mul_high_words_vs_gmp.nim", true),
# Field # Field
# ----------------------------------------------------------
("tests/t_io_fields", false), ("tests/t_io_fields", false),
("tests/t_finite_fields.nim", false), ("tests/t_finite_fields.nim", false),
("tests/t_finite_fields_conditional_arithmetic.nim", false), ("tests/t_finite_fields_conditional_arithmetic.nim", false),
@ -35,95 +44,104 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
("tests/t_finite_fields_vs_gmp.nim", true), ("tests/t_finite_fields_vs_gmp.nim", true),
("tests/t_fp_cubic_root.nim", false), ("tests/t_fp_cubic_root.nim", false),
# Double-width finite fields # Double-width finite fields
# ----------------------------------------------------------
("tests/t_finite_fields_double_width.nim", false), ("tests/t_finite_fields_double_width.nim", false),
# Towers of extension fields # Towers of extension fields
("tests/t_fp2.nim", false), # ----------------------------------------------------------
# ("tests/t_fp2.nim", false),
("tests/t_fp2_sqrt.nim", false), ("tests/t_fp2_sqrt.nim", false),
("tests/t_fp6_bn254_snarks.nim", false), # ("tests/t_fp6_bn254_snarks.nim", false),
("tests/t_fp6_bls12_377.nim", false), # ("tests/t_fp6_bls12_377.nim", false),
("tests/t_fp6_bls12_381.nim", false), # ("tests/t_fp6_bls12_381.nim", false),
("tests/t_fp6_bw6_761.nim", false), ("tests/t_fp6_bw6_761.nim", false),
("tests/t_fp12_bn254_snarks.nim", false), ("tests/t_fp12_bn254_snarks.nim", false),
("tests/t_fp12_bls12_377.nim", false), ("tests/t_fp12_bls12_377.nim", false),
("tests/t_fp12_bls12_381.nim", false), ("tests/t_fp12_bls12_381.nim", false),
("tests/t_fp12_exponentiation.nim", false), ("tests/t_fp12_exponentiation.nim", false),
("tests/t_fp4_frobenius.nim", false), # ("tests/t_fp4_frobenius.nim", false),
# ("tests/t_fp6_frobenius.nim", false),
("tests/t_fp12_frobenius.nim", false),
# Elliptic curve arithmetic G1 # Elliptic curve arithmetic G1
("tests/t_ec_shortw_prj_g1_add_double.nim", false), # ----------------------------------------------------------
("tests/t_ec_shortw_prj_g1_mul_sanity.nim", false), # ("tests/t_ec_shortw_prj_g1_add_double.nim", false),
("tests/t_ec_shortw_prj_g1_mul_distri.nim", false), # ("tests/t_ec_shortw_prj_g1_mul_sanity.nim", false),
# ("tests/t_ec_shortw_prj_g1_mul_distri.nim", false),
("tests/t_ec_shortw_prj_g1_mul_vs_ref.nim", false), ("tests/t_ec_shortw_prj_g1_mul_vs_ref.nim", false),
("tests/t_ec_shortw_prj_g1_mixed_add.nim", false), ("tests/t_ec_shortw_prj_g1_mixed_add.nim", false),
("tests/t_ec_shortw_jac_g1_add_double.nim", false), # ("tests/t_ec_shortw_jac_g1_add_double.nim", false),
("tests/t_ec_shortw_jac_g1_mul_sanity.nim", false), # ("tests/t_ec_shortw_jac_g1_mul_sanity.nim", false),
("tests/t_ec_shortw_jac_g1_mul_distri.nim", false), # ("tests/t_ec_shortw_jac_g1_mul_distri.nim", false),
("tests/t_ec_shortw_jac_g1_mul_vs_ref.nim", false), ("tests/t_ec_shortw_jac_g1_mul_vs_ref.nim", false),
# mixed_add # mixed_add
# Elliptic curve arithmetic G2 # Elliptic curve arithmetic G2
("tests/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false), # ----------------------------------------------------------
("tests/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false), # ("tests/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false),
("tests/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false),
# ("tests/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false),
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false), ("tests/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false),
("tests/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false), ("tests/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false),
("tests/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false), # ("tests/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false),
("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false),
("tests/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false),
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false), ("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false),
("tests/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false), ("tests/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false),
("tests/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false), # ("tests/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false),
("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false),
("tests/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false),
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false), ("tests/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false),
("tests/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false), ("tests/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false),
("tests/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false), # ("tests/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false),
("tests/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false),
("tests/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false), # ("tests/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false),
("tests/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false), ("tests/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false),
("tests/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false), ("tests/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false),
("tests/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false), # ("tests/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false),
("tests/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false),
("tests/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false),
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false), ("tests/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false),
# mixed_add # mixed_add
("tests/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false), # ("tests/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false),
("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false),
("tests/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false),
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false), ("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false),
# mixed_add # mixed_add
("tests/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false), # ("tests/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false),
("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false),
("tests/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false),
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false), ("tests/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false),
# mixed_add # mixed_add
("tests/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false), # ("tests/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false),
("tests/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false),
("tests/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false), # ("tests/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false),
("tests/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false), ("tests/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false),
# mixed_add # mixed_add
# Elliptic curve arithmetic vs Sagemath # Elliptic curve arithmetic vs Sagemath
# ----------------------------------------------------------
("tests/t_ec_frobenius.nim", false), ("tests/t_ec_frobenius.nim", false),
("tests/t_ec_sage_bn254_nogami.nim", false), ("tests/t_ec_sage_bn254_nogami.nim", false),
("tests/t_ec_sage_bn254_snarks.nim", false), ("tests/t_ec_sage_bn254_snarks.nim", false),
("tests/t_ec_sage_bls12_377.nim", false), ("tests/t_ec_sage_bls12_377.nim", false),
("tests/t_ec_sage_bls12_381.nim", false), ("tests/t_ec_sage_bls12_381.nim", false),
# Edge cases highlighted by past bugs # Edge cases highlighted by past bugs
# ----------------------------------------------------------
("tests/t_ec_shortw_prj_edge_cases.nim", false), ("tests/t_ec_shortw_prj_edge_cases.nim", false),
# Pairing # Pairing
("tests/t_pairing_bls12_377_line_functions.nim", false), # ----------------------------------------------------------
("tests/t_pairing_bls12_381_line_functions.nim", false), # ("tests/t_pairing_bls12_377_line_functions.nim", false),
("tests/t_pairing_mul_fp12_by_lines.nim", false), # ("tests/t_pairing_bls12_381_line_functions.nim", false),
("tests/t_pairing_cyclotomic_fp12.nim", false), # ("tests/t_pairing_mul_fp12_by_lines.nim", false),
# ("tests/t_pairing_cyclotomic_fp12.nim", false),
("tests/t_pairing_bn254_nogami_optate.nim", false), ("tests/t_pairing_bn254_nogami_optate.nim", false),
("tests/t_pairing_bn254_snarks_optate.nim", false), ("tests/t_pairing_bn254_snarks_optate.nim", false),
("tests/t_pairing_bls12_377_optate.nim", false), ("tests/t_pairing_bls12_377_optate.nim", false),
@ -149,11 +167,15 @@ const skipSanitizers = [
"tests/t_ec_sage_bls12_381.nim", "tests/t_ec_sage_bls12_381.nim",
] ]
const sanitizers = when defined(windows):
" --passC:-fsanitize=undefined --passL:-fsanitize=undefined" & # UBSAN is not available on mingw
" --passC:-fno-sanitize-recover" & # Enforce crash on undefined behaviour const sanitizers = ""
" --gc:none" # The conservative stack scanning of Nim default GC triggers, alignment UB and stack-buffer-overflow check. else:
# " --passC:-fsanitize=address --passL:-fsanitize=address" & # Requires too much stack for the inline assembly const sanitizers =
" --passC:-fsanitize=undefined --passL:-fsanitize=undefined" &
" --passC:-fno-sanitize-recover" & # Enforce crash on undefined behaviour
" --gc:none" # The conservative stack scanning of Nim default GC triggers, alignment UB and stack-buffer-overflow check.
# " --passC:-fsanitize=address --passL:-fsanitize=address" & # Requires too much stack for the inline assembly
# Helper functions # Helper functions
@ -175,7 +197,10 @@ proc test(flags, path: string, commandFile = false) =
if existsEnv"CC": if existsEnv"CC":
cc = " --cc:" & getEnv"CC" cc = " --cc:" & getEnv"CC"
var flags = flags & " --passC:-fstack-protector-all" var flags = flags
when not defined(windows):
# Not available in MinGW https://github.com/libressl-portable/portable/issues/54
flags &= " --passC:-fstack-protector-all"
let command = "nim " & lang & cc & " " & flags & let command = "nim " & lang & cc & " " & flags &
" --verbosity:0 --outdir:build/testsuite -r --hints:off --warnings:off " & " --verbosity:0 --outdir:build/testsuite -r --hints:off --warnings:off " &
" --nimcache:nimcache/" & path & " " & " --nimcache:nimcache/" & path & " " &
@ -189,10 +214,13 @@ proc test(flags, path: string, commandFile = false) =
else: else:
exec "echo \'" & command & "\' >> " & buildParallel exec "echo \'" & command & "\' >> " & buildParallel
proc runBench(benchName: string, compiler = "", useAsm = true) = proc buildBench(benchName: string, compiler = "", useAsm = true, run = false) =
if not dirExists "build": if not dirExists "build":
mkDir "build" mkDir "build"
let runFlag = if run: " -r "
else: " "
var cc = "" var cc = ""
if compiler != "": if compiler != "":
cc = "--cc:" & compiler cc = "--cc:" & compiler
@ -201,7 +229,10 @@ proc runBench(benchName: string, compiler = "", useAsm = true) =
exec "nim c " & cc & exec "nim c " & cc &
" -d:danger --verbosity:0 -o:build/bench/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") & " -d:danger --verbosity:0 -o:build/bench/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
" --nimcache:nimcache/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") & " --nimcache:nimcache/" & benchName & "_" & compiler & "_" & (if useAsm: "useASM" else: "noASM") &
" -r --hints:off --warnings:off benchmarks/" & benchName & ".nim" runFlag & "--hints:off --warnings:off benchmarks/" & benchName & ".nim"
proc runBench(benchName: string, compiler = "", useAsm = true) =
buildBench(benchName, compiler, useAsm, run = true)
proc runTests(requireGMP: bool, dumpCmdFile = false, test32bit = false, testASM = true) = proc runTests(requireGMP: bool, dumpCmdFile = false, test32bit = false, testASM = true) =
for td in testDesc: for td in testDesc:
@ -217,6 +248,23 @@ proc runTests(requireGMP: bool, dumpCmdFile = false, test32bit = false, testASM
flags &= sanitizers flags &= sanitizers
test flags, td.path, dumpCmdFile test flags, td.path, dumpCmdFile
proc buildAllBenches() =
echo "\n\n------------------------------------------------------\n"
echo "Building benchmarks to ensure they stay relevant ..."
buildBench("bench_fp")
buildBench("bench_fp_double_width")
buildBench("bench_fp2")
buildBench("bench_fp6")
buildBench("bench_fp12")
buildBench("bench_ec_g1")
buildBench("bench_ec_g2")
buildBench("bench_pairing_bls12_377")
buildBench("bench_pairing_bls12_381")
buildBench("bench_pairing_bn254_nogami")
buildBench("bench_pairing_bn254_snarks")
buildBench("bench_sha256")
echo "All benchmarks compile successfully."
# Tasks # Tasks
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -229,18 +277,7 @@ task test, "Run all tests":
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp_double_width")
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
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
@ -251,17 +288,7 @@ task test_no_gmp, "Run tests that don't require GMP":
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
task test_parallel, "Run all tests in parallel (via GNU parallel)": task test_parallel, "Run all tests in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience # -d:testingCurves is configured in a *.nim.cfg for convenience
@ -269,28 +296,18 @@ task test_parallel, "Run all tests in parallel (via GNU parallel)":
runTests(requireGMP = true, dumpCmdFile = true) runTests(requireGMP = true, dumpCmdFile = true)
exec "parallel --keep-order --group < " & buildParallel exec "parallel --keep-order --group < " & buildParallel
if sizeof(int) == 8: # 32-bit tests on 64-bit arch # if sizeof(int) == 8: # 32-bit tests on 64-bit arch
clearParallelBuild() # clearParallelBuild()
runTests(requireGMP = true, dumpCmdFile = true, test32bit = true) # runTests(requireGMP = true, dumpCmdFile = true, test32bit = true)
exec "parallel --keep-order --group < " & buildParallel # exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks # Now run the benchmarks
# #
# Benchmarks compile and run # Benchmarks compile
# ignore Windows 32-bit for the moment # ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
task test_parallel_no_assembler, "Run all tests (without macro assembler) in parallel (via GNU parallel)": task test_parallel_no_assembler, "Run all tests (without macro assembler) in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience # -d:testingCurves is configured in a *.nim.cfg for convenience
@ -298,29 +315,18 @@ task test_parallel_no_assembler, "Run all tests (without macro assembler) in par
runTests(requireGMP = true, dumpCmdFile = true, testASM = false) runTests(requireGMP = true, dumpCmdFile = true, testASM = false)
exec "parallel --keep-order --group < " & buildParallel exec "parallel --keep-order --group < " & buildParallel
exec "> " & buildParallel # if sizeof(int) == 8: # 32-bit tests on 64-bit arch
if sizeof(int) == 8: # 32-bit tests on 64-bit arch # clearParallelBuild()
clearParallelBuild() # runTests(requireGMP = true, dumpCmdFile = true, test32bit = true, testASM = false)
runTests(requireGMP = true, dumpCmdFile = true, test32bit = true, testASM = false) # exec "parallel --keep-order --group < " & buildParallel
exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks # Now run the benchmarks
# #
# Benchmarks compile and run # Benchmarks compile
# ignore Windows 32-bit for the moment # ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)": task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience # -d:testingCurves is configured in a *.nim.cfg for convenience
@ -328,28 +334,18 @@ task test_parallel_no_gmp, "Run all tests in parallel (via GNU parallel)":
runTests(requireGMP = false, dumpCmdFile = true) runTests(requireGMP = false, dumpCmdFile = true)
exec "parallel --keep-order --group < " & buildParallel exec "parallel --keep-order --group < " & buildParallel
if sizeof(int) == 8: # 32-bit tests on 64-bit arch # if sizeof(int) == 8: # 32-bit tests on 64-bit arch
clearParallelBuild() # clearParallelBuild()
runTests(requireGMP = false, dumpCmdFile = true, test32bit = true) # runTests(requireGMP = false, dumpCmdFile = true, test32bit = true)
exec "parallel --keep-order --group < " & buildParallel # exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks # Now run the benchmarks
# #
# Benchmarks compile and run # Benchmarks compile
# ignore Windows 32-bit for the moment # ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
task test_parallel_no_gmp_no_assembler, "Run all tests in parallel (via GNU parallel)": task test_parallel_no_gmp_no_assembler, "Run all tests in parallel (via GNU parallel)":
# -d:testingCurves is configured in a *.nim.cfg for convenience # -d:testingCurves is configured in a *.nim.cfg for convenience
@ -357,29 +353,18 @@ task test_parallel_no_gmp_no_assembler, "Run all tests in parallel (via GNU para
runTests(requireGMP = false, dumpCmdFile = true, testASM = false) runTests(requireGMP = false, dumpCmdFile = true, testASM = false)
exec "parallel --keep-order --group < " & buildParallel exec "parallel --keep-order --group < " & buildParallel
exec "> " & buildParallel # if sizeof(int) == 8: # 32-bit tests on 64-bit arch
if sizeof(int) == 8: # 32-bit tests on 64-bit arch # clearParallelBuild()
clearParallelBuild() # runTests(requireGMP = false, dumpCmdFile = true, test32bit = true, testASM = false)
runTests(requireGMP = false, dumpCmdFile = true, test32bit = true, testASM = false) # exec "parallel --keep-order --group < " & buildParallel
exec "parallel --keep-order --group < " & buildParallel
# Now run the benchmarks # Now run the benchmarks
# #
# Benchmarks compile and run # Benchmarks compile
# ignore Windows 32-bit for the moment # ignore Windows 32-bit for the moment
# Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment # Ensure benchmarks stay relevant. Ignore Windows 32-bit at the moment
if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"): if not defined(windows) or not (existsEnv"UCPU" or getEnv"UCPU" == "i686"):
runBench("bench_fp") buildAllBenches()
runBench("bench_fp2")
runBench("bench_fp6")
runBench("bench_fp12")
runBench("bench_ec_g1")
runBench("bench_ec_g2")
runBench("bench_pairing_bls12_377")
runBench("bench_pairing_bls12_381")
runBench("bench_pairing_bn254_nogami")
runBench("bench_pairing_bn254_snarks")
runBench("bench_sha256")
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")