aboutsummaryrefslogtreecommitdiff
path: root/lava_dispatcher/actions/test/__init__.py
blob: da14241d2ecf5fd6179f8b94be02ce5e750e0591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (C) 2014 Linaro Limited
#
# Author: Neil Williams <neil.williams@linaro.org>
#
# This file is part of LAVA Dispatcher.
#
# LAVA Dispatcher is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LAVA Dispatcher is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along
# with this program; if not, see <http://www.gnu.org/licenses>.

from lava_dispatcher.action import (
    Action,
    JobError,
)
from lava_dispatcher.logical import (
    LavaTest,
    RetryAction,
)


def handle_testcase(params):

    # FIXME: move to utils
    data = {}
    for param in params:
        parts = param.split('=')
        if len(parts) == 2:
            key, value = parts
            key = key.lower()
            data[key] = value
        else:
            raise JobError(
                "Ignoring malformed parameter for signal: \"%s\". " % param)
    return data


class TestAction(Action):
    """
    Base class for all actions which run lava test
    cases on a device under test.
    The subclass selected to do the work will be the
    subclass returning True in the accepts(device, image)
    function.
    Each new subclass needs a unit test to ensure it is
    reliably selected for the correct deployment and not
    selected for an invalid deployment or a deployment
    accepted by a different subclass.
    """

    name = 'test'