diff --git a/ChangeLog b/ChangeLog index 6e32932109b37faff6cd9656905ae65f8c78d5ff..47a5a06aaf59e8cb39c367d349fefe12f4e3eaa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2023-10-03 Niels Möller <nisse@lysator.liu.se> + * testsuite/ecc-mod-arith-test.c: Reduce test count, aiming to get + test to complete in roughly 0.1s. + * testsuite/ecc-mod-test.c: Likewise. + * testsuite/ecc-modinv-test.c: Likewise. + * testsuite/ecc-mul-a-test.c: Likewise. + * testsuite/ecc-redc-test.c: Likewise. + * testsuite/ecc-sqrt-test.c: Likewise. + * testsuite/eddsa-compress-test.c: Likewise. + * testsuite/poly1305-test.c: Likewise. + * testsuite/random-prime-test.c: Likewise. + * testsuite/rsa-compute-root-test.c: Likewise. + * testsuite/rsa-sec-decrypt-test.c: Likewise. + * testsuite/Makefile.in (TS_SH): Delete tools tests from list. * tools/Makefile.in (check): Run tools tests from this target. (TS_ALL): New variable. diff --git a/testsuite/ecc-mod-arith-test.c b/testsuite/ecc-mod-arith-test.c index 14b3bd1c4abdcf158f148c13d3eb859c16fd70cb..de77d48914f42612cff6b126d9c4eb1890983e38 100644 --- a/testsuite/ecc-mod-arith-test.c +++ b/testsuite/ecc-mod-arith-test.c @@ -1,7 +1,7 @@ #include "testutils.h" #define MAX_SIZE (1 + 521 / GMP_NUMB_BITS) -#define COUNT 50000 +#define COUNT 10000 static void test_add(const char *name, @@ -143,18 +143,16 @@ void test_main (void) { gmp_randstate_t rands; - unsigned count = COUNT; unsigned i; gmp_randinit_default (rands); - if (test_randomize(rands)) - count *= 20; + test_randomize(rands); for (i = 0; ecc_curves[i]; i++) { - test_modulo (rands, "p", &ecc_curves[i]->p, count); - test_modulo (rands, "q", &ecc_curves[i]->q, count); + test_modulo (rands, "p", &ecc_curves[i]->p, COUNT); + test_modulo (rands, "q", &ecc_curves[i]->q, COUNT); } gmp_randclear (rands); } diff --git a/testsuite/ecc-mod-test.c b/testsuite/ecc-mod-test.c index 50fbeecf9372a4ba12763f6c9712c9dee0e07129..d6641d385ab68db7c0097ecdc3de2b02229aa8e8 100644 --- a/testsuite/ecc-mod-test.c +++ b/testsuite/ecc-mod-test.c @@ -13,7 +13,7 @@ ref_mod (mp_limb_t *rp, const mp_limb_t *ap, const mp_limb_t *mp, mp_size_t mn) #define MAX_ECC_SIZE (1 + 521 / GMP_NUMB_BITS) #define MAX_SIZE (2*MAX_ECC_SIZE) -#define COUNT 50000 +#define COUNT 10000 /* Destructively normalize tp, then compare */ static int @@ -215,7 +215,6 @@ void test_main (void) { gmp_randstate_t rands; - unsigned count = COUNT; unsigned i; gmp_randinit_default (rands); @@ -228,13 +227,12 @@ test_main (void) test_patterns ("q", &ecc_curves[i]->p); } - if (test_randomize(rands)) - count *= 20; + test_randomize(rands); for (i = 0; ecc_curves[i]; i++) { - test_modulo (rands, "p", &ecc_curves[i]->p, count); - test_modulo (rands, "q", &ecc_curves[i]->q, count); + test_modulo (rands, "p", &ecc_curves[i]->p, COUNT); + test_modulo (rands, "q", &ecc_curves[i]->q, COUNT); } gmp_randclear (rands); } diff --git a/testsuite/ecc-modinv-test.c b/testsuite/ecc-modinv-test.c index aecfb43b4f565133a8c9a968f0037b4e840edbe0..fdb013d760e48c28b9380e2eee9f7dcd7c46494a 100644 --- a/testsuite/ecc-modinv-test.c +++ b/testsuite/ecc-modinv-test.c @@ -39,7 +39,7 @@ ref_modinv (mp_limb_t *rp, const mp_limb_t *ap, } #define MAX_ECC_SIZE (1 + 521 / GMP_NUMB_BITS) -#define COUNT 500 +#define COUNT 200 static void test_modulo (gmp_randstate_t rands, const char *name, diff --git a/testsuite/ecc-mul-a-test.c b/testsuite/ecc-mul-a-test.c index 9d19762fd30a0eadffff7df423ff7f8241f0ef88..ec78ca572167874f7fa3f5b8df955b94f8c3bf52 100644 --- a/testsuite/ecc-mul-a-test.c +++ b/testsuite/ecc-mul-a-test.c @@ -46,7 +46,7 @@ test_main (void) mpn_zero (n, size); - for (j = 0; j < 100; j++) + for (j = 0; j < 30; j++) { if (j & 1) mpz_rrandomb (r, rands, size * GMP_NUMB_BITS); diff --git a/testsuite/ecc-redc-test.c b/testsuite/ecc-redc-test.c index 476a6db1661335c2d2b66705e01d890754df8324..7caab0b74c61af738c9d25f6c9f312b09b2bcdc9 100644 --- a/testsuite/ecc-redc-test.c +++ b/testsuite/ecc-redc-test.c @@ -38,7 +38,7 @@ mod_equal(const struct ecc_modulo *m, const mp_limb_t *ref, mp_limb_t *tp) #define MAX_ECC_SIZE (1 + 521 / GMP_NUMB_BITS) #define MAX_SIZE (2*MAX_ECC_SIZE) -#define COUNT 50000 +#define COUNT 10000 void test_main (void) diff --git a/testsuite/ecc-sqrt-test.c b/testsuite/ecc-sqrt-test.c index 3bb915c88a6078c0cdc4e0d31cd3872b2a241902..7fe6f17676285fd756bbce42ba86f1b551b505d8 100644 --- a/testsuite/ecc-sqrt-test.c +++ b/testsuite/ecc-sqrt-test.c @@ -31,7 +31,7 @@ #include "testutils.h" -#define COUNT 5000 +#define COUNT 500 #if NETTLE_USE_MINI_GMP /* Implements Legendre symbol only, requiring that p is an odd prime */ diff --git a/testsuite/eddsa-compress-test.c b/testsuite/eddsa-compress-test.c index e17a869c7015ebeb8ea9adbebbab70d1ff2e4f95..c0d2c52ce2f4c1ff8435e813c570e8f73d92ed15 100644 --- a/testsuite/eddsa-compress-test.c +++ b/testsuite/eddsa-compress-test.c @@ -34,7 +34,7 @@ #include "eddsa.h" #include "eddsa-internal.h" -#define COUNT 1000 +#define COUNT 500 void test_main (void) { diff --git a/testsuite/poly1305-test.c b/testsuite/poly1305-test.c index d13af236076bb4ce63e7f7daff642e44c316565b..7b23943967eda563907ba6170ed0cc465b20aa91 100644 --- a/testsuite/poly1305-test.c +++ b/testsuite/poly1305-test.c @@ -185,7 +185,7 @@ test_fixed (void) } } -#define COUNT 100000 +#define COUNT 10000 #define MAX_MESSAGE_SIZE 300 static void diff --git a/testsuite/random-prime-test.c b/testsuite/random-prime-test.c index 73eead08dcb8b8652ae0c41138f03bfb5b52dbc2..b967d3b6be02f3b85a41d8f056f44a9348c9b6fc 100644 --- a/testsuite/random-prime-test.c +++ b/testsuite/random-prime-test.c @@ -12,7 +12,7 @@ test_main(void) knuth_lfib_init(&lfib, 17); mpz_init(p); - for (bits = 6; bits < 1000; bits = bits + 1 + bits/20) + for (bits = 6; bits < 1000; bits = bits + 1 + bits/10) { if (verbose) fprintf(stderr, "bits = %d\n", bits); diff --git a/testsuite/rsa-compute-root-test.c b/testsuite/rsa-compute-root-test.c index de3586efcbb30b155b90adc7f6dc4e77d977ca23..e7e7848d02f08088c64b63a31ad1cc13c12ba67f 100644 --- a/testsuite/rsa-compute-root-test.c +++ b/testsuite/rsa-compute-root-test.c @@ -4,8 +4,8 @@ #include "rsa.h" -#define KEY_COUNT 20 -#define COUNT 100 +#define KEY_COUNT 10 +#define COUNT 50 static void random_fn (void *ctx, size_t n, uint8_t *dst) diff --git a/testsuite/rsa-sec-decrypt-test.c b/testsuite/rsa-sec-decrypt-test.c index 3419322eeecb08f2ba05abfab39eeb0c279b24ef..be7ab5fb57e49bbad6cb5a12b13bc12e33af2121 100644 --- a/testsuite/rsa-sec-decrypt-test.c +++ b/testsuite/rsa-sec-decrypt-test.c @@ -69,7 +69,7 @@ test_main(void) unsigned n_size = 1024; mpz_t gibberish; mpz_t garbage; - size_t size; + unsigned count; rsa_private_key_init(&key); rsa_public_key_init(&pub); @@ -80,7 +80,7 @@ test_main(void) memset(verifybad, 'A', PAYLOAD_SIZE); - for (size = 1; size < 51; size++) + for (count = 1; count < 20; count++) { ASSERT (rsa_generate_keypair(&pub, &key, &random_ctx, (nettle_random_func *) knuth_lfib_random,