tor-browser

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

validate1.sh (1296B)


      1 #!/bin/sh
      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 # Validate1.sh is a helper shell script that each of the base test shell
      8 # scripts call to help validate that the generated response (response)
      9 # matches the known answer response (fax). Sometimes (depending on the
     10 # individual tests) there are extraneous output in either or both response
     11 # and fax files. These allow the caller to pass in additional sed commands
     12 # to clear out those extraneous outputs before we compare the two files.
     13 # The sed line always clears out Windows line endings, replaces tabs with
     14 # spaces, and removed comments.
     15 #
     16 set -e
     17 
     18 TESTDIR=${1-.}
     19 request=${2}
     20 extraneous_response=${3}
     21 extraneous_fax=${4}
     22 name=`basename $request .req`
     23 echo ">>>>>  $name"
     24 sed -e 's;\r;;g' -e 's;	; ;g' -e '/^#/d' $extraneous_response ${TESTDIR}/resp/${name}.rsp > /tmp/y1
     25 # if we didn't generate any output, flag that as an error
     26 size=`sum /tmp/y1 | awk '{ print $1 }'`
     27 if [ $size -eq 0 ]; then
     28   echo "${TESTDIR}/resp/${name}.rsp: empty"
     29   exit 1;
     30 fi
     31 sed -e 's;\r;;g' -e 's;	; ;g' -e '/^#/d' $extraneous_fax ${TESTDIR}/fax/${name}.fax > /tmp/y2
     32 diff -i -w -B /tmp/y1 /tmp/y2