# HG changeset patch # User pacien # Date 1636420098 -3600 # Node ID 7dd48d5da64f84ab0ace0815938c25769b7d1c88 # Parent ab2dfc993b5cc21d853ef331871ecf10e264b739 tests: add guard check for suid support This adds a check for setuid and setgid support and guards a part of a test requiring this particular filesystem feature. Such feature is notably missing in the Nix/NixOS build sandbox and was causing the whole test to fail for the mercurial package. Differential Revision: https://phab.mercurial-scm.org/D11739 diff -r ab2dfc993b5c -r 7dd48d5da64f tests/hghave.py --- a/tests/hghave.py Tue Nov 09 02:00:25 2021 +0100 +++ b/tests/hghave.py Tue Nov 09 02:08:18 2021 +0100 @@ -264,6 +264,13 @@ return not (new_file_has_exec or exec_flags_cannot_flip) +@check("suidbit", "setuid and setgid bit") +def has_suidbit(): + if getattr(os, "statvfs", None) is None or getattr(os, "ST_NOSUID") is None: + return False + return bool(os.statvfs('.').f_flag & os.ST_NOSUID) + + @check("icasefs", "case insensitive file system") def has_icasefs(): # Stolen from mercurial.util diff -r ab2dfc993b5c -r 7dd48d5da64f tests/test-remotefilelog-permissions.t --- a/tests/test-remotefilelog-permissions.t Tue Nov 09 02:00:25 2021 +0100 +++ b/tests/test-remotefilelog-permissions.t Tue Nov 09 02:08:18 2021 +0100 @@ -33,6 +33,8 @@ $ chmod -R u+w master/.hg/remotefilelogcache +#if suidbit + # Test setting up shared cache with the right permissions # (this is hard to test in a cross platform way, so we just make sure nothing # crashes) @@ -44,3 +46,5 @@ 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) $ ls -ld $CACHEDIR/11 drwxrws* $TESTTMP/hgcache/11 (glob) + +#endif