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

tests fail on 32-bit with _FILE_BITS=64 #2786

Open
mwhudson opened this issue Mar 8, 2024 · 0 comments
Open

tests fail on 32-bit with _FILE_BITS=64 #2786

mwhudson opened this issue Mar 8, 2024 · 0 comments

Comments

@mwhudson
Copy link

mwhudson commented Mar 8, 2024

When _FILE_BITS is set to 64, symbols like open get redirected (by glibc headers) to symbols like open64 and that means the interception/wrapping of those symbols done in the tests fail and so you get failures like this:

FAIL: test/unit/tcti-libtpms
============================

[==========] tests: Running 16 test(s).
[ RUN      ] tcti_libtpms_init_all_null_test
[       OK ] tcti_libtpms_init_all_null_test
[ RUN      ] tcti_libtpms_init_dlopen_fail_test
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:581:tcti_libtpms_dl() Could not load libtpms library: (null) 
[       OK ] tcti_libtpms_init_dlopen_fail_test
[ RUN      ] tcti_libtpms_init_dlsym_fail_test
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:587:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_ChooseTPMVersion(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:593:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_RegisterCallbacks(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:599:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_GetState(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:605:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_MainInit(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:611:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_Process(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:617:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_SetState(): (null) 
ERROR:tcti:src/tss2-tcti/tcti-libtpms.c:623:tcti_libtpms_dl() Could not resolve libtpms symbol TPMLIB_Terminate(): (null) 
[       OK ] tcti_libtpms_init_dlsym_fail_test
[ RUN      ] tcti_libtpms_init_state_open_fail_test
[  ERROR   ] --- No entries for symbol __wrap_close.
test/unit/tcti-libtpms.c:285: error: Could not get value to mock function __wrap_close
test/unit/tcti-libtpms.c:425: note: Previously returned mock value was declared here

[  FAILED  ] tcti_libtpms_init_state_open_fail_test
[ RUN      ] tcti_libtpms_init_state_lseek_fail_test
[  ERROR   ] --- 0x4 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:501: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!
[  FAILED  ] tcti_libtpms_init_state_lseek_fail_test
[ RUN      ] tcti_libtpms_init_state_posix_fallocate_fail_test
[  ERROR   ] --- 0x5 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:578: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!
[  FAILED  ] tcti_libtpms_init_state_posix_fallocate_fail_test
[ RUN      ] tcti_libtpms_init_state_mmap_fail_test
[  ERROR   ] --- 0x6 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:664: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!
[  FAILED  ] tcti_libtpms_init_state_mmap_fail_test
[ RUN      ] tcti_libtpms_no_statefile_success_test
tcti_libtpms_setup_no_statefile: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
tcti_libtpms_init_from_conf: after second init
tcti_libtpms_setup_no_statefile: done
[       OK ] tcti_libtpms_no_statefile_success_test
[ RUN      ] tcti_libtpms_receive_success_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0x7 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_receive_success_test
[ RUN      ] tcti_libtpms_locality_success_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0x8 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_locality_success_test
[ RUN      ] tcti_libtpms_transmit_success_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0x9 != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_transmit_success_test
[ RUN      ] tcti_libtpms_remap_state_success_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0xa != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_remap_state_success_test
[ RUN      ] tcti_libtpms_remap_state_mremap_fail_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0xb != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_remap_state_mremap_fail_test
[ RUN      ] tcti_libtpms_remap_state_posix_fallocate_fail_test
tcti_libtpms_setup: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf: before first init
tcti_libtpms_init_from_conf: before second_init
Could not run test: 0xc != 0xaabb
test/unit/tcti-libtpms.c:287: error: Check of parameter fd, function __wrap_close failed
test/unit/tcti-libtpms.c:759: note: Expected parameter declared here
[   LINE   ] --- test/unit/tcti-libtpms.c:287: error: Failure!Test setup failed
[  ERROR   ] tcti_libtpms_remap_state_posix_fallocate_fail_test
[ RUN      ] tcti_libtpms_two_states_no_statefiles_success_test
tcti_libtpms_setup_two_states_no_statefiles: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf_real: before first init
tcti_libtpms_init_from_conf_real: before second_init
tcti_libtpms_init_from_conf_real: after second init
tcti_libtpms_init_from_conf_real: before first init
tcti_libtpms_init_from_conf_real: before second_init
tcti_libtpms_init_from_conf_real: after second init
tcti_libtpms_setup_two_states_no_statefiles: done
WARNING:test:test/unit/tcti-libtpms.c:1599:tcti_libtpms_teardown_two_states() Failed to delete statefile statefile0.bin: No such file or directory 
WARNING:test:test/unit/tcti-libtpms.c:1604:tcti_libtpms_teardown_two_states() Failed to delete statefile statefile1.bin: No such file or directory 
[       OK ] tcti_libtpms_two_states_no_statefiles_success_test
[ RUN      ] tcti_libtpms_two_states_success_test
tcti_libtpms_setup_two_states: before tcti_libtpms_init_from_conf
tcti_libtpms_init_from_conf_real: before first init
tcti_libtpms_init_from_conf_real: before second_init
tcti_libtpms_init_from_conf_real: after second init
tcti_libtpms_init_from_conf_real: before first init
tcti_libtpms_init_from_conf_real: before second_init
tcti_libtpms_init_from_conf_real: after second init
tcti_libtpms_setup_two_states: done
Could not run test: %s() has remaining non-returned values.
: __wrap_lseektest/unit/tcti-libtpms.c:861: note: remaining item was declared here
test/unit/tcti-libtpms.c:861: note: remaining item was declared here
%s() has remaining non-returned values.
: __wrap_posix_fallocatetest/unit/tcti-libtpms.c:862: note: remaining item was declared here
test/unit/tcti-libtpms.c:862: note: remaining item was declared here
%s() has remaining non-returned values.
: __wrap_mmaptest/unit/tcti-libtpms.c:863: note: remaining item was declared here
test/unit/tcti-libtpms.c:863: note: remaining item was declared here
__wrap_open: '%s' parameter still has values that haven't been checked.
: pathnametest/unit/tcti-libtpms.c:856: note: remaining item was declared here
test/unit/tcti-libtpms.c:856: note: remaining item was declared here
'%s' parameter still has values that haven't been checked.
: flagstest/unit/tcti-libtpms.c:857: note: remaining item was declared here
test/unit/tcti-libtpms.c:857: note: remaining item was declared here
'%s' parameter still has values that haven't been checked.
: modetest/unit/tcti-libtpms.c:858: note: remaining item was declared here
test/unit/tcti-libtpms.c:858: note: remaining item was declared here
Test setup failed
[  ERROR   ] tcti_libtpms_two_states_success_test
[==========] tests: 16 test(s) run.
[  PASSED  ] 5 test(s).
[  FAILED  ] tests: 4 test(s), listed below:
[  FAILED  ] tcti_libtpms_init_state_open_fail_test
[  FAILED  ] tcti_libtpms_init_state_lseek_fail_test
[  FAILED  ] tcti_libtpms_init_state_posix_fallocate_fail_test
[  FAILED  ] tcti_libtpms_init_state_mmap_fail_test

 11 FAILED TEST(S)
FAIL test/unit/tcti-libtpms (exit status: 11)

(excerpted from https://launchpadlibrarian.net/717964109/buildlog_ubuntu-noble-armhf.tpm2-tss_4.0.1-7.1ubuntu2_BUILDING.txt.gz)

Fixing this properly is probably quite annoying (it requires something like all this nonsense https://lore.kernel.org/all/[email protected]/).

JuergenReppSIT added a commit to JuergenReppSIT/tpm2-tss that referenced this issue Mar 18, 2024
Tests file the unit tests are compiled with _FILE_BITS is set to 64.
The tests work without problems if _FILE_BITS is not set.
Addresses: tpm2-software#2786

Signed-off-by: Juergen Repp <[email protected]>
JuergenReppSIT added a commit to JuergenReppSIT/tpm2-tss that referenced this issue Mar 20, 2024
Tests file the unit tests are compiled with _FILE_BITS is set to 64.
The tests work without problems if _FILE_BITS is not set.
Addresses: tpm2-software#2786

Signed-off-by: Juergen Repp <[email protected]>
JuergenReppSIT added a commit to JuergenReppSIT/tpm2-tss that referenced this issue Mar 20, 2024
Tests file the unit tests are compiled with _FILE_BITS is set to 64.
The tests work without problems if _FILE_BITS is not set.
Addresses: tpm2-software#2786

Signed-off-by: Juergen Repp <[email protected]>
AndreasFuchsTPM pushed a commit that referenced this issue Mar 21, 2024
Tests file the unit tests are compiled with _FILE_BITS is set to 64.
The tests work without problems if _FILE_BITS is not set.
Addresses: #2786

Signed-off-by: Juergen Repp <[email protected]>
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

No branches or pull requests

1 participant