summaryrefslogtreecommitdiff
path: root/tests/rbtest.conf
blob: 6fd30bab64931b856e0d002f459fa286848d12f6 (plain)
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
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Rollback code exhaustive test.
#
# INSTRUCTIONS.  Put this file in /etc/init.  Move /etc/init/tcsd.conf to
# /etc/init/tcsd.confxxx to disable it.  Then boot with the device connected by
# wired ethernet.  The test will start and reboot the host after every cycle.
# Unplug the ethernet cable to stop testing.  If left alone, the test will stop
# at the first failure or when all the states have been tested.
#
# Reminder: rollback_index_test only works with TPM-agnostic firmware.

# Connecting to tcsd requires that "localhost" be reachable, so we wait for
# shill to start, but that's not enough, and in the while loop below we also
# wait for pinging to localhost to succeed.

start on started shill

script
  cable=""
  while [ "$cable" != "yes" ]; do
    cable=$(/usr/sbin/ethtool eth0 | grep Link | cut -f 3 -d ' ')
    logger "rbtest: cable is $cable"
    ping -c 1 localhost || cable=""
    sleep 2
  done
  # ideally we would like to issue a "stop tcsd", but this doesn't work
  # (upstart race?) so we must manually disable tcsd.conf
  ### stop tcsd
  logger "starting rbtest"
  /usr/bin/rollback_index_test > /tmp/rbtest.out 2>&1
end script