michael@0: #! /bin/bash michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: ######################################################################## michael@0: # michael@0: # mozilla/security/nss/tests/sdr/sdr.sh michael@0: # michael@0: # Script to start test basic functionallity of NSS sdr michael@0: # michael@0: # needs to work on all Unix and Windows platforms michael@0: # michael@0: # special strings michael@0: # --------------- michael@0: # FIXME ... known problems, search for this string michael@0: # NOTE .... unexpected behavior michael@0: # michael@0: ######################################################################## michael@0: michael@0: ############################## sdr_init ################################ michael@0: # local shell function to initialize this script michael@0: ######################################################################## michael@0: sdr_init() michael@0: { michael@0: SCRIPTNAME=sdr.sh michael@0: if [ -z "${CLEANUP}" ] ; then michael@0: CLEANUP="${SCRIPTNAME}" michael@0: fi michael@0: michael@0: if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then michael@0: cd ../common michael@0: . ./init.sh michael@0: fi michael@0: SCRIPTNAME=sdr.sh michael@0: michael@0: #temporary files michael@0: VALUE1=$HOSTDIR/tests.v1.$$ michael@0: VALUE2=$HOSTDIR/tests.v2.$$ michael@0: VALUE3=$HOSTDIR/tests.v3.$$ michael@0: michael@0: T1="Test1" michael@0: T2="The quick brown fox jumped over the lazy dog" michael@0: T3="1234567" michael@0: michael@0: SDRDIR=${HOSTDIR}/SDR michael@0: D_SDR="SDR.$version" michael@0: if [ ! -d ${SDRDIR} ]; then michael@0: mkdir -p ${SDRDIR} michael@0: fi michael@0: michael@0: PROFILE=. michael@0: if [ -n "${MULTIACCESS_DBM}" ]; then michael@0: PROFILE="multiaccess:${D_SDR}" michael@0: fi michael@0: michael@0: cd ${SDRDIR} michael@0: html_head "SDR Tests" michael@0: } michael@0: michael@0: ############################## sdr_main ################################ michael@0: # local shell function to test NSS SDR michael@0: ######################################################################## michael@0: sdr_main() michael@0: { michael@0: echo "$SCRIPTNAME: Creating an SDR key/SDR Encrypt - Value 1" michael@0: echo "sdrtest -d ${PROFILE} -o ${VALUE1} -t \"${T1}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE1} -t "${T1}" michael@0: html_msg $? 0 "Creating SDR Key/Encrypt - Value 1" michael@0: michael@0: echo "$SCRIPTNAME: SDR Encrypt - Value 2" michael@0: echo "sdrtest -d ${PROFILE} -o ${VALUE2} -t \"${T2}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE2} -t "${T2}" michael@0: html_msg $? 0 "Encrypt - Value 2" michael@0: michael@0: echo "$SCRIPTNAME: SDR Encrypt - Value 3" michael@0: echo "sdrtest -d ${PROFILE} -o ${VALUE3} -t \"${T3}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -o ${VALUE3} -t "${T3}" michael@0: html_msg $? 0 "Encrypt - Value 3" michael@0: michael@0: echo "$SCRIPTNAME: SDR Decrypt - Value 1" michael@0: echo "sdrtest -d ${PROFILE} -i ${VALUE1} -t \"${T1}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE1} -t "${T1}" michael@0: html_msg $? 0 "Decrypt - Value 1" michael@0: michael@0: echo "$SCRIPTNAME: SDR Decrypt - Value 2" michael@0: echo "sdrtest -d ${PROFILE} -i ${VALUE2} -t \"${T2}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE2} -t "${T2}" michael@0: html_msg $? 0 "Decrypt - Value 2" michael@0: michael@0: echo "$SCRIPTNAME: SDR Decrypt - Value 3" michael@0: echo "sdrtest -d ${PROFILE} -i ${VALUE3} -t \"${T3}\"" michael@0: ${BINDIR}/sdrtest -d ${PROFILE} -i ${VALUE3} -t "${T3}" michael@0: html_msg $? 0 "Decrypt - Value 3" michael@0: } michael@0: michael@0: ############################## sdr_cleanup ############################# michael@0: # local shell function to finish this script (no exit since it might be michael@0: # sourced) michael@0: ######################################################################## michael@0: sdr_cleanup() michael@0: { michael@0: html "
" michael@0: cd ${QADIR} michael@0: . common/cleanup.sh michael@0: } michael@0: michael@0: sdr_init michael@0: sdr_main michael@0: sdr_cleanup