icetindil | 82838a2 | 2013-10-11 16:41:18 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Till Westmann | 0f6ee0a | 2015-10-02 17:10:19 -0700 | [diff] [blame] | 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | |
icetindil | 82838a2 | 2013-10-11 16:41:18 -0700 | [diff] [blame] | 19 | |
| 20 | TMP=/tmp/verify_ |
| 21 | |
| 22 | if [ $# -lt "2" ] |
| 23 | then |
| 24 | echo "Usage: `basename $0` result.txt result.T.txt [-u]" |
| 25 | exit $E_BADARGS |
| 26 | fi |
| 27 | |
| 28 | args=( $@ ) |
| 29 | for i in 0 1 |
| 30 | do |
| 31 | f=${args[$i]} |
| 32 | ### Assume second argument is alredy sorted and with no duplicates |
| 33 | if [ "$i" -eq "0" ] |
| 34 | then |
| 35 | sort $3 $f > $TMP$i |
| 36 | else |
| 37 | rm $TMP$i 2> /dev/null |
| 38 | ln -s $PWD/$f $TMP$i |
| 39 | fi |
| 40 | if [ "$?" -ne "0" ] |
| 41 | then |
| 42 | echo Fail -- preprocessing |
| 43 | exit 1 |
| 44 | fi |
| 45 | |
| 46 | l[$i]=`wc --lines $TMP$i | cut --delimiter=" " --fields=1` |
| 47 | if [ "$?" -ne "0" ] |
| 48 | then |
| 49 | echo Fail -- preprocessing |
| 50 | exit 1 |
| 51 | fi |
| 52 | done |
| 53 | |
| 54 | |
| 55 | ### Test 1 |
| 56 | if [ "${l[0]}" -ne "${l[1]}" ] |
| 57 | then |
| 58 | echo $1 ${l[0]} |
| 59 | echo $2 ${l[1]} |
| 60 | echo Fail -- different number of tokens |
| 61 | exit 1 |
| 62 | fi |
| 63 | |
| 64 | ### Test 2 |
| 65 | diff --brief ${TMP}0 ${TMP}1 |
| 66 | if [ "$?" -ne "0" ] |
| 67 | then |
| 68 | echo Fail -- differnt tokens |
| 69 | exit 1 |
| 70 | fi |
| 71 | rm ${TMP}0 ${TMP}1 |
| 72 | |
Till Westmann | 0f6ee0a | 2015-10-02 17:10:19 -0700 | [diff] [blame] | 73 | echo Pass |