From c17ae41dcc60ee1014824e373d0c2e6522d82fb0 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Wed, 4 Dec 2013 07:50:17 +0530 Subject: [PATCH] Add new configure option, --enable-race-checking This commit adds a new configure option, --enable-race-checking which is to be used exclusively for debugging. Also, conditionally add tests to XFAIL_TESTS when Race Checking is enabled. --- configure.ac | 13 +++++++++++++ testenv/Makefile.am | 48 ++++++++++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 53eaa42..5e9e433 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,12 @@ ENABLE_METALINK=$enableval, ENABLE_METALINK=no) test x"${ENABLE_METALINK}" = xyes && AC_DEFINE([ENABLE_METALINK], 1, [Define if you want the metalink file format support compiled in.]) +AC_ARG_ENABLE(race-detection, +[ --enable-race-detection enable support for detecting race conditions], +ENABLE_RACES=$enableval, ENABLE_RACES=no) +test x"${ENABLE_RACES}" = xyes && AC_DEFINE([ENABLE_RACES], 1, + [Define if you want runtime Race Detection enabled.]) + dnl dnl Find the compiler dnl @@ -388,6 +394,11 @@ dnl ]) ]) ]) +AS_IF([test x"$ENABLE_RACES" != xno],[ + CFLAGS="$CFLAGS -fsanitize=thread -fPIE"; + LDFLAGS="$LDFLAGS -fsanitize=thread -pie"; +]) + AS_IF([test x"$ENABLE_METALINK" != xno],[ dnl If metalink support is requested PKG_CHECK_MODULES(LIBMETALINK, libmetalink, [ @@ -630,6 +641,7 @@ dnl Needed by src/Makefile.am AM_CONDITIONAL([IRI_IS_ENABLED], [test "X$iri" == "Xyes"]) AM_CONDITIONAL([METALINK_IS_ENABLED], [test "X$metalink" == "Xyes"]) AM_CONDITIONAL([THREADS_ARE_ENABLED], [test "X$threads" == "Xyes"]) +AM_CONDITIONAL([RACE_CHECKING_IS_ENABLED], [test "X$race-detection" == "Xyes"]) dnl dnl Create output @@ -656,4 +668,5 @@ AC_MSG_NOTICE([Summary of build options: OPIE: $ENABLE_OPIE Metalink: $ENABLE_METALINK Debugging: $ENABLE_DEBUG + Race Detection: $ENABLE_RACES ]) diff --git a/testenv/Makefile.am b/testenv/Makefile.am index 15eed93..42a07ba 100644 --- a/testenv/Makefile.am +++ b/testenv/Makefile.am @@ -28,27 +28,35 @@ AUTOMAKE_OPTIONS = parallel-tests AM_TESTS_ENVIRONMENT = MAKE_CHECK=True; export MAKE_CHECK; -TESTS = Test-auth-basic-fail.py \ - Test-auth-basic.py \ - Test-auth-both.py \ - Test-auth-digest.py \ - Test-auth-no-challenge.py \ - Test-auth-no-challenge-url.py \ - Test-auth-retcode.py \ - Test-auth-with-content-disposition.py \ - Test-c-full.py \ - Test-Content-disposition-2.py \ - Test-Content-disposition.py \ - Test-cookie-401.py \ - Test-cookie-domain-mismatch.py \ - Test-cookie-expires.py \ - Test-cookie.py \ - Test-Head.py \ - Test-O.py \ - Test-Post.py \ - Test--spider-r.py -XFAIL_TESTS = Test-auth-both.py +if RACE_CHECKING_IS_ENABLED +RACE_FAIL = Test--spider-r.py +RACE_TESTS = +endif + +TESTS = Test-auth-basic-fail.py \ + Test-auth-basic.py \ + Test-auth-both.py \ + Test-auth-digest.py \ + Test-auth-no-challenge.py \ + Test-auth-no-challenge-url.py \ + Test-auth-retcode.py \ + Test-auth-with-content-disposition.py \ + Test-c-full.py \ + Test-Content-disposition-2.py \ + Test-Content-disposition.py \ + Test-cookie-401.py \ + Test-cookie-domain-mismatch.py \ + Test-cookie-expires.py \ + Test-cookie.py \ + $(RACE_TESTS) \ + Test-Head.py \ + Test-O.py \ + Test-Post.py \ + Test--spider-r.py + +XFAIL_TESTS = Test-auth-both.py \ + $(RACE_FAIL) LOG_COMPILER = python3 -- 1.8.4.2