Skip to content

Commit

Permalink
Merge pull request #480 from yoguo/master
Browse files Browse the repository at this point in the history
Modify test_boot_fipsenabled case to be compatible with image mode
  • Loading branch information
yoguo authored Nov 25, 2024
2 parents f6aabd9 + f625c8b commit 353e429
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions os_tests/tests/test_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ def test_boot_fipsenabled(self):
expect_kw='enabled')
utils_lib.run_cmd(self, 'cat /proc/cmdline', expect_kw='fips=1')
utils_lib.run_cmd(self, 'sudo dmesg', msg='save dmesg')

cmd = 'sudo fips-mode-setup --disable'
if 'OSTree' in out:
cmd = cmd + ' --no-bootcfg'
utils_lib.run_cmd(self, cmd, msg='Disable fips!')
else:
# RHEL-65652 Remove fips-mode-setup, below steps are only for test purpose
Expand Down Expand Up @@ -1688,16 +1691,23 @@ def test_kdump_over_nfs(self):
def tearDown(self):
utils_lib.finish_case(self)
reboot_require = False
addon_args = ["hpet_mmap=1", "mitigations=auto,nosmt", "usbcore.quirks=quirks=0781:5580:bk,0a5c:5834:gij",
"nr_cpus=1","nr_cpus=2", "nr_cpus=4", "nr_cpus=5", "intel_iommu=on", "fips=1","mem_encrypt=on","boot"]
cmdline = utils_lib.run_cmd(self, 'cat /proc/cmdline')
if cmdline:
for arg in addon_args:
if arg in cmdline:
cmd = 'sudo grubby --update-kernel=ALL --remove-args={}'.format(arg)
utils_lib.run_cmd(self, cmd, msg='Remove {}'.format(arg))
reboot_require = True

if 'ostree' in cmdline:
addon_args = ['fips=1']
else:
addon_args = ['hpet_mmap=1', 'mitigations=auto,nosmt', 'usbcore.quirks=quirks=0781:5580:bk,0a5c:5834:gij',
'nr_cpus=1', 'nr_cpus=2', 'nr_cpus=4', 'nr_cpus=5', 'intel_iommu=on', 'fips=1', 'mem_encrypt=on', 'boot']

args_to_remove = [arg for arg in addon_args if arg in cmdline]
if args_to_remove:
if 'ostree' in cmdline:
cmd = 'sudo rpm-ostree kargs --delete={}'
else:
cmd = 'sudo grubby --update-kernel=ALL --remove-args={}'
for arg in args_to_remove:
utils_lib.run_cmd(self, cmd.format(arg), msg='Remove {}'.format(arg))
reboot_require = True

if "boot_debugkernel" in self.id():
current_boot_kernel = utils_lib.run_cmd(self, "sudo grubby --default-kernel", expect_ret=0)
current_cmdline = utils_lib.run_cmd(self, 'cat /proc/cmdline')
Expand Down

0 comments on commit 353e429

Please sign in to comment.