security/nss/tests/remote/Makefile

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #! gmake
michael@0 2 #
michael@0 3 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6
michael@0 7 #######################################################################
michael@0 8 # (1) Include initial platform-independent assignments (MANDATORY). #
michael@0 9 #######################################################################
michael@0 10
michael@0 11 include manifest.mn
michael@0 12
michael@0 13 #######################################################################
michael@0 14 # (2) Include "global" configuration information. (OPTIONAL) #
michael@0 15 #######################################################################
michael@0 16
michael@0 17 include $(CORE_DEPTH)/coreconf/config.mk
michael@0 18
michael@0 19 #######################################################################
michael@0 20 # (3) Include "component" configuration information. (OPTIONAL) #
michael@0 21 #######################################################################
michael@0 22
michael@0 23
michael@0 24
michael@0 25 #######################################################################
michael@0 26 # (4) Include "local" platform-dependent assignments (OPTIONAL). #
michael@0 27 #######################################################################
michael@0 28
michael@0 29
michael@0 30
michael@0 31 #######################################################################
michael@0 32 # (5) Execute "global" rules. (OPTIONAL) #
michael@0 33 #######################################################################
michael@0 34
michael@0 35 include $(CORE_DEPTH)/coreconf/rules.mk
michael@0 36
michael@0 37 #######################################################################
michael@0 38 # (6) Execute "component" rules. (OPTIONAL) #
michael@0 39 #######################################################################
michael@0 40
michael@0 41
michael@0 42
michael@0 43 #######################################################################
michael@0 44 # (7) Execute "local" rules. (OPTIONAL). #
michael@0 45 #######################################################################
michael@0 46
michael@0 47 TESTPACKAGE="nss-$(OS_TARGET)$(CPU_TAG).tgz"
michael@0 48 RTSH=$(DIST)/../../runtests.sh
michael@0 49 PCFG=$(DIST)/platform.cfg
michael@0 50
michael@0 51
michael@0 52 #Hint: In order to test the Makefiles without running the tests, use:
michael@0 53 # make NSS_CYCLES="standard" NSS_TESTS="dummy"
michael@0 54
michael@0 55 ifeq ($(OS_TARGET),Android)
michael@0 56 TEST_SHELL?=$$HOME/bin/sh
michael@0 57 ANDROID_PORT?="2222"
michael@0 58 #Define the subset of tests that is known to work on Android
michael@0 59 NSS_CYCLES?="standard pkix upgradedb sharedb"
michael@0 60 NSS_TESTS?="cipher lowhash libpkix cert dbtests tools sdr crmf smime ssl ocsp merge pkits chains"
michael@0 61 NSS_SSL_TESTS?="crl normal_normal iopr"
michael@0 62 NSS_SSL_RUN?="cov auth stress"
michael@0 63 else
michael@0 64 TEST_SHELL?="/bin/sh"
michael@0 65 endif
michael@0 66
michael@0 67 # Create a package for test execution on a separate system.
michael@0 68 package_for_testing:
michael@0 69 echo "export OBJDIR=$(OBJDIR_NAME)" > $(PCFG)
michael@0 70 echo "export OS_ARCH=$(OS_ARCH)" >> $(PCFG)
michael@0 71 echo "export OS_TARGET=$(OS_TARGET)" >> $(PCFG)
michael@0 72 echo "export DLL_PREFIX=$(DLL_PREFIX)" >> $(PCFG)
michael@0 73 echo "export DLL_SUFFIX=$(DLL_SUFFIX)" >> $(PCFG)
michael@0 74 echo 'echo "set HOST and DOMSUF if your system is not registered in DNS"' > $(RTSH)
michael@0 75 cat $(PCFG) >> $(RTSH)
michael@0 76 echo 'export NSS_TESTS=$(NSS_TESTS)' >> $(RTSH)
michael@0 77 echo 'export NSS_SSL_TESTS=$(NSS_SSL_TESTS)' >> $(RTSH)
michael@0 78 echo 'export NSS_SSL_RUN=$(NSS_SSL_RUN)' >> $(RTSH)
michael@0 79 echo 'export NSS_CYCLES=$(NSS_CYCLES)' >> $(RTSH)
michael@0 80 echo 'export USE_64=$(USE_64)' >> $(RTSH)
michael@0 81 echo 'export BUILD_OPT=$(BUILD_OPT)' >> $(RTSH)
michael@0 82 echo 'export PKITS_DATA=$(PKITS_DATA)' >> $(RTSH)
michael@0 83 echo 'export NSS_DISABLE_ECC=$(NSS_DISABLE_ECC)' >> $(RTSH)
michael@0 84 echo 'export NSS_ECC_MORE_THAN_SUITE_B=$(NSS_ECC_MORE_THAN_SUITE_B)' >> $(RTSH)
michael@0 85 echo 'export NSPR_LOG_MODULES=$(NSPR_LOG_MODULES)' >> $(RTSH)
michael@0 86 ifeq ($(OS_TARGET),Android)
michael@0 87 # Android doesn't support FIPS tests, because
michael@0 88 # dladdr does not return a full path for implicitly loaded libraries
michael@0 89 echo "export NSS_TEST_DISABLE_FIPS=1" >> $(DIST)/platform.cfg
michael@0 90 endif
michael@0 91 ifeq ($(CROSS_COMPILE),1)
michael@0 92 # execute signing on test system
michael@0 93 echo 'export DIST=$${HOME}/nsstest/dist/' >> $(RTSH)
michael@0 94 echo 'export NSPR_LIB_DIR=$${DIST}/$${OBJDIR}/lib/' >> $(RTSH)
michael@0 95 echo 'echo "signing"' >> $(RTSH)
michael@0 96 # work around a bug in Android ash that has a corrupted work directory after login
michael@0 97 echo 'cd $${HOME}/nsstest' >> $(RTSH)
michael@0 98 echo 'cd nss/cmd/shlibsign' >> $(RTSH)
michael@0 99 echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}freebl3.$${DLL_SUFFIX}' >> $(RTSH)
michael@0 100 echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}softokn3.$${DLL_SUFFIX}' >> $(RTSH)
michael@0 101 echo '$(TEST_SHELL) ./sign.sh $${DIST}/$${OBJDIR}/ $${DIST}/$${OBJDIR}/bin $${OS_TARGET} $${NSPR_LIB_DIR} $${NSPR_LIB_DIR}$${DLL_PREFIX}nssdbm3.$${DLL_SUFFIX}' >> $(RTSH)
michael@0 102 ifneq ($(OS_TARGET),Android)
michael@0 103 # Android's ash doesn't support "export -n" yet
michael@0 104 echo 'export -n DIST' >> $(RTSH)
michael@0 105 echo 'export -n NSPR_LIB_DIR' >> $(RTSH)
michael@0 106 endif
michael@0 107 echo 'cd ../../../' >> $(RTSH)
michael@0 108 endif
michael@0 109 echo 'rm -rf tests_results' >> $(RTSH)
michael@0 110 echo 'echo "running tests"' >> $(RTSH)
michael@0 111 echo 'cd nss/tests' >> $(RTSH)
michael@0 112 # We require progress indication on stdout while running the tests (to avoid timeouts).
michael@0 113 set -o pipefail
michael@0 114 echo '$(TEST_SHELL) ./all.sh | tee ../../logfile 2>&1 |grep ": #"' >> $(RTSH)
michael@0 115 RETVAL=$?
michael@0 116 echo 'cd ../../' >> $(RTSH)
michael@0 117 # dump test summary from end of logfile
michael@0 118 echo 'echo "=========="; tail -100 logfile' >> $(RTSH)
michael@0 119 echo 'tar czf tests_results.tgz tests_results' >> $(RTSH)
michael@0 120 echo 'echo "created tests_results.tgz"' >> $(RTSH)
michael@0 121 echo 'echo "results are in directory: "`ls -1d tests_results/security/*.1`' >> $(RTSH)
michael@0 122 echo 'echo exit status: $${RETVAL}' >> $(RTSH)
michael@0 123 echo 'exit $${RETVAL}' >> $(RTSH)
michael@0 124 rm -f $(TESTPACKAGE)
michael@0 125 (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)" )
michael@0 126
michael@0 127 android_run_tests:
michael@0 128 ssh -p $(ANDROID_PORT) -o CheckHostIP=no $(ANDROID_ADDR) 'pwd; cd; pwd; cd nsstest; export PATH=$$HOME/bin:$$PATH ; $(TEST_SHELL) runtests.sh'
michael@0 129
michael@0 130 android_install:
michael@0 131 rm -f $(DIST)/android.sftp
michael@0 132 echo '-mkdir nsstest' > $(DIST)/android.sftp
michael@0 133 echo '-rm nsstest/$(TESTPACKAGE)' >> $(DIST)/android.sftp
michael@0 134 echo 'progress' >> $(DIST)/android.sftp
michael@0 135 echo 'put $(DIST)/../$(TESTPACKAGE) nsstest' >> $(DIST)/android.sftp
michael@0 136 sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(DIST)/android.sftp $(ANDROID_ADDR)
michael@0 137 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)'
michael@0 138
michael@0 139 WORKDIR="$(DIST)/../../"
michael@0 140 RESULTSPACKAGE=tests_results.tgz
michael@0 141 android_get_result:
michael@0 142 rm -f $(WORKDIR)/result.sftp $(WORKDIR)/$(RESULTSPACKAGE)
michael@0 143 echo "progress" > $(WORKDIR)/result.sftp
michael@0 144 echo 'get nsstest/$(RESULTSPACKAGE) $(WORKDIR)' >> $(WORKDIR)/result.sftp
michael@0 145 sftp -o Port=$(ANDROID_PORT) -o CheckHostIP=no -b $(WORKDIR)/result.sftp $(ANDROID_ADDR)
michael@0 146 (cd $(WORKDIR); tar xzf $(RESULTSPACKAGE); rm -f result.sftp $(RESULTSPACKAGE) )
michael@0 147
michael@0 148 # Android testing assumes having built with: OS_TARGET=Android CROSS_COMPILE=1
michael@0 149 # Connectivity tested with Android app: SSHDroid
michael@0 150 # Provide appropriate ANDROID_ADDR variable, e.g.:
michael@0 151 # make test_android ANDROID_ADDR=root@192.168.4.5
michael@0 152 # See also: https://wiki.mozilla.org/NSS:Android
michael@0 153
michael@0 154 test_android: package_for_testing android_install android_run_tests android_get_result

mercurial