Code

Run longer test on redhat for spopen/pthread problem. Allow enable/disable of
authorTon Voon <tonvoon@users.sourceforge.net>
Thu, 1 Dec 2005 01:05:12 +0000 (01:05 +0000)
committerTon Voon <tonvoon@users.sourceforge.net>
Thu, 1 Dec 2005 01:05:12 +0000 (01:05 +0000)
pthread fix via configure option

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1292 f882894a-f735-0410-b71e-b25c423dba1c

config_test/Makefile
config_test/run_tests
configure.in

index 295696e98941c78c7dbe1b5a92d6c8177d485640..1064d569d7571cf0ce5a447fb408a304a2d9c30f 100644 (file)
@@ -1,9 +1,11 @@
 
-all: child_test.c
+all: child_test
+
+child_test: child_test.c
        gcc -o child_test child_test.c
 
 test:
-       ./run_tests 10
+       ./run_tests 10 100 > /dev/null
 
 clean:
        rm -f child_test
index e41db232f4055ad30376afb03b9f61910218651d..e7db3cae7f84b236ae934f28cb1f2290defbd787 100755 (executable)
@@ -1,16 +1,30 @@
 #!/bin/ksh
+# $1 is the number of iterations to run
+# If $2 is specified, this is the number of times you run each iteration
+# If there is a fail at run, exit 1
+# Prints to stdout # of successes and passes
+# Prints to stderr a dot for each run
 
-i=0
-success=0
-fail=0
-while [[ $i -lt $1 ]] ; do
-       ./child_test
-       if [[ $? -eq 0 ]] ; then
-               success=$(($success+1))
-       else
-               fail=$((fail+1))
-       fi
-       i=$(($i+1))
+total_runs=$2
+[[ -z $total_runs ]] && total_runs=1
+run=1
+while [[ $run -le $total_runs ]] ; do
+       i=0
+       success=0
+       fail=0
+       while [[ $i -lt $1 ]] ; do
+               ./child_test
+               if [[ $? -eq 0 ]] ; then
+                       success=$(($success+1))
+               else
+                       fail=$((fail+1))
+               fi
+               i=$(($i+1))
+       done
+       print "Success=$success Fail=$fail"
+       [[ $fail -gt 0 ]] && exit 1
+       run=$(($run+1))
+       [[ $total_runs -gt 1 ]] && print -u2 -n "."
 done
-print "Success=$success Fail=$fail"
-[[ $fail -gt 0 ]] && exit 1
+[[ $total_runs -gt 1 ]] && print -u2 
+exit 0
index be9fe83afb1570d4a645f35304cd5f814c1a2f64..9303850ae4fdcdfeb7cc3d9e0ce83474bd2beb9a 100644 (file)
@@ -1680,17 +1680,26 @@ dnl Wierd problem where ECHILD is returned from a wait call in error
 dnl Only appears to affect nslookup and dig calls. Only affects redhat around
 dnl 2.6.9-11 (okay in 2.6.9-5). Redhat investigating root cause
 dnl We patch plugins/popen.c
-dnl Need to add smp because uname different on those. May need to check
-dnl Fedora Core too in future
-if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
-       AC_MSG_CHECKING(for redhat spopen problem)
-       ( cd config_test && make && make test ) > /dev/null 2>&1
-       if test $? -eq 0 ; then
-               AC_MSG_RESULT(okay)
-       else
-               AC_MSG_RESULT(error)
-               AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, "Problem on redhat with spopen")
+dnl Need to add smp because uname different on those
+dnl Can force patch to be applied with --enable-redhat-pthread-workaround
+AC_ARG_ENABLE(redhat-pthread-workaround, 
+       AC_HELP_STRING([--enable-redhat-pthread-workaround], 
+               [force Redhat patch to be applied (default: test system)]),
+       [ac_cv_enable_redhat_pthread_workaround=$enableval],
+       [ac_cv_enable_redhat_pthread_workaround=test])
+if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
+       if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
+               AC_MSG_CHECKING(for redhat spopen problem)
+               ( cd config_test && make && make test ) > /dev/null 2>&1
+               if test $? -eq 0 ; then
+                       AC_MSG_RESULT(okay)
+               else
+                       AC_MSG_RESULT(error)
+                       AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Workaround on redhat in spopen])
+               fi
        fi
+elif test "$ac_cv_enable_redhat_pthread_workaround" = "yes" ; then
+       AC_DEFINE(REDHAT_SPOPEN_ERROR, 1, [Forced workaround on redhat in spopen])
 fi
 
 dnl External libraries - see ACKNOWLEDGEMENTS