[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3952) Patch: 'make test' does not fail at all errors



Of course I ran into shell issues at once after writing that patch:-(
I'm moving this to -devel, except some cleanup and strangeness that fit
better in ITS:


* test011-glue-slapadd tests sizelimit with ldapsearch -z
and fails if $RC = 0 (success).

Is there any reason not to test $RC != 4 (sizeLimitExceeded) instead?
Gives better error message, if nothing else.


* sql-test000-read does "Testing compare (should be UNDEFINED)"
by checking that ldapcompare's return value is not 5 or 6.
Can that be replaced with testing that it is the expected return code?
(I can't test it, haven't compiled in sql.)


* When test035-meta says

"### Hit LDAP_BUSY problem; you may want to re-run the test"

it sometimes kills the servers and exits, and sometimes not.
I don't see a reason for the difference.
Would it be OK to always do that?

Or - maybe operations except the ldapmodify that can report this should
sleep a second and retry the operation a few times before giving up?
(Would have to output to another file and append it to the "real" output
time before finishing.)  Something like this:

Maybe_busy () {
	op_tmpfile=$TESTDIR/tmp.out op_outfile=$1; shift
	for i in 0 1 1; do
		test $i -ne 0 &&
			echo "Got LDAP_BUSY; retrying after 1 second..." &&
			sleep 1
		"$@" >$op_tmpfile 2>&1 </dev/null
		RC=$?
		test $RC -eq 51 || break
	done
	cat $op_tmpfile >> $op_outfile

	# I do not know if this is still necessary after N tries:
	if test $RC -eq 51; then
		echo "### Hit LDAP_BUSY problem; you may want to re-run the test"
		test $KILLSERVERS != no && kill -HUP $KILLPIDS
		exit 0
	fi

	return $RC
}

...
Maybe_busy $SEARCHOUT \
	$LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN"
RC=$?
if test $RC != 0 ; then
	echo "Search failed ($RC)!"
	test $KILLSERVERS != no && kill -HUP $KILLPIDS
	exit $RC
fi

OpenLDAP already uses shell functions via build/shtool, so I guess
there is no point in worrying about old shells that do not support
them.  But I'll take that to -devel.

Actually LDAP_BUSY from the ldapmodify could be handled too, by getting
the last modify attempt from stderr of previous ldapmodify and only
redoing the modifications from that point in the input file.  I think
I'll leave that to someone else though:-)



* startup_nis_ldap_server.sh uses variable $DBDIR, which no longer
exists.

* And as I mentioned, I don't know what scripts/start-server* and
startup_nis_ldap_server.sh are used for.  I assume they should kill
slapd if they fail, but should they obey $KILLSERVERS (the ./run -k
flag)?

-- 
Hallvard