tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Makefile (7585B)


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