1##########################################################################
2# Copyright (c) 2011, 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##########################################################################
9import datetime
10import re
11import tests
12from common import TestCommon
13from results import PassFailResult
14
15#IRQTEST_TIMEOUT = datetime.timedelta(minutes=5)
16
17class IRQTestCommon(TestCommon):
18    '''PCI IRQ test'''
19
20    def get_modules(self, build, machine):
21        modules = super(IRQTestCommon, self).get_modules(build, machine)
22        # This makes kaluga start the irqtest binary for e1000 cards
23        modules.add_module("e1000n_irqtest", ["auto"])
24        return modules
25
26    def get_finish_string(self):
27        return "TEST "
28
29    def process_data(self, testdir, rawiter):
30        for line in rawiter:
31            if line.startswith("TEST SUCCESS"):
32                return PassFailResult(True)
33        return PassFailResult(False)
34
35@tests.add_test
36class IRQTestLegacy(IRQTestCommon):
37    '''PCI Legacy IRQ test'''
38    name = "irqtestlegacy"
39
40    def get_modules(self, build, machine):
41        modules = super(IRQTestLegacy, self).get_modules(build, machine)
42        # This makes kaluga start the irqtest binary for e1000 cards
43        modules.add_module_arg("kaluga","add_device_db=device_db_irqtest_legacy")
44        return modules
45
46    def get_finish_string(self):
47        return "TEST "
48
49    def process_data(self, testdir, rawiter):
50        for line in rawiter:
51            if line.startswith("TEST SUCCESS"):
52                return PassFailResult(True)
53        return PassFailResult(False)
54
55@tests.add_test
56class IRQTestMSIX(IRQTestCommon):
57    '''PCI MSIX IRQ test'''
58    name = "irqtestmsix"
59
60    def get_modules(self, build, machine):
61        modules = super(IRQTestMSIX, self).get_modules(build, machine)
62        # This makes kaluga start the irqtest binary for e1000 cards
63        modules.add_module_arg("kaluga","add_device_db=device_db_irqtest_msix")
64        return modules
65