diff options
author | kaie%kuix.de <devnull@localhost> | 2013-01-08 16:19:11 +0000 |
---|---|---|
committer | kaie%kuix.de <devnull@localhost> | 2013-01-08 16:19:11 +0000 |
commit | 68da1150e2fb30257e0d88234d79560395f66704 (patch) | |
tree | 8b3fa2665dd70c41eb6f5e13d6c5672a13c86823 | |
parent | f7a7102f5757ba72e41af1d31030f27ff9647f69 (diff) | |
download | nss-hg-68da1150e2fb30257e0d88234d79560395f66704.tar.gz |
Bug 772144 - Run the NSS test suite on ARM/Android, Patch by rrelyea/kaie, r=kaie/rrelyea
-rw-r--r-- | dbm/src/mktemp.c | 3 | ||||
-rw-r--r-- | security/coreconf/Android.mk | 6 | ||||
-rw-r--r-- | security/coreconf/Linux.mk | 30 | ||||
-rw-r--r-- | security/coreconf/arch.mk | 11 | ||||
-rw-r--r-- | security/coreconf/config.mk | 2 | ||||
-rw-r--r-- | security/nss/Makefile | 31 | ||||
-rw-r--r-- | security/nss/cmd/shlibsign/Makefile | 2 | ||||
-rw-r--r-- | security/nss/cmd/shlibsign/sign.sh | 7 | ||||
-rw-r--r-- | security/nss/lib/freebl/unix_rand.c | 2 | ||||
-rw-r--r-- | security/nss/lib/util/secasn1t.h | 2 | ||||
-rwxr-xr-x | security/nss/tests/cert/cert.sh | 4 | ||||
-rw-r--r-- | security/nss/tests/chains/chains.sh | 4 | ||||
-rw-r--r-- | security/nss/tests/common/init.sh | 50 | ||||
-rw-r--r-- | security/nss/tests/dummy/dummy.sh | 19 | ||||
-rw-r--r-- | security/nss/tests/remote/Makefile | 154 | ||||
-rw-r--r-- | security/nss/tests/remote/manifest.mn | 6 |
16 files changed, 281 insertions, 52 deletions
diff --git a/dbm/src/mktemp.c b/dbm/src/mktemp.c index 58224fa04..bbf05cd4c 100644 --- a/dbm/src/mktemp.c +++ b/dbm/src/mktemp.c @@ -84,9 +84,6 @@ mkstempflags(char *path, int extraFlags) static int _gettemp(char *path, register int *doopen, int extraFlags) { -#if !defined(_WINDOWS) || defined(_WIN32) - extern int errno; -#endif register char *start, *trv; struct stat sbuf; unsigned int pid; diff --git a/security/coreconf/Android.mk b/security/coreconf/Android.mk new file mode 100644 index 000000000..415812a7e --- /dev/null +++ b/security/coreconf/Android.mk @@ -0,0 +1,6 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +include $(CORE_DEPTH)/coreconf/Linux.mk diff --git a/security/coreconf/Linux.mk b/security/coreconf/Linux.mk index 4417d1642..a586e5edb 100644 --- a/security/coreconf/Linux.mk +++ b/security/coreconf/Linux.mk @@ -8,7 +8,9 @@ include $(CORE_DEPTH)/coreconf/UNIX.mk # # The default implementation strategy for Linux is now pthreads # -USE_PTHREADS = 1 +ifneq ($(OS_TARGET),Android) + USE_PTHREADS = 1 +endif ifeq ($(USE_PTHREADS),1) IMPL_STRATEGY = _PTH @@ -20,6 +22,26 @@ RANLIB = ranlib DEFAULT_COMPILER = gcc +ifeq ($(OS_TARGET),Android) +ifndef ANDROID_NDK + $(error Must set ANDROID_NDK to the path to the android NDK first) +endif + ANDROID_PREFIX=$(OS_TEST)-linux-androideabi + ANDROID_TARGET=$(ANDROID_PREFIX)-4.4.3 + # should autodetect which linux we are on, currently android only + # supports linux-x86 prebuilts + ANDROID_TOOLCHAIN=$(ANDROID_NDK)/toolchains/$(ANDROID_TARGET)/prebuilt/linux-x86 + ANDROID_SYSROOT=$(ANDROID_NDK)/platforms/android-$(OS_TARGET_RELEASE)/arch-$(OS_TEST) + ANDROID_CC=$(ANDROID_TOOLCHAIN)/bin/$(ANDROID_PREFIX)-gcc +# internal tools need to be built with the native compiler +ifndef INTERNAL_TOOLS + CC = $(ANDROID_CC) --sysroot=$(ANDROID_SYSROOT) + DEFAULT_COMPILER=$(ANDROID_PREFIX)-gcc + ARCHFLAG = --sysroot=$(ANDROID_SYSROOT) + DEFINES += -DNO_SYSINFO -DNO_FORK_CHECK -DANDROID + CROSS_COMPILE = 1 +endif +endif ifeq ($(OS_TEST),ppc64) CPU_ARCH = ppc ifeq ($(USE_64),1) @@ -67,7 +89,9 @@ endif endif +ifneq ($(OS_TARGET),Android) LIBC_TAG = _glibc +endif ifeq ($(OS_RELEASE),2.0) OS_REL_CFLAGS += -DLINUX2_0 @@ -103,7 +127,7 @@ endif # Place -ansi and *_SOURCE before $(DSO_CFLAGS) so DSO_CFLAGS can override # -ansi on platforms like Android where the system headers are C99 and do # not build with -ansi. -STANDARDS_CFLAGS = -ansi -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE +STANDARDS_CFLAGS = -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE OS_CFLAGS = $(STANDARDS_CFLAGS) $(DSO_CFLAGS) $(OS_REL_CFLAGS) $(ARCHFLAG) -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR OS_LIBS = $(OS_PTHREAD) -ldl -lc @@ -141,12 +165,14 @@ CPU_TAG = _$(CPU_ARCH) # dependencies by default. Set FREEBL_NO_DEPEND to 0 in the environment to # override this. # +ifneq ($(OS_TARGET),Android) ifeq (2.6,$(firstword $(sort 2.6 $(OS_RELEASE)))) ifndef FREEBL_NO_DEPEND FREEBL_NO_DEPEND = 1 FREEBL_LOWHASH = 1 endif endif +endif USE_SYSTEM_ZLIB = 1 ZLIB_LIBS = -lz diff --git a/security/coreconf/arch.mk b/security/coreconf/arch.mk index 718fb64df..6557348b2 100644 --- a/security/coreconf/arch.mk +++ b/security/coreconf/arch.mk @@ -249,6 +249,17 @@ ifeq (MINGW32_NT,$(findstring MINGW32_NT,$(OS_ARCH))) endif endif +ifeq ($(OS_TARGET),Android) +# +# this should be configurable from the user +# + OS_TEST := arm + OS_ARCH = Android + ifndef OS_TARGET_RELEASE + OS_TARGET_RELEASE := 8 + endif +endif + ifndef OS_TARGET OS_TARGET = $(OS_ARCH) endif diff --git a/security/coreconf/config.mk b/security/coreconf/config.mk index 93a11d7c5..7694d3db3 100644 --- a/security/coreconf/config.mk +++ b/security/coreconf/config.mk @@ -31,7 +31,7 @@ endif ####################################################################### TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \ - AIX RISCOS WINNT WIN95 Linux + AIX RISCOS WINNT WIN95 Linux Android ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET))) include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk diff --git a/security/nss/Makefile b/security/nss/Makefile index 89b123ddd..26c6fe4d2 100644 --- a/security/nss/Makefile +++ b/security/nss/Makefile @@ -61,6 +61,9 @@ NSPR_CONFIGURE = $(CORE_DEPTH)/../nsprpub/configure # Translate coreconf build options to NSPR configure options. # +ifeq ($(OS_TARGET),Android) +NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) --target=arm-linux-androideabi --with-android-version=$(OS_TARGET_RELEASE) +endif ifdef BUILD_OPT NSPR_CONFIGURE_OPTS += --disable-debug --enable-optimize endif @@ -150,31 +153,3 @@ nss_RelEng_bld: build_coreconf import build_dbm all package: $(MAKE) -C pkg publish -TESTPACKAGE="nss-$(OS_TARGET)$(CPU_TAG).tgz" -package_for_testing: - echo "export OBJDIR=$(OBJDIR_NAME)" > $(DIST)/platform.cfg - echo "export OS_ARCH=$(ANDROID)" >> $(DIST)/platform.cfg - echo "export DLL_PREFIX=$(DLL_PREFIX)" >> $(DIST)/platform.cfg - echo "export DLL_SUFFIX=$(DLL_SUFFIX)" >> $(DIST)/platform.cfg -ifeq ($(OS_TARGET),Android) - # Android doesn't support FIPS tests, so don't run them - echo "export NSS_TEST_DISABLE_FIPS=1" >> $(DIST)/platform.cfg -endif - echo 'echo "set HOST and DOMSUF if your system is not registered in DNS"; sleep 5' > $(DIST)/../../runtests.sh - echo 'export NSS_TESTS=$(NSS_TESTS)' >> $(DIST)/../../runtests.sh - echo 'export NSS_SSL_TESTS=$(NSS_SSL_TESTS)' >> $(DIST)/../../runtests.sh - echo 'export NSS_SSL_RUN=$(NSS_SSL_RUN)' >> $(DIST)/../../runtests.sh - echo 'export NSS_CYCLES=$(NSS_CYCLES)' >> $(DIST)/../../runtests.sh - echo 'export OBJDIR=$(OBJDIR_NAME)' >> $(DIST)/../../runtests.sh - echo 'export USE_64=$(USE_64)' >> $(DIST)/../../runtests.sh - echo 'export BUILD_OPT=$(BUILD_OPT)' >> $(DIST)/../../runtests.sh - echo 'rm -rf test_results' >> $(DIST)/../../runtests.sh - echo 'echo "running tests"' >> $(DIST)/../../runtests.sh - echo 'cd security/nss/tests; ./all.sh > ../../../logfile 2>&1 ; cd ../../../' >> $(DIST)/../../runtests.sh - echo 'tar czf tests_results.tgz tests_results' >> $(DIST)/../../runtests.sh - echo 'echo "created tests_results.tgz"' >> $(DIST)/../../runtests.sh - echo 'echo "results are in directory: "`ls -1d tests_results/security/*.1`' >> $(DIST)/../../runtests.sh - echo 'echo -n "number of PASSED tests: "; grep -cw PASSED logfile;' >> $(DIST)/../../runtests.sh - echo 'echo -n "number of FAILED tests: "; grep -cw FAILED logfile;' >> $(DIST)/../../runtests.sh - rm -f $(TESTPACKAGE) - (cd $(DIST)/../.. ; tar czhf dist/$(TESTPACKAGE) runtests.sh dist/$(OBJDIR_NAME) dist/public security/nss/tests security/nss/cmd/bltest/tests; echo "created "`pwd`"/dist/$(TESTPACKAGE)") diff --git a/security/nss/cmd/shlibsign/Makefile b/security/nss/cmd/shlibsign/Makefile index 0dc52db4c..a9bb138df 100644 --- a/security/nss/cmd/shlibsign/Makefile +++ b/security/nss/cmd/shlibsign/Makefile @@ -82,6 +82,8 @@ ifeq ($(OS_TARGET), OS2) cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ $(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<) +else ifeq ($(CROSS_COMPILE),1) + # do nothing else cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \ $(call core_abspath,$(OBJDIR)) $(OS_TARGET) \ diff --git a/security/nss/cmd/shlibsign/sign.sh b/security/nss/cmd/shlibsign/sign.sh index f64481dbb..d8bd837d6 100644 --- a/security/nss/cmd/shlibsign/sign.sh +++ b/security/nss/cmd/shlibsign/sign.sh @@ -3,6 +3,13 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +# arguments: +# 1: full path to DIST/OBJDIR (parent dir of "lib") +# 2: full path to shlibsign executable (DIST/OBJDIR/bin) +# 3: OS_TARGET +# 4: full path to DIST/OBJDIR/lib +# 5: full path to library that is to be signed + case "${3}" in WIN*) if echo "${PATH}" | grep -c \; >/dev/null; then diff --git a/security/nss/lib/freebl/unix_rand.c b/security/nss/lib/freebl/unix_rand.c index 086f1050e..95c2d0595 100644 --- a/security/nss/lib/freebl/unix_rand.c +++ b/security/nss/lib/freebl/unix_rand.c @@ -358,10 +358,12 @@ GetHighResClock(void *buf, size_t maxbytes) static void GiveSystemInfo(void) { +#ifndef NO_SYSINFO struct sysinfo si; if (sysinfo(&si) == 0) { RNG_RandomUpdate(&si, sizeof(si)); } +#endif } #endif /* LINUX */ diff --git a/security/nss/lib/util/secasn1t.h b/security/nss/lib/util/secasn1t.h index 1f91984f8..c662b0ea4 100644 --- a/security/nss/lib/util/secasn1t.h +++ b/security/nss/lib/util/secasn1t.h @@ -183,7 +183,7 @@ typedef struct sec_ASN1Template_struct { typedef const SEC_ASN1Template * SEC_ASN1TemplateChooser(void *arg, PRBool enc); typedef SEC_ASN1TemplateChooser * SEC_ASN1TemplateChooserPtr; -#if defined(_WIN32) +#if defined(_WIN32) || defined(ANDROID) #define SEC_ASN1_GET(x) NSS_Get_##x(NULL, PR_FALSE) #define SEC_ASN1_SUB(x) &p_NSS_Get_##x #define SEC_ASN1_XTRN SEC_ASN1_DYNAMIC diff --git a/security/nss/tests/cert/cert.sh b/security/nss/tests/cert/cert.sh index 6dbd041f0..dc3700eee 100755 --- a/security/nss/tests/cert/cert.sh +++ b/security/nss/tests/cert/cert.sh @@ -1485,7 +1485,9 @@ cert_all_CA cert_extended_ssl cert_ssl cert_smime_client -cert_fips +if [ -z "$NSS_TEST_DISABLE_FIPS" ]; then + cert_fips +fi cert_eccurves cert_extensions cert_test_password diff --git a/security/nss/tests/chains/chains.sh b/security/nss/tests/chains/chains.sh index 650215e40..c5ca3d6b7 100644 --- a/security/nss/tests/chains/chains.sh +++ b/security/nss/tests/chains/chains.sh @@ -186,9 +186,7 @@ chains_init() if [ -n "${NSS_AIA_PATH}" ]; then HTTPPID=${NSS_AIA_PATH}/http_pid.$$ mkdir -p "${NSS_AIA_PATH}" - pushd "${NSS_AIA_PATH}" - start_httpserv - popd + (cd "${NSS_AIA_PATH}" ; start_httpserv ) fi html_head "Certificate Chains Tests" diff --git a/security/nss/tests/common/init.sh b/security/nss/tests/common/init.sh index 239b66de6..d9ee58905 100644 --- a/security/nss/tests/common/init.sh +++ b/security/nss/tests/common/init.sh @@ -250,18 +250,35 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then COMMON=${TEST_COMMON-$common} export COMMON - MAKE=gmake - $MAKE -v >/dev/null 2>&1 || MAKE=make - $MAKE -v >/dev/null 2>&1 || { echo "You are missing make."; exit 5; } - MAKE="$MAKE --no-print-directory" - DIST=${DIST-${MOZILLA_ROOT}/dist} SECURITY_ROOT=${SECURITY_ROOT-${MOZILLA_ROOT}/security/nss} TESTDIR=${TESTDIR-${MOZILLA_ROOT}/tests_results/security} - 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)` + + # Allow for override options from a config file + if [ -n "${OBJDIR}" -a -f ${DIST}/${OBJDIR}/platform.cfg ]; then + . ${DIST}/${OBJDIR}/platform.cfg + fi + + # only need make if we don't already have certain variables set + if [ -z "${OBJDIR}" -o -z "${OS_ARCH}" -o -z "${DLL_PREFIX}" -o -z "${DLL_SUFFIX}" ]; then + MAKE=gmake + $MAKE -v >/dev/null 2>&1 || MAKE=make + $MAKE -v >/dev/null 2>&1 || { echo "You are missing make."; exit 5; } + MAKE="$MAKE --no-print-directory" + fi + + if [ "${OBJDIR}" = "" ]; then + OBJDIR=`(cd $COMMON; $MAKE objdir_name)` + fi + if [ "${OS_ARCH}" = "" ]; then + OS_ARCH=`(cd $COMMON; $MAKE os_arch)` + fi + if [ "${DLL_PREFIX}" = "" ]; then + DLL_PREFIX=`(cd $COMMON; $MAKE dll_prefix)` + fi + if [ "${DLL_SUFFIX}" = "" ]; then + DLL_SUFFIX=`(cd $COMMON; $MAKE dll_suffix)` + fi OS_NAME=`uname -s | sed -e "s/-[0-9]*\.[0-9]*//" | sed -e "s/-WOW64//"` BINDIR="${DIST}/${OBJDIR}/bin" @@ -296,7 +313,10 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then if [ "${OS_ARCH}" = "WINNT" -a "$OS_NAME" != "CYGWIN_NT" -a "$OS_NAME" != "MINGW32_NT" ]; then PATH=.\;${DIST}/${OBJDIR}/bin\;${DIST}/${OBJDIR}/lib\;$PATH PATH=`perl ../path_uniq -d ';' "$PATH"` - else + elif [ "${OS_ARCH}" = "Android" ]; then + # android doesn't have perl, skip the uniq step + PATH=.:${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:$PATH + else PATH=.:${DIST}/${OBJDIR}/bin:${DIST}/${OBJDIR}/lib:/bin:/usr/bin:$PATH # added /bin and /usr/bin in the beginning so a local perl will # be used @@ -349,7 +369,7 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then ;; esac - if [ -z "${DOMSUF}" ]; then + if [ -z "${DOMSUF}" -a "${OS_ARCH}" != "Android" ]; then echo "$SCRIPTNAME: Fatal DOMSUF env. variable is not defined." exit 1 #does not need to be Exit, very early in script fi @@ -358,7 +378,11 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then #not needed anymore (purpose: be able to use IP address for the server #cert instead of PC name which was not in the DNS because of dyn IP address if [ -z "$USE_IP" -o "$USE_IP" != "TRUE" ] ; then - HOSTADDR=${HOST}.${DOMSUF} + if [ -z "${DOMSUF}" ]; then + HOSTADDR=${HOST} + else + HOSTADDR=${HOST}.${DOMSUF} + fi else HOSTADDR=${IP_ADDRESS} fi @@ -618,7 +642,7 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then fi ################################################# - if [ "${OS_ARCH}" != "WINNT" ]; then + if [ "${OS_ARCH}" != "WINNT" -a "${OS_ARCH}" != "Android" ]; then ulimit -c unlimited fi diff --git a/security/nss/tests/dummy/dummy.sh b/security/nss/tests/dummy/dummy.sh new file mode 100644 index 000000000..27d3c9cf4 --- /dev/null +++ b/security/nss/tests/dummy/dummy.sh @@ -0,0 +1,19 @@ +#! /bin/bash +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +######################################################################## +# +# mozilla/security/nss/tests/dummy/dummy.sh +# +# Minimal test that doesn't do anything +# +# NSS_TESTS="dummy" can be used for quick testing of the +# test script infrastructure, without running any of the tests +# +######################################################################## + +# html_failed "dummy test fail" +html_passed "dummy test ok" diff --git a/security/nss/tests/remote/Makefile b/security/nss/tests/remote/Makefile new file mode 100644 index 000000000..18f88a113 --- /dev/null +++ b/security/nss/tests/remote/Makefile @@ -0,0 +1,154 @@ +#! gmake +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +TESTPACKAGE="nss-$(OS_TARGET)$(CPU_TAG).tgz" +RTSH=$(DIST)/../../runtests.sh +PCFG=$(DIST)/platform.cfg + + +#Hint: In order to test the Makefiles without running the tests, use: +# make NSS_CYCLES="standard" NSS_TESTS="dummy" + +ifeq ($(OS_TARGET),Android) +TEST_SHELL?=$$HOME/bin/sh +ANDROID_PORT?="2222" +#Define the subset of tests that is known to work on Android +NSS_CYCLES?="standard pkix upgradedb sharedb" +NSS_TESTS?="cipher lowhash libpkix cert dbtests tools sdr crmf smime ssl ocsp merge pkits chains" +NSS_SSL_TESTS?="crl normal_normal iopr" +NSS_SSL_RUN?="cov auth stress" +else +TEST_SHELL?="/bin/sh" +endif + +# Create a package for test execution on a separate system. +package_for_testing: + echo "export OBJDIR=$(OBJDIR_NAME)" > $(PCFG) + echo "export OS_ARCH=$(OS_ARCH)" >> $(PCFG) + echo "export OS_TARGET=$(OS_TARGET)" >> $(PCFG) + echo "export DLL_PREFIX=$(DLL_PREFIX)" >> $(PCFG) + echo "export DLL_SUFFIX=$(DLL_SUFFIX)" >> $(PCFG) + echo 'echo "set HOST and DOMSUF if your system is not registered in DNS"' > $(RTSH) + cat $(PCFG) >> $(RTSH) + echo 'export NSS_TESTS=$(NSS_TESTS)' >> $(RTSH) + echo 'export NSS_SSL_TESTS=$(NSS_SSL_TESTS)' >> $(RTSH) + echo 'export NSS_SSL_RUN=$(NSS_SSL_RUN)' >> $(RTSH) + echo 'export NSS_CYCLES=$(NSS_CYCLES)' >> $(RTSH) + echo 'export USE_64=$(USE_64)' >> $(RTSH) + echo 'export BUILD_OPT=$(BUILD_OPT)' >> $(RTSH) + echo 'export PKITS_DATA=$(PKITS_DATA)' >> $(RTSH) + echo 'export NSS_ENABLE_ECC=$(NSS_ENABLE_ECC)' >> $(RTSH) + echo 'export NSS_ECC_MORE_THAN_SUITE_B=$(NSS_ECC_MORE_THAN_SUITE_B)' >> $(RTSH) + echo 'export NSPR_LOG_MODULES=$(NSPR_LOG_MODULES)' >> $(RTSH) +ifeq ($(OS_TARGET),Android) + # Android doesn't support FIPS tests, because + # dladdr does not return a full path for implicitly loaded libraries + echo "export NSS_TEST_DISABLE_FIPS=1" >> $(DIST)/platform.cfg +endif +ifeq ($(CROSS_COMPILE),1) +# execute signing on test system + echo 'export DIST=$${HOME}/nsstest/dist/' >> $(RTSH) + echo 'export NSPR_LIB_DIR=$${DIST}/$${OBJDIR}/lib/' >> $(RTSH) + echo 'echo "signing"' >> $(RTSH) +# work around a bug in Android ash that has a corrupted work directory after login + echo 'cd $${HOME}/nsstest' >> $(RTSH) + echo 'cd security/nss/cmd/shlibsign' >> $(RTSH) + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}freebl3.$${DLL_SUFFIX}' >> $(RTSH) + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}softokn3.$${DLL_SUFFIX}' >> $(RTSH) + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}nssdbm3.$${DLL_SUFFIX}' >> $(RTSH) +ifneq ($(OS_TARGET),Android) +# Android's ash doesn't support "export -n" yet + echo 'export -n DIST' >> $(RTSH) + echo 'export -n NSPR_LIB_DIR' >> $(RTSH) +endif + echo 'cd ../../../../' >> $(RTSH) +endif + echo 'rm -rf tests_results' >> $(RTSH) + echo 'echo "running tests"' >> $(RTSH) + echo 'cd security/nss/tests' >> $(RTSH) + # We require progress indication on stdout while running the tests (to avoid timeouts). + set -o pipefail + echo '$(TEST_SHELL) ./all.sh | tee ../../../logfile 2>&1 |grep ": #"' >> $(RTSH) + RETVAL=$? + echo 'cd ../../../' >> $(RTSH) + # dump test summary from end of logfile + echo 'echo "=========="; tail -100 logfile' >> $(RTSH) + echo 'tar czf tests_results.tgz tests_results' >> $(RTSH) + echo 'echo "created tests_results.tgz"' >> $(RTSH) + echo 'echo "results are in directory: "`ls -1d tests_results/security/*.1`' >> $(RTSH) + echo 'echo exit status: $${RETVAL}' >> $(RTSH) + echo 'exit $${RETVAL}' >> $(RTSH) + rm -f $(TESTPACKAGE) + (cd $(DIST)/../.. ; tar czhf dist/$(TESTPACKAGE) runtests.sh dist/$(OBJDIR_NAME) dist/public security/nss/tests security/nss/cmd/bltest/tests security/nss/cmd/shlibsign; echo "created "`pwd`"/dist/$(TESTPACKAGE)" ) + +android_run_tests: + ssh -p $(ANDROID_PORT) -o CheckHostIP=no $(ANDROID_ADDR) 'pwd; cd; pwd; cd nsstest; export PATH=$$HOME/bin:$$PATH ; $(TEST_SHELL) runtests.sh' + +android_install: + rm -f $(DIST)/android.sftp + echo '-mkdir nsstest' > $(DIST)/android.sftp + echo '-rm nsstest/$(TESTPACKAGE)' >> $(DIST)/android.sftp + echo 'progress' >> $(DIST)/android.sftp + echo 'put $(DIST)/../$(TESTPACKAGE) nsstest' >> $(DIST)/android.sftp + sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(DIST)/android.sftp $(ANDROID_ADDR) + ssh -p $(ANDROID_PORT) -o CheckHostIP=no $(ANDROID_ADDR) 'cd nsstest ; $$HOME/bin/rm -rf logfile runtests.sh dist security tests_results tests_results.tgz; $$HOME/bin/tar xzf $(TESTPACKAGE)' + +WORKDIR="$(DIST)/../../" +RESULTSPACKAGE=tests_results.tgz +android_get_result: + rm -f $(WORKDIR)/result.sftp $(WORKDIR)/$(RESULTSPACKAGE) + echo "progress" > $(WORKDIR)/result.sftp + echo 'get nsstest/$(RESULTSPACKAGE) $(WORKDIR)' >> $(WORKDIR)/result.sftp + sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(WORKDIR)/result.sftp $(ANDROID_ADDR) + (cd $(WORKDIR); tar xzf $(RESULTSPACKAGE); rm -f result.sftp $(RESULTSPACKAGE) ) + +# Android testing assumes having built with: OS_TARGET=Android CROSS_COMPILE=1 +# Connectivity tested with Android app: SSHDroid +# Provide appropriate ANDROID_ADDR variable, e.g.: +# make test_android ANDROID_ADDR=root@192.168.4.5 +# See also: https://wiki.mozilla.org/NSS:Android + +test_android: package_for_testing android_install android_run_tests android_get_result diff --git a/security/nss/tests/remote/manifest.mn b/security/nss/tests/remote/manifest.mn new file mode 100644 index 000000000..b4afdc206 --- /dev/null +++ b/security/nss/tests/remote/manifest.mn @@ -0,0 +1,6 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +CORE_DEPTH = ../../.. +DEPTH = ../../.. |