configure: add --enable-coverage to set options for coverage analysis
This commit is contained in:
parent
b595163992
commit
a724d7296d
10
Makefile.am
10
Makefile.am
|
@ -93,7 +93,10 @@ TESTS =
|
||||||
if USE_TESTS
|
if USE_TESTS
|
||||||
noinst_PROGRAMS += tests
|
noinst_PROGRAMS += tests
|
||||||
tests_SOURCES = src/tests.c
|
tests_SOURCES = src/tests.c
|
||||||
tests_CPPFLAGS = -DSECP256K1_BUILD -DVERIFY -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
|
tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
|
||||||
|
if !ENABLE_COVERAGE
|
||||||
|
tests_CPPFLAGS += -DVERIFY
|
||||||
|
endif
|
||||||
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
|
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
|
||||||
tests_LDFLAGS = -static
|
tests_LDFLAGS = -static
|
||||||
TESTS += tests
|
TESTS += tests
|
||||||
|
@ -102,7 +105,10 @@ endif
|
||||||
if USE_EXHAUSTIVE_TESTS
|
if USE_EXHAUSTIVE_TESTS
|
||||||
noinst_PROGRAMS += exhaustive_tests
|
noinst_PROGRAMS += exhaustive_tests
|
||||||
exhaustive_tests_SOURCES = src/tests_exhaustive.c
|
exhaustive_tests_SOURCES = src/tests_exhaustive.c
|
||||||
exhaustive_tests_CPPFLAGS = -DSECP256K1_BUILD -DVERIFY -I$(top_srcdir)/src $(SECP_INCLUDES)
|
exhaustive_tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src $(SECP_INCLUDES)
|
||||||
|
if !ENABLE_COVERAGE
|
||||||
|
exhaustive_tests_CPPFLAGS += -DVERIFY
|
||||||
|
endif
|
||||||
exhaustive_tests_LDADD = $(SECP_LIBS)
|
exhaustive_tests_LDADD = $(SECP_LIBS)
|
||||||
exhaustive_tests_LDFLAGS = -static
|
exhaustive_tests_LDFLAGS = -static
|
||||||
TESTS += exhaustive_tests
|
TESTS += exhaustive_tests
|
||||||
|
|
17
configure.ac
17
configure.ac
|
@ -20,7 +20,7 @@ AC_PATH_TOOL(STRIP, strip)
|
||||||
AX_PROG_CC_FOR_BUILD
|
AX_PROG_CC_FOR_BUILD
|
||||||
|
|
||||||
if test "x$CFLAGS" = "x"; then
|
if test "x$CFLAGS" = "x"; then
|
||||||
CFLAGS="-O3 -g"
|
CFLAGS="-g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
|
@ -89,6 +89,11 @@ AC_ARG_ENABLE(benchmark,
|
||||||
[use_benchmark=$enableval],
|
[use_benchmark=$enableval],
|
||||||
[use_benchmark=no])
|
[use_benchmark=no])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(coverage,
|
||||||
|
AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis]),
|
||||||
|
[enable_coverage=$enableval],
|
||||||
|
[enable_coverage=no])
|
||||||
|
|
||||||
AC_ARG_ENABLE(tests,
|
AC_ARG_ENABLE(tests,
|
||||||
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
||||||
[use_tests=$enableval],
|
[use_tests=$enableval],
|
||||||
|
@ -154,6 +159,14 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_expect(0,0);}]])],
|
||||||
[ AC_MSG_RESULT([no])
|
[ AC_MSG_RESULT([no])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
if test x"$enable_coverage" = x"yes"; then
|
||||||
|
AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code])
|
||||||
|
CFLAGS="$CFLAGS -O0 --coverage"
|
||||||
|
LDFLAGS="--coverage"
|
||||||
|
else
|
||||||
|
CFLAGS="$CFLAGS -O3"
|
||||||
|
fi
|
||||||
|
|
||||||
if test x"$use_ecmult_static_precomputation" != x"no"; then
|
if test x"$use_ecmult_static_precomputation" != x"no"; then
|
||||||
save_cross_compiling=$cross_compiling
|
save_cross_compiling=$cross_compiling
|
||||||
cross_compiling=no
|
cross_compiling=no
|
||||||
|
@ -434,6 +447,7 @@ AC_MSG_NOTICE([Using field implementation: $set_field])
|
||||||
AC_MSG_NOTICE([Using bignum implementation: $set_bignum])
|
AC_MSG_NOTICE([Using bignum implementation: $set_bignum])
|
||||||
AC_MSG_NOTICE([Using scalar implementation: $set_scalar])
|
AC_MSG_NOTICE([Using scalar implementation: $set_scalar])
|
||||||
AC_MSG_NOTICE([Using endomorphism optimizations: $use_endomorphism])
|
AC_MSG_NOTICE([Using endomorphism optimizations: $use_endomorphism])
|
||||||
|
AC_MSG_NOTICE([Building for coverage analysis: $enable_coverage])
|
||||||
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
|
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
|
||||||
AC_MSG_NOTICE([Building ECDSA pubkey recovery module: $enable_module_recovery])
|
AC_MSG_NOTICE([Building ECDSA pubkey recovery module: $enable_module_recovery])
|
||||||
AC_MSG_NOTICE([Using jni: $use_jni])
|
AC_MSG_NOTICE([Using jni: $use_jni])
|
||||||
|
@ -460,6 +474,7 @@ AC_SUBST(SECP_INCLUDES)
|
||||||
AC_SUBST(SECP_LIBS)
|
AC_SUBST(SECP_LIBS)
|
||||||
AC_SUBST(SECP_TEST_LIBS)
|
AC_SUBST(SECP_TEST_LIBS)
|
||||||
AC_SUBST(SECP_TEST_INCLUDES)
|
AC_SUBST(SECP_TEST_INCLUDES)
|
||||||
|
AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
|
||||||
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
|
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
|
||||||
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
|
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
|
||||||
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
|
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
|
||||||
|
|
|
@ -57,7 +57,10 @@ static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback *
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Like assert(), but when VERIFY is defined, and side-effect safe. */
|
/* Like assert(), but when VERIFY is defined, and side-effect safe. */
|
||||||
#ifdef VERIFY
|
#if defined(COVERAGE)
|
||||||
|
#define VERIFY_CHECK(check)
|
||||||
|
#define VERIFY_SETUP(stmt)
|
||||||
|
#elif defined(VERIFY)
|
||||||
#define VERIFY_CHECK CHECK
|
#define VERIFY_CHECK CHECK
|
||||||
#define VERIFY_SETUP(stmt) do { stmt; } while(0)
|
#define VERIFY_SETUP(stmt) do { stmt; } while(0)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue