Fix for bug 401792 . Restore support for cygwin in all.sh . r=slavo, alexei NSS_3_11_BRANCH
authorjulien.pierre.boogz%sun.com
Wed, 14 Nov 2007 22:41:29 +0000
branchNSS_3_11_BRANCH
changeset 8226 11f05819258729c442e7ffc0ab14ad7e40e50705
parent 8224 21d23295868d42ca2b3dcc6508203f2f2f53f01d
child 8227 f6fdfda689094a7337e3cbd31ba0de880f6cc918
push idunknown
push userunknown
push dateunknown
reviewersslavo, alexei
bugs401792
Fix for bug 401792 . Restore support for cygwin in all.sh . r=slavo, alexei
security/nss/tests/cert/cert.sh
security/nss/tests/cipher/performance.sh
security/nss/tests/common/init.sh
security/nss/tests/fips/fips.sh
security/nss/tests/iopr/cert_iopr.sh
--- a/security/nss/tests/cert/cert.sh
+++ b/security/nss/tests/cert/cert.sh
@@ -92,16 +92,21 @@ cert_init()
   if [ ! "${ROOTCERTSFILE}" ] ; then
       html_failed "<TR><TD>Looking for root certs module." 
       cert_log "ERROR: Root certs module not found."
       Exit 5 "Fatal - Root certs module not found."
   else
       html_passed "<TR><TD>Looking for root certs module."
   fi
 
+  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+	ROOTCERTSFILE=`cygpath -m ${ROOTCERTSFILE}`
+  fi
+
+
   ################## Generate noise for our CA cert. ######################
   # NOTE: these keys are only suitable for testing, as this whole thing 
   # bypasses the entropy gathering. Don't use this method to generate 
   # keys and certs for product use or deployment.
   #
   ps -efl > ${NOISE_FILE} 2>&1
   ps aux >> ${NOISE_FILE} 2>&1
   noise
@@ -215,16 +220,19 @@ cert_init_cert()
         mkdir -p "${CERTDIR}"
     else
         echo "$SCRIPTNAME: WARNING - ${CERTDIR} exists"
     fi
     cd "${CERTDIR}"
     CERTDIR="."
 
     PROFILEDIR=`cd ${CERTDIR}; pwd`
+    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+        PROFILEDIR=`cygpath -m ${PROFILEDIR}`
+    fi
     if [ -n "${MULTIACCESS_DBM}" ]; then
 	PROFILEDIR="multiaccess:${DOMAIN}"
     fi
 
     noise
 }
 
 ############################# hw_acc #################################
@@ -485,16 +493,19 @@ cert_CA()
 
   if [ ! -d "${CUR_CADIR}" ]; then
       mkdir -p "${CUR_CADIR}"
   fi
   cd ${CUR_CADIR}
   pwd
 
   LPROFILE=`pwd`
+  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+     LPROFILE=`cygpath -m ${LPROFILE}`
+  fi
   if [ -n "${MULTIACCESS_DBM}" ]; then
 	LPROFILE="multiaccess:${DOMAIN}"
   fi
 
   if [ "$SIGNER" = "-x" ] ; then # self signed -> create DB
       CU_ACTION="Creating CA Cert DB"
       certu -N -d "${LPROFILE}" -f ${R_PWFILE} 2>&1
       if [ "$RET" -ne 0 ]; then
