| # Copyright 2012 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Enables power on after power failure for DUT's in the lab" | |
| author "chromium-os-dev@chromium.org" | |
| oom score never | |
| # For test images being ran on Intel-based devices in the lab, set the | |
| # correct pci bit so that it will reboot on a power cycle. | |
| # NOTE - This job may run more than once per boot, because the .labmachine | |
| # image is missing on the first boot after the autotest try job process | |
| # completes. Therefore the autotest installation process will rerun this job a | |
| # second time on that boot. | |
| start on started failsafe | |
| script | |
| LAB_FILE="/mnt/stateful_partition/.labmachine" | |
| if [ -f "$LAB_FILE" ]; then | |
| # If this is a labmachine without a battery running on an x86 processor, | |
| # set the device to automatically reboot on a power cycle. | |
| if ! power_supply_info | grep -q Battery && | |
| uname -m | grep -q x86; then | |
| setpci -s 00:1f.0 0xA4.b=4 | |
| fi | |
| fi | |
| end script |