Skip to content

Commit

Permalink
unit tests: skip tests which fail on 32-bit with _FILE_BITS=64
Browse files Browse the repository at this point in the history
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 <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT authored and AndreasFuchsTPM committed Mar 21, 2024
1 parent b5248f8 commit 932b1e7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MAINTAINERS.md
@@ -1,5 +1,5 @@
|email|PGP Fingerprint|
| ------------- | ------------- |
| Andreas Fuchs <andreas.fuchs@infineon.com>| [D533275B0123D0A679F51FF48F4F9A45D7FFEE74](htps://keys.openpgp.org/vks/v1/by-fingerprint/D533275B0123D0A679F51FF48F4F9A45D7FFEE74)|
| Andreas Fuchs <andreas.fuchs@infineon.com>| [D533275B0123D0A679F51FF48F4F9A45D7FFEE74](https://keys.openpgp.org/vks/v1/by-fingerprint/D533275B0123D0A679F51FF48F4F9A45D7FFEE74)|
| Bill Roberts <william.c.roberts@intel.com>| [5b482b8e3e19da7c978e1d016de2e9078e1f50c1](https://keys.openpgp.org/vks/v1/by-fingerprint/5B482B8E3E19DA7C978E1D016DE2E9078E1F50C1)|
| Juergen Repp <juergen_repp@web.de>| [7A8F470DA9C8B2CACED1DBAAF1B152D9441A2563](https://keys.openpgp.org/vks/v1/by-fingerprint/7A8F470DA9C8B2CACED1DBAAF1B152D9441A2563)|
7 changes: 7 additions & 0 deletions test/unit/fapi-io.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
Expand Down
11 changes: 11 additions & 0 deletions test/unit/tcti-device.c
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 8 additions & 0 deletions test/unit/tcti-libtpms.c
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
11 changes: 11 additions & 0 deletions test/unit/tcti-pcap.c
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 932b1e7

Please sign in to comment.