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

the vendor_cmds requester unit_test has some error #2780

Closed
Wenxing-hou opened this issue Jul 26, 2024 · 4 comments · Fixed by #2822
Closed

the vendor_cmds requester unit_test has some error #2780

Wenxing-hou opened this issue Jul 26, 2024 · 4 comments · Fixed by #2822
Assignees
Labels
test For tests and testing infrastructure

Comments

@Wenxing-hou
Copy link
Contributor

When any requester unit_test is called after the vendor_cmds requester unit_test, the GCC release build failed.

There is a example PR:
Wenxing-hou#17

@steven-bellock steven-bellock added the test For tests and testing infrastructure label Jul 29, 2024
@steven-bellock
Copy link
Contributor

Removing -flto from compilation will let this pass. Seems to be a compiler bug. Tested on

gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0

@steven-bellock
Copy link
Contributor

Also reproduces in

gcc-14 (Ubuntu 14-20240412-0ubuntu1) 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f]

@steven-bellock steven-bellock self-assigned this Aug 16, 2024
@steven-bellock
Copy link
Contributor

This is "fixed" by moving

libspdm_test_context_t m_libspdm_requester_vendor_cmds_test_context = {
LIBSPDM_TEST_CONTEXT_VERSION,
true,
libspdm_requester_vendor_cmds_test_send_message,
libspdm_requester_vendor_cmds_test_receive_message,
};
and
libspdm_test_context_t m_libspdm_requester_vendor_cmds_err_test_context = {
LIBSPDM_TEST_CONTEXT_VERSION,
true,
libspdm_requester_vendor_cmds_err_test_send_message,
libspdm_requester_vendor_cmds_err_test_receive_message,
};
inside their respective _main functions. This should be done anyways since those values are not needed at file scope and definitely do not need external linkage.

@steven-bellock
Copy link
Contributor

status = libspdm_transport_test_decode_message(
spdm_test_context, &session_id, &is_app_message, true,
status = libspdm_transport_test_decode_message(
spdm_test_context, &session_id, &is_app_message, true,

Also use of spdm_test_context is incorrect. It should be spdm_context. I'm surprised the call to the function is successful, but that's C for you. This issue was found by Rani at NVIDIA using his formal verification tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test For tests and testing infrastructure
Projects
None yet
2 participants