Skip to content

Commit c6f25d6

Browse files
committed
Make ctime tests building configurable
1 parent d1897bd commit c6f25d6

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Makefile.am

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,20 @@ if USE_TESTS
115115
noinst_PROGRAMS += tests
116116
tests_SOURCES = src/tests.c
117117
tests_CPPFLAGS = $(SECP_INCLUDES) $(SECP_TEST_INCLUDES) $(SECP_CONFIG_DEFINES)
118-
if VALGRIND_ENABLED
118+
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
119+
tests_LDFLAGS = -static
120+
TESTS += tests
121+
if !ENABLE_COVERAGE
122+
tests_CPPFLAGS += -DVERIFY
123+
endif
124+
endif
125+
126+
if USE_CTIME_TESTS
119127
noinst_PROGRAMS += ctime_tests
120128
ctime_tests_SOURCES = src/ctime_tests.c
121129
ctime_tests_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
122130
ctime_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
123131
endif
124-
if !ENABLE_COVERAGE
125-
tests_CPPFLAGS += -DVERIFY
126-
endif
127-
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
128-
tests_LDFLAGS = -static
129-
TESTS += tests
130-
endif
131132

132133
if USE_EXHAUSTIVE_TESTS
133134
noinst_PROGRAMS += exhaustive_tests

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ AC_ARG_ENABLE(tests,
142142
AS_HELP_STRING([--enable-tests],[compile tests [default=yes]]), [],
143143
[SECP_SET_DEFAULT([enable_tests], [yes], [yes])])
144144

145+
AC_ARG_ENABLE(ctime_tests,
146+
AS_HELP_STRING([--enable-ctime-tests],[compile constant-time tests [default=yes if valgrind enabled]]), [],
147+
[SECP_SET_DEFAULT([enable_ctime_tests], [auto], [auto])])
148+
145149
AC_ARG_ENABLE(experimental,
146150
AS_HELP_STRING([--enable-experimental],[allow experimental configure options [default=no]]), [],
147151
[SECP_SET_DEFAULT([enable_experimental], [no], [yes])])
@@ -227,6 +231,10 @@ else
227231
fi
228232
AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
229233

234+
if test x"$enable_ctime_tests" = x"auto"; then
235+
enable_ctime_tests=$enable_valgrind
236+
fi
237+
230238
if test x"$enable_coverage" = x"yes"; then
231239
SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOVERAGE=1"
232240
SECP_CFLAGS="-O0 --coverage $SECP_CFLAGS"
@@ -407,6 +415,7 @@ AC_SUBST(SECP_CFLAGS)
407415
AC_SUBST(SECP_CONFIG_DEFINES)
408416
AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
409417
AM_CONDITIONAL([USE_TESTS], [test x"$enable_tests" != x"no"])
418+
AM_CONDITIONAL([USE_CTIME_TESTS], [test x"$enable_ctime_tests" = x"yes"])
410419
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$enable_exhaustive_tests" != x"no"])
411420
AM_CONDITIONAL([USE_EXAMPLES], [test x"$enable_examples" != x"no"])
412421
AM_CONDITIONAL([USE_BENCHMARK], [test x"$enable_benchmark" = x"yes"])
@@ -428,6 +437,7 @@ echo "Build Options:"
428437
echo " with external callbacks = $enable_external_default_callbacks"
429438
echo " with benchmarks = $enable_benchmark"
430439
echo " with tests = $enable_tests"
440+
echo " with ctime tests = $enable_ctime_tests"
431441
echo " with coverage = $enable_coverage"
432442
echo " with examples = $enable_examples"
433443
echo " module ecdh = $enable_module_ecdh"

0 commit comments

Comments
 (0)