mirror of
https://github.com/status-im/constantine.git
synced 2025-02-22 17:08:05 +00:00
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:
parent
85d365359d
commit
c2313ad697
@ -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)"
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
||||
|
@ -19,7 +19,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
|
||||
run_EC_addition_tests(
|
||||
ec = ECP_SWei_Proj[Fp[BN254_Snarks]],
|
||||
|
@ -20,7 +20,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_distributive_tests(
|
||||
|
@ -20,7 +20,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_sanity_tests(
|
||||
|
@ -20,7 +20,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_vs_ref_impl(
|
||||
|
@ -20,7 +20,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
|
||||
run_EC_addition_tests(
|
||||
ec = ECP_SWei_Proj[Fp2[BLS12_381]],
|
||||
|
@ -20,7 +20,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
|
||||
run_EC_addition_tests(
|
||||
ec = ECP_SWei_Proj[Fp2[BN254_Snarks]],
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_distributive_tests(
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_distributive_tests(
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_sanity_tests(
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_sanity_tests(
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_vs_ref_impl(
|
||||
|
@ -21,7 +21,7 @@ import
|
||||
./t_ec_template
|
||||
|
||||
const
|
||||
Iters = 128
|
||||
Iters = 24
|
||||
ItersMul = Iters div 4
|
||||
|
||||
run_EC_mul_vs_ref_impl(
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user