5.3x faster test suite.

The running time of the test suite has increased significantly with:
- new tests (for example scalar mul implementations)
- new tests that stresses the whole stack/tower
- x3 randomizers for fuzzing
- new CI and platforms: Total 16x runs per commit

This would let all tests take less than 10 min on CI even non-parallelized one like on Windows.
This commit is contained in:
Mamy André-Ratsimbazafy 2020-09-03 23:30:39 +02:00
parent 85d365359d
commit c2313ad697
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1
27 changed files with 30 additions and 30 deletions

View File

@ -92,7 +92,7 @@ proc main() =
mpz_init(m) mpz_init(m)
mpz_init(r) mpz_init(r)
testRandomModSizes(128, aBits, mBits): testRandomModSizes(24, aBits, mBits):
# echo "--------------------------------------------------------------------------------" # echo "--------------------------------------------------------------------------------"
echo "Testing: random dividend (" & align($aBits, 4) & "-bit) -- random modulus (" & align($mBits, 4) & "-bit)" echo "Testing: random dividend (" & align($aBits, 4) & "-bit) -- random modulus (" & align($mBits, 4) & "-bit)"

View File

@ -67,7 +67,7 @@ proc main() =
mpz_init(a) mpz_init(a)
mpz_init(b) mpz_init(b)
testRandomModSizes(128, rBits, aBits, bBits, wordsStartIndex): testRandomModSizes(24, rBits, aBits, bBits, wordsStartIndex):
# echo "--------------------------------------------------------------------------------" # echo "--------------------------------------------------------------------------------"
echo "Testing: random mul_high_words r (", align($rBits, 4), echo "Testing: random mul_high_words r (", align($rBits, 4),
"-bit, keeping from ", wordsStartIndex, "-bit, keeping from ", wordsStartIndex,

View File

@ -64,7 +64,7 @@ proc main() =
mpz_init(a) mpz_init(a)
mpz_init(b) mpz_init(b)
testRandomModSizes(128, rBits, aBits, bBits): testRandomModSizes(24, rBits, aBits, bBits):
# echo "--------------------------------------------------------------------------------" # echo "--------------------------------------------------------------------------------"
echo "Testing: random mul r (", align($rBits, 4), "-bit) <- a (", align($aBits, 4), "-bit) * b (", align($bBits, 4), "-bit) (full mul bits: ", align($(aBits+bBits), 4), "), r large enough? ", rBits >= aBits+bBits echo "Testing: random mul r (", align($rBits, 4), "-bit) <- a (", align($aBits, 4), "-bit) * b (", align($bBits, 4), "-bit) (full mul bits: ", align($(aBits+bBits), 4), "), r large enough? ", rBits >= aBits+bBits

View File

