blob: e2e2e9f3fd64609a8bade9080be5133e63e567ec [file] [log] [blame]
# 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
# flimflam 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 flimflam
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
# 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