-
Notifications
You must be signed in to change notification settings - Fork 322
Description
Hello,
while building libyang 2.0.112 in Ubuntu Jammy (22.04, devel release), I'm getting these two test failures:
[ ERROR ] --- "Unable to use search directory "./tests/utests/basic/test_context.c" (No such file or directory)." != "Unable to fully access search directory "./tests/utests/basic/test_con
text.c" (Permission denied)."
[ LINE ] --- ./tests/utests/basic/test_context.c:43: error: Failure!
[ FAILED ] test_searchdirs
and
RUN ] test_input_fd
[ ERROR ] --- 0xffffffffffffffff == 0xffffffffffffffff
[ LINE ] --- ./tests/utests/basic/test_inout.c:57: error: Failure!
[ FAILED ] test_input_fd
[ RUN ] test_input_file
[ ERROR ] --- 0 != 0x3
[ LINE ] --- ./tests/utests/basic/test_inout.c:91: error: Failure!
[ FAILED ] test_input_file
[ RUN ] test_input_filepath
[ ERROR ] --- 0 != 0x2
[ LINE ] --- ./tests/utests/basic/test_inout.c:113: error: Failure!
[ FAILED ] test_input_filepath
I debugged test_searchdirs a little bit, and it looks like __FILE__ as used in ./tests/utests/basic/test_context.c:43 is a relative path and fails to be converted to an absolute one.
(gdb) n
84 if (search_dir) {
(gdb) p search_dir
$2 = 0x555555642008 "./tests/utests/basic/test_context.c"
(gdb) n
85 new_dir = realpath(search_dir, NULL);
(gdb) n
86 LY_CHECK_ERR_RET(!new_dir,
(gdb) p new_dir
$3 = 0x0
(gdb) p errno
$4 = 2
The process is in this directory at that time: /proc/128218/cwd -> /home/ubuntu/git/packages/libyang2/libyang2/obj-x86_64-linux-gnu/tests/
And relative to that, ./tests/utests/basic/test_context.c does indeed not exist.
The other failing test is also the only one using __FILE__, and I'm just guessing it's a similar issue, but I haven't debugged.
This happens when I run the tests in multiple ways:
make -C obj-x86_64-linux-gnu/ testcd obj-x86_64-linux-gnu/ && ctest
The build was done with:
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON "-GUnix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_BUILD_TYPE:String=Release -DENABLE_TESTS=ON
This is the normal debian package build, where I just added the flag to enable the tests.