Commit d53e452c authored by Neil Williams's avatar Neil Williams 💬 Committed by Matt Hart

Fix login support for second UART

Ensure that the connection-namespace parameters are available
when booting the second UART and mark this as a login which
does not expect to see kernel boot messages.
Allow transfer_overlay to be used on the primary UART.

Change-Id: Ie35f2d699689b72c015ea476a6a3fa4c7818a32f
parent 6b96c961
......@@ -153,6 +153,7 @@ class AutoLoginAction(Action):
)
self.force_prompt = False
self.params = None
self.booting = True # if a boot is expected, False for second UART or ssh.
def validate(self): # pylint: disable=too-many-branches
super(AutoLoginAction, self).validate()
......@@ -197,6 +198,17 @@ class AutoLoginAction(Action):
for prompt in prompts:
if not prompt:
self.errors = "Items of 'prompts' can't be empty"
if self.job: # unit test protection
methods = self.job.device['actions']['boot']['methods']
if self.method not in methods:
# second uart
self.booting = False
elif not methods[self.method]:
# secondary connections
self.booting = False
elif 'parameters' in methods[self.method]:
# fastboot devices usually lack method parameters
self.params = methods[self.method]['parameters']
def check_kernel_messages(self, connection, max_end_time):
"""
......@@ -226,24 +238,22 @@ class AutoLoginAction(Action):
def run(self, connection, max_end_time, args=None):
# Prompts commonly include # - when logging such strings,
# use lazy logging or the string will not be quoted correctly.
if self.job.device['actions']['boot']['methods'][self.method]:
if 'parameters' in self.job.device['actions']['boot']['methods'][self.method]:
self.params = self.job.device['actions']['boot']['methods'][self.method]['parameters']
kernel_start_message = self.parameters.get(
'parameters', {}).get(
'kernel-start-message', self.job.device.get_constant('kernel-start-message'))
if kernel_start_message:
connection.prompt_str = [kernel_start_message]
if self.params and self.params.get('boot_message', None):
self.logger.warning("boot_message is being deprecated in favour of kernel-start-message in constants")
connection.prompt_str = [self.params.get('boot_message')]
error_messages = self.job.device.get_constant('error-messages', prefix=self.method, missing_ok=True)
if error_messages:
connection.prompt_str = connection.prompt_str + error_messages
res = self.wait(connection)
if res != 0:
raise InfrastructureError('matched a bootloader error message')
if self.booting:
kernel_start_message = self.parameters.get(
'parameters', {}).get(
'kernel-start-message', self.job.device.get_constant('kernel-start-message'))
if kernel_start_message:
connection.prompt_str = [kernel_start_message]
if self.params and self.params.get('boot_message', None):
self.logger.warning("boot_message is being deprecated in favour of kernel-start-message in constants")
connection.prompt_str = [self.params.get('boot_message')]
error_messages = self.job.device.get_constant('error-messages', prefix=self.method, missing_ok=True)
if error_messages:
connection.prompt_str = connection.prompt_str + error_messages
res = self.wait(connection)
if res != 0:
raise InfrastructureError('matched a bootloader error message')
def check_prompt_characters(chk_prompt):
if not any([True for c in DISTINCTIVE_PROMPT_CHARACTERS if c in chk_prompt]):
......
......@@ -149,10 +149,13 @@ class JobParser(object):
test_parameters = test_action['test']
test_type = LavaTest.select(device, test_parameters)
namespace = test_parameters.get('namespace', 'common')
connection_namespace = test_parameters.get('connection-namespace', namespace)
if namespace in test_info:
test_info[namespace].append({'class': test_type, 'parameters': test_parameters})
else:
test_info.update({namespace: [{'class': test_type, 'parameters': test_parameters}]})
if namespace != connection_namespace:
test_info.update({connection_namespace: [{'class': test_type, 'parameters': test_parameters}]})
# FIXME: also read permissable overrides from device config and set from job data
# FIXME: ensure that a timeout for deployment 0 does not get set as the timeout for deployment 1 if 1 is default
......
......@@ -94,6 +94,8 @@
pipeline:
- {class: connections.serial.ConnectShell, name: connect-shell}
- {class: actions.boot.AutoLoginAction, name: auto-login-action}
- {class: shell.ExpectShellSession, name: expect-shell-connection}
- {class: actions.boot.environment.ExportDeviceEnvironment, name: export-device-env}
- class: actions.test.shell.TestShellRetry
name: lava-test-retry
pipeline:
......
......@@ -77,6 +77,9 @@ actions:
timeout:
minutes: 5
method: uefi-menu
transfer_overlay:
download_command: cd /tmp ; wget
unpack_command: tar --warning=no-timestamp -C / -xvzf
commands: fastboot
protocols:
lava-lxc:
......
......@@ -233,6 +233,8 @@ class TestConnection(StdoutTestCase): # pylint: disable=too-many-public-methods
self.assertFalse(ssh.primary)
self.assertIsNotNone(scp.scp)
self.assertFalse(scp.primary)
autologin = [action for action in login.internal_pipeline.actions if action.name == 'auto-login-action'][0]
self.assertIsNone(autologin.params)
self.assertIn('host_key', login.parameters['parameters'])
self.assertIn('hostID', login.parameters['parameters'])
self.assertIn( # ipv4
......
......@@ -317,6 +317,14 @@ class TestGrubAction(StdoutTestCase): # pylint: disable=too-many-public-methods
self.assertNotEqual(shell.parameters['namespace'], 'isolation')
self.assertEqual(shell.parameters['namespace'], 'tlxc')
self.assertNotIn('connection-namespace', shell.parameters.keys())
menu = [action for action in job.pipeline.actions if action.name == 'uefi-menu-action'][0]
autologin = [action for action in menu.internal_pipeline.actions if action.name == 'auto-login-action'][0]
self.assertIsNotNone(autologin.params)
self.assertIn('test_info', autologin.parameters)
self.assertIn('isolation', autologin.parameters['test_info'])
self.assertIn('hikey-oe', autologin.parameters['test_info'])
self.assertIn('tlxc', autologin.parameters['test_info'])
self.assertEqual(['login:'], autologin.parameters.get('prompts', None))
def test_hikey960_grub(self):
job = self.factory.create_hikey960_job('sample_jobs/hikey960-oe.yaml')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment