Make the performance tests conditional on a run-time environment variable

rather than a build-time option.
This commit is contained in:
Dag-Erling Smørgrav 2014-07-11 00:18:34 +00:00 committed by des
parent 7c9b8f108a
commit cd10966e07
9 changed files with 65 additions and 90 deletions

View file

@ -23,14 +23,6 @@ LT_INIT()
# other programs # other programs
AC_PROG_INSTALL AC_PROG_INSTALL
# Include benchmarks in unit tests
AC_ARG_WITH([benchmarks],
AC_HELP_STRING([--with-benchmarks],
[include benchmarks in unit tests]),
[],
[with_benchmarks=no])
AM_CONDITIONAL([WITH_BENCHMARKS], [test x"$with_benchmarks" = x"yes"])
# OpenSSL versions of the unit tests for comparison # OpenSSL versions of the unit tests for comparison
AC_ARG_WITH([openssl], AC_ARG_WITH([openssl],
AC_HELP_STRING([--with-openssl], AC_HELP_STRING([--with-openssl],

View file

@ -2,10 +2,6 @@
AM_CPPFLAGS = -I$(top_srcdir)/include AM_CPPFLAGS = -I$(top_srcdir)/include
if WITH_BENCHMARKS
AM_CPPFLAGS += -DBENCHMARKS
endif
noinst_HEADERS = t.h noinst_HEADERS = t.h
# Common support code # Common support code

View file

@ -177,7 +177,6 @@ t_md2_short_updates(char **desc CRYB_UNUSED, void *arg)
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the MD2 sum of a * Performance test: measure the time spent computing the MD2 sum of a
* message of the specified length. * message of the specified length.
@ -208,7 +207,6 @@ t_md2_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -240,7 +238,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_md2_short_updates, &t_md2_vectors[6], t_add_test(t_md2_short_updates, &t_md2_vectors[6],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_md2_perf, &one, t_add_test(t_md2_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -248,7 +246,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_md2_perf, &million, t_add_test(t_md2_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -192,7 +192,7 @@ t_md4_short_updates(char **desc CRYB_UNUSED, void *arg)
} }
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the MD4 sum of a * Performance test: measure the time spent computing the MD4 sum of a
* message of the specified length. * message of the specified length.
@ -223,7 +223,6 @@ t_md4_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -255,7 +254,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_md4_short_updates, &t_md4_vectors[6], t_add_test(t_md4_short_updates, &t_md4_vectors[6],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_md4_perf, &one, t_add_test(t_md4_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -263,7 +262,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_md4_perf, &million, t_add_test(t_md4_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -193,7 +193,6 @@ t_md5_short_updates(char **desc CRYB_UNUSED, void *arg)
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the MD5 sum of a * Performance test: measure the time spent computing the MD5 sum of a
* message of the specified length. * message of the specified length.
@ -224,7 +223,6 @@ t_md5_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -256,7 +254,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_md5_short_updates, &t_md5_vectors[6], t_add_test(t_md5_short_updates, &t_md5_vectors[6],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_md5_perf, &one, t_add_test(t_md5_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -264,7 +262,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_md5_perf, &million, t_add_test(t_md5_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -189,7 +189,6 @@ t_sha1_short_updates(char **desc CRYB_UNUSED, void *arg)
} }
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the SHA1 sum of a * Performance test: measure the time spent computing the SHA1 sum of a
* message of the specified length. * message of the specified length.
@ -220,7 +219,6 @@ t_sha1_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -252,7 +250,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_sha1_short_updates, &t_sha1_vectors[4], t_add_test(t_sha1_short_updates, &t_sha1_vectors[4],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_sha1_perf, &one, t_add_test(t_sha1_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -260,7 +258,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_sha1_perf, &million, t_add_test(t_sha1_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -194,8 +194,6 @@ t_sha256_short_updates(char **desc CRYB_UNUSED, void *arg)
} }
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the SHA256 sum of a * Performance test: measure the time spent computing the SHA256 sum of a
* message of the specified length. * message of the specified length.
@ -226,7 +224,6 @@ t_sha256_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -258,7 +255,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_sha256_short_updates, &t_sha256_vectors[4], t_add_test(t_sha256_short_updates, &t_sha256_vectors[4],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_sha256_perf, &one, t_add_test(t_sha256_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -266,7 +263,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_sha256_perf, &million, t_add_test(t_sha256_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -205,7 +205,7 @@ t_sha384_short_updates(char **desc CRYB_UNUSED, void *arg)
} }
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the SHA384 sum of a * Performance test: measure the time spent computing the SHA384 sum of a
* message of the specified length. * message of the specified length.
@ -236,7 +236,6 @@ t_sha384_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -268,7 +267,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_sha384_short_updates, &t_sha384_vectors[4], t_add_test(t_sha384_short_updates, &t_sha384_vectors[4],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_sha384_perf, &one, t_add_test(t_sha384_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -276,7 +275,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_sha384_perf, &million, t_add_test(t_sha384_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }

View file

@ -216,7 +216,6 @@ t_sha512_short_updates(char **desc CRYB_UNUSED, void *arg)
#endif #endif
#ifdef BENCHMARKS
/* /*
* Performance test: measure the time spent computing the SHA512 sum of a * Performance test: measure the time spent computing the SHA512 sum of a
* message of the specified length. * message of the specified length.
@ -247,7 +246,6 @@ t_sha512_perf(char **desc, void *arg)
*desc = comment; *desc = comment;
return (1); return (1);
} }
#endif
/*************************************************************************** /***************************************************************************
@ -279,7 +277,7 @@ t_prepare(int argc, char *argv[])
t_add_test(t_sha512_short_updates, &t_sha512_vectors[4], t_add_test(t_sha512_short_updates, &t_sha512_vectors[4],
"multiple short updates"); "multiple short updates");
#endif #endif
#ifdef BENCHMARKS if (getenv("CRYB_PERFTEST")) {
static size_t one = 1, thousand = 1000, million = 1000000; static size_t one = 1, thousand = 1000, million = 1000000;
t_add_test(t_sha512_perf, &one, t_add_test(t_sha512_perf, &one,
"performance test (1 byte)"); "performance test (1 byte)");
@ -287,7 +285,7 @@ t_prepare(int argc, char *argv[])
"performance test (1,000 bytes)"); "performance test (1,000 bytes)");
t_add_test(t_sha512_perf, &million, t_add_test(t_sha512_perf, &million,
"performance test (1,000,000 bytes)"); "performance test (1,000,000 bytes)");
#endif }
return (0); return (0);
} }