diff options
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/bench-slope.c | 16 | ||||
-rw-r--r-- | tests/benchmark.c | 13 | ||||
-rw-r--r-- | tests/tsexp.c | 3 |
4 files changed, 31 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 87283f91..3fb9fd62 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -23,10 +23,11 @@ TESTS = version mpitests tsexp t-convert \ prime basic keygen pubkey hmac hashtest t-kdf keygrip \ fips186-dsa aeswrap pkcs1v2 random dsa-rfc6979 t-ed25519 - # The last tests to run. TESTS += benchmark bench-slope +TESTS_ENVIRONMENT = GCRYPT_IN_REGRESSION_TEST=1 + # Need to include ../src in addition to top_srcdir because gcrypt.h is # a built header. diff --git a/tests/bench-slope.c b/tests/bench-slope.c index 79314c3e..219e0dd7 100644 --- a/tests/bench-slope.c +++ b/tests/bench-slope.c @@ -48,6 +48,9 @@ static int num_measurement_repetitions; results. */ static double cpu_ghz = -1; +/* Whether we are running as part of the regression test suite. */ +static int in_regression_test; + /* The name of the currently printed section. */ static char *current_section_name; /* The name of the currently printed algorithm. */ @@ -1453,8 +1456,6 @@ main (int argc, char **argv) int last_argc = -1; int debug = 0; - num_measurement_repetitions = NUM_MEASUREMENT_REPETITIONS; - if (argc) { argc--; @@ -1466,6 +1467,14 @@ main (int argc, char **argv) if (!argc && getenv ("srcdir") && getenv ("GCRYPT_NO_BENCHMARKS")) exit (77); + if (getenv ("GCRYPT_IN_REGRESSION_TEST")) + { + in_regression_test = 1; + num_measurement_repetitions = 2; + } + else + num_measurement_repetitions = NUM_MEASUREMENT_REPETITIONS; + while (argc && last_argc != argc) { last_argc = argc; @@ -1565,6 +1574,9 @@ main (int argc, char **argv) gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); + if (in_regression_test) + fputs ("Note: " PGM " running in quick regression test mode.\n", stdout); + if (!argc) { warm_up_cpu (); diff --git a/tests/benchmark.c b/tests/benchmark.c index 3f44e338..62dfc220 100644 --- a/tests/benchmark.c +++ b/tests/benchmark.c @@ -59,6 +59,9 @@ static int cipher_with_keysetup; /* Whether fips mode was active at startup. */ static int in_fips_mode; +/* Whether we are running as part of the regression test suite. */ +static int in_regression_test; + static const char sample_private_dsa_key_1024[] = "(private-key\n" @@ -266,6 +269,7 @@ die (const char *format, ...) exit (1); } + static void show_sexp (const char *prefix, gcry_sexp_t a) { @@ -1301,6 +1305,12 @@ main( int argc, char **argv ) if (!argc && getenv ("srcdir") && getenv ("GCRYPT_NO_BENCHMARKS")) exit (77); + if (getenv ("GCRYPT_IN_REGRESSION_TEST")) + { + in_regression_test = 1; + pk_count = 10; + } + while (argc && last_argc != argc ) { last_argc = argc; @@ -1473,6 +1483,9 @@ main( int argc, char **argv ) if (mac_repetitions < 1) mac_repetitions = 1; + if (in_regression_test) + fputs ("Note: " PGM " running in quick regression test mode.\n", stdout); + if ( !argc ) { gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); diff --git a/tests/tsexp.c b/tests/tsexp.c index 2f6ad8f9..1ab98026 100644 --- a/tests/tsexp.c +++ b/tests/tsexp.c @@ -1022,7 +1022,8 @@ check_extract_param (void) { fail ("gcry_sexp_extract_param long name failed: curve mismatch"); gcry_log_debug ("expected: %s\n", "Ed25519"); - gcry_log_debug (" got: %.*s\n", (int)ioarray[0].len, ioarray[0].data); + gcry_log_debug (" got: %.*s\n", + (int)ioarray[0].len, (char*)ioarray[0].data); } if (!mpis[0]) |