Mercurial > hg
comparison tests/hghave.py @ 48312:7dd48d5da64f stable
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
author | pacien <pacien.trangirard@pacien.net> |
---|---|
date | Tue, 09 Nov 2021 02:08:18 +0100 |
parents | 1ff06ceb070f |
children | 6505d3902eac |
comparison
equal
deleted
inserted
replaced
48307:ab2dfc993b5c | 48312:7dd48d5da64f |
---|---|
260 os.unlink(fn) | 260 os.unlink(fn) |
261 except (IOError, OSError): | 261 except (IOError, OSError): |
262 # we don't care, the user probably won't be able to commit anyway | 262 # we don't care, the user probably won't be able to commit anyway |
263 return False | 263 return False |
264 return not (new_file_has_exec or exec_flags_cannot_flip) | 264 return not (new_file_has_exec or exec_flags_cannot_flip) |
265 | |
266 | |
267 @check("suidbit", "setuid and setgid bit") | |
268 def has_suidbit(): | |
269 if getattr(os, "statvfs", None) is None or getattr(os, "ST_NOSUID") is None: | |
270 return False | |
271 return bool(os.statvfs('.').f_flag & os.ST_NOSUID) | |
265 | 272 |
266 | 273 |
267 @check("icasefs", "case insensitive file system") | 274 @check("icasefs", "case insensitive file system") |
268 def has_icasefs(): | 275 def has_icasefs(): |
269 # Stolen from mercurial.util | 276 # Stolen from mercurial.util |