Home | History | Annotate | Download | only in contrib
      1 #!/bin/bash
      2 
      3 # Force a verify job for any host that hasn't seen activity in
      4 # the past day.
      5 #
      6 # Various scripts/cron jobs look for DUTs that aren't working.  To
      7 # be conservative, those scripts assume that a DUT that hasn't run
      8 # any jobs within a reasonable time interval isn't working, since
      9 # some of the ways a DUT may be unavailable manifest as inactivity.
     10 #
     11 # In some cases, we'd like to be more certain as to a DUT's status.
     12 # This script goes through the entire AFE hosts table, and
     13 # identifies unlocked hosts that would otherwise be flagged as "not
     14 # working due to lack of activity", and forces a Verify job.
     15 #
     16 # Locked hosts are skipped because they can't run jobs, and because
     17 # we want them to show up as suspicious anyway.
     18 
     19 
     20 cd $(dirname $0)/..
     21 
     22 # Gather all the hosts under supervision of the SKC fire team.
     23 # Basically, that's any host in the suites, bvt, cq, or pfq pool.
     24 
     25 GET_HOSTS='
     26   /pool:(suites|bvt|cq|continuous)/ {
     27     print $1
     28   }
     29 '
     30 HOSTS=( $(cli/atest host list --unlocked | awk "$GET_HOSTS") )
     31 
     32 
     33 # Go through the gathered hosts, and use dut_status to find the
     34 # ones with unknown state (anything without a positive "OK" or
     35 # "NO" diagnosis).
     36 
     37 NEED_VERIFY='
     38   /OK/ || /NO/ { next }
     39   /^chromeos/ {
     40     print $1
     41   }
     42 '
     43 VERIFY=( $(site_utils/dut_status.py -d 19 "${HOSTS[@]}" | awk "$NEED_VERIFY") )
     44 
     45 # Reverify the unknown hosts.
     46 contrib/reverify_hosts "${VERIFY[@]}"
     47