Testing against Gnulib's test suite

GNU gnulib has a growing test suite of POSIX and glibc headers and functions. As of 2012, it covers ca. 40 header files and ca. 280 functions. These tests are known to pass on glibc platforms with 6 different CPU types, as well as on major Unix systems (from Mac OS X to Cygwin), modulo platform specific bugs on these non-glibc systems.

The tests are generally written according to the POSIX standard. Many tested behaviours are also "common sense". Only few tests could be characterized as "hairy". It is suitable to test glibc against this test suite, as a sanity check.

How to run the test suite

1. On a development machine (a machine with GNU tools, including gperf), checkout GNU gnulib https://savannah.gnu.org/projects/gnulib and run

$ ${GNULIB_CHECKOUT}/gnulib-tool --create-testdir --dir=/tmp/testdir \
                                 --with-tests --single-configure \

2. Copy the /tmp/testdir directory to the target machine, if it is a different machine.

3. In /tmp/testdir: For testing a glibc installed in /usr, run

$ ./configure CPPFLAGS="-Wall"

For testing a glibc built from source with --prefix=$GLIBC_INSTALL_DIR, run

$ ./configure CC="gcc -Wl,-rpath=$GLIBC_INSTALL_DIR/lib64:$GLIBC_INSTALL_DIR/usr/lib64 -Wl,--dynamic-linker=$GLIBC_INSTALL_DIR/lib64/ld-linux-x86-64.so.2" CPPFLAGS="-nostdinc -I`gcc -print-file-name=include-fixed` -I$GLIBC_INSTALL_DIR/usr/include -I`gcc -print-file-name=include` -Wall"

4. Run

$ make

Verify that Gnulib has built no replacement/workaround code (gllib/*.o files) - if so, this indicates problems in the libc.

$ (cd gllib; ls -1 $(${GNULIB_CHECKOUT}/posix-modules | sed -e 's|-posix$||' | sort -u | grep -v 'nonblocking' | sed -e 's|$|.o|') 2>/dev/null )

5. Run

make check

Known problems

Known problems (all kernels)

checking for ioctl with POSIX signature... no

checking whether fflush works on input streams... no

checking for working nanosleep... no (mishandles large arguments)

checking whether glob lists broken symlinks... no

checking whether printf supports infinite 'long double' arguments... no

checking whether isfinite(long double) works... no

Known problems on Linux

checking for strerror_r with POSIX signature... no

checking whether fcntl understands F_DUPFD_CLOEXEC... needs runtime check

checking whether futimens works... needs runtime check

checking whether linkat(,AT_SYMLINK_FOLLOW) works... need runtime check

checking whether utimensat works... needs runtime check

Known problems on Hurd

These were found in glibc 2.13, in a virtual image run through qemu.


Investigating new problems

When an expected .o file is built, or when a check fails, look at

If your conclusion is that it's a bug in Gnulib, please report it at bug-gnulib at gnu dot org.

None: Testing/Gnulib (last edited 2020-01-31 17:31:58 by SiddheshPoyarekar)