[Nagiosplug-checkins] nagiosplug/config_test Makefile,1.1,1.2 run_tests,1.1,1.2

Ton Voon tonvoon at users.sourceforge.net
Wed Nov 30 17:06:07 CET 2005


Update of /cvsroot/nagiosplug/nagiosplug/config_test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28753/config_test

Modified Files:
	Makefile run_tests 
Log Message:
Run longer test on redhat for spopen/pthread problem. Allow enable/disable of
pthread fix via configure option


Index: Makefile
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/config_test/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile	12 Sep 2005 10:31:29 -0000	1.1
+++ Makefile	1 Dec 2005 01:05:12 -0000	1.2
@@ -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: run_tests
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/config_test/run_tests,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- run_tests	12 Sep 2005 10:31:29 -0000	1.1
+++ run_tests	1 Dec 2005 01:05:12 -0000	1.2
@@ -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





More information about the Commits mailing list