blob: 21ae948923e215ea304c10473590e92a5fa645e6 [file] [log] [blame]
icetindil82838a22013-10-11 16:41:18 -07001#!/bin/bash
Till Westmann0f6ee0a2015-10-02 17:10:19 -07002# 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
icetindil82838a22013-10-11 16:41:18 -070019
20TMP=/tmp/verify_
21
22if [ $# -lt "2" ]
23then
24 echo "Usage: `basename $0` result.txt result.T.txt [-u]"
25 exit $E_BADARGS
26fi
27
28args=( $@ )
29for i in 0 1
30do
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
52done
53
54
55### Test 1
56if [ "${l[0]}" -ne "${l[1]}" ]
57then
58 echo $1 ${l[0]}
59 echo $2 ${l[1]}
60 echo Fail -- different number of tokens
61 exit 1
62fi
63
64### Test 2
65diff --brief ${TMP}0 ${TMP}1
66if [ "$?" -ne "0" ]
67then
68 echo Fail -- differnt tokens
69 exit 1
70fi
71rm ${TMP}0 ${TMP}1
72
Till Westmann0f6ee0a2015-10-02 17:10:19 -070073echo Pass