From f8ebdbc14d39708cbdca1fcf53bdeba44849cd4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 4 Oct 2015 07:49:48 +0000 Subject: [PATCH] Move the test framework into its own subdirectory --- configure.ac | 1 + include/cryb/Makefile.am | 1 + t/t.h => include/cryb/test.h | 6 ++++-- lib/Makefile.am | 3 ++- lib/cipher/aes.c | 6 ++++++ {t => lib/test}/t_const.c | 2 +- {t => lib/test}/t_file.c | 2 +- {t => lib/test}/t_main.c | 2 +- {t => lib/test}/t_malloc.c | 2 +- {t => lib/test}/t_util.c | 2 +- t/Makefile.am | 7 +------ t/t_adler.c | 2 +- t/t_aes.c | 2 +- t/t_ctype.c | 2 +- t/t_endian.c | 2 +- t/t_fletcher.c | 2 +- t/t_hmac_sha1.c | 2 +- t/t_hmac_sha224.c | 2 +- t/t_hmac_sha256.c | 2 +- t/t_hmac_sha384.c | 2 +- t/t_hmac_sha512.c | 2 +- t/t_md2.c | 2 +- t/t_md4.c | 2 +- t/t_md5.c | 2 +- t/t_memset_s.c | 2 +- t/t_mpi.c | 2 +- t/t_murmur3_32.c | 2 +- t/t_pearson.c | 2 +- t/t_rc4.c | 2 +- t/t_rfc3986.c | 2 +- t/t_rfc4648.c | 2 +- t/t_sha1.c | 2 +- t/t_sha224.c | 2 +- t/t_sha256.c | 2 +- t/t_sha384.c | 2 +- t/t_sha512.c | 2 +- t/t_string.c | 2 +- t/t_strlcat.c | 2 +- t/t_strlcmp.c | 2 +- t/t_strlcpy.c | 2 +- t/t_wstring.c | 2 +- 41 files changed, 50 insertions(+), 44 deletions(-) rename t/t.h => include/cryb/test.h (97%) rename {t => lib/test}/t_const.c (99%) rename {t => lib/test}/t_file.c (99%) rename {t => lib/test}/t_main.c (99%) rename {t => lib/test}/t_malloc.c (99%) rename {t => lib/test}/t_util.c (99%) diff --git a/configure.ac b/configure.ac index 4d6e94b..303a148 100644 --- a/configure.ac +++ b/configure.ac @@ -167,6 +167,7 @@ AC_CONFIG_FILES([ lib/oath/Makefile lib/rand/Makefile lib/rsaref/Makefile + lib/test/Makefile t/Makefile ]) AC_CONFIG_FILES([mkpkgng], [chmod +x mkpkgng]) diff --git a/include/cryb/Makefile.am b/include/cryb/Makefile.am index ed3384c..21552f3 100644 --- a/include/cryb/Makefile.am +++ b/include/cryb/Makefile.am @@ -41,6 +41,7 @@ cryb_HEADERS = \ strlcat.h \ strlcmp.h \ strlcpy.h \ + test.h \ to.h \ totp.h \ version.h \ diff --git a/t/t.h b/include/cryb/test.h similarity index 97% rename from t/t.h rename to include/cryb/test.h index da60b9c..799a66d 100644 --- a/t/t.h +++ b/include/cryb/test.h @@ -27,8 +27,10 @@ * SUCH DAMAGE. */ -#ifndef T_H_INCLUDED -#define T_H_INCLUDED +#ifndef CRYB_TEST_H_INCLUDED +#define CRYB_TEST_H_INCLUDED + +#include CRYB_DISABLE_COVERAGE diff --git a/lib/Makefile.am b/lib/Makefile.am index ccfb114..f87aa2d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,7 +8,8 @@ SUBDIRS = \ mac \ mpi \ oath \ - rand + rand \ + test if WITH_RSAREF SUBDIRS += rsaref diff --git a/lib/cipher/aes.c b/lib/cipher/aes.c index 5206b8f..7c00c7e 100644 --- a/lib/cipher/aes.c +++ b/lib/cipher/aes.c @@ -316,8 +316,10 @@ aes_setkey_enc(aes_ctx *ctx, const uint8_t *key, int keysize) case 32: ctx->nr = 14; break; +CRYB_DISABLE_COVERAGE default: return; +CRYB_RESTORE_COVERAGE } ctx->rk = RK = ctx->buf; for (i = 0; i < (keysize >> 2); i++) @@ -371,8 +373,10 @@ aes_setkey_enc(aes_ctx *ctx, const uint8_t *key, int keysize) RK[15] = RK[7] ^ RK[14]; } break; +CRYB_DISABLE_COVERAGE default: break; +CRYB_RESTORE_COVERAGE } } @@ -397,8 +401,10 @@ aes_setkey_dec(aes_ctx *ctx, const uint8_t *key, int keysize) case 32: ctx->nr = 14; break; +CRYB_DISABLE_COVERAGE default: return; +CRYB_RESTORE_COVERAGE } ctx->rk = RK = ctx->buf; aes_setkey_enc(&cty, key, keysize); diff --git a/t/t_const.c b/lib/test/t_const.c similarity index 99% rename from t/t_const.c rename to lib/test/t_const.c index f2ff938..69aa0d9 100644 --- a/t/t_const.c +++ b/lib/test/t_const.c @@ -32,7 +32,7 @@ #include #include -#include "t.h" +#include const uint8_t t_zero[4096] = { }; diff --git a/t/t_file.c b/lib/test/t_file.c similarity index 99% rename from t/t_file.c rename to lib/test/t_file.c index 0134f6b..b974236 100644 --- a/t/t_file.c +++ b/lib/test/t_file.c @@ -39,7 +39,7 @@ #include #include -#include "t.h" +#include static struct t_file *tflist; diff --git a/t/t_main.c b/lib/test/t_main.c similarity index 99% rename from t/t_main.c rename to lib/test/t_main.c index 8352c81..9c501b0 100644 --- a/t/t_main.c +++ b/lib/test/t_main.c @@ -40,7 +40,7 @@ #include #include -#include "t.h" +#include /* program name */ const char *t_progname; diff --git a/t/t_malloc.c b/lib/test/t_malloc.c similarity index 99% rename from t/t_malloc.c rename to lib/test/t_malloc.c index d81c771..50fd06b 100644 --- a/t/t_malloc.c +++ b/lib/test/t_malloc.c @@ -56,7 +56,7 @@ #include #include -#include "t.h" +#include /* * Very simple, non-thread-safe malloc() implementation tailored for unit diff --git a/t/t_util.c b/lib/test/t_util.c similarity index 99% rename from t/t_util.c rename to lib/test/t_util.c index 264b781..ed4260b 100644 --- a/t/t_util.c +++ b/lib/test/t_util.c @@ -38,7 +38,7 @@ #include #include -#include "t.h" +#include /* * Compare two buffers, and print a verbose message if they differ. diff --git a/t/Makefile.am b/t/Makefile.am index 3a9329b..f27435c 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -1,12 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -noinst_HEADERS = t.h EXTRA_DIST = -# Test driver and support code -check_LTLIBRARIES = libt.la -libt_la_SOURCES = t_main.c t_file.c t_util.c t_const.c t_malloc.c - # Individual libraries libcipher = $(top_builddir)/lib/cipher/libcryb-cipher.la libcore = $(top_builddir)/lib/core/libcryb-core.la @@ -17,7 +12,7 @@ libmac = $(top_builddir)/lib/mac/libcryb-mac.la libmpi = $(top_builddir)/lib/mpi/libcryb-mpi.la liboath = $(top_builddir)/lib/oath/libcryb-oath.la librand = $(top_builddir)/lib/rand/libcryb-rand.la -libt = $(builddir)/libt.la +libt = $(top_builddir)/lib/test/libcryb-test.la # Additional headers, flags and libraries for OpenSSL if WITH_OPENSSL diff --git a/t/t_adler.c b/t/t_adler.c index 1b0b2fe..5f8f6e2 100644 --- a/t/t_adler.c +++ b/t/t_adler.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #define ADLER32_INVALID 0xffffffffLU diff --git a/t/t_aes.c b/t/t_aes.c index 6a47573..b81c21f 100644 --- a/t/t_aes.c +++ b/t/t_aes.c @@ -35,7 +35,7 @@ #include -#include "t.h" +#include struct t_case { const char *desc; diff --git a/t/t_ctype.c b/t/t_ctype.c index fd4aee7..ec706ac 100644 --- a/t/t_ctype.c +++ b/t/t_ctype.c @@ -35,7 +35,7 @@ #include -#include "t.h" +#include #define OC_DIGIT "0123456789" #define OC_XDIGIT OC_DIGIT "ABCDEFabcdef" diff --git a/t/t_endian.c b/t/t_endian.c index 1fa6a13..bf93dc6 100644 --- a/t/t_endian.c +++ b/t/t_endian.c @@ -35,7 +35,7 @@ #include -#include "t.h" +#include static uint16_t be16 = 0xf001U; static uint32_t be32 = 0xdeadbeefUL; diff --git a/t/t_fletcher.c b/t/t_fletcher.c index 36fe89b..725e8be 100644 --- a/t/t_fletcher.c +++ b/t/t_fletcher.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #define FLETCHER16_INVALID 0xffffU #define FLETCHER32_INVALID 0xffffffffLU diff --git a/t/t_hmac_sha1.c b/t/t_hmac_sha1.c index 154a3ad..12f30ba 100644 --- a/t/t_hmac_sha1.c +++ b/t/t_hmac_sha1.c @@ -34,7 +34,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_hmac_sha224.c b/t/t_hmac_sha224.c index e1c1e07..a732386 100644 --- a/t/t_hmac_sha224.c +++ b/t/t_hmac_sha224.c @@ -34,7 +34,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_hmac_sha256.c b/t/t_hmac_sha256.c index c26ed60..ff43ad7 100644 --- a/t/t_hmac_sha256.c +++ b/t/t_hmac_sha256.c @@ -34,7 +34,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_hmac_sha384.c b/t/t_hmac_sha384.c index 804105f..10a7204 100644 --- a/t/t_hmac_sha384.c +++ b/t/t_hmac_sha384.c @@ -34,7 +34,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_hmac_sha512.c b/t/t_hmac_sha512.c index 159d770..027bb58 100644 --- a/t/t_hmac_sha512.c +++ b/t/t_hmac_sha512.c @@ -34,7 +34,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_md2.c b/t/t_md2.c index f1f5d9b..2d87520 100644 --- a/t/t_md2.c +++ b/t/t_md2.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_RSAREF diff --git a/t/t_md4.c b/t/t_md4.c index c58776c..9bc892d 100644 --- a/t/t_md4.c +++ b/t/t_md4.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_md5.c b/t/t_md5.c index 1c7462d..a4a5972 100644 --- a/t/t_md5.c +++ b/t/t_md5.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_memset_s.c b/t/t_memset_s.c index e8fb269..8dc6152 100644 --- a/t/t_memset_s.c +++ b/t/t_memset_s.c @@ -36,7 +36,7 @@ #undef HAVE_MEMSET_S #include -#include "t.h" +#include #define T_BUF_LEN 32 diff --git a/t/t_mpi.c b/t/t_mpi.c index 3b5a26c..e96d2a3 100644 --- a/t/t_mpi.c +++ b/t/t_mpi.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include /*************************************************************************** diff --git a/t/t_murmur3_32.c b/t/t_murmur3_32.c index 250093e..31c6128 100644 --- a/t/t_murmur3_32.c +++ b/t/t_murmur3_32.c @@ -34,7 +34,7 @@ #include -#include "t.h" +#include struct t_case { const char *desc; diff --git a/t/t_pearson.c b/t/t_pearson.c index fd4b921..3af1dfa 100644 --- a/t/t_pearson.c +++ b/t/t_pearson.c @@ -34,7 +34,7 @@ #include -#include "t.h" +#include #define T_MAGIC_WORD_1 "squeamish" #define T_MAGIC_WORD_2 "ossifrage" diff --git a/t/t_rc4.c b/t/t_rc4.c index 9160280..406e047 100644 --- a/t/t_rc4.c +++ b/t/t_rc4.c @@ -35,7 +35,7 @@ #include -#include "t.h" +#include struct t_case { const char *desc; diff --git a/t/t_rfc3986.c b/t/t_rfc3986.c index e9d9583..dcd80ac 100644 --- a/t/t_rfc3986.c +++ b/t/t_rfc3986.c @@ -38,7 +38,7 @@ #include -#include "t.h" +#include struct t_case { const char *desc; diff --git a/t/t_rfc4648.c b/t/t_rfc4648.c index c42ddb8..3a5b3e3 100644 --- a/t/t_rfc4648.c +++ b/t/t_rfc4648.c @@ -39,7 +39,7 @@ #include -#include "t.h" +#include struct t_case { const char *desc; diff --git a/t/t_sha1.c b/t/t_sha1.c index dfaad88..602993d 100644 --- a/t/t_sha1.c +++ b/t/t_sha1.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_sha224.c b/t/t_sha224.c index 746d050..66c16d2 100644 --- a/t/t_sha224.c +++ b/t/t_sha224.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_sha256.c b/t/t_sha256.c index 92b0995..1c098ff 100644 --- a/t/t_sha256.c +++ b/t/t_sha256.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_sha384.c b/t/t_sha384.c index 146c33e..dd72aff 100644 --- a/t/t_sha384.c +++ b/t/t_sha384.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_sha512.c b/t/t_sha512.c index 26d63a2..716fd69 100644 --- a/t/t_sha512.c +++ b/t/t_sha512.c @@ -36,7 +36,7 @@ #include #include -#include "t.h" +#include #if WITH_OPENSSL diff --git a/t/t_string.c b/t/t_string.c index 2565081..b980b68 100644 --- a/t/t_string.c +++ b/t/t_string.c @@ -37,7 +37,7 @@ #include -#include "t.h" +#include #define char_t char diff --git a/t/t_strlcat.c b/t/t_strlcat.c index 87ba01c..3a72fe0 100644 --- a/t/t_strlcat.c +++ b/t/t_strlcat.c @@ -35,7 +35,7 @@ #undef HAVE_STRLCAT #include -#include "t.h" +#include #define T_MAGIC_STR "squeamish ossifrage" #define T_MAGIC_LEN (sizeof(T_MAGIC_STR) - 1) diff --git a/t/t_strlcmp.c b/t/t_strlcmp.c index f774eee..a5fde0d 100644 --- a/t/t_strlcmp.c +++ b/t/t_strlcmp.c @@ -36,7 +36,7 @@ #undef HAVE_STRLCMP #include -#include "t.h" +#include #define T_MAGIC_STR "squeamish ossifrage" #define T_MAGIC_INITIAL 's' diff --git a/t/t_strlcpy.c b/t/t_strlcpy.c index 2244c1c..ecee06d 100644 --- a/t/t_strlcpy.c +++ b/t/t_strlcpy.c @@ -35,7 +35,7 @@ #undef HAVE_STRLCPY #include -#include "t.h" +#include #define T_MAGIC_STR "squeamish ossifrage" #define T_MAGIC_LEN (sizeof(T_MAGIC_STR) - 1) diff --git a/t/t_wstring.c b/t/t_wstring.c index 56c5aad..ebe015d 100644 --- a/t/t_wstring.c +++ b/t/t_wstring.c @@ -38,7 +38,7 @@ #include -#include "t.h" +#include #define char_t wchar_t #define vsnprintf vswprintf