blob: 2ed2b56d5f33bb3748cc09a0f94202d70c834c73 [file] [log] [blame]
# Copyright (c) 2011 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.
description "Chrome OS factory startup stub"
author "chromium-os-dev@chromium.org"
start on started system-services
stop on stopping system-services
script
SUITE_FACTORY=/usr/local/autotest/site_tests/suite_Factory
FACTORY_LOG_FILE=/var/log/factory.log
CONSOLE_LOG_FILE=/tmp/factory_console.log
modprobe i2c-dev
cd /usr/local/autotest
eval $($SUITE_FACTORY/startx.sh)
date >>$FACTORY_LOG_FILE
# Before continuing, we must make sure the control and control.state are both
# in good shape otherwise there will be only a blank screen.
OPT=""
if ! [ -e factory_started -a -e control ]; then
touch factory_started
cp -f $SUITE_FACTORY/control .
elif $SUITE_FACTORY/check_state control.state >>$FACTORY_LOG_FILE 2>&1; then
OPT="-c"
fi
# Factory log will be uploaded so we must always preserve previous results.
# Console log is just for UI to display, no need to be saved across sessions;
# however in order to support writing by multiple processes, the file must be
# opened in "append" mode. So we must first delete it then use >> to append.
rm -f "$CONSOLE_LOG_FILE"
./bin/autotest -t factory $OPT control 2>&1 |
tee -a "$FACTORY_LOG_FILE" |
grep --line-buffer "FACTORY" |
sed -u 's/^\([0-9:]*\) ERROR| FACTORY: /\1 | /' >>"$CONSOLE_LOG_FILE"
end script
pre-stop script
pkill python
pkill X
end script