@@ -947,16 +958,19 @@ cert_stresscerts()
 {
 
   ############### Creating Certs for SSL stress test #######################
   #
   CERTDIR="$CLIENTDIR"
   cd "${CERTDIR}"
 
   PROFILEDIR=`cd ${CERTDIR}; pwd`
+  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+     PROFILEDIR=`cygpath -m ${PROFILEDIR}`
+  fi  
   if [ -n "${MULTIACCESS_DBM}" ]; then
      PROFILEDIR="multiaccess:${D_CLIENT}"
   fi
   CERTFAILED=0
   echo "$SCRIPTNAME: Creating Client CA Issued Certificates ==============="
 
   CONTINUE=$GLOB_MAX_CERT
   CERTSERIAL=10
@@ -1165,16 +1179,19 @@ cert_crl_ssl()
   ################# Creating Certs ###################################
   #
   CERTFAILED=0
   CERTSERIAL=${CRL_GRP_1_BEGIN}
 
   cd $CADIR
   
   PROFILEDIR=`cd ${CLIENTDIR}; pwd`
+  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+     PROFILEDIR=`cygpath -m ${PROFILEDIR}`
+  fi
   CRL_GRPS_END=`expr ${CRL_GRP_1_BEGIN} + ${TOTAL_CRL_RANGE} - 1`
   echo "$SCRIPTNAME: Creating Client CA Issued Certificates Range $CRL_GRP_1_BEGIN - $CRL_GRPS_END ==="
   CU_ACTION="Creating client test certs"
 
   while [ $CERTSERIAL -le $CRL_GRPS_END ]
   do
       CERTNAME="TestUser$CERTSERIAL"
       cert_add_cert 
--- a/security/nss/tests/cipher/performance.sh
+++ b/security/nss/tests/cipher/performance.sh
@@ -1,15 +1,18 @@
 #!/bin/sh  
 #
 # This is just a quick script so we can still run our testcases.
 # Longer term we need a scriptable test environment..
 #
 . ../common/init.sh
 CURDIR=`pwd`
+if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+	CURDIR=`cygpath -m ${CURDIR}`
+fi
 
 CIPHERDIR=${HOSTDIR}/cipher
 SKTESTS=${CURDIR}/symmkey.txt
 RSATESTS=${CURDIR}/rsa.txt
 DSATESTS=${CURDIR}/dsa.txt
 HASHTESTS=${CURDIR}/hash.txt
 SKPERFOUT=${CIPHERDIR}/skperfout.data
 RSAPERFOUT=${CIPHERDIR}/rsaperfout.data
--- a/security/nss/tests/common/init.sh
+++ b/security/nss/tests/common/init.sh
@@ -173,31 +173,48 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOU
 
     qadir=`(cd ..; pwd)`
     QADIR=${QADIR-$qadir}
 
     common=${QADIR}/common
     COMMON=${TEST_COMMON-$common}
     export COMMON
 
+    MAKE=`which gmake`
+    if [ -z "$MAKE" ]; then
+		MAKE=`which make`
+    fi
+    if [ -z "$MAKE" ]; then
+		You are missing make.
+		exit 5
+    fi
+
     DIST=${DIST-${MOZILLA_ROOT}/dist}
     SECURITY_ROOT=${SECURITY_ROOT-${MOZILLA_ROOT}/security/nss}
     TESTDIR=${TESTDIR-${MOZILLA_ROOT}/tests_results/security}
-    OBJDIR=`(cd $COMMON; gmake objdir_name)`
-    OS_ARCH=`(cd $COMMON; gmake os_arch)`
-    DLL_PREFIX=`(cd $COMMON; gmake dll_prefix)`
-    DLL_SUFFIX=`(cd $COMMON; gmake dll_suffix)`
-    OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//"`
+    OBJDIR=`(cd $COMMON; $MAKE objdir_name)`
+    OS_ARCH=`(cd $COMMON; $MAKE os_arch)`
+    DLL_PREFIX=`(cd $COMMON; $MAKE dll_prefix)`
+    DLL_SUFFIX=`(cd $COMMON; $MAKE dll_suffix)`
+    OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//" | sed -e "s/-WOW64//"`
 
     # Pathnames constructed from ${TESTDIR} are passed to NSS tools
     # such as certutil, which don't understand Cygwin pathnames.
     # So we need to convert ${TESTDIR} to a Windows pathname (with
     # regular slashes).
     if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
         TESTDIR=`cygpath -m ${TESTDIR}`
+        QADIR=`cygpath -m ${QADIR}`
+    fi
+
+    # Same problem with MSYS/Mingw, except we need to start over with pwd -W
+    if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "MINGW32_NT" ]; then
+		mingw_mozilla_root=`(cd ../../../..; pwd -W)`
+		MINGW_MOZILLA_ROOT=${MINGW_MOZILLA_ROOT-$mingw_mozilla_root}
+		TESTDIR=${MINGW_TESTDIR-${MINGW_MOZILLA_ROOT}/tests_results/security}
     fi
 
     # Same problem with MSYS/Mingw, except we need to start over with pwd -W
     if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "MINGW32_NT" ]; then
 		mingw_mozilla_root=`(cd ../../../..; pwd -W)`
 		MINGW_MOZILLA_ROOT=${MINGW_MOZILLA_ROOT-$mingw_mozilla_root}
 		TESTDIR=${MINGW_TESTDIR-${MINGW_MOZILLA_ROOT}/tests_results/security}
     fi
--- a/security/nss/tests/fips/fips.sh
+++ b/security/nss/tests/fips/fips.sh
@@ -264,16 +264,20 @@ fips_140()
   SOFTOKEN=${MANGLEDIR}/${DLL_PREFIX}softokn3.${DLL_SUFFIX}
 
   echo "mangling ${SOFTOKEN}"
   echo "mangle -i ${SOFTOKEN} -o -8 -b 5"
   mangle -i ${SOFTOKEN} -o -8 -b 5 2>&1
   if [ $? -eq 0 ]; then
     if [ "${OS_ARCH}" = "WINNT" ]; then
       DBTEST=`which dbtest`
+	  if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+		DBTEST=`cygpath -m ${DBTEST}`
+		MANGLEDIR=`cygpath -u ${MANGLEDIR}`
+	  fi
       echo "PATH=${MANGLEDIR} ${DBTEST} -r -d ${P_R_FIPSDIR}"
       PATH="${MANGLEDIR}" ${DBTEST} -r -d ${P_R_FIPSDIR} > ${TMP}/dbtestoutput.txt 2>&1
       RESULT=$?
     elif [ "${OS_ARCH}" = "HP-UX" ]; then
       echo "SHLIB_PATH=${MANGLEDIR} dbtest -r -d ${P_R_FIPSDIR}"
       LD_LIBRARY_PATH="" SHLIB_PATH="${MANGLEDIR}" dbtest -r -d ${P_R_FIPSDIR} > ${TMP}/dbtestoutput.txt 2>&1
       RESULT=$?
     elif [ "${OS_ARCH}" = "AIX" ]; then
--- a/security/nss/tests/iopr/cert_iopr.sh
+++ b/security/nss/tests/iopr/cert_iopr.sh
@@ -75,16 +75,19 @@ pk12u()
 # Params:
 #      $1 - directory location
 #
 createDBDir() {
     trgDir=$1
 
     if [ -z "`ls $trgDir | grep db`" ]; then
         trgDir=`cd ${trgDir}; pwd`
+        if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" = "CYGWIN_NT" ]; then
+			trgDir=`cygpath -m ${trgDir}`
+        fi
 
         CU_ACTION="Initializing DB at ${trgDir}"
         certu -N -d "${trgDir}" -f "${R_PWFILE}" 2>&1
         if [ "$RET" -ne 0 ]; then
             return $RET
         fi
 
         CU_ACTION="Loading root cert module to Cert DB at ${trgDir}"