| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | @runs=(0,5,11,1000); |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | $LAST = @runs - 2; |
|---|
| 17 | |
|---|
| 18 | if(!$ARGV[0]) |
|---|
| 19 | { |
|---|
| 20 | $ARGV[0] = 0;; |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | $nrun = $ARGV[0]; |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | $c = "M"; |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | system( "net use $c: \\\\cumulus\\cumulus_c\$ /persistent:no" ); |
|---|
| 36 | |
|---|
| 37 | $in_dir = "$c:/projects/cloudy/trunk/tsuite/slow/"; |
|---|
| 38 | $out_dir = "$c:/projects/cloudy/trunk/tsuite/slow/"; |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | chdir( $out_dir or die "could not move to test suite directory\n"); |
|---|
| 42 | |
|---|
| 43 | $log_file = "dayslow"."$nrun".".log"; |
|---|
| 44 | open( ioLOG , ">$log_file" ); |
|---|
| 45 | printf( ioLOG "have moved to output dir and opened log files\n"); |
|---|
| 46 | printf( ioLOG "input dir is $in_dir, out is $out_dir\n"); |
|---|
| 47 | |
|---|
| 48 | if( $nrun == 0 || $nrun == 1 || $nrun == 2 ) |
|---|
| 49 | { |
|---|
| 50 | printf( ioLOG " start run number $nrun for test suite\n"); |
|---|
| 51 | } |
|---|
| 52 | else |
|---|
| 53 | { |
|---|
| 54 | printf( ioLOG " invalid run number $nrun for test suite\n"); |
|---|
| 55 | exit(1); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | $nSkip = $runs[$nrun]; |
|---|
| 62 | |
|---|
| 63 | $nmod_calc = $runs[$nrun+1]; |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | $exe_gcc = "$c:/projects/cloudy/trunk/gcc/release/cloudy_gcc.exe"; |
|---|
| 70 | $exe_icl = "$c:/projects/cloudy/trunk/icl/release/cloudy_icl.exe"; |
|---|
| 71 | $exe_org = $exe_icl; |
|---|
| 72 | system("cp $exe_org $out_dir "); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | $exe_gcc = "$out_dir"."cloudy_gcc.exe"; |
|---|
| 76 | $exe_icl = "$out_dir"."cloudy_icl.exe"; |
|---|
| 77 | $exe = $exe_icl; |
|---|
| 78 | printf(ioLOG "exe is $exe\n"); |
|---|
| 79 | |
|---|
| 80 | $TRUE = 1; |
|---|
| 81 | $FALSE = 0; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | $lgForceCompute = $TRUE; |
|---|
| 85 | |
|---|
| 86 | $lgForceCompute = $FALSE; |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | $errors = "$out_dir"."errors"."$nrun".".txt"; |
|---|
| 90 | |
|---|
| 91 | $blockrun = "blockfile.txt"; |
|---|
| 92 | |
|---|
| 93 | $problem_file = "$out_dir"."problems"."$nrun".".txt"; |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | if( !open(EXEFILE, "$exe_org") ) |
|---|
| 97 | { |
|---|
| 98 | printf( ioLOG "executable did not exist so exiting without running.\n" ); |
|---|
| 99 | printf( STDERR "executable did not exist so exiting without running.\n" ); |
|---|
| 100 | exit(1); |
|---|
| 101 | } |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | if( !$lgForceCompute ) |
|---|
| 106 | { |
|---|
| 107 | if( -e $errors ) |
|---|
| 108 | { |
|---|
| 109 | |
|---|
| 110 | if( (-M $errors) < (-M EXEFILE ) ) |
|---|
| 111 | { |
|---|
| 112 | printf( ioLOG "executable older than errors.txt so exit.\n" ); |
|---|
| 113 | |
|---|
| 114 | exit(2); |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | if( -e $blockrun ) |
|---|
| 118 | { |
|---|
| 119 | printf( ioLOG "blockrun file exists so exit.\n" ); |
|---|
| 120 | |
|---|
| 121 | exit(3); |
|---|
| 122 | } |
|---|
| 123 | } |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | printf( ioLOG "entering loop, exe is $exe \n" ); |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | $nModTotal = 0; |
|---|
| 131 | |
|---|
| 132 | $nComputed = 0; |
|---|
| 133 | |
|---|
| 134 | while( defined( $input = glob("$in_dir*.in") ) ) |
|---|
| 135 | { |
|---|
| 136 | if( $nModTotal >= $nSkip && $nModTotal < $nmod_calc ) |
|---|
| 137 | { |
|---|
| 138 | |
|---|
| 139 | $output = $input; |
|---|
| 140 | $output =~ s/$in_dir/$out_dir/gi; |
|---|
| 141 | |
|---|
| 142 | $output =~ s/\.in/.out/gi; |
|---|
| 143 | |
|---|
| 144 | if( -e $output ) |
|---|
| 145 | { |
|---|
| 146 | $backup = $output; |
|---|
| 147 | $backup =~ s/\.out/\.bak/gi; |
|---|
| 148 | system( "cp $output $backup " ); |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | system "nice -n 5 $exe < $input > $output "; |
|---|
| 152 | printf( ioLOG "$input going to $output \n" ); |
|---|
| 153 | ++$nComputed; |
|---|
| 154 | } |
|---|
| 155 | ++$nModTotal; |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | printf( ioLOG "$nComputed sims were run\n"); |
|---|
| 159 | |
|---|
| 160 | check_output(); |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | send_mail(); |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | if( $nrun == $LAST ) |
|---|
| 168 | { |
|---|
| 169 | |
|---|
| 170 | system( "perl checkall.pl" ); |
|---|
| 171 | |
|---|
| 172 | if( -s "serious.txt" ) |
|---|
| 173 | { |
|---|
| 174 | |
|---|
| 175 | system("c:\\u\\blat\\blat.exe serious.txt -t gary\@pa.uky.edu -s \"last Cloudy slow run completed and errors existed\" " ); |
|---|
| 176 | } |
|---|
| 177 | else |
|---|
| 178 | { |
|---|
| 179 | $script_dir = "$c:/projects/cloudy/trunk/scripts/"; |
|---|
| 180 | system( "perl \"$script_dir\"promote_last_good_slow.pl" ); |
|---|
| 181 | |
|---|
| 182 | open( ioEMAIL , ">message.txt" ); |
|---|
| 183 | printf( ioEMAIL " Last Cloudy slow run completed and no errors found\n"); |
|---|
| 184 | close( ioEMAIL ); |
|---|
| 185 | system("c:\\u\\blat\\blat.exe message.txt -t gary\@pa.uky.edu -s \"last Cloudy slow run finished and all are successfull\" " ); |
|---|
| 186 | } |
|---|
| 187 | } |
|---|
| 188 | |
|---|
| 189 | exit(0); |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | sub send_mail |
|---|
| 197 | { |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | |
|---|
| 201 | if( -s "$errors" ) |
|---|
| 202 | { |
|---|
| 203 | system("c:\\u\\blat\\blat.exe $errors -t gary\@pa.uky.edu -s \"Cloudy slow run dayslow$nrun had errors\" " ); |
|---|
| 204 | } |
|---|
| 205 | else |
|---|
| 206 | { |
|---|
| 207 | open( ioEMAIL , ">message.txt" ); |
|---|
| 208 | |
|---|
| 209 | printf( ioEMAIL " Cloudy slow run dayslow$nrun ran OK on PC\n"); |
|---|
| 210 | printf( ioEMAIL " no crashes or asserts\r\n" ) ; |
|---|
| 211 | close( ioEMAIL ); |
|---|
| 212 | system("c:\\u\\blat\\blat.exe message.txt -t gary\@pa.uky.edu -s \"Cloudy slow run dayslow$nrun successfull\" " ); |
|---|
| 213 | |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | if( -s "$problem_file" ) |
|---|
| 218 | { |
|---|
| 219 | system("c:\\u\\blat\\blat.exe problems.txt -t gary\@pa.uky.edu -s \"Cloudy slow run dayslow$nrun PROBLEM or DEBUG string\" " ); |
|---|
| 220 | } |
|---|
| 221 | } |
|---|
| 222 | |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | sub check_output |
|---|
| 228 | { |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | if( $lgLOGGING ) |
|---|
| 233 | { |
|---|
| 234 | printf( ioLOG "check_output entered\n"); |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | $checkend = "$out_dir"."checkend.txt"; |
|---|
| 242 | |
|---|
| 243 | if( -e $problem_file ) |
|---|
| 244 | { |
|---|
| 245 | unlink( $problem_file ); |
|---|
| 246 | } |
|---|
| 247 | if( -e $errors ) |
|---|
| 248 | { |
|---|
| 249 | unlink( $errors ); |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | |
|---|
| 253 | $nModTotal = 0; |
|---|
| 254 | while( defined( $input = glob("$in_dir*.in") ) ) |
|---|
| 255 | { |
|---|
| 256 | if( $nModTotal >= $nSkip && $nModTotal < $nmod_calc ) |
|---|
| 257 | { |
|---|
| 258 | |
|---|
| 259 | |
|---|
| 260 | $output = $input; |
|---|
| 261 | $output =~ s/$in_dir/$out_dir/gi; |
|---|
| 262 | |
|---|
| 263 | $output =~ s/\.in/.out/gi; |
|---|
| 264 | |
|---|
| 265 | system "grep -H Botch $output >>$errors"; |
|---|
| 266 | system "grep -H \"W-\" $output >> $errors"; |
|---|
| 267 | |
|---|
| 268 | system "grep -H \"ChkAssert\" $output > $checkend "; |
|---|
| 269 | |
|---|
| 270 | if(-z "$checkend") |
|---|
| 271 | { |
|---|
| 272 | system( "echo \"$output did not end or had no asserts\" >> $errors " ); |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | system( "grep -H \"PROBLEM\" $output > $problem_file" ); |
|---|
| 276 | |
|---|
| 277 | system( "grep -H \"DEBUG\" $output >> $problem_file" ); |
|---|
| 278 | } |
|---|
| 279 | ++$nModTotal; |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | |
|---|
| 283 | system "ls \"$out_dir*.skip\" > skip.txt" ; |
|---|
| 284 | |
|---|
| 285 | if( -s "skip.txt" ) |
|---|
| 286 | { |
|---|
| 287 | print STDERR "\n\n some files were skipped by renmaing to .skip - list is in skip.txt\n" ; |
|---|
| 288 | system "echo some files were skipped by renmaing to .skip - list is in skip.txt >> checkall.txt "; |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | if( $lgLOGGING ) |
|---|
| 292 | { |
|---|
| 293 | printf( ioLOG "check_output exits\n"); |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | } |
|---|