| # 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 stopped udev-addon |
| stop on starting halt or starting reboot |
| |
| script |
| modprobe i2c-dev |
| cd /usr/local/autotest |
| eval $(./site_tests/suite_Factory/startx.sh) |
| date >>/var/log/factory.log |
| if [ ! -e factory_started ]; then |
| touch factory_started |
| cp -f site_tests/suite_Factory/control . |
| OPT="" |
| else |
| OPT="-c" |
| fi |
| FACTORY_LOG_FILE=/var/log/factory.log |
| CONSOLE_LOG_FILE=/var/log/factory_console.log |
| # 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" >>"$CONSOLE_LOG_FILE" |
| end script |
| |
| pre-stop script |
| pkill python |
| pkill X |
| end script |