26
26
from lava_dispatcher.actions import BaseAction
27
27
from lava_dispatcher.client.base import OperationFailed, CriticalError
28
from lava_dispatcher.utils import generete_bundle_file_name
30
31
def _install_lava_test(client, session):
32
33
session.run('apt-get update')
33
34
#Install necessary packages for build lava-test
34
35
cmd = ('apt-get -y --force-yes install '
35
'bzr usbutils python-apt python-setuptools python-simplejson lsb-release')
36
'bzr usbutils python-apt python-setuptools '
37
'python-simplejson lsb-release')
36
38
session.run(cmd, timeout=2400)
37
39
session.run("apt-get -y --force-yes install python-pip")
59
62
'additionalProperties': False,
62
def test_name(self, test_name, test_options = "", timeout=-1):
65
def test_name(self, test_name, test_options="", timeout=-1):
63
66
return super(cmd_lava_test_run, self).test_name() + ' (%s)' % test_name
65
def run(self, test_name, test_options = "", timeout=-1):
68
def run(self, test_name, test_options="", timeout=-1):
66
69
logging.info("Executing lava_test_run %s command" % test_name)
67
70
with self.client.tester_session() as session:
68
71
session.run('mkdir -p %s' % self.context.lava_result_dir)
69
72
session.export_display()
70
bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
73
bundle_name = generete_bundle_file_name(test_name)
72
74
if test_options != "":
73
75
test_options = "-t '%s'" % test_options
75
77
cmd = ('lava-test run %s %s -o %s/%s.bundle' % (
76
test_name, test_options, self.context.lava_result_dir, bundle_name))
78
test_name, test_options, self.context.lava_result_dir,
78
81
rc = session.run(cmd, timeout=timeout)
90
93
raise OperationFailed("test case getting return value failed")
92
raise OperationFailed("test case failed with return value: %s" % rc)
95
raise OperationFailed(
96
"test case failed with return value: %s" % rc)
94
99
class cmd_lava_test_install(BaseAction):
111
116
'additionalProperties': False,
114
def run(self, tests, install_python = None, register = None, timeout=2400):
115
logging.info("Executing lava_test_install (%s) command" % ",".join(tests))
119
def run(self, tests, install_python=None, register=None, timeout=2400):
121
"Executing lava_test_install (%s) command" % ",".join(tests))
117
123
with self.client.reliable_session() as session:
136
142
class cmd_add_apt_repository(BaseAction):
138
144
add apt repository to test image rootfs by chroot
139
arg could be 'deb uri distribution [component1] [component2][...]' or ppa:<ppa_name>
145
arg could be 'deb uri distribution [component1] [component2][...]'
142
149
parameters_schema = {