From 932b1e78047ed0ddc09fcb06bff2e7cf96406976 Mon Sep 17 00:00:00 2001 From: Juergen Repp Date: Sun, 17 Mar 2024 10:43:19 +0100 Subject: [PATCH] unit tests: skip tests which fail on 32-bit with _FILE_BITS=64 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 --- MAINTAINERS.md | 2 +- test/unit/fapi-io.c | 7 +++++++ test/unit/tcti-device.c | 11 +++++++++++ test/unit/tcti-libtpms.c | 8 ++++++++ test/unit/tcti-pcap.c | 11 +++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 6c49c20f4..771b86f0c 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,5 +1,5 @@ |email|PGP Fingerprint| | ------------- | ------------- | -| Andreas Fuchs | [D533275B0123D0A679F51FF48F4F9A45D7FFEE74](htps://keys.openpgp.org/vks/v1/by-fingerprint/D533275B0123D0A679F51FF48F4F9A45D7FFEE74)| +| Andreas Fuchs | [D533275B0123D0A679F51FF48F4F9A45D7FFEE74](https://keys.openpgp.org/vks/v1/by-fingerprint/D533275B0123D0A679F51FF48F4F9A45D7FFEE74)| | Bill Roberts | [5b482b8e3e19da7c978e1d016de2e9078e1f50c1](https://keys.openpgp.org/vks/v1/by-fingerprint/5B482B8E3E19DA7C978E1D016DE2E9078E1F50C1)| | Juergen Repp | [7A8F470DA9C8B2CACED1DBAAF1B152D9441A2563](https://keys.openpgp.org/vks/v1/by-fingerprint/7A8F470DA9C8B2CACED1DBAAF1B152D9441A2563)| diff --git a/test/unit/fapi-io.c b/test/unit/fapi-io.c index 8a883a43d..846637669 100644 --- a/test/unit/fapi-io.c +++ b/test/unit/fapi-io.c @@ -28,6 +28,7 @@ #define LOGMODULE tests #include "util/log.h" +#define EXIT_SKIP 77 /* * The unit tests will simulate error codes which can be returned by the * system calls for file system IO. @@ -364,6 +365,12 @@ check_io_write_finish(void **state) { int main(int argc, char *argv[]) { +#if _FILE_OFFSET_BITS == 64 + // Would produce cmocka error + LOG_WARNING("_FILE_OFFSET == 64 would produce cmocka errors."); + return EXIT_SKIP; +#endif + const struct CMUnitTest tests[] = { cmocka_unit_test(check_io_read_async), cmocka_unit_test(check_io_read_finish), diff --git a/test/unit/tcti-device.c b/test/unit/tcti-device.c index 5a3c9cb4b..f1cd1808a 100644 --- a/test/unit/tcti-device.c +++ b/test/unit/tcti-device.c @@ -25,6 +25,11 @@ #include "tss2-tcti/tcti-common.h" #include "tss2-tcti/tcti-device.h" +#define LOGMODULE tests +#include "util/log.h" + +#define EXIT_SKIP 77 + /* * Size of the TPM2 buffer used in these tests. In some cases this will be * the command sent (transmit tests) and in others it's used as the response @@ -444,6 +449,12 @@ tcti_device_poll_io_error (void **state) int main(int argc, char* argv[]) { +#if _FILE_OFFSET_BITS == 64 + // Would produce cmocka error + LOG_WARNING("_FILE_OFFSET == 64 would produce cmocka errors."); + return EXIT_SKIP; +#endif + const struct CMUnitTest tests[] = { cmocka_unit_test (tcti_device_init_all_null_test), cmocka_unit_test(tcti_device_init_size_test), diff --git a/test/unit/tcti-libtpms.c b/test/unit/tcti-libtpms.c index cf0c6d07d..11e501a4c 100644 --- a/test/unit/tcti-libtpms.c +++ b/test/unit/tcti-libtpms.c @@ -28,6 +28,8 @@ #define LOGMODULE test #include "util/log.h" +#define EXIT_SKIP 77 + #define LIBTPMS_DL_HANDLE 0x12345678 #define STATEFILE_PATH "statefile.bin" #define STATEFILE_FD 0xAABB @@ -1786,6 +1788,12 @@ int main(int argc, char *argv[]) { +#if _FILE_OFFSET_BITS == 64 + // Would produce cmocka error + LOG_WARNING("_FILE_OFFSET == 64 would produce cmocka errors."); + return EXIT_SKIP; +#endif + const struct CMUnitTest tests[] = { cmocka_unit_test(tcti_libtpms_init_all_null_test), cmocka_unit_test(tcti_libtpms_init_dlopen_fail_test), diff --git a/test/unit/tcti-pcap.c b/test/unit/tcti-pcap.c index bfc527bb2..ef589752f 100644 --- a/test/unit/tcti-pcap.c +++ b/test/unit/tcti-pcap.c @@ -27,6 +27,11 @@ #include "tss2-tcti/tcti-common.h" #include "tss2-tcti/tcti-pcap.h" +#define LOGMODULE tests +#include "util/log.h" + +#define EXIT_SKIP 77 + #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #define _LE32TOH(a,b,c,d) d,c,b,a #define _LE16TOH(a,b) b,a @@ -726,6 +731,12 @@ int main (int argc, char *argv[]) { +#if _FILE_OFFSET_BITS == 64 + // Would produce cmocka error + LOG_WARNING("_FILE_OFFSET == 64 would produce cmocka errors."); + return EXIT_SKIP; +#endif + const struct CMUnitTest tests[] = { cmocka_unit_test (tcti_pcap_init_context_and_size_null_test), cmocka_unit_test (tcti_pcap_init_size_test),