From patchwork Tue Nov 9 13:18:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11739: tests: add guard check for suid support From: phabricator X-Patchwork-Id: 50064 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 9 Nov 2021 13:18:27 +0000 Alphare created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY 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. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D11739 AFFECTED FILES tests/hghave.py tests/test-remotefilelog-permissions.t CHANGE DETAILS To: Alphare, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/tests/test-remotefilelog-permissions.t b/tests/test-remotefilelog-permissions.t --- a/tests/test-remotefilelog-permissions.t +++ b/tests/test-remotefilelog-permissions.t @@ -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 diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -264,6 +264,11 @@ return not (new_file_has_exec or exec_flags_cannot_flip) +@check("suidbit", "setuid and setgid bit") +def has_suidbit(): + return bool(os.statvfs('.').f_flag & os.ST_NOSUID) + + @check("icasefs", "case insensitive file system") def has_icasefs(): # Stolen from mercurial.util