Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verifier/tdx: fix TdShimPlatformConfigInfo parse error comparation #538

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

Xynnn007
Copy link
Member

@Xynnn007 Xynnn007 commented Oct 18, 2024

The original unit tests use anyhow for error handling. The results are unstable because the debug format of the anyhow error might change due to different environments. This patch replace anyhow with thiserror without changing the test aim. This would give a more robust error type defination for comparation.

cc @jodh-intel @fitzthum

deps/verifier/src/tdx/claims.rs Outdated Show resolved Hide resolved
ParseDescriptor,

#[error("Failed to parse `InfoLength`")]
ParseInfoLength,
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIU, it's more like:

Suggested change
ParseInfoLength,
ReadInfoLength(#[from] io::Error),

Copy link
Member Author

Choose a reason for hiding this comment

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

std::io:Error does not support PartialEq thus we cannot use #[from] macro. This is possible as the error information is enough.

The original unit tests use anyhow for error handling. The results are
unstable because the debug format of the anyhow error might change due
to different environments. This patch replace anyhow with thiserror
without changing the test aim. This would give a more robust error type
defination for comparation.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
@Xynnn007 Xynnn007 marked this pull request as ready for review October 18, 2024 07:52
@Xynnn007 Xynnn007 requested a review from a team as a code owner October 18, 2024 07:52
Copy link
Contributor

@mythi mythi left a comment

Choose a reason for hiding this comment

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

LGTM

@Xynnn007 Xynnn007 merged commit 6d492d3 into confidential-containers:main Oct 18, 2024
13 checks passed
@Xynnn007 Xynnn007 deleted the fix-error branch October 21, 2024 14:06
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.

3 participants