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

building tests fails #49

Open
sharkcz opened this issue Jun 11, 2021 · 4 comments
Open

building tests fails #49

sharkcz opened this issue Jun 11, 2021 · 4 comments

Comments

@sharkcz
Copy link

sharkcz commented Jun 11, 2021

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
@fbarrat
Copy link
Contributor

fbarrat commented Jun 11, 2021

hmmm, those have apparently been broken for a while.
I'm going to fix the compilation/linking problems, but the tests are not passing, they seem to be hanging pretty hard in fuse territory.
On Ubuntu 21.04: it's hanging in the call to ocxl_afu_open() in the test "AFU:getters"
On RHEL 8.3, it's hanging later, in test "AFU:ocxl_afu_attach"
In both cases, kill -9 cannot even stop the test!

I can't look at it now and I have doubt if it's even worth it now that we have real hardware. We obviously hadn't run those for a while.

@sharkcz
Copy link
Author

sharkcz commented Jun 14, 2021

Yeah, and I remember I reported some issues when running the tests in #29 some time ago. But I would like to run at least a "sanity check" during the package build by compiling the unittests binary. Which seems to work OK with PR #51

@fbarrat
Copy link
Contributor

fbarrat commented Jun 14, 2021

No rush, but we're leaning toward dropping those unittests. If it's just to check the build, then we now have real AFU tests in /afutests. Woulldn't that do what you want?

@fbarrat
Copy link
Contributor

fbarrat commented Jun 16, 2021

I've fixed the test build issue in release 1.2.1. However, as discussed, the tests are hanging somewhere in fuse. That will be addressed later, probably by removing the unittest, since they create more problems than it's worth, and we now have the afutests, which can validate the build and work with real hardware. In the meantime, I'm keeping this issue open

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

2 participants