1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/tests/remote/Makefile Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,154 @@ 1.4 +#! gmake 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +####################################################################### 1.11 +# (1) Include initial platform-independent assignments (MANDATORY). # 1.12 +####################################################################### 1.13 + 1.14 +include manifest.mn 1.15 + 1.16 +####################################################################### 1.17 +# (2) Include "global" configuration information. (OPTIONAL) # 1.18 +####################################################################### 1.19 + 1.20 +include $(CORE_DEPTH)/coreconf/config.mk 1.21 + 1.22 +####################################################################### 1.23 +# (3) Include "component" configuration information. (OPTIONAL) # 1.24 +####################################################################### 1.25 + 1.26 + 1.27 + 1.28 +####################################################################### 1.29 +# (4) Include "local" platform-dependent assignments (OPTIONAL). # 1.30 +####################################################################### 1.31 + 1.32 + 1.33 + 1.34 +####################################################################### 1.35 +# (5) Execute "global" rules. (OPTIONAL) # 1.36 +####################################################################### 1.37 + 1.38 +include $(CORE_DEPTH)/coreconf/rules.mk 1.39 + 1.40 +####################################################################### 1.41 +# (6) Execute "component" rules. (OPTIONAL) # 1.42 +####################################################################### 1.43 + 1.44 + 1.45 + 1.46 +####################################################################### 1.47 +# (7) Execute "local" rules. (OPTIONAL). # 1.48 +####################################################################### 1.49 + 1.50 +TESTPACKAGE="nss-$(OS_TARGET)$(CPU_TAG).tgz" 1.51 +RTSH=$(DIST)/../../runtests.sh 1.52 +PCFG=$(DIST)/platform.cfg 1.53 + 1.54 + 1.55 +#Hint: In order to test the Makefiles without running the tests, use: 1.56 +# make NSS_CYCLES="standard" NSS_TESTS="dummy" 1.57 + 1.58 +ifeq ($(OS_TARGET),Android) 1.59 +TEST_SHELL?=$$HOME/bin/sh 1.60 +ANDROID_PORT?="2222" 1.61 +#Define the subset of tests that is known to work on Android 1.62 +NSS_CYCLES?="standard pkix upgradedb sharedb" 1.63 +NSS_TESTS?="cipher lowhash libpkix cert dbtests tools sdr crmf smime ssl ocsp merge pkits chains" 1.64 +NSS_SSL_TESTS?="crl normal_normal iopr" 1.65 +NSS_SSL_RUN?="cov auth stress" 1.66 +else 1.67 +TEST_SHELL?="/bin/sh" 1.68 +endif 1.69 + 1.70 +# Create a package for test execution on a separate system. 1.71 +package_for_testing: 1.72 + echo "export OBJDIR=$(OBJDIR_NAME)" > $(PCFG) 1.73 + echo "export OS_ARCH=$(OS_ARCH)" >> $(PCFG) 1.74 + echo "export OS_TARGET=$(OS_TARGET)" >> $(PCFG) 1.75 + echo "export DLL_PREFIX=$(DLL_PREFIX)" >> $(PCFG) 1.76 + echo "export DLL_SUFFIX=$(DLL_SUFFIX)" >> $(PCFG) 1.77 + echo 'echo "set HOST and DOMSUF if your system is not registered in DNS"' > $(RTSH) 1.78 + cat $(PCFG) >> $(RTSH) 1.79 + echo 'export NSS_TESTS=$(NSS_TESTS)' >> $(RTSH) 1.80 + echo 'export NSS_SSL_TESTS=$(NSS_SSL_TESTS)' >> $(RTSH) 1.81 + echo 'export NSS_SSL_RUN=$(NSS_SSL_RUN)' >> $(RTSH) 1.82 + echo 'export NSS_CYCLES=$(NSS_CYCLES)' >> $(RTSH) 1.83 + echo 'export USE_64=$(USE_64)' >> $(RTSH) 1.84 + echo 'export BUILD_OPT=$(BUILD_OPT)' >> $(RTSH) 1.85 + echo 'export PKITS_DATA=$(PKITS_DATA)' >> $(RTSH) 1.86 + echo 'export NSS_DISABLE_ECC=$(NSS_DISABLE_ECC)' >> $(RTSH) 1.87 + echo 'export NSS_ECC_MORE_THAN_SUITE_B=$(NSS_ECC_MORE_THAN_SUITE_B)' >> $(RTSH) 1.88 + echo 'export NSPR_LOG_MODULES=$(NSPR_LOG_MODULES)' >> $(RTSH) 1.89 +ifeq ($(OS_TARGET),Android) 1.90 + # Android doesn't support FIPS tests, because 1.91 + # dladdr does not return a full path for implicitly loaded libraries 1.92 + echo "export NSS_TEST_DISABLE_FIPS=1" >> $(DIST)/platform.cfg 1.93 +endif 1.94 +ifeq ($(CROSS_COMPILE),1) 1.95 +# execute signing on test system 1.96 + echo 'export DIST=$${HOME}/nsstest/dist/' >> $(RTSH) 1.97 + echo 'export NSPR_LIB_DIR=$${DIST}/$${OBJDIR}/lib/' >> $(RTSH) 1.98 + echo 'echo "signing"' >> $(RTSH) 1.99 +# work around a bug in Android ash that has a corrupted work directory after login 1.100 + echo 'cd $${HOME}/nsstest' >> $(RTSH) 1.101 + echo 'cd nss/cmd/shlibsign' >> $(RTSH) 1.102 + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}freebl3.$${DLL_SUFFIX}' >> $(RTSH) 1.103 + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}softokn3.$${DLL_SUFFIX}' >> $(RTSH) 1.104 + echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}nssdbm3.$${DLL_SUFFIX}' >> $(RTSH) 1.105 +ifneq ($(OS_TARGET),Android) 1.106 +# Android's ash doesn't support "export -n" yet 1.107 + echo 'export -n DIST' >> $(RTSH) 1.108 + echo 'export -n NSPR_LIB_DIR' >> $(RTSH) 1.109 +endif 1.110 + echo 'cd ../../../' >> $(RTSH) 1.111 +endif 1.112 + echo 'rm -rf tests_results' >> $(RTSH) 1.113 + echo 'echo "running tests"' >> $(RTSH) 1.114 + echo 'cd nss/tests' >> $(RTSH) 1.115 + # We require progress indication on stdout while running the tests (to avoid timeouts). 1.116 + set -o pipefail 1.117 + echo '$(TEST_SHELL) ./all.sh | tee ../../logfile 2>&1 |grep ": #"' >> $(RTSH) 1.118 + RETVAL=$? 1.119 + echo 'cd ../../' >> $(RTSH) 1.120 + # dump test summary from end of logfile 1.121 + echo 'echo "=========="; tail -100 logfile' >> $(RTSH) 1.122 + echo 'tar czf tests_results.tgz tests_results' >> $(RTSH) 1.123 + echo 'echo "created tests_results.tgz"' >> $(RTSH) 1.124 + echo 'echo "results are in directory: "`ls -1d tests_results/security/*.1`' >> $(RTSH) 1.125 + echo 'echo exit status: $${RETVAL}' >> $(RTSH) 1.126 + echo 'exit $${RETVAL}' >> $(RTSH) 1.127 + rm -f $(TESTPACKAGE) 1.128 + (cd $(DIST)/../.. ; tar czhf dist/$(TESTPACKAGE) runtests.sh dist/$(OBJDIR_NAME) dist/public nss/tests nss/cmd/bltest/tests nss/cmd/pk11gcmtest/tests nss/cmd/shlibsign; echo "created "`pwd`"/dist/$(TESTPACKAGE)" ) 1.129 + 1.130 +android_run_tests: 1.131 + ssh -p $(ANDROID_PORT) -o CheckHostIP=no $(ANDROID_ADDR) 'pwd; cd; pwd; cd nsstest; export PATH=$$HOME/bin:$$PATH ; $(TEST_SHELL) runtests.sh' 1.132 + 1.133 +android_install: 1.134 + rm -f $(DIST)/android.sftp 1.135 + echo '-mkdir nsstest' > $(DIST)/android.sftp 1.136 + echo '-rm nsstest/$(TESTPACKAGE)' >> $(DIST)/android.sftp 1.137 + echo 'progress' >> $(DIST)/android.sftp 1.138 + echo 'put $(DIST)/../$(TESTPACKAGE) nsstest' >> $(DIST)/android.sftp 1.139 + sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(DIST)/android.sftp $(ANDROID_ADDR) 1.140 + 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)' 1.141 + 1.142 +WORKDIR="$(DIST)/../../" 1.143 +RESULTSPACKAGE=tests_results.tgz 1.144 +android_get_result: 1.145 + rm -f $(WORKDIR)/result.sftp $(WORKDIR)/$(RESULTSPACKAGE) 1.146 + echo "progress" > $(WORKDIR)/result.sftp 1.147 + echo 'get nsstest/$(RESULTSPACKAGE) $(WORKDIR)' >> $(WORKDIR)/result.sftp 1.148 + sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(WORKDIR)/result.sftp $(ANDROID_ADDR) 1.149 + (cd $(WORKDIR); tar xzf $(RESULTSPACKAGE); rm -f result.sftp $(RESULTSPACKAGE) ) 1.150 + 1.151 +# Android testing assumes having built with: OS_TARGET=Android CROSS_COMPILE=1 1.152 +# Connectivity tested with Android app: SSHDroid 1.153 +# Provide appropriate ANDROID_ADDR variable, e.g.: 1.154 +# make test_android ANDROID_ADDR=root@192.168.4.5 1.155 +# See also: https://wiki.mozilla.org/NSS:Android 1.156 + 1.157 +test_android: package_for_testing android_install android_run_tests android_get_result