From c2313ad69771ef733408005608308ad9c312c12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Thu, 3 Sep 2020 23:30:39 +0200 Subject: [PATCH] 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. --- tests/t_bigints_mod_vs_gmp.nim | 2 +- tests/t_bigints_mul_high_words_vs_gmp.nim | 2 +- tests/t_bigints_mul_vs_gmp.nim | 2 +- tests/t_ec_wstrass_prj_g1_add_double.nim | 2 +- tests/t_ec_wstrass_prj_g1_mul_distri.nim | 2 +- tests/t_ec_wstrass_prj_g1_mul_sanity.nim | 2 +- tests/t_ec_wstrass_prj_g1_mul_vs_ref.nim | 2 +- tests/t_ec_wstrass_prj_g2_add_double_bls12_381.nim | 2 +- tests/t_ec_wstrass_prj_g2_add_double_bn254_snarks.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_distri_bls12_381.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_distri_bn254_snarks.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_sanity_bls12_381.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_sanity_bn254_snarks.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_vs_ref_bls12_381.nim | 2 +- tests/t_ec_wstrass_prj_g2_mul_vs_ref_bn254_snarks.nim | 2 +- tests/t_finite_fields_double_width.nim | 2 +- tests/t_finite_fields_mulsquare.nim | 2 +- tests/t_finite_fields_powinv.nim | 2 +- tests/t_finite_fields_sqrt.nim | 2 +- tests/t_finite_fields_vs_gmp.nim | 8 ++++---- tests/t_fp12_bls12_377.nim | 2 +- tests/t_fp12_bls12_381.nim | 2 +- tests/t_fp12_bn254_snarks.nim | 2 +- tests/t_fp2.nim | 2 +- tests/t_fp2_sqrt.nim | 2 +- tests/t_fp6_bls12_377.nim | 2 +- tests/t_fp6_bls12_381.nim | 2 +- 27 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/t_bigints_mod_vs_gmp.nim b/tests/t_bigints_mod_vs_gmp.nim index d8fb058..2f96cd6 100644 --- a/tests/t_bigints_mod_vs_gmp.nim +++ b/tests/t_bigints_mod_vs_gmp.nim @@ -92,7 +92,7 @@ proc main() = mpz_init(m) mpz_init(r) - testRandomModSizes(128, aBits, mBits): + testRandomModSizes(24, aBits, mBits): # echo "--------------------------------------------------------------------------------" echo "Testing: random dividend (" & align($aBits, 4) & "-bit) -- random modulus (" & align($mBits, 4) & "-bit)" diff --git a/tests/t_bigints_mul_high_words_vs_gmp.nim b/tests/t_bigints_mul_high_words_vs_gmp.nim index b44f8e1..c2daafd 100644 --- a/tests/t_bigints_mul_high_words_vs_gmp.nim +++ b/tests/t_bigints_mul_high_words_vs_gmp.nim @@ -67,7 +67,7 @@ proc main() = mpz_init(a) mpz_init(b) - testRandomModSizes(128, rBits, aBits, bBits, wordsStartIndex): + testRandomModSizes(24, rBits, aBits, bBits, wordsStartIndex): # echo "--------------------------------------------------------------------------------" echo "Testing: random mul_high_words r (", align($rBits, 4), "-bit, keeping from ", wordsStartIndex, diff --git a/tests/t_bigints_mul_vs_gmp.nim b/tests/t_bigints_mul_vs_gmp.nim index f777a52..db960cb 100644 --- a/tests/t_bigints_mul_vs_gmp.nim +++ b/tests/t_bigints_mul_vs_gmp.nim @@ -64,7 +64,7 @@ proc main() = mpz_init(a) mpz_init(b) - testRandomModSizes(128, rBits, aBits, bBits): + testRandomModSizes(24, rBits, aBits, bBits): # 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 diff --git a/tests/t_ec_wstrass_prj_g1_add_double.nim b/tests/t_ec_wstrass_prj_g1_add_double.nim index 991c42b..eec6af8 100644 --- a/tests/t_ec_wstrass_prj_g1_add_double.nim +++ b/tests/t_ec_wstrass_prj_g1_add_double.nim @@ -19,7 +19,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 run_EC_addition_tests( ec = ECP_SWei_Proj[Fp[BN254_Snarks]], diff --git a/tests/t_ec_wstrass_prj_g1_mul_distri.nim b/tests/t_ec_wstrass_prj_g1_mul_distri.nim index b53b79f..16e1bee 100644 --- a/tests/t_ec_wstrass_prj_g1_mul_distri.nim +++ b/tests/t_ec_wstrass_prj_g1_mul_distri.nim @@ -20,7 +20,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_distributive_tests( diff --git a/tests/t_ec_wstrass_prj_g1_mul_sanity.nim b/tests/t_ec_wstrass_prj_g1_mul_sanity.nim index 8a5f582..b5eaff3 100644 --- a/tests/t_ec_wstrass_prj_g1_mul_sanity.nim +++ b/tests/t_ec_wstrass_prj_g1_mul_sanity.nim @@ -20,7 +20,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_sanity_tests( diff --git a/tests/t_ec_wstrass_prj_g1_mul_vs_ref.nim b/tests/t_ec_wstrass_prj_g1_mul_vs_ref.nim index 96da445..49661d1 100644 --- a/tests/t_ec_wstrass_prj_g1_mul_vs_ref.nim +++ b/tests/t_ec_wstrass_prj_g1_mul_vs_ref.nim @@ -20,7 +20,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_vs_ref_impl( diff --git a/tests/t_ec_wstrass_prj_g2_add_double_bls12_381.nim b/tests/t_ec_wstrass_prj_g2_add_double_bls12_381.nim index 9f7ed94..7d33697 100644 --- a/tests/t_ec_wstrass_prj_g2_add_double_bls12_381.nim +++ b/tests/t_ec_wstrass_prj_g2_add_double_bls12_381.nim @@ -20,7 +20,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 run_EC_addition_tests( ec = ECP_SWei_Proj[Fp2[BLS12_381]], diff --git a/tests/t_ec_wstrass_prj_g2_add_double_bn254_snarks.nim b/tests/t_ec_wstrass_prj_g2_add_double_bn254_snarks.nim index 46760bd..4c024f7 100644 --- a/tests/t_ec_wstrass_prj_g2_add_double_bn254_snarks.nim +++ b/tests/t_ec_wstrass_prj_g2_add_double_bn254_snarks.nim @@ -20,7 +20,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 run_EC_addition_tests( ec = ECP_SWei_Proj[Fp2[BN254_Snarks]], diff --git a/tests/t_ec_wstrass_prj_g2_mul_distri_bls12_381.nim b/tests/t_ec_wstrass_prj_g2_mul_distri_bls12_381.nim index 0bfcf75..4c76ea7 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_distri_bls12_381.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_distri_bls12_381.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_distributive_tests( diff --git a/tests/t_ec_wstrass_prj_g2_mul_distri_bn254_snarks.nim b/tests/t_ec_wstrass_prj_g2_mul_distri_bn254_snarks.nim index 7b7adaf..2199b1c 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_distri_bn254_snarks.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_distri_bn254_snarks.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_distributive_tests( diff --git a/tests/t_ec_wstrass_prj_g2_mul_sanity_bls12_381.nim b/tests/t_ec_wstrass_prj_g2_mul_sanity_bls12_381.nim index 3d51d15..8888b2f 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_sanity_bls12_381.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_sanity_bls12_381.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_sanity_tests( diff --git a/tests/t_ec_wstrass_prj_g2_mul_sanity_bn254_snarks.nim b/tests/t_ec_wstrass_prj_g2_mul_sanity_bn254_snarks.nim index 386d49c..a0fe1f8 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_sanity_bn254_snarks.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_sanity_bn254_snarks.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_sanity_tests( diff --git a/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bls12_381.nim b/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bls12_381.nim index 66a0f67..ccd5fd3 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bls12_381.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bls12_381.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_vs_ref_impl( diff --git a/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bn254_snarks.nim b/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bn254_snarks.nim index 86712c0..3bbe774 100644 --- a/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bn254_snarks.nim +++ b/tests/t_ec_wstrass_prj_g2_mul_vs_ref_bn254_snarks.nim @@ -21,7 +21,7 @@ import ./t_ec_template const - Iters = 128 + Iters = 24 ItersMul = Iters div 4 run_EC_mul_vs_ref_impl( diff --git a/tests/t_finite_fields_double_width.nim b/tests/t_finite_fields_double_width.nim index da9951f..9934281 100644 --- a/tests/t_finite_fields_double_width.nim +++ b/tests/t_finite_fields_double_width.nim @@ -16,7 +16,7 @@ import # Test utilities ../helpers/prng_unsafe -const Iters = 128 +const Iters = 24 var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/tests/t_finite_fields_mulsquare.nim b/tests/t_finite_fields_mulsquare.nim index 255ce57..d5ea038 100644 --- a/tests/t_finite_fields_mulsquare.nim +++ b/tests/t_finite_fields_mulsquare.nim @@ -16,7 +16,7 @@ import # Test utilities ../helpers/prng_unsafe -const Iters = 128 +const Iters = 24 var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/tests/t_finite_fields_powinv.nim b/tests/t_finite_fields_powinv.nim index 7af8485..83a9744 100644 --- a/tests/t_finite_fields_powinv.nim +++ b/tests/t_finite_fields_powinv.nim @@ -20,7 +20,7 @@ import static: doAssert defined(testingCurves), "This modules requires the -d:testingCurves compile option" -const Iters = 512 +const Iters = 24 var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/tests/t_finite_fields_sqrt.nim b/tests/t_finite_fields_sqrt.nim index 3762be4..10b3271 100644 --- a/tests/t_finite_fields_sqrt.nim +++ b/tests/t_finite_fields_sqrt.nim @@ -17,7 +17,7 @@ import ../helpers/prng_unsafe -const Iters = 128 +const Iters = 24 var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/tests/t_finite_fields_vs_gmp.nim b/tests/t_finite_fields_vs_gmp.nim index af96673..32514b8 100644 --- a/tests/t_finite_fields_vs_gmp.nim +++ b/tests/t_finite_fields_vs_gmp.nim @@ -237,25 +237,25 @@ template testSetup {.dirty.} = proc mainMul() = testSetup() echo "Testing modular multiplications vs GMP" - randomTests(128, curve): + randomTests(24, curve): mulTests(gmpRng, a, b, p, r, curve) proc mainAdd() = testSetup() echo "Testing modular additions vs GMP" - randomTests(128, curve): + randomTests(24, curve): addTests(gmpRng, a, b, p, r, curve) proc mainSub() = testSetup() echo "Testing modular substractions vs GMP" - randomTests(128, curve): + randomTests(24, curve): subTests(gmpRng, a, b, p, r, curve) proc mainInv() = testSetup() echo "Testing modular inversions vs GMP" - randomTests(128, curve): + randomTests(24, curve): invTests(gmpRng, a, b, p, r, curve) diff --git a/tests/t_fp12_bls12_377.nim b/tests/t_fp12_bls12_377.nim index ff8cbbb..ae3c47f 100644 --- a/tests/t_fp12_bls12_377.nim +++ b/tests/t_fp12_bls12_377.nim @@ -19,7 +19,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 12, - Iters = 128, + Iters = 24, TestCurves = TestCurves, moduleName = "test_fp12_" & $BLS12_377, testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_377 diff --git a/tests/t_fp12_bls12_381.nim b/tests/t_fp12_bls12_381.nim index 93832e5..9f48322 100644 --- a/tests/t_fp12_bls12_381.nim +++ b/tests/t_fp12_bls12_381.nim @@ -19,7 +19,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 12, - Iters = 128, + Iters = 24, TestCurves = TestCurves, moduleName = "test_fp12_" & $BLS12_381, testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BLS12_381 diff --git a/tests/t_fp12_bn254_snarks.nim b/tests/t_fp12_bn254_snarks.nim index f4796c9..69957e2 100644 --- a/tests/t_fp12_bn254_snarks.nim +++ b/tests/t_fp12_bn254_snarks.nim @@ -19,7 +19,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 12, - Iters = 128, + Iters = 24, TestCurves = TestCurves, moduleName = "test_fp12_" & $BN254_Snarks, testSuiteDesc = "𝔽p12 = 𝔽p6[w] " & $BN254_Snarks diff --git a/tests/t_fp2.nim b/tests/t_fp2.nim index 51cf64b..6f97a87 100644 --- a/tests/t_fp2.nim +++ b/tests/t_fp2.nim @@ -26,7 +26,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 2, - Iters = 128, + Iters = 24, TestCurves = TestCurves, 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" diff --git a/tests/t_fp2_sqrt.nim b/tests/t_fp2_sqrt.nim index 2626531..b10122a 100644 --- a/tests/t_fp2_sqrt.nim +++ b/tests/t_fp2_sqrt.nim @@ -18,7 +18,7 @@ import # Test utilities ../helpers/prng_unsafe -const Iters = 128 +const Iters = 24 var rng: RngState let seed = uint32(getTime().toUnix() and (1'i64 shl 32 - 1)) # unixTime mod 2^32 diff --git a/tests/t_fp6_bls12_377.nim b/tests/t_fp6_bls12_377.nim index eab9547..2f79766 100644 --- a/tests/t_fp6_bls12_377.nim +++ b/tests/t_fp6_bls12_377.nim @@ -19,7 +19,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 6, - Iters = 128, + Iters = 24, TestCurves = TestCurves, moduleName = "test_fp6_" & $BLS12_377, testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_377 diff --git a/tests/t_fp6_bls12_381.nim b/tests/t_fp6_bls12_381.nim index 60738a6..6672874 100644 --- a/tests/t_fp6_bls12_381.nim +++ b/tests/t_fp6_bls12_381.nim @@ -19,7 +19,7 @@ const TestCurves = [ runTowerTests( ExtDegree = 6, - Iters = 128, + Iters = 24, TestCurves = TestCurves, moduleName = "test_fp6_" & $BLS12_381, testSuiteDesc = "𝔽p6 = 𝔽p2[v] " & $BLS12_381