> 2025-06-12 Bruno Haible <br...@clisp.org> > > stat, lstat, fstat tests: Enhance tests regarding /dev/null or NUL. > * tests/test-fstat.c: Include <fcntl.h>. > (main): Check that fstat reports /dev/null or NUL as a character device. > * tests/test-stat.h (test_stat_func): Likewise for stat. > * tests/test-lstat.h (test_lstat_func): Likewise for lstat.
Oops, this leads to test failures on Solaris: test-lstat.h:74: assertion 'S_ISCHR (st1.st_mode)' failed This patch should fix it. 2025-06-12 Bruno Haible <br...@clisp.org> lstat tests: Avoid test failure on Solaris. * tests/test-lstat.h (test_lstat_func): Reduce assumption about /dev/null on Solaris. diff --git a/tests/test-lstat.h b/tests/test-lstat.h index fb9a808a76..bfd5b5526b 100644 --- a/tests/test-lstat.h +++ b/tests/test-lstat.h @@ -64,14 +64,17 @@ test_lstat_func (int (*func) (char const *, struct stat *), bool print) ASSERT (func (BASE "file/", &st1) == -1); ASSERT (errno == ENOTDIR); - /* /dev/null is a character device. */ + /* /dev/null is a character device. + Except on Solaris, where it is a symlink. */ #if defined _WIN32 && !defined __CYGWIN__ ASSERT (func ("NUL", &st1) == 0); #else ASSERT (func ("/dev/null", &st1) == 0); #endif ASSERT (!S_ISREG (st1.st_mode)); +#if !defined __sun ASSERT (S_ISCHR (st1.st_mode)); +#endif /* Now for some symlink tests, where supported. We set up: link1 -> directory