File: fmt_output.awk

package info (click to toggle)
devicexlib 0.8.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,364 kB
  • sloc: f90: 77,678; sh: 3,701; fortran: 773; makefile: 268; python: 246; ansic: 69; awk: 36
file content (46 lines) | stat: -rwxr-xr-x 876 bytes parent folder | download
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
#! /bin/awk -f

BEGIN{
  #
  # definitions about colors & styles
  #
  bold_on=""
  bold_off=""
  green_on=""
  green_off=""
  orange_on=""
  orange_off=""
  red_on=""
  red_off=""
  #
  stat_pass= green_on"passed"green_off ;
  stat_warn= orange_on"warning"orange_off ;
  stat_fail= red_on"failed"red_off ;
  #
  npass=0
  nfail=0
  completed=0
}

{
  if ( match($0,"SUMMARY") ) {completed=1; next}
  if ( match($0,"# passed") ) {npass+=$(NF)}
  if ( match($0,"# failed") ) {nfail+=$(NF)}
  if ( match($1,"#") ) {print}
}

END{
  ntot=npass+nfail
  #
  str=stat_fail
  if (ntot > 0) {
    if (nfail+0.0 < 0.15*(ntot+0.0)) {str=stat_warn}
    if (nfail==0) {str=stat_pass}
  }
  if (completed==0) {
    str=stat_fail
    printf "   # %s (crashed)\n", str
  } else {
    printf "   # %s (fails %d/%d)\n", str, nfail, ntot
  }
}