Bug 391815:
1. Wrapped OCSP tests by debug tool. 2. Modified memleak script to use one function for testing different tools (selfserv, strsclnt, ocspclnt) + added OCSP tests. r=alexei git-svn-id: svn://10.0.0.236/trunk@237087 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -96,16 +96,21 @@ ocsp_get_cert_status() {
|
||||
clntParam="-l $respUrl -t $defRespCert"
|
||||
fi
|
||||
|
||||
outFile=$dbDir/ocsptest.out.$$
|
||||
echo "ocspclnt -d $dbDir -S $cert $clntParam"
|
||||
ocspclnt -d $dbDir -S $cert $clntParam >$outFile 2>&1
|
||||
ret=$?
|
||||
echo "ocspclnt output:"
|
||||
cat $outFile
|
||||
[ -z "`grep succeeded $outFile`" ] && ret=1
|
||||
if [ -z "${MEMLEAK_DBG}" ]; then
|
||||
outFile=$dbDir/ocsptest.out.$$
|
||||
echo "ocspclnt -d $dbDir -S $cert $clntParam"
|
||||
ocspclnt -d $dbDir -S $cert $clntParam >$outFile 2>&1
|
||||
ret=$?
|
||||
echo "ocspclnt output:"
|
||||
cat $outFile
|
||||
[ -z "`grep succeeded $outFile`" ] && ret=1
|
||||
|
||||
rm -f $outFile
|
||||
return $ret
|
||||
rm -f $outFile
|
||||
return $ret
|
||||
fi
|
||||
|
||||
OCSP_ATTR="-d $dbDir -S $cert $clntParam"
|
||||
${RUN_COMMAND_DBG} ocspclnt ${OCSP_ATTR}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -129,8 +134,10 @@ ocsp_iopr() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
html_head "OCSP testing with responder at $IOPR_HOSTADDR. <br>" \
|
||||
"Test Type: $testDescription"
|
||||
if [ -z "${MEMLEAK_DBG}" ]; then
|
||||
html_head "OCSP testing with responder at $IOPR_HOSTADDR. <br>" \
|
||||
"Test Type: $testDescription"
|
||||
fi
|
||||
|
||||
if [ -n "$testResponder" ]; then
|
||||
responderUrl="$testProto://$servName:$testPort"
|
||||
@@ -138,25 +145,35 @@ ocsp_iopr() {
|
||||
responderUrl=""
|
||||
fi
|
||||
|
||||
for certName in $testValidCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" "$testResponder"
|
||||
html_msg $? 0 "Getting status of a valid cert ($certName)" \
|
||||
"produced a returncode of $ret, expected is 0."
|
||||
done
|
||||
if [ -z "${MEMLEAK_DBG}" ]; then
|
||||
for certName in $testValidCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" \
|
||||
"$testResponder"
|
||||
html_msg $? 0 "Getting status of a valid cert ($certName)" \
|
||||
"produced a returncode of $ret, expected is 0."
|
||||
done
|
||||
|
||||
for certName in $testRevokedCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" "$testResponder"
|
||||
html_msg $? 1 "Getting status of a unvalid cert ($certName)" \
|
||||
"produced a returncode of $ret, expected is 1."
|
||||
done
|
||||
for certName in $testRevokedCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" \
|
||||
"$testResponder"
|
||||
html_msg $? 1 "Getting status of a unvalid cert ($certName)" \
|
||||
"produced a returncode of $ret, expected is 1."
|
||||
done
|
||||
|
||||
for certName in $testStatUnknownCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" "$testResponder"
|
||||
html_msg $? 1 "Getting status of a cert with unknown status " \
|
||||
"($certName) produced a returncode of $ret, expected is 1."
|
||||
done
|
||||
for certName in $testStatUnknownCertNames; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" \
|
||||
"$testResponder"
|
||||
html_msg $? 1 "Getting status of a cert with unknown status " \
|
||||
"($certName) produced a returncode of $ret, expected is 1."
|
||||
done
|
||||
else
|
||||
for certName in $testValidCertNames $testRevokedCertNames \
|
||||
$testStatUnknownCertName; do
|
||||
ocsp_get_cert_status $dbDir $certName "$responderUrl" \
|
||||
"$testResponder" 2>&1
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Initial point for running ocsp test againt multiple hosts involved in
|
||||
@@ -175,6 +192,10 @@ ocsp_iopr_run() {
|
||||
fi
|
||||
cd ${CLIENTDIR}
|
||||
|
||||
if [ -n "${MEMLEAK_DBG}" ]; then
|
||||
html_head "Memory leak checking - IOPR"
|
||||
fi
|
||||
|
||||
num=1
|
||||
IOPR_HOST_PARAM=`echo "${IOPR_HOSTADDR_LIST} " | cut -f $num -d' '`
|
||||
while [ "$IOPR_HOST_PARAM" ]; do
|
||||
@@ -197,21 +218,46 @@ ocsp_iopr_run() {
|
||||
#
|
||||
[ -z "`echo ${supportedTests_new} | grep -i ocsp`" ] && continue;
|
||||
|
||||
# Testing directories defined by webserver.
|
||||
if [ -n "${MEMLEAK_DBG}" ]; then
|
||||
LOGNAME=iopr-${IOPR_HOSTADDR}
|
||||
LOGFILE=${LOGDIR}/${LOGNAME}.log
|
||||
fi
|
||||
|
||||
# Testing directories defined by webserver.
|
||||
echo "Testing ocsp interoperability.
|
||||
Client: local(tstclnt).
|
||||
Responder: remote($IOPR_HOSTADDR)"
|
||||
|
||||
|
||||
for ocspTestType in ${supportedTests_new}; do
|
||||
if [ -z "`echo $ocspTestType | grep -i ocsp`" ]; then
|
||||
continue
|
||||
fi
|
||||
ocsp_iopr $ocspTestType ${IOPR_HOSTADDR} \
|
||||
${IOPR_OCSP_CLIENTDIR}_${IOPR_HOSTADDR}
|
||||
if [ -n "${MEMLEAK_DBG}" ]; then
|
||||
ocsp_iopr $ocspTestType ${IOPR_HOSTADDR} \
|
||||
${IOPR_OCSP_CLIENTDIR}_${IOPR_HOSTADDR} 2>&1 |
|
||||
tee -a ${LOGFILE}
|
||||
else
|
||||
ocsp_iopr $ocspTestType ${IOPR_HOSTADDR} \
|
||||
${IOPR_OCSP_CLIENTDIR}_${IOPR_HOSTADDR}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${MEMLEAK_DBG}" ]; then
|
||||
log_parse >> ${FOUNDLEAKS}
|
||||
ret=$?
|
||||
html_msg ${ret} 0 "${LOGNAME}" \
|
||||
"produced a returncode of $ret, expected is 0"
|
||||
fi
|
||||
|
||||
echo "================================================"
|
||||
echo "Done testing ocsp interoperability with $IOPR_HOSTADDR"
|
||||
done
|
||||
|
||||
if [ -n "${MEMLEAK_DBG}" ]; then
|
||||
html "</TABLE><BR>"
|
||||
fi
|
||||
|
||||
NO_ECC_CERTS=0
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ memleak_init()
|
||||
fi
|
||||
|
||||
if [ ! -r ${CERT_LOG_FILE} ]; then
|
||||
cd ../cert
|
||||
cd ${QADIR}/cert
|
||||
. ./cert.sh
|
||||
fi
|
||||
|
||||
@@ -135,8 +135,7 @@ memleak_init()
|
||||
FREEBL_LIST="${FREEBL_DEFAULT}"
|
||||
fi
|
||||
|
||||
RUN_SELFSERV_DBG="run_selfserv_dbx"
|
||||
RUN_STRSCLNT_DBG="run_strsclnt_dbx"
|
||||
RUN_COMMAND_DBG="run_command_dbx"
|
||||
PARSE_LOGFILE="parse_logfile_dbx"
|
||||
;;
|
||||
"Linux")
|
||||
@@ -157,8 +156,7 @@ memleak_init()
|
||||
FREEBL_DEFAULT="libfreebl_3"
|
||||
FREEBL_LIST="${FREEBL_DEFAULT}"
|
||||
|
||||
RUN_SELFSERV_DBG="run_selfserv_valgrind"
|
||||
RUN_STRSCLNT_DBG="run_strsclnt_valgrind"
|
||||
RUN_COMMAND_DBG="run_command_valgrind"
|
||||
PARSE_LOGFILE="parse_logfile_valgrind"
|
||||
;;
|
||||
*)
|
||||
@@ -167,7 +165,7 @@ memleak_init()
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${BUILD_OPT}" -eq 1 ] ; then
|
||||
if [ "${BUILD_OPT}" -eq "1" ] ; then
|
||||
OPT="OPT"
|
||||
unset NSS_DISABLE_UNLOAD
|
||||
else
|
||||
@@ -181,6 +179,9 @@ memleak_init()
|
||||
|
||||
tbytes=0
|
||||
tblocks=0
|
||||
|
||||
MEMLEAK_DBG=1
|
||||
export MEMLEAK_DBG
|
||||
}
|
||||
|
||||
########################### memleak_cleanup ############################
|
||||
@@ -188,6 +189,7 @@ memleak_init()
|
||||
########################################################################
|
||||
memleak_cleanup()
|
||||
{
|
||||
unset MEMLEAK_DBG
|
||||
. ${QADIR}/common/cleanup.sh
|
||||
}
|
||||
|
||||
@@ -278,6 +280,45 @@ clear_freebl()
|
||||
fi
|
||||
}
|
||||
|
||||
############################ run_command_dbx ###########################
|
||||
# local shell function to run command under dbx tool
|
||||
########################################################################
|
||||
run_command_dbx()
|
||||
{
|
||||
COMMAND=$1
|
||||
shift
|
||||
ATTR=$*
|
||||
|
||||
COMMAND=`which ${COMMAND}`
|
||||
DBX_CMD="dbxenv follow_fork_mode parent
|
||||
dbxenv rtc_mel_at_exit verbose
|
||||
dbxenv rtc_biu_at_exit verbose
|
||||
check -memuse -match 16 -frames 16
|
||||
run ${ATTR}
|
||||
"
|
||||
|
||||
echo "${SCRIPTNAME}: -------- Running ${COMMAND} under DBX:"
|
||||
echo "${DBX} ${COMMAND}"
|
||||
echo "${SCRIPTNAME}: -------- DBX commands:"
|
||||
echo "${DBX_CMD}"
|
||||
echo "${DBX_CMD}" | ${DBX} ${COMMAND} 2>/dev/null | grep -v Reading
|
||||
}
|
||||
|
||||
######################### run_command_valgrind #########################
|
||||
# local shell function to run command under valgrind tool
|
||||
########################################################################
|
||||
run_command_valgrind()
|
||||
{
|
||||
COMMAND=$1
|
||||
shift
|
||||
ATTR=$*
|
||||
|
||||
echo "${SCRIPTNAME}: -------- Running ${COMMAND} under Valgrind:"
|
||||
echo "${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 ${COMMAND} ${ATTR}"
|
||||
${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 ${COMMAND} ${ATTR}
|
||||
echo "==0=="
|
||||
}
|
||||
|
||||
############################# run_selfserv #############################
|
||||
# local shell function to start selfserv
|
||||
########################################################################
|
||||
@@ -290,50 +331,14 @@ run_selfserv()
|
||||
selfserv ${SELFSERV_ATTR}
|
||||
}
|
||||
|
||||
########################### run_selfserv_dbx ###########################
|
||||
# local shell function to start selfserv under dbx tool
|
||||
########################### run_selfserv_dbg ###########################
|
||||
# local shell function to start selfserv under debug tool
|
||||
########################################################################
|
||||
run_selfserv_dbx()
|
||||
run_selfserv_dbg()
|
||||
{
|
||||
DBX_CMD="${HOSTDIR}/run_selfserv$$.dbx"
|
||||
|
||||
cat << EOF_DBX > ${DBX_CMD}
|
||||
dbxenv follow_fork_mode parent
|
||||
dbxenv rtc_mel_at_exit verbose
|
||||
dbxenv rtc_biu_at_exit verbose
|
||||
check -memuse -match 16 -frames 16
|
||||
run ${SERVER_OPTION} ${SELFSERV_ATTR}
|
||||
EOF_DBX
|
||||
|
||||
SELFSERV=`which selfserv`
|
||||
echo "PATH=${PATH}"
|
||||
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
|
||||
echo "${SCRIPTNAME}: -------- Running selfserv under DBX:"
|
||||
echo "${DBX} ${SELFSERV} < ${DBX_CMD}"
|
||||
echo "${SCRIPTNAME}: -------- DBX commands (${DBX_CMD}):"
|
||||
cat ${DBX_CMD}
|
||||
${DBX} ${SELFSERV} < ${DBX_CMD} 2>/dev/null | grep -v Reading
|
||||
rm ${DBX_CMD}
|
||||
}
|
||||
|
||||
######################### run_selfserv_valgrind ########################
|
||||
# local shell function to start selfserv under valgrind tool
|
||||
########################################################################
|
||||
run_selfserv_valgrind()
|
||||
{
|
||||
echo "PATH=${PATH}"
|
||||
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
|
||||
echo "${SCRIPTNAME}: -------- Running selfserv under Valgrind:"
|
||||
echo "${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 selfserv ${SELFSERV_ATTR}"
|
||||
${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 selfserv ${SELFSERV_ATTR}
|
||||
}
|
||||
|
||||
############################ strsclnt_attr #############################
|
||||
# local shell function to set strsclnt attributes and parameters
|
||||
########################################################################
|
||||
strsclnt_attr()
|
||||
{
|
||||
STRSCLNT_ATTR="-q -p ${PORT} -d ${CLIENT_DB} -w nss -c 1000 -C ${cipher} ${HOSTADDR}"
|
||||
${RUN_COMMAND_DBG} selfserv ${SERVER_OPTION} ${SELFSERV_ATTR}
|
||||
}
|
||||
|
||||
############################# run_strsclnt #############################
|
||||
@@ -343,70 +348,27 @@ strsclnt_attr()
|
||||
run_strsclnt()
|
||||
{
|
||||
for cipher in ${cipher_list}; do
|
||||
strsclnt_attr ${cipher}
|
||||
STRSCLNT_ATTR="-q -p ${PORT} -d ${CLIENT_DB} -w nss -c 1000 -C ${cipher} ${HOSTADDR}"
|
||||
echo "${SCRIPTNAME}: -------- Trying cipher ${cipher}:"
|
||||
echo "strsclnt ${STRSCLNT_ATTR}"
|
||||
strsclnt ${STRSCLNT_ATTR}
|
||||
done
|
||||
|
||||
echo "PATH=${PATH}"
|
||||
echo "LD_PATH=${LD_LIBRARY_PATH}"
|
||||
|
||||
echo "${SCRIPTNAME}: -------- Stopping server:"
|
||||
echo "tstclnt ${TSTCLNT_ATTR} < ${REQUEST_FILE}"
|
||||
tstclnt ${TSTCLNT_ATTR} < ${REQUEST_FILE}
|
||||
}
|
||||
|
||||
########################### run_strsclnt_dbx ###########################
|
||||
# local shell function to run strsclnt under dbx for all ciphers and
|
||||
# send stop command to selfserv over tstclnt
|
||||
########################################################################
|
||||
run_strsclnt_dbx()
|
||||
{
|
||||
DBX_CMD="${HOSTDIR}/run_strsclnt$$.dbx"
|
||||
|
||||
for cipher in ${cipher_list}; do
|
||||
strsclnt_attr ${cipher}
|
||||
cat << EOF_DBX > ${DBX_CMD}
|
||||
dbxenv follow_fork_mode parent
|
||||
dbxenv rtc_mel_at_exit verbose
|
||||
dbxenv rtc_biu_at_exit verbose
|
||||
check -memuse -match 16 -frames 16
|
||||
run ${CLIENT_OPTION} ${STRSCLNT_ATTR}
|
||||
EOF_DBX
|
||||
|
||||
STRSCLNT=`which strsclnt`
|
||||
echo "${SCRIPTNAME}: -------- Trying cipher ${cipher} under DBX:"
|
||||
echo "${DBX} ${STRSCLNT} < ${DBX_CMD}"
|
||||
echo "${SCRIPTNAME}: -------- DBX comands (${DBX_CMD}):"
|
||||
cat ${DBX_CMD}
|
||||
${DBX} ${STRSCLNT} < ${DBX_CMD} 2>/dev/null | grep -v Reading
|
||||
done
|
||||
|
||||
echo "PATH=${PATH}"
|
||||
echo "LD_PATH=${LD_LIBRARY_PATH}"
|
||||
|
||||
echo "${SCRIPTNAME}: -------- Stopping server:"
|
||||
echo "tstclnt ${TSTCLNT_ATTR} < ${REQUEST_FILE}"
|
||||
tstclnt ${TSTCLNT_ATTR} < ${REQUEST_FILE}
|
||||
rm ${DBX_CMD}
|
||||
}
|
||||
|
||||
######################## run_strsclnt_valgrind #########################
|
||||
# local shell function to run strsclnt under valgrind for all ciphers
|
||||
########################### run_strsclnt_dbg ###########################
|
||||
# local shell function to run strsclnt under debug tool for all ciphers
|
||||
# and send stop command to selfserv over tstclnt
|
||||
########################################################################
|
||||
run_strsclnt_valgrind()
|
||||
run_strsclnt_dbg()
|
||||
{
|
||||
for cipher in ${cipher_list}; do
|
||||
strsclnt_attr ${cipher}
|
||||
echo "${SCRIPTNAME}: -------- Trying cipher ${cipher} under Valgrind:"
|
||||
echo "${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 strsclnt ${STRSCLNT_ATTR}"
|
||||
${VALGRIND} --tool=memcheck --leak-check=yes --show-reachable=yes --partial-loads-ok=yes --leak-resolution=high --num-callers=50 strsclnt ${STRSCLNT_ATTR}
|
||||
STRSCLNT_ATTR="-q -p ${PORT} -d ${CLIENT_DB} -w nss -c 1001 -C ${cipher} ${HOSTADDR}"
|
||||
${RUN_COMMAND_DBG} strsclnt ${CLIENT_OPTION} ${STRSCLNT_ATTR}
|
||||
done
|
||||
|
||||
echo "PATH=${PATH}"
|
||||
echo "LD_PATH=${LD_LIBRARY_PATH}"
|
||||
|
||||
echo "${SCRIPTNAME}: -------- Stopping server:"
|
||||
echo "tstclnt ${TSTCLNT_ATTR} < ${REQUEST_FILE}"
|
||||
@@ -431,18 +393,13 @@ run_ciphers_server()
|
||||
LOGFILE=${LOGDIR}/${LOGNAME}.log
|
||||
echo "Running ${LOGNAME}"
|
||||
|
||||
${RUN_SELFSERV_DBG} 2>&1 | tee ${LOGFILE} &
|
||||
run_selfserv_dbg 2>&1 | tee ${LOGFILE} &
|
||||
sleep 5
|
||||
run_strsclnt
|
||||
|
||||
sleep 20
|
||||
clear_freebl
|
||||
|
||||
if [ ${OS_NAME} = "Linux" ]; then
|
||||
echo "==0==" >> ${LOGFILE}
|
||||
fi
|
||||
echo "" >> ${LOGFILE}
|
||||
|
||||
log_parse >> ${FOUNDLEAKS}
|
||||
ret=$?
|
||||
html_msg ${ret} 0 "${LOGNAME}" "produced a returncode of $ret, expected is 0"
|
||||
@@ -472,16 +429,11 @@ run_ciphers_client()
|
||||
|
||||
run_selfserv &
|
||||
sleep 5
|
||||
${RUN_STRSCLNT_DBG} 2>&1 | tee ${LOGFILE}
|
||||
run_strsclnt_dbg 2>&1 | tee ${LOGFILE}
|
||||
|
||||
sleep 20
|
||||
clear_freebl
|
||||
|
||||
if [ ${OS_NAME} = "Linux" ]; then
|
||||
echo "==0==" >> ${LOGFILE}
|
||||
fi
|
||||
echo "" >> ${LOGFILE}
|
||||
|
||||
|
||||
log_parse >> ${FOUNDLEAKS}
|
||||
ret=$?
|
||||
html_msg ${ret} 0 "${LOGNAME}" "produced a returncode of $ret, expected is 0"
|
||||
@@ -551,7 +503,7 @@ parse_logfile_valgrind()
|
||||
do
|
||||
gline=`echo "${line}" | grep "^=="`
|
||||
if [ -z "${gline}" ] ; then
|
||||
gline=`echo "${line}" | grep "^${VALGRIND} "`
|
||||
gline=`echo "${line}" | grep "^${VALGRIND} " | sed "s:.*/::"`
|
||||
if [ -n "${gline}" ] ; then
|
||||
bin_name=`echo "${line}" | cut -d" " -f8`
|
||||
fi
|
||||
@@ -728,10 +680,23 @@ cnt_total()
|
||||
echo ""
|
||||
}
|
||||
|
||||
############################### run_ocsp ###############################
|
||||
# local shell function to run ocsp tests
|
||||
########################################################################
|
||||
run_ocsp()
|
||||
{
|
||||
cd ${QADIR}/iopr
|
||||
. ./ocsp_iopr.sh
|
||||
ocsp_iopr_run
|
||||
}
|
||||
|
||||
################################# main #################################
|
||||
|
||||
memleak_init
|
||||
|
||||
run_ciphers_server
|
||||
run_ciphers_client
|
||||
run_ocsp
|
||||
|
||||
cnt_total
|
||||
memleak_cleanup
|
||||
|
||||
Reference in New Issue
Block a user