Skip to content

manticore: added sanity tests for manticore driver#4320

Open
sidchintamaneni wants to merge 1 commit intomicrosoft:mainfrom
sidchintamaneni:siddharthc/manticore-tests
Open

manticore: added sanity tests for manticore driver#4320
sidchintamaneni wants to merge 1 commit intomicrosoft:mainfrom
sidchintamaneni:siddharthc/manticore-tests

Conversation

@sidchintamaneni
Copy link
Copy Markdown
Collaborator

Tested by running the following command on a VM

LISA_RPM_PATH=/path/to/manticore-hwe-*.rpm \
  lisa run -r lisa/microsoft/runbook/ready.yml \
    -v "public_address:<VM_IP>" \
    -v "user_name:azureuser" \
    -v "admin_private_key_file:/path/to/key" \
    -v tier:debug \
    -v "case:verify_azihsm.*"

@netsweng
Copy link
Copy Markdown

  1. This is very RPM specific. Admittedly, the focus is on Mariner, but we also want to be able to run the Lisa tests on Ubuntu.

  2. This test should just install packages from a well-known pkg repo like tux-dev and not require a manual step to copy something onto the system first.

  3. There are versions hardwired into this script which creates ongoing maintenance, or the test will not be running against the latest product. These versions should be determined dynamically.

  4. The tests that are implemented are good general driver tests, but we also need tests that use the azihsm test tools for deeper coverage.

@sidchintamaneni
Copy link
Copy Markdown
Collaborator Author

Agreed with all your points. This PR is created to initiate a conversation with LISA team.

  • we are relying on Manticore team to add functional tests since we are not familiar with what the driver does. Feel free to extend on top of these sanity tests or you can create a new PR and I'll close this one.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new LISA test suite that validates the manticore-hwe RPM packaging for the azihsm out-of-tree kernel module on Azure Linux (CBL-Mariner), covering install, module load/unload behavior, and uninstall cleanup.

Changes:

  • Adds a new AziHsmRpmTest suite with phased test cases (installation, modinfo/load cycles, uninstallation).
  • Adds helpers to locate the RPM on-node (env var, URL tarball download+extract, fallback globs) and parse module/kernel metadata from the RPM contents.
  • Adds optional kernel-hwe installation + reboot flow when the running kernel doesn’t match the module’s target kernel.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +316 to +322
# Unload module first if loaded (pre-uninstall safety)
node.execute(
"modprobe -r azihsm", sudo=True, no_error_log=True
)
node.execute(
f"rpm -evh {self.PKG_NAME}", sudo=True, no_error_log=True
)
Comment on lines +215 to +217
result = node.execute(
f"rpm -qp --queryformat '%{{VERSION}} %{{RELEASE}}' {rpm_path}",
sudo=True,
Comment on lines +232 to +236
result = node.execute(
f"rpm -qpl {rpm_path} | grep '\\.ko$'",
sudo=True,
shell=True,
)
Comment on lines +179 to +181
result = node.execute(
f"test -f {env_path}", sudo=True, no_error_log=True
)
Comment on lines +517 to +519
# Clear dmesg
node.execute("dmesg -c", sudo=True)

)
def verify_azihsm_rpm_installation(
self, node: Node, log: Logger
) -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a parameter variable: Dict[str, Any], and make all os environment variables be set from runbook. Then get the value in below way.

oot_source_url = variables.get("LISA_OOT_SOURCE_URL", "")


# Test 1 - RPM installs without errors
self._install_rpm(node, log, rpm_path)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add all common code into one method, then reuse it.

expected_exit_code=0,
)
pkg_full = result.stdout.strip()
log.info(f"Package in RPM DB: {pkg_full}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use rpm tool to install the package

rpm_tool = node.tools[Rpm]
rpm_tool.is_valid_package
rpm_tool.install_local_package

time.sleep(1)

# Clear dmesg
node.execute("dmesg -c", sudo=True)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use dmesg tool

@netsweng
Copy link
Copy Markdown

Note, the code I am working on for the functional tests is using the distro agnostic package_install API instead of calling rpm directly. This will make it more portable in the long run.

@sidchintamaneni
Copy link
Copy Markdown
Collaborator Author

Note, the code I am working on for the functional tests is using the distro agnostic package_install API instead of calling rpm directly. This will make it more portable in the long run.

can you cite your work here and close this PR in favor of that

@netsweng
Copy link
Copy Markdown

I will do that, but I want to incorporate the tests here into my code before I offer a replacement PR to make sure they do not get lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants