run_tests.sh 1.3 KB
Newer Older
1 2
#!/bin/bash
cd `dirname $0`
3

4
set -e
Y
Yu Yang 已提交
5 6
PYTHON_EXEC=$1
COMPARE_PROTO_UTIL=$2
7 8 9

protostr=`dirname $0`/protostr

10
files=`ls $protostr | grep -v "unittest"`
11

Y
Yu Yang 已提交
12
./generate_protostr.sh ${PYTHON_EXEC}
13

14 15
. ./file_list.sh

Y
Yu Yang 已提交
16
if [ -z ${COMPARE_PROTO_UTIL} ]; then
17 18 19 20
  for file in $files
  do
      base_protostr=$protostr/$file
      new_protostr=$protostr/$file.unittest
H
hanchao 已提交
21
      diff $base_protostr $new_protostr -u
H
hanchao 已提交
22
      diff $protostr/$file $protostr/$file.non_file_config.unittest -u
23 24 25 26
  done
else
  for file in ${configs[*]}
  do
Y
Yu Yang 已提交
27
    if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.unittest; then
H
hanchao 已提交
28 29
      diff $protostr/$file.protostr $protostr/$file.protostr.unittest -u
    fi
Y
Yu Yang 已提交
30
    if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest; then
H
hanchao 已提交
31
      diff $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest -u
32 33 34 35
    fi
  done

  for file in ${whole_configs[*]}
H
hanchao 已提交
36
  do
Y
Yu Yang 已提交
37
    if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.unittest --whole; then
H
hanchao 已提交
38 39
      diff $protostr/$file.protostr $protostr/$file.protostr.unittest -u
    fi
Y
Yu Yang 已提交
40
    if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest --whole; then
H
hanchao 已提交
41
      diff $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest -u
42 43 44
    fi
  done
fi