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
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
AC_ARG_WITH([openssl],
AC_HELP_STRING([--with-openssl],

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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