tests: define fallback PATH_MAX

Few filesystem-related tests rely on PATH_MAX for buffers, and PATH_MAX
is optional in POSIX (and not available on the Hurd). To make them build
and pass, provide a fallback definition of PATH_MAX in case not
available.

Ideally speaking, the tests ought to not unconditionally rely on
PATH_MAX, do alternative strategies (e.g. dynamically allocate buffers,
expand them as needed, etc); OTOH this is test code, so it would be more
work that what it would be worth, so IMHO the define fallback is good
enough.
This commit is contained in:
Pino Toscano 2024-07-30 05:34:34 +02:00
parent 7442f4a161
commit a1ccf60613

View File

@ -17,6 +17,10 @@
# define FS_ROOT FS_SEP # define FS_ROOT FS_SEP
#endif #endif
#ifndef PATH_MAX
# define PATH_MAX 4096
#endif
namespace nix { namespace nix {
/* ----------- tests for util.hh ------------------------------------------------*/ /* ----------- tests for util.hh ------------------------------------------------*/