@ -19,7 +19,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
run_EC_addition_tests( run_EC_addition_tests(
ec = ECP_SWei_Proj[Fp[BN254_Snarks]], ec = ECP_SWei_Proj[Fp[BN254_Snarks]],

View File

@ -20,7 +20,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_distributive_tests( run_EC_mul_distributive_tests(

View File

@ -20,7 +20,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_sanity_tests( run_EC_mul_sanity_tests(

View File

@ -20,7 +20,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_vs_ref_impl( run_EC_mul_vs_ref_impl(

View File

@ -20,7 +20,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
run_EC_addition_tests( run_EC_addition_tests(
ec = ECP_SWei_Proj[Fp2[BLS12_381]], ec = ECP_SWei_Proj[Fp2[BLS12_381]],

View File

@ -20,7 +20,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
run_EC_addition_tests( run_EC_addition_tests(
ec = ECP_SWei_Proj[Fp2[BN254_Snarks]], ec = ECP_SWei_Proj[Fp2[BN254_Snarks]],

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_distributive_tests( run_EC_mul_distributive_tests(

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_distributive_tests( run_EC_mul_distributive_tests(

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_sanity_tests( run_EC_mul_sanity_tests(

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_sanity_tests( run_EC_mul_sanity_tests(

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_vs_ref_impl( run_EC_mul_vs_ref_impl(

View File

@ -21,7 +21,7 @@ import
./t_ec_template ./t_ec_template
const const
Iters = 128 Iters = 24
ItersMul = Iters div 4 ItersMul = Iters div 4
run_EC_mul_vs_ref_impl( run_EC_mul_vs_ref_impl(

View File

@ -16,7 +16,7 @@ import
# Test utilities # Test utilities
../helpers/prng_unsafe ../helpers/prng_unsafe
const Iters = 128 const Iters = 24
var rng: RngState var rng: RngState
let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32

View File

@ -16,7 +16,7 @@ import
# Test utilities # Test utilities
../helpers/prng_unsafe ../helpers/prng_unsafe
const Iters = 128 const Iters = 24
var rng: RngState var rng: RngState
let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32

View File

@ -20,7 +20,7 @@ import
static: doAssert defined(testingCurves), "This modules requires the -d:testingCurves compile option" static: doAssert defined(testingCurves), "This modules requires the -d:testingCurves compile option"
const Iters = 512 const Iters = 24
var rng: RngState var rng: RngState
let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32

View File

@ -17,7 +17,7 @@ import
../helpers/prng_unsafe ../helpers/prng_unsafe
const Iters = 128 const Iters = 24
var rng: RngState var rng: RngState
let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32

View File

@ -237,25 +237,25 @@ template testSetup {.dirty.} =
proc mainMul() = proc mainMul() =
testSetup() testSetup()
echo "Testing modular multiplications vs GMP" echo "Testing modular multiplications vs GMP"
randomTests(128, curve): randomTests(24, curve):
mulTests(gmpRng, a, b, p, r, curve) mulTests(gmpRng, a, b, p, r, curve)
proc mainAdd() = proc mainAdd() =
testSetup() testSetup()
echo "Testing modular additions vs GMP" echo "Testing modular additions vs GMP"
randomTests(128, curve): randomTests(24, curve):
addTests(gmpRng, a, b, p, r, curve) addTests(gmpRng, a, b, p, r, curve)
proc mainSub() = proc mainSub() =
testSetup() testSetup()
echo "Testing modular substractions vs GMP" echo "Testing modular substractions vs GMP"
randomTests(128, curve): randomTests(24, curve):
subTests(gmpRng, a, b, p, r, curve) subTests(gmpRng, a, b, p, r, curve)
proc mainInv() = proc mainInv() =
testSetup() testSetup()
echo "Testing modular inversions vs GMP" echo "Testing modular inversions vs GMP"
randomTests(128, curve): randomTests(24, curve):
invTests(gmpRng, a, b, p, r, curve) invTests(gmpRng, a, b, p, r, curve)

View File

@ -19,7 +19,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 12, ExtDegree = 12,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp12_" & $BLS12_377, moduleName = "test_fp12_" & $BLS12_377,
testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_377 testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_377

View File

@ -19,7 +19,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 12, ExtDegree = 12,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp12_" & $BLS12_381, moduleName = "test_fp12_" & $BLS12_381,
testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_381 testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_381

View File

@ -19,7 +19,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 12, ExtDegree = 12,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp12_" & $BN254_Snarks, moduleName = "test_fp12_" & $BN254_Snarks,
testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BN254_Snarks testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BN254_Snarks

View File

@ -26,7 +26,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 2, ExtDegree = 2,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp2", moduleName = "test_fp2",
testSuiteDesc = "𝔽p2 = 𝔽p[u] (irreducible polynomial u²-β = 0) -> 𝔽p2 point (a, b) with coordinate a + bu and β quadratic non-residue in 𝔽p" testSuiteDesc = "𝔽p2 = 𝔽p[u] (irreducible polynomial u²-β = 0) -> 𝔽p2 point (a, b) with coordinate a + bu and β quadratic non-residue in 𝔽p"

View File

@ -18,7 +18,7 @@ import
# Test utilities # Test utilities
../helpers/prng_unsafe ../helpers/prng_unsafe
const Iters = 128 const Iters = 24
var rng: RngState var rng: RngState
let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32

View File

@ -19,7 +19,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 6, ExtDegree = 6,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp6_" & $BLS12_377, moduleName = "test_fp6_" & $BLS12_377,
testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_377 testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_377

View File

@ -19,7 +19,7 @@ const TestCurves = [
runTowerTests( runTowerTests(
ExtDegree = 6, ExtDegree = 6,
Iters = 128, Iters = 24,
TestCurves = TestCurves, TestCurves = TestCurves,
moduleName = "test_fp6_" & $BLS12_381, moduleName = "test_fp6_" & $BLS12_381,
testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_381 testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_381