blob: 6fd30bab64931b856e0d002f459fa286848d12f6 [file] [log] [blame]
Luigi Semenzato416f6812010-07-08 12:12:12 -07001# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Rollback code exhaustive test.
6#
7# INSTRUCTIONS. Put this file in /etc/init. Move /etc/init/tcsd.conf to
8# /etc/init/tcsd.confxxx to disable it. Then boot with the device connected by
9# wired ethernet. The test will start and reboot the host after every cycle.
10# Unplug the ethernet cable to stop testing. If left alone, the test will stop
11# at the first failure or when all the states have been tested.
12#
13# Reminder: rollback_index_test only works with TPM-agnostic firmware.
14
15# Connecting to tcsd requires that "localhost" be reachable, so we wait for
Paul Stewart0c69afc2012-10-31 08:47:43 -070016# shill to start, but that's not enough, and in the while loop below we also
Luigi Semenzato416f6812010-07-08 12:12:12 -070017# wait for pinging to localhost to succeed.
18
Paul Stewart0c69afc2012-10-31 08:47:43 -070019start on started shill
Luigi Semenzato416f6812010-07-08 12:12:12 -070020
21script
22 cable=""
23 while [ "$cable" != "yes" ]; do
24 cable=$(/usr/sbin/ethtool eth0 | grep Link | cut -f 3 -d ' ')
25 logger "rbtest: cable is $cable"
26 ping -c 1 localhost || cable=""
27 sleep 2
28 done
29 # ideally we would like to issue a "stop tcsd", but this doesn't work
30 # (upstart race?) so we must manually disable tcsd.conf
31 ### stop tcsd
32 logger "starting rbtest"
33 /usr/bin/rollback_index_test > /tmp/rbtest.out 2>&1
34end script