-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.sh
executable file
·170 lines (157 loc) · 6.35 KB
/
tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
cd `dirname $0`
#-------------------------------------------------------------------------------
# Setup the environment and build the code
#-------------------------------------------------------------------------------
# Setup the build and runtime environment from LCG views
. setupLCG.sh
if [ "$?" != "0" ]; then exit 1; fi
# Print all variables
make -f Makefile print
# Build all targets
make -f Makefile
if [ "$?" != "0" ]; then exit 1; fi
# Setup the runtime environment for BLUEFIN
eval `make -f ./Makefile setup_sh`
#-------------------------------------------------------------------------------
# Execute the tests
#-------------------------------------------------------------------------------
dataDirs=""
dataDirs="$dataDirs examples/dataTOP"
dataDirs="$dataDirs examples/dataXSE"
dataDirs="$dataDirs examples/dataSWW"
dataDirs="$dataDirs examples/dataBRW"
dataDirs="$dataDirs examples/dataMIS"
for dataDir in $dataDirs; do
minOpts=
###minOpts=-M4
###if [ "$dataDir" == "examples/dataMIS" ]; then minOpts=-M0; fi
dataDir=`cd $dataDir; pwd`
files=`cd $dataDir; \ls *.bfin`
###files=`cd $dataDir; \ls *Paper4*.bfin`
for file in $files; do
file=${file%.bfin}
infile=$dataDir/${file}.bfin
outfile=$dataDir/${file}_bluefin.log
reffile=$dataDir/${file}_bluefin.log.ref
outtexfile=$dataDir/${file}.tex
reftexfile=$dataDir/${file}.tex.ref
outtexbody=$dataDir/${file}_body.tex
reftexbody=$dataDir/${file}_body.tex.ref
outpdffile=$dataDir/${file}.pdf
outfile1=$dataDir/${file}_bluefin1.log
outfile2=$dataDir/${file}_bluefin2.log
outfile1s=$dataDir/${file}_bluefin1s.log
outfile2s=$dataDir/${file}_bluefin2s.log
unset BFEXTRAFOOTER
if [ "$file" == "lhc2012" ]; then export BFEXTRAFOOTER="WARNING! This is an example where inputs are taken from Table 4 in CMS PAS TOP-12-001. The output results differ because of rounding errors in those inputs."; fi
if [ "$file" == "sww" ]; then export BFEXTRAFOOTER="LEP Combination for the Summer 2001 Conferences (http://lepewwg.web.cern.ch/LEPEWWG/lepww/4f/Summer01). The output results may differ because of rounding errors."; fi
echo "----------------------------------------------------------------------"
echo Create $outfile and $outtexbody and $outpdffile
if [ -f $outfile ]; then \rm -f $outfile; fi
if [ -f $outtexfile ]; then \rm -f $outtexbody; fi
if [ -f $outfile1 ]; then \rm -f $outfile1; fi
if [ -f $outfile1s ]; then \rm -f $outfile1s; fi
echo bluefin -q $infile -o $dataDir -t $dataDir -c2 $minOpts
bluefin -q $infile -o $dataDir -t $dataDir -c2 $minOpts
if [ "$?" != "0" ]; then
echo "ERROR! bluefin -q $infile -o $dataDir -t $dataDir FAILED!"
###echo cat $outfile
###cat $outfile
#echo tail $outfile
#tail -10 $outfile
continue
fi
###cat $outfile
\mv $outfile $outfile1
cat $outfile1 | awk -vp=1 '{if ($1$2$3=="Createlatexreport:"){p=0}; if(p==1) print $0;}' > $outfile1s
echo "----------------------------------------------------------------------"
echo "Create $outfile (skip latex)"
if [ -f $outfile ]; then \rm -f $outfile; fi
if [ -f $outfile2 ]; then \rm -f $outfile2; fi
if [ -f $outfile2s ]; then \rm -f $outfile2s; fi
echo bluefin $infile -o $dataDir -T -c2 $minOpts
bluefin $infile -o $dataDir -T -c2 $minOpts
if [ "$?" != "0" ]; then
echo "ERROR! bluefin $infile -o $dataDir -T -c2 $minOpts FAILED!"
###echo cat $outfile
###cat $outfile
#echo tail $outfile
#tail -10 $outfile
continue
fi
###cat $outfile
\mv $outfile $outfile2
cat $outfile2 | awk -vp=1 '{if ($1$2$3=="Createlatexreport:"){p=0}; if(p==1) print $0;}' > $outfile2s
#------------------------------------------------------------
# Compare logs with and without latex
#------------------------------------------------------------
ls -l $outfile1s $outfile2s
###echo "Compare $outfile1s to $outfile2s"
echo "diff $outfile1s $outfile2s"
diff $outfile1s $outfile2s
if [ "$?" != "0" ]; then
echo "ERROR! Logfiles differ with and without pdflatex?"
echo ""
echo "diff $outfile1 $outfile2"
diff $outfile1 $outfile2
exit 1
fi
###echo tkdiff $outfile1s $outfile2s
###tkdiff $outfile1s $outfile2s &
###sleep 1 # wait until tkdiff has started before removing the file!
#--- BEGIN cleanup
\mv $outfile1 $outfile
\rm -f $outfile1s
\rm -f $outfile2
\rm -f $outfile2s
#--- END cleanup
#------------------------------------------------------------
# Compare ref
#------------------------------------------------------------
ls -l $outfile $reffile
###echo "Compare $outfile to $reffile"
echo "diff $outfile $reffile"
diff $outfile $reffile
###echo tkdiff $outfile $reffile
###tkdiff $outfile $reffile &
###sleep 1 # wait until tkdiff has started before removing the file!
#--- BEGIN create a new reference
\cp $outfile $reffile
#--- END create a new reference
#\rm -f $outfile
#------------------------------------------------------------
# Compare ref tex file
#------------------------------------------------------------
ls -l $outtexfile $reftexfile
###echo "Compare $outexfile to $reftexfile"
echo "diff $outtexfile $reftexfile"
diff $outtexfile $reftexfile
###echo "tkdiff $outtexfile $reftexfile"
###tkdiff $outtexfile $reftexfile &
###sleep 1 # wait until tkdiff has started before removing the file!
#--- BEGIN create a new reference
\cp $outtexfile $reftexfile
#--- END create a new reference
#\rm -f $outtexfile
#------------------------------------------------------------
# Compare ref tex body
#------------------------------------------------------------
ls -l $outtexbody $reftexbody
###echo "Compare $outexbody to $reftexbody"
echo "diff $outtexbody $reftexbody"
diff $outtexbody $reftexbody
###echo "tkdiff $outtexbody $reftexbody"
###tkdiff $outtexbody $reftexbody &
###sleep 1 # wait until tkdiff has started before removing the file!
#--- BEGIN create a new reference
\cp $outtexbody $reftexbody
#--- END create a new reference
###\rm -f $outtexbody
\rm -f $dataDir/${file}.aux
\rm -f $dataDir/${file}.log
\rm -f $dataDir/${file}_body.aux
\rm -f $dataDir/BlueFinLogo.jpg
done
done
###make clean