Skip to content

building tests fails #49

Open
Open
@sharkcz

Description

@sharkcz

Building the tests fails with

...
gcc -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64  -o testobj/unittests testobj/unittests.o-test testobj/virtocxl.o-test testobj/libocxl.a -lfuse -lpthread
/usr/bin/ld: testobj/unittests.o-test: in function `test_ocxl_mmio_read32':
/builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:739: undefined reference to `be32toh'
/usr/bin/ld: /builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:756: undefined reference to `le32toh'
/usr/bin/ld: testobj/unittests.o-test: in function `test_ocxl_mmio_read64':
/builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:800: undefined reference to `be64toh'
/usr/bin/ld: /builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:817: undefined reference to `le64toh'
collect2: error: ld returned 1 exit status
make: *** [Makefile:96: testobj/unittests] Error 1

after a number of "implicit declaration" warnings

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.h209Z4
+ umask 022
+ cd /builddir/build/BUILD
+ cd libocxl-1.2.0
+ make test V=1
mkdir testobj
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/afu.o src/afu.c
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/internal.o src/internal.c
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/irq.o src/irq.c
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/mmio.o src/mmio.c
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/setup.o src/setup.c
ar rcs testobj/libocxl-temp.a testobj/afu.o testobj/internal.o testobj/irq.o testobj/mmio.o testobj/setup.o
nm testobj/libocxl-temp.a | grep ' t ' | grep -v __ | cut -d ' ' -f 3 > testobj/static-syms
perl -n static-prototypes.pl src/*.c >testobj/static.h
objcopy --globalize-symbols=testobj/static-syms testobj/libocxl-temp.a testobj/libocxl.a
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/unittests.o-test unittests/unittests.c
In file included from unittests/unittests.c:30:
src/libocxl_internal.h:21: warning: "_POSIX_C_SOURCE" redefined
   21 | #define _POSIX_C_SOURCE 200809L
      | 
In file included from /usr/include/unistd.h:25,
                 from unittests/unittests.c:17:
/usr/include/features.h:317: note: this is the location of the previous definition
  317 | # define _POSIX_C_SOURCE 199506L
      | 
unittests/unittests.c: In function 'test_device_matches':
unittests/unittests.c:254:22: warning: implicit declaration of function 'dirfd' [-Wimplicit-function-declaration]
  254 |         int dev_fd = dirfd(dev_dir);
      |                      ^~~~~
unittests/unittests.c:256:17: warning: implicit declaration of function 'fstatat'; did you mean 'fstat'? [-Wimplicit-function-declaration]
  256 |         ASSERT(!fstatat(dev_fd, "urandom", &urandom, 0));
      |                 ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
unittests/unittests.c: In function 'test_get_afu_by_path':
unittests/unittests.c:326:21: warning: implicit declaration of function 'symlink' [-Wimplicit-function-declaration]
  326 |         ASSERT(0 == symlink("/dev/ocxl-test/IBM,Dummy.0001:00:00.1.0", symlink_path));
      |                     ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
unittests/unittests.c: In function 'test_ocxl_mmio_read32':
unittests/unittests.c:739:21: warning: implicit declaration of function 'be32toh' [-Wimplicit-function-declaration]
  739 |         ASSERT(4 == be32toh(big));
      |                     ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
unittests/unittests.c:756:21: warning: implicit declaration of function 'le32toh' [-Wimplicit-function-declaration]
  756 |         ASSERT(4 == le32toh(little));
      |                     ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
unittests/unittests.c: In function 'test_ocxl_mmio_read64':
unittests/unittests.c:800:21: warning: implicit declaration of function 'be64toh' [-Wimplicit-function-declaration]
  800 |         ASSERT(8 == be64toh(big));
      |                     ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
unittests/unittests.c:817:21: warning: implicit declaration of function 'le64toh' [-Wimplicit-function-declaration]
  817 |         ASSERT(8 == le64toh(little));
      |                     ^~~~~~~
unittests/unittests.c:64:15: note: in definition of macro 'ASSERT'
   64 |         if (!(statement)) { \
      |               ^~~~~~~~~
gcc  -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64 -O0 -DTEST_ENVIRONMENT=1 -I src -I testobj -pthread -c -o testobj/virtocxl.o-test unittests/virtocxl.c
In file included from unittests/virtocxl.c:20:
src/libocxl_internal.h:21: warning: "_POSIX_C_SOURCE" redefined
   21 | #define _POSIX_C_SOURCE 200809L
      | 
In file included from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/ppc64le-redhat-linux/11/include/stdint.h:9,
                 from /usr/include/fuse/fuse_common.h:19,
                 from /usr/include/fuse/fuse_lowlevel.h:26,
                 from /usr/include/fuse/cuse_lowlevel.h:19,
                 from unittests/virtocxl.c:17:
/usr/include/features.h:317: note: this is the location of the previous definition
  317 | # define _POSIX_C_SOURCE 199506L
      | 
unittests/virtocxl.c: In function 'create_ocxl_device':
unittests/virtocxl.c:215:39: warning: '/global_mmio_area' directive output may be truncated writing 17 bytes into a region of size between 1 and 4096 [-Wformat-truncation=]
  215 |         snprintf(tmp, sizeof(tmp), "%s/global_mmio_area", sysfs_base);
      |                                       ^~~~~~~~~~~~~~~~~
unittests/virtocxl.c:215:9: note: 'snprintf' output between 18 and 4113 bytes into a destination of size 4096
  215 |         snprintf(tmp, sizeof(tmp), "%s/global_mmio_area", sysfs_base);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unittests/virtocxl.c: In function 'afu_read':
unittests/virtocxl.c:71:17: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
   71 |                 fuse_reply_buf(req, buf, 0);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/fuse/cuse_lowlevel.h:19,
                 from unittests/virtocxl.c:17:
/usr/include/fuse/fuse_lowlevel.h:1157:5: note: by argument 2 of type 'const char *' to 'fuse_reply_buf' declared here
 1157 | int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
      |     ^~~~~~~~~~~~~~
unittests/virtocxl.c:54:14: note: 'buf' declared here
   54 |         char buf[KERNEL_EVENT_SIZE];
      |              ^~~
gcc -g -Wall -Wextra -O2 -m64 -std=c11 -DLIBOCXL_SUPPRESS_INACCESSIBLE_WARNINGS -I src/include -I kernel/include -fPIC -D_FILE_OFFSET_BITS=64  -o testobj/unittests testobj/unittests.o-test testobj/virtocxl.o-test testobj/libocxl.a -lfuse -lpthread
/usr/bin/ld: testobj/unittests.o-test: in function `test_ocxl_mmio_read32':
/builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:739: undefined reference to `be32toh'
/usr/bin/ld: /builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:756: undefined reference to `le32toh'
/usr/bin/ld: testobj/unittests.o-test: in function `test_ocxl_mmio_read64':
/builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:800: undefined reference to `be64toh'
/usr/bin/ld: /builddir/build/BUILD/libocxl-1.2.0/unittests/unittests.c:817: undefined reference to `le64toh'
collect2: error: ld returned 1 exit status
make: *** [Makefile:96: testobj/unittests] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions