Skip to content

Commit c7ef98b

Browse files
dianpopaalindima
authored andcommitted
tests: exercise behavior with kernel init params
Signed-off-by: Diana Popa <[email protected]>
1 parent aefc93e commit c7ef98b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Test kernel commandline behavior."""
5+
6+
from framework.microvm import Serial
7+
8+
9+
def test_init_params(test_microvm_with_api):
10+
"""Correct propagation of boot args to the kernel's command line.
11+
12+
Test that init's parameters (the ones present after "--") do not get
13+
altered or misplaced.
14+
15+
@type: functional
16+
"""
17+
vm = test_microvm_with_api
18+
vm.jailer.daemonize = False
19+
vm.spawn()
20+
vm.memory_monitor = None
21+
22+
# We will override the init with /bin/cat so that we try to read the
23+
# Ubuntu version from the /etc/issue file.
24+
vm.basic_config(
25+
vcpu_count=1,
26+
boot_args='console=ttyS0 reboot=k panic=1 pci=off'
27+
' init=/bin/cat -- /etc/issue',
28+
)
29+
30+
vm.start()
31+
serial = Serial(vm)
32+
serial.open()
33+
# If the string does not show up, the test will fail.
34+
serial.rx(token='Ubuntu 18.04 LTS')

0 commit comments

Comments
 (0)