[llvm] [lit] Implement builtin umask (PR #94621)

Paul T Robinson via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 08:08:20 PDT 2024


================
@@ -565,6 +566,20 @@ class SHFILEOPSTRUCTW(Structure):
     return ShellCommandResult(cmd, "", stderr.getvalue(), exitCode, False)
 
 
+def executeBuiltinUmask(cmd, shenv):
+    """executeBuiltinUmask - Change the current umask."""
+    if os.name != "posix":
+        raise InternalShellError(cmd, "'umask' not supported on this system")
----------------
pogo59 wrote:

If you move this check down to right before the `return` statement, then the argument checks are made before the host check, and the test works (almost, see one comment there).

Now, it would seem to make more sense to put the "posix" check first, but in that case the errors seen by the test aren't what it expects, and it fails. If you want to leave this check where it is, then shtest-umask.py needs to have `UNSUPPORTED: system-windows` and, because I'm a masochist, there would need to be a separate shtest-umask-windows.py that looks for the right error messages. I can provide that test if that's the direction you prefer.

https://github.com/llvm/llvm-project/pull/94621


More information about the llvm-commits mailing list