I have been working on making a few changes to the parallel-wget branch.
Currently, I am focused on getting all the tests implemented for parallel
wget and detection of race conditions. For this, I submit two patches.

The first patch, is merely a little cleanup. It removes the redundant
--enable-threads options in configure.ac since this option is already added
automagically for us by threadlib.m4 in GNULib. I have also added reporting
the status of Metalink Libraries in the configure status message.

The second patch needs a little more work. I am trying to get working on
Autotools, but this is one crazy project. I have small issue that isn't
working, if anyone can fix this for me, that'd be great!
I have added a new configure option, --enable-race-detection. This option
when enabled will compile Wget with certain flags which will spew a lot of
output to the screen on runtime in case it encounters potential race
conditions. Hence, this option should NEVER be used on production systems.
This option must only be used when debugging the code and it is preferable
to use this option when running the new Test Suite which has tests
specifically to fail when this is option is used.

I added the AC_ARG_ENABLE option to create a new command line switch to
configure. I also added an AM_CONDITIONAL to create a ENABLE_RACES variable
for use in Makefiles. But I can't get the if statements in the Makefile to
work correctly. Specifically, in the second patch, I have an if statement
in testenv/Makefile.am that adds a certain test to XFAIL_TESTS when
ENABLE_RACES is set. This condition does not seem to work. If anyone can
help me out here, I would be extremely grateful!

-- 
Thanking You,
Darshit Shah
From 601b17624404e593195bd8a9cc34c574220a5a60 Mon Sep 17 00:00:00 2001
From: Darshit Shah <[email protected]>
Date: Wed, 23 Oct 2013 06:26:14 +0530
Subject: [PATCH 1/2] Build changes. Remove redundant --enable-threads option
 and add Metalink to configure summary

---
 ChangeLog    | 5 +++++
 configure.ac | 7 +------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b32da52..ea07955 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-23  Darshit Shah  <[email protected]>
+
+    * configure.ac: Remove redundant --enable-threads option.
+                    Add Metalink to configure summary
+
 2013-07-02  Darshit Shah  <[email protected]>
 
 	* README.checkout: Add dependency on libmetalink.
diff --git a/configure.ac b/configure.ac
index 3a45f6c..53eaa42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,12 +89,6 @@ AC_ARG_ENABLE(debug,
 ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes)
 test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE([ENABLE_DEBUG], 1,
    [Define if you want the debug output support compiled in.])
-   
-AC_ARG_ENABLE(threads,
-[  --disable-threads      disable support for parallel downloads using threads],
-ENABLE_THREADS=$enableval, ENABLE_THREADS=no)
-test x"${ENABLE_THREADS}" = xyes && AC_DEFINE([ENABLE_THREADS], 1,
-   [Define if you want the concurrent download support compiled in.])
 
 AC_ARG_ENABLE(metalink,
 [  --disable-metalink      disable support for metalink file format],
@@ -660,5 +654,6 @@ AC_MSG_NOTICE([Summary of build options:
   Digest:            $ENABLE_DIGEST
   NTLM:              $ENABLE_NTLM
   OPIE:              $ENABLE_OPIE
+  Metalink:          $ENABLE_METALINK
   Debugging:         $ENABLE_DEBUG
 ])
-- 
1.8.4.2

From c17ae41dcc60ee1014824e373d0c2e6522d82fb0 Mon Sep 17 00:00:00 2001
From: Darshit Shah <[email protected]>
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

Reply via email to