Debian Codegraph @

commissioning/casestats.csh

raw
1 #! /bin/csh
2 #---------------------
3 #-x -- turn on this flag to make it echo everything
4 # Grep -I through the log files produced by a test run to count up
5 # passes, failures, and unique obsmode/spectrum combinations that
6 # went into each of them.
7 #
8 # First get the prefix associated with the set of tests.
9 # If none is supplied, prompt for one.
10 #.....................................................................
11 if ( "$1" == "" ) then
12 echo -n "Enter test run prefix: "
13 set idstring = $<
14 else
15 set idstring = $1
16 endif
17 #
18 #Collect stats from the full set
19 set allfiles = `find $idstring -name "*.log" `
20 set ntests = `echo $allfiles | wc -w`
21 set ncases = `find $idstring -name "*.log" | awk -F / '{print $3}' | sort -u | wc -l`
22
23 set nobstot=`grep da_obs $allfiles | awk '{print $2}' | sort -u | wc -l`
24 set nspectot=`grep da_spec $allfiles | awk '{print $2}' | sort -u | wc -l`
25 echo Test statistics for "$idstring*.log":
26 echo $ncases test cases
27 echo $ntests total tests
28 echo $nobstot unique obsmodes
29 echo $nspectot unique spectra
30 echo ================================================
31 #
32 chdir $idstring
33 # Work with one type of test at a time
34 foreach tname (`ls`)
35 chdir $tname
36 #.....**Warning, not robust against other junk in directory
37 # Count the total number of tests
38 set ntests = `ls -1 *.log | wc -l`
39 echo $tname : $ntests total tests
40 # Count the errors
41 set nerr = ` grep -l Status=E *.log | wc -l`
42 echo Error cases: $nerr
43 # Count the number that failed
44 set ffiles=`grep -l Status=F *.log`
45 set nfailed = `grep -i -l Status=F *.log | wc -l`
46 echo Failed cases: $nfailed
47 if ($nfailed > 0) then
48 set nobs = `grep -i da_obsmode $ffiles | awk '{print $2}' | sort -u | wc -l`
49 set nspec = `grep -i da_spectrum $ffiles | awk '{print $2}' | sort -u | wc -l`
50 else
51 set nobs = 0
52 set nspec = 0
53 endif
54
55 # Count the number of extreme failures
56 set efiles=`grep -l ra_extreme *.log`
57 set nextreme = `grep -i -l ra_extreme *.log | wc -l`
58 echo Extreme failures: $nextreme
59 if ($nextreme > 0) then
60 set nobs_e = `grep -i da_obsmode $efiles | awk '{print $2}' | sort -u | wc -l`
61 set nspec_e = `grep -i da_spectrum $efiles | awk '{print $2}' | sort -u | wc -l`
62 else
63 set nobs_e = 0
64 set nspec_e = 0
65 endif
66
67 echo Unique obsmodes: $nobs_e extreme / $nobs all failures / $nobstot total
68
69 echo -n Unique spectra : $nspec_e extreme / $nspec all failures / $nspectot total
70
71 echo
72 echo -------------------------------------------------------
73 echo
74 #Go back up
75
76 chdir ..
77
78 end
79 chdir ..