c7424a546c4a83220fde16217b502bea2e4daff7
markd
  Sat Mar 24 22:57:34 2012 -0700
fixed timing problem that caused intermitent errors setting up process group by create a group leader process
diff --git src/lib/tests/makefile src/lib/tests/makefile
index 1bebbb9..ebaf6dd 100644
--- src/lib/tests/makefile
+++ src/lib/tests/makefile
@@ -30,31 +30,31 @@
 
 htmlExpandUrlTest: htmlExpandUrlTest.o ${MYLIBS} mkdirs
 	${CC} ${COPT} -o ${BIN_DIR}/htmlExpandUrlTest htmlExpandUrlTest.o ${MYLIBS} ${L}
 	${STRIP} ${BIN_DIR}/htmlExpandUrlTest${EXE}
 	${BIN_DIR}/htmlExpandUrlTest > output/htmlExpandUrlTest 2>&1
 	diff expected/htmlExpandUrlTest output/htmlExpandUrlTest
 
 htmlPageTest: htmlPageTest.o ${MYLIBS} mkdirs
 	${CC} ${COPT} -o ${BIN_DIR}/htmlPageTest htmlPageTest.o ${MYLIBS} ${L}
 	${STRIP} ${BIN_DIR}/htmlPageTest${EXE}
 	${BIN_DIR}/htmlPageTest input/google.html > output/google.out
 	diff expected/google.out output/google.out
 
 pipelineTests: 	pipelineWrite pipelineWriteMult pipelineWriteFd \
 		pipelineRead pipelineReadMult pipelineReadFd pipelineReadMem \
-		pipelineExitCode pipelineWriteErr
+		pipelineExitCode pipelineWriteErr pipelineExecError
 
 pipelineWrite: ${BIN_DIR}/pipelineTester mkdirs
 	${BIN_DIR}/pipelineTester -write -pipeData=input/simple1.txt -otherEnd=output/$@.out.gz "gzip -1"
 	gunzip -c output/$@.out.gz > output/$@.out
 	diff -b input/simple1.txt output/$@.out
 
 # add come junk to make sure output gets truncated
 pipelineWriteMult: ${BIN_DIR}/pipelineTester mkdirs
 	cat input/google.html > output/$@.wc
 	${BIN_DIR}/pipelineTester -write -pipeData=input/simple1.txt -otherEnd=output/$@.wc "gzip -1" "gzip -dc" "wc"
 	diff -b expected/simple1.wc output/$@.wc
 
 pipelineWriteFd: ${BIN_DIR}/pipelineTester mkdirs
 	${BIN_DIR}/pipelineTester -fdApi -write -pipeData=input/simple1.txt -otherEnd=output/$@.out.gz "gzip -1"
 	gunzip -c output/$@.out.gz > output/$@.out
@@ -67,43 +67,50 @@
 
 pipelineReadMult: ${BIN_DIR}/pipelineTester mkdirs
 	${BIN_DIR}/pipelineTester -pipeData=output/$@.wc -otherEnd=input/simple1.txt "gzip -1" "gzip -dc" "wc"
 	diff -b expected/simple1.wc output/$@.wc
 
 pipelineReadFd: ${BIN_DIR}/pipelineTester mkdirs
 	gzip -1c input/simple1.txt >output/$@.in.gz
 	${BIN_DIR}/pipelineTester -fdApi -otherEnd=output/$@.in.gz -pipeData=output/$@.out "gzip -dc"
 	diff -b input/simple1.txt output/$@.out
 
 pipelineReadMem: ${BIN_DIR}/pipelineTester mkdirs
 	gzip -1c input/simple1.txt >output/$@.in.gz
 	${BIN_DIR}/pipelineTester -memApi -otherEnd=output/$@.in.gz -pipeData=output/$@.out "gzip -dc"
 	diff -b input/simple1.txt output/$@.out
 
+# make sure piple exit code makes it back
 pipelineExitCode: ${BIN_DIR}/pipelineTester
-	${BIN_DIR}/pipelineTester -exitCode=1 false
+	${BIN_DIR}/pipelineTester -exitCode=13 "sh -c 'exit 13'"
 
 # test redirecting stderr, see that two process can write stderr, but only
 # the second's stdout should make it to the end of the pipe.  Since order
 # of writes to stderr is determined by process scheduling and when a process
 # terminates due to SIGPIPE, just check that stderr was not empty, don't
 # check contents.
 pipelineWriteErr: ${BIN_DIR}/pipelineTester mkdirs
 	${BIN_DIR}/pipelineTester -write -otherEnd=output/$@.out -stderr=output/$@.err "sh -c 'echo OUT; echo ERR >&2'"  "sh -c 'echo OUT2; echo ERR2 >&2'"
 	diff -b expected/$@.out output/$@.out
 	test -s output/$@.err
 
+# exec a non-existant program
+pipelineExecError: ${BIN_DIR}/pipelineTester mkdirs
+	if ${BIN_DIR}/pipelineTester -write -stderr=output/$@.err "thatDoesNotCompute" 2> output/$@.parent.err ; then false else true ; fi
+	diff -b expected/$@.err output/$@.err
+	diff -b expected/$@.parent.err output/$@.parent.err
+
 ${BIN_DIR}/pipelineTester:  mkdirs pipelineTester.o ${MYLIBS}
 	${CC} ${COPT} -o ${BIN_DIR}/pipelineTester pipelineTester.o ${MYLIBS} ${L}
 
 
 dyStringTest: ${BIN_DIR}/dyStringTester mkdirs
 	${BIN_DIR}/dyStringTester
 
 ${BIN_DIR}/dyStringTester:  mkdirs dyStringTester.o ${MYLIBS}
 	${CC} ${COPT} -o ${BIN_DIR}/dyStringTester dyStringTester.o ${MYLIBS} ${L}
 
 
 mimeTests: mime1 mime2 mime3 mime4 mimeBin mime5 mimeAltHead mimeAutoBoundary mimeBlat
 
 ${BIN_DIR}/mimeTester:  mkdirs mimeTester.o ${MYLIBS}
 	${CC} ${COPT} -o ${BIN_DIR}/mimeTester mimeTester.o ${MYLIBS} ${L}