| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | if( -r "optimal.in" ) |
|---|
| 18 | { |
|---|
| 19 | unlink "optimal.in"; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | print( "\nThis script checks for problems in the output from the Cloudy test suite.\n"); |
|---|
| 23 | print( " It checks for three things in the simulations:\n"); |
|---|
| 24 | print( " 1) Botched asserts or warnings: These are serious problems.\n"); |
|---|
| 25 | print( " 2) Whether the PROBLEM or DEBUG string were printed.\n"); |
|---|
| 26 | print( " 3) Crashes, in which the code did not end - these are also serious problems.\n"); |
|---|
| 27 | |
|---|
| 28 | $nMod = 0; |
|---|
| 29 | $nOK = 0; |
|---|
| 30 | $nSkip = 0; |
|---|
| 31 | $nFail = 0; |
|---|
| 32 | $nCrash = 0; |
|---|
| 33 | $nBotch = 0; |
|---|
| 34 | $nWarn = 0; |
|---|
| 35 | |
|---|
| 36 | open( CRASHED, ">crashed.txt" ); |
|---|
| 37 | open( SERIOUS, ">serious.txt" ); |
|---|
| 38 | open( BOTCH, ">serious.asr" ); |
|---|
| 39 | open( MINOR, ">minor.txt" ); |
|---|
| 40 | open( CLOSE, ">close.txt" ); |
|---|
| 41 | open( DEBUG, ">debug.txt" ); |
|---|
| 42 | open( SKIP, ">skip.txt" ); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | while( defined( $input = glob("*.in") ) ) |
|---|
| 46 | { |
|---|
| 47 | |
|---|
| 48 | ++$nMod; |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | $output = $input; |
|---|
| 52 | $output =~ s/\.in/\.out/gi; |
|---|
| 53 | |
|---|
| 54 | if( -r $output ) |
|---|
| 55 | { |
|---|
| 56 | $checkEnd = 0; |
|---|
| 57 | $nWarnMessage = 0; |
|---|
| 58 | $lgCrash = 0; |
|---|
| 59 | $lgFailure = 0; |
|---|
| 60 | $lgBotch = 0; |
|---|
| 61 | $lgAtmosNotFound = 0; |
|---|
| 62 | open( OUTP, $output ); |
|---|
| 63 | while( <OUTP> ) |
|---|
| 64 | { |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | if( /DISASTER/ || /Botched/ || /W-/ ) |
|---|
| 68 | { |
|---|
| 69 | print SERIOUS "$output: $_"; |
|---|
| 70 | if( /W-/ ) |
|---|
| 71 | { |
|---|
| 72 | ++$nWarnMessage; |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | if( /botch/ ) |
|---|
| 76 | { |
|---|
| 77 | print BOTCH "$output: $_"; |
|---|
| 78 | $lgBotch = 1; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | if( /PROBLEM/ && ! /DISASTER/ ) |
|---|
| 83 | { |
|---|
| 84 | print MINOR "$output: $_"; |
|---|
| 85 | } |
|---|
| 86 | if( /ChkAssert ----/ ) |
|---|
| 87 | { |
|---|
| 88 | print CLOSE "$output: $_"; |
|---|
| 89 | } |
|---|
| 90 | if( /DEBUG/ || /Test code/ ) |
|---|
| 91 | { |
|---|
| 92 | print DEBUG "$output: $_"; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | if( /ChkAssert/ || /Cloudy exited OK\]/ || /something went wrong\]/ ) |
|---|
| 97 | { |
|---|
| 98 | ++$checkEnd; |
|---|
| 99 | } |
|---|
| 100 | if( /something bad has happened./ ) |
|---|
| 101 | { |
|---|
| 102 | $lgCrash = 1; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | if( /something went wrong\]/ && !$lgBotch && $nWarnMessage == 0 ) |
|---|
| 106 | { |
|---|
| 107 | $lgFailure = 1; |
|---|
| 108 | } |
|---|
| 109 | if( /Error: stellar atmosphere file not found./ ) |
|---|
| 110 | { |
|---|
| 111 | $lgAtmosNotFound = 1; |
|---|
| 112 | } |
|---|
| 113 | } |
|---|
| 114 | close( OUTP ); |
|---|
| 115 | if( $lgAtmosNotFound ) |
|---|
| 116 | { |
|---|
| 117 | ++$nSkip; |
|---|
| 118 | print SKIP "$input: stellar atmosphere file is not installed\n"; |
|---|
| 119 | } |
|---|
| 120 | elsif( $checkEnd == 0 || $lgCrash ) |
|---|
| 121 | { |
|---|
| 122 | ++$nCrash; |
|---|
| 123 | print SERIOUS "$output: crashed\n"; |
|---|
| 124 | print CRASHED "$output: crashed\n"; |
|---|
| 125 | $lgSeriousProblems = 1; |
|---|
| 126 | } |
|---|
| 127 | elsif( $lgFailure ) |
|---|
| 128 | { |
|---|
| 129 | ++$nFail; |
|---|
| 130 | print SERIOUS "$output: returned with FAILURE status\n"; |
|---|
| 131 | $lgSeriousProblems = 1; |
|---|
| 132 | } |
|---|
| 133 | elsif( $nWarnMessage > 0 ) |
|---|
| 134 | { |
|---|
| 135 | ++$nWarn; |
|---|
| 136 | } |
|---|
| 137 | elsif( $lgBotch ) |
|---|
| 138 | { |
|---|
| 139 | ++$nBotch; |
|---|
| 140 | } |
|---|
| 141 | else |
|---|
| 142 | { |
|---|
| 143 | ++$nOK; |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | else |
|---|
| 147 | { |
|---|
| 148 | ++$nSkip; |
|---|
| 149 | print SKIP "$input: no corresponding output was found\n"; |
|---|
| 150 | } |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | close( CRASHED ); |
|---|
| 154 | close( SERIOUS ); |
|---|
| 155 | close( BOTCH ); |
|---|
| 156 | close( MINOR ); |
|---|
| 157 | close( CLOSE ); |
|---|
| 158 | close( DEBUG ); |
|---|
| 159 | close( SKIP ); |
|---|
| 160 | |
|---|
| 161 | if( $nMod != $nOK+$nSkip+$nCrash+$nFail+$nWarn+$nBotch ) |
|---|
| 162 | { |
|---|
| 163 | print STDERR "\nINTERNAL ERROR: the number of sims don't add up!!!!!\n\n"; |
|---|
| 164 | } |
|---|
| 165 | |
|---|
| 166 | print( "\nLooking for crashes, botched results and warnings:"); |
|---|
| 167 | |
|---|
| 168 | if( -s "serious.txt" ) |
|---|
| 169 | { |
|---|
| 170 | print "\nWARNING! crashes, failures, botches or warnings were found. This is a serious problem.\n"; |
|---|
| 171 | if( $nCrash > 0 ) |
|---|
| 172 | { |
|---|
| 173 | print "Cloudy crashed in $nCrash sims.\n"; |
|---|
| 174 | } |
|---|
| 175 | print "Check the file serious.txt for names, serious.asr for botched asserts.\n"; |
|---|
| 176 | system "grep Cloudy < serious.txt"; |
|---|
| 177 | $lgSeriousProblems = 1; |
|---|
| 178 | } |
|---|
| 179 | else |
|---|
| 180 | { |
|---|
| 181 | print " good, none found.\n"; |
|---|
| 182 | $lgSeriousProblems = 0; |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | print( "\nLooking for PROBLEM string in the output files:"); |
|---|
| 186 | if( -s "minor.txt" ) |
|---|
| 187 | { |
|---|
| 188 | print "\nPROBLEM string was found. Check minor.txt for a list of names.\n"; |
|---|
| 189 | print "This can occur a few times and is not a serious concern.\n"; |
|---|
| 190 | $lgMinorProblems = 1; |
|---|
| 191 | } |
|---|
| 192 | else |
|---|
| 193 | { |
|---|
| 194 | print " good, none found.\n"; |
|---|
| 195 | $lgMinorProblems = 0; |
|---|
| 196 | } |
|---|
| 197 | |
|---|
| 198 | if( -s "close.txt" ) |
|---|
| 199 | { |
|---|
| 200 | print "\nSome sims are close to an assert. Check close.txt for a list of names.\n"; |
|---|
| 201 | print "This is for information only, not a problem.\n"; |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | print( "\nLooking for DEBUG string or TestCode call:"); |
|---|
| 205 | if( -s "debug.txt" ) |
|---|
| 206 | { |
|---|
| 207 | print "\nDEBUG string or TestCode calls were found. Check debug.txt for names.\n"; |
|---|
| 208 | $lgDebugPrint = 1; |
|---|
| 209 | } |
|---|
| 210 | else |
|---|
| 211 | { |
|---|
| 212 | print " good, none found.\n"; |
|---|
| 213 | $lgDebugPrint = 0; |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | print "\nLooking for skipped sims:"; |
|---|
| 218 | if( $nSkip > 0 ) |
|---|
| 219 | { |
|---|
| 220 | print " $nSkip sims were skipped - a list is in skip.txt\n" ; |
|---|
| 221 | } |
|---|
| 222 | else |
|---|
| 223 | { |
|---|
| 224 | print " good: no sims were skipped.\n"; |
|---|
| 225 | } |
|---|
| 226 | |
|---|
| 227 | printf( "\n%i sims are present", $nMod ); |
|---|
| 228 | if( $nSkip > 0 ) |
|---|
| 229 | { |
|---|
| 230 | printf( ", %i were skipped", $nSkip ); |
|---|
| 231 | } |
|---|
| 232 | if( $nCrash > 0 ) |
|---|
| 233 | { |
|---|
| 234 | printf( ", %i crashed", $nCrash ); |
|---|
| 235 | } |
|---|
| 236 | if( $nFail > 0 ) |
|---|
| 237 | { |
|---|
| 238 | printf( ", %i failed", $nFail ); |
|---|
| 239 | } |
|---|
| 240 | if( $nWarn > 0 ) |
|---|
| 241 | { |
|---|
| 242 | printf( ", %i have warnings", $nWarn ); |
|---|
| 243 | } |
|---|
| 244 | if( $nBotch > 0 ) |
|---|
| 245 | { |
|---|
| 246 | printf( ", %i botched", $nBotch ); |
|---|
| 247 | } |
|---|
| 248 | if( $nOK > 0 ) |
|---|
| 249 | { |
|---|
| 250 | printf( ", %i are OK", $nOK ); |
|---|
| 251 | } |
|---|
| 252 | print ".\n"; |
|---|
| 253 | |
|---|
| 254 | if( $lgMinorProblems ) |
|---|
| 255 | { |
|---|
| 256 | print "Minor problems were found, this is normal, list is in minor.txt\n"; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | if( $lgDebugPrint ) |
|---|
| 260 | { |
|---|
| 261 | print "DEBUG prints or TestCode calls were found, list is in debug.txt\n"; |
|---|
| 262 | } |
|---|
| 263 | |
|---|
| 264 | if( $lgSeriousProblems ) |
|---|
| 265 | { |
|---|
| 266 | print "Serious problems were found. See serious.txt for a summary\n"; |
|---|
| 267 | } |
|---|
| 268 | else |
|---|
| 269 | { |
|---|
| 270 | if( $nOK > 0 ) |
|---|
| 271 | { |
|---|
| 272 | print "The test suite was successful; you have a valid executable.\n"; |
|---|
| 273 | } |
|---|
| 274 | } |
|---|