root/guts_main/guts_main.sh

Revision 178 (checked in by apokayi, 2 days ago)

dropped the localsizeof2_neg test
typo was fixed in lock_attempt

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2
3 # GWU-HPCL Unified Testing Suite
4 # UPC Compilers compliance check with the latest UPC spec v1.2
5 # Script by Abdullah Kayi
6
7 if test -z "$1"; then
8     echo "Usage: ./guts.sh [number of threads] "
9     exit
10 fi
11
12 #go to the src directory
13 cd src
14
15 # Initial cleanup
16 if test -f units.passed ; then
17         rm -f units.passed
18 fi
19
20 if test -f units.notpassed ; then
21         rm -f units.notpassed
22 fi
23
24 printf "\n\n"
25 printf "_______________      Script for compiling and running GUTS-UPC      _______________\n"
26
27 umask 0002
28 NP=$1
29 UNITS=units
30 RNUNITS=units_runtime_neg
31 UNITS_NEG=units_neg
32
33 echo "Running the testing suite for ${NP} threads"
34 printf "\n"
35 passed=0
36 failed=0
37 cmp_failed=0
38
39 # specify second argument as ON to turn on the coloring in the output
40 COLOR=$2
41
42 # flags for Berkeley UPC Compiler
43 # NOTE: interface to automatically set these variables for various UPC Compilers
44 # will be added as we get access and test those UPC Compilers
45 UPCC=upcc
46 UPC_FLAGS="-T=${NP}"
47
48 # for gcc-upc use the following flags instead
49 #UPCC=upc
50 #UPC_FLAGS="-fupc-threads-${NP}"
51
52 for UNIT in `cat ${UNITS}`; do
53         printf ">-------------->      Working on unit -- $UNIT\n"
54        
55         build_output=`$UPCC $UPC_FLAGS -I../include $UNIT.upc -o $UNIT >>$UNIT.out 2>$UNIT.errout`
56
57         if test $? -eq 0 ; then
58                 echo $build_output     
59                 echo "Compilation was SUCCESSFUL for the unit [${UNIT}]"
60                 echo "Now the unit [${UNIT}] will be run for ${NP} threads ..."
61                 #runtime settings for berkeley UPC
62                 RUN=`eval echo "upcrun -qn ${NP} ${UNIT}"`
63                 #use the following runtime settings for gcc-upc
64                 #RUN=`eval echo "./${UNIT}"`
65                 echo $RUN
66                 exe_output=`$RUN`
67                
68         if test $? -eq 0 ; then
69                         if [ "$COLOR" == "ON" ]; then
70                                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]"
71                         else
72                                 printf "TEST PASSED for the unit [$UNIT]"
73                         fi
74                         echo $exe_output
75                         echo "$UNIT" >>units.passed
76                         passed=`expr $passed + 1`
77                 else
78                         if [ "$COLOR" == "ON" ]; then
79                                 printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]"
80                         else
81                                 printf "TEST FAILED for the unit [$UNIT]"
82                         fi
83                         echo $exe_output
84                         echo "$UNIT" >>units.notpassed
85                         failed=`expr $failed + 1`
86                 fi
87        
88     else
89                 echo "COMPILER ERROR: The unit [$UNIT] cannot be compiled"
90                 echo "The unit will not be run!!!"
91                 cat $UNIT.errout
92                 echo "$UNIT" >>units.notpassed
93                 failed=$((failed+1))
94                 cmp_failed=$((cmp_failed+1))
95         fi     
96        
97         `rm -f *.o ${UNIT} ${UNIT}.*out`
98        
99         printf "\n"
100         printf "===============================================================================\n\n"
101 done
102
103 # compile the negative UNITS
104 # these UNITS should raise compiler ERRORS
105
106 for NUNIT in `cat ${UNITS_NEG}`; do
107         printf ">-------------->      Working on unit -- $NUNIT\n"
108
109         build_output=`$UPCC $UPC_FLAGS -I../include $NUNIT.upc -o $NUNIT`
110
111          if test $? -eq 0 ; then
112         echo $build_output
113                 echo "ERROR: The NEGATIVE unit [$NUNIT] pass the compilation phase"
114         echo "The unit will not be run!!!"
115                 if [ "$COLOR" == "ON" ]; then
116                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$NUNIT]"
117                 else
118                         printf "TEST FAILED for the unit [$NUNIT]"
119         fi
120                 echo "$NUNIT" >>units.notpassed
121         failed=`expr $failed + 1`
122         cmp_failed=`expr $cmp_failed + 1`
123      
124      else
125                 echo "Compilation was UNSUCCESSFUL for the negative unit [${NUNIT}]"
126                 echo "Note that this is the EXPECTED result since the unit is negative"
127                 echo "The unit will not be run!!!"
128                 if [ "$COLOR" == "ON" ]; then
129                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$NUNIT]"
130                 else
131                         printf "TEST PASSED for the unit [$NUNIT]"
132                 fi
133                 echo "$NUNIT" >>units.passed     
134                 passed=`expr $passed + 1`
135         fi
136
137     `rm -f *.o ${NUNIT} ${NUNIT}.*out`
138        
139         printf "\n\n"
140         printf "===============================================================================\n\n"
141        
142 done
143
144 # following loop will work for negative units which expect to raise ERROR at runtime
145
146 for RNUNIT in `cat ${RNUNITS}`; do
147     printf ">-------------->      Working on unit -- $RNUNIT\n"
148
149     build_output=`$UPCC $UPC_FLAGS -I../include $RNUNIT.upc -o $RNUNIT >>$RNUNIT.out 2>$RNUNIT.errout`
150
151     if test $? -eq 0 ; then
152         echo $build_output
153         echo "Compilation was SUCCESSFUL for the unit [${RNUNIT}]"
154         echo "Now the unit [${RNUNIT}] will be run for ${NP} threads ..."
155         echo "Note that this is a negative unit which MUST raise a RUNTIME ERROR"
156         #runtime settings for berkeley UPC
157         RUN=`eval echo "upcrun -qn ${NP} ${RNUNIT}"`
158         #use the following runtime settings for gcc-upc
159         #RUN=`eval echo "./${RNUNIT}"`
160         echo $RUN
161         exe_output=`$RUN`
162        
163         if test $? -eq 0 ; then
164             if [ "$COLOR" == "ON" ]; then
165                 printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$RNUNIT]"
166             else
167                 printf "TEST FAILED for the unit [$RNUNIT]"
168             fi
169             echo "$RNUNIT" >>units.notpassed
170             failed=`expr $failed + 1`
171         else
172             if [ "$COLOR" == "ON" ]; then
173                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]"
174             else
175                 printf "TEST PASSED for the unit [$UNIT]"
176             fi
177             echo "$UNIT" >>units.passed
178             passed=`expr $passed + 1`
179         fi
180
181     else
182         echo "COMPILER ERROR: The unit [$RNUNIT] cannot be compiled"
183         echo "The unit will not be run!!!"
184        
185         if [ "$COLOR" == "ON" ]; then
186             printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$RNUNIT]"
187         else
188             printf "TEST FAILED for the unit [$RNUNIT]"
189         fi
190        
191         cat $RNUNIT.errout
192         echo "$RNUNIT" >>units.notpassed
193         failed=`expr $failed + 1`
194         cmp_failed=`expr $cmp_failed + 1`
195     fi
196
197     `rm -f *.o ${RNUNIT} ${RNUNIT}.*out`
198
199     printf "\n\n"
200     printf "===============================================================================\n"
201 done
202
203
204 # STATISTICAL OUTPUT
205
206 printf "________________       GWU-HPCL UPC Compiler Testing Summary         ________________\n"
207 echo "SUCCESSFUL UNITS --> (units.passed)"
208
209 if [ "$COLOR" == "ON" ]; then
210         printf "\033[34m\033[1m"
211 fi
212
213 if test -f units.passed ; then
214         cat units.passed|sort|uniq
215 fi
216
217 if [ "$COLOR" == "ON" ]; then
218         printf "\033[0m"
219 fi
220
221 echo "    FAILED UNITS --> (units.notpassed)"
222
223 if [ "$COLOR" == "ON" ]; then
224         printf "\033[31m\033[1m"
225 fi
226
227 if test -f units.notpassed ; then
228         cat units.notpassed|sort|uniq
229 fi
230
231 if [ "$COLOR" == "ON" ]; then
232         printf "\033[0m"
233         printf "\033[1m\033[1m\033[35m"
234 fi
235
236 echo "                  >-->    Number of units PASSED : $passed"
237 echo "                  >-->    Number of units FAILED : $failed"
238 total=`expr $passed + $failed`
239 percentage=$(((passed*100) / total))
240
241 echo "                  >-->    $percentage % of the units have PASSED"
242 printf "\n"
243
244 if [ "$COLOR" == "ON" ]; then
245         printf "\033[0m"
246 fi
247
248 printf "===========================     TEST END    ====================================\n"
Note: See TracBrowser for help on using the browser.