1########################################################################## 2# Copyright (c) 2009, ETH Zurich. 3# All rights reserved. 4# 5# This file is distributed under the terms in the attached LICENSE file. 6# If you do not find this file, copies can be found by writing to: 7# ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8########################################################################## 9 10import tests 11from common import TestCommon 12from results import PassFailResult 13 14@tests.add_test 15class BootTest(TestCommon): 16 '''Simple test that checks if the machine boots into grub/hagfish''' 17 name = "boottest" 18 grub_boot = "GNU GRUB version 0.97-os.3" 19 hagfish_boot = "Hagfish UEFI loader starting" 20 21 def setup(self, build, machine, testdir): 22 # Don't build BF 23 machine.lock() 24 machine.setup() 25 26 def run(self, build, machine, testdir): 27 self.reboot(machine) 28 # Ignore the boot phase 29 self.boot_phase = False 30 return self.collect_data(machine) 31 32 def cleanup(self, machine): 33 machine.shutdown() 34 machine.unlock() 35 36 def is_finished(self, line): 37 # Exit test when we get an assertion failure or an abort, rather than 38 # waiting for timeout 39 return self.grub_boot in line or \ 40 self.hagfish_boot in line or \ 41 line.startswith("Assertion failed on core") or \ 42 line.startswith("Aborted") 43 44 def process_data(self, testdir, rawiter): 45 for line in rawiter: 46 if line.find(self.grub_boot) > -1 or \ 47 line.find(self.hagfish_boot) > -1: 48 return PassFailResult(True) 49 return PassFailResult(False) 50 51