1########################################################################## 2# Copyright (c) 2009, 2010, 2011, 2014, 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 socket, datetime 11import tests, siteconfig 12from common import TestCommon 13from results import PassFailResult 14 15VMKIT_TIMEOUT = datetime.timedelta(minutes=15) 16 17@tests.add_test 18class VMKitTest(TestCommon): 19 '''VMKit test''' 20 name = "vmkit" 21 22 def get_modules(self, build, machine): 23 cardName = "e1000" 24 modules = super(VMKitTest, self).get_modules(build, machine) 25 modules.add_module("serial_pc16550d", ["auto"]) 26 modules.add_module("lpc_timer", ["auto"]) 27 modules.add_module("e1000n", ["auto"]) 28 modules.add_module("net_sockets_server", ["nospawn"]) 29 30 nfsip = socket.gethostbyname(siteconfig.get('WEBSERVER_NFS_HOST')) 31 modules.add_module("vmkitmon", [cardName, 32 "nfs://" + nfsip + 33 siteconfig.get('WEBSERVER_VM_PATH')]) 34 return modules 35 36 def get_finish_string(self): 37 return "bash-4.0#" 38 39 def boot(self, *args): 40 super(VMKitTest, self).boot(*args) 41 self.set_timeout(VMKIT_TIMEOUT) 42 43 def process_data(self, testdir, rawiter): 44 # the test passed iff the last line is the finish string 45 lastline = '' 46 for line in rawiter: 47 lastline = line 48 passed = lastline.startswith(self.get_finish_string()) 49 return PassFailResult(passed) 50