[llvm-branch-commits] [llvm] b685845 - Revert "[lit] Implement builtin umask (#94621)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 9 09:17:59 PDT 2024


Author: Jay Foad
Date: 2024-07-09T17:17:57+01:00
New Revision: b68584571de3370ba7655b62047908b28a81d56c

URL: https://github.com/llvm/llvm-project/commit/b68584571de3370ba7655b62047908b28a81d56c
DIFF: https://github.com/llvm/llvm-project/commit/b68584571de3370ba7655b62047908b28a81d56c.diff

LOG: Revert "[lit] Implement builtin umask (#94621)"

This reverts commit 9f6dd1f761a5121e9a69e5d1f67c2438c065b499.

Added: 
    

Modified: 
    llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test
    llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
    llvm/test/tools/llvm-objcopy/ELF/respect-umask.test
    llvm/utils/lit/lit/TestRunner.py

Removed: 
    llvm/utils/lit/tests/Inputs/shtest-umask/lit.cfg
    llvm/utils/lit/tests/Inputs/shtest-umask/umask-bad-arg.txt
    llvm/utils/lit/tests/Inputs/shtest-umask/umask-ok.txt
    llvm/utils/lit/tests/Inputs/shtest-umask/umask-too-many-args.txt
    llvm/utils/lit/tests/shtest-umask.py


################################################################################
diff  --git a/llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test b/llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test
index fdcba4dcd666b..a95d1c0aafa21 100644
--- a/llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test
+++ b/llvm/test/tools/llvm-dwarfutil/ELF/X86/mirror-permissions-unix.test
@@ -3,6 +3,7 @@
 ## Setting the umask to 0 ensures deterministic permissions across
 ## test environments.
 # UNSUPPORTED: system-windows
+# REQUIRES: shell
 
 # RUN: touch %t
 # RUN: chmod 0777 %t

diff  --git a/llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test b/llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
index 66a481a2230d1..8f4993f4f3d29 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
@@ -6,6 +6,7 @@
 ## Setting the umask to 0 ensures deterministic permissions across
 ## test environments.
 # UNSUPPORTED: system-windows
+# REQUIRES: shell
 
 # RUN: touch %t
 # RUN: chmod 0777 %t

diff  --git a/llvm/test/tools/llvm-objcopy/ELF/respect-umask.test b/llvm/test/tools/llvm-objcopy/ELF/respect-umask.test
index 02e9b93f5376f..376e33a217819 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/respect-umask.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/respect-umask.test
@@ -1,8 +1,10 @@
 ## This tests that the umask is respected when
 ## assigning permissions of output files.
 
-## Windows has no umask so this test makes no sense.
+## Windows has no umask so this test makes no sense, nor would
+## it work because there is no umask(1) in a Windows environment
 # UNSUPPORTED: system-windows
+# REQUIRES: shell
 
 # RUN: rm -f %t
 # RUN: touch %t

diff  --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index 865376e0e711e..da7fa86fd3917 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -87,10 +87,9 @@ class ShellEnvironment(object):
     we maintain a dir stack for pushd/popd.
     """
 
-    def __init__(self, cwd, env, umask=-1):
+    def __init__(self, cwd, env):
         self.cwd = cwd
         self.env = dict(env)
-        self.umask = umask
         self.dirStack = []
 
     def change_dir(self, newdir):
@@ -566,20 +565,6 @@ 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")
-    if len(cmd.args) != 2:
-        raise InternalShellError(cmd, "'umask' supports only one argument")
-    try:
-        # Update the umask in the parent environment.
-        shenv.umask = int(cmd.args[1], 8)
-    except ValueError as err:
-        raise InternalShellError(cmd, "Error: 'umask': %s" % str(err))
-    return ShellCommandResult(cmd, "", "", 0, False)
-
-
 def executeBuiltinColon(cmd, cmd_shenv):
     """executeBuiltinColon - Discard arguments and exit with status 0."""
     return ShellCommandResult(cmd, "", "", 0, False)
@@ -734,7 +719,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
         "popd": executeBuiltinPopd,
         "pushd": executeBuiltinPushd,
         "rm": executeBuiltinRm,
-        "umask": executeBuiltinUmask,
         ":": executeBuiltinColon,
     }
     # To avoid deadlock, we use a single stderr stream for piped
@@ -756,7 +740,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
                 #   env FOO=1 llc < %s | env BAR=2 llvm-mc | FileCheck %s
                 #   env FOO=1 %{another_env_plus_cmd} | FileCheck %s
                 if cmd_shenv is shenv:
-                    cmd_shenv = ShellEnvironment(shenv.cwd, shenv.env, shenv.umask)
+                    cmd_shenv = ShellEnvironment(shenv.cwd, shenv.env)
                 args = updateEnv(cmd_shenv, args)
                 if not args:
                     raise InternalShellError(j, "Error: 'env' requires a" " subcommand")
@@ -900,7 +884,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
                     close_fds=kUseCloseFDs,
                     universal_newlines=True,
                     errors="replace",
-                    umask=cmd_shenv.umask,
                 )
             )
             proc_not_counts.append(not_count)

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-umask/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-umask/lit.cfg
deleted file mode 100644
index 52e18b1d5c2b3..0000000000000
--- a/llvm/utils/lit/tests/Inputs/shtest-umask/lit.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-import lit.formats
-
-config.name = "shtest-umask"
-config.suffixes = [".txt"]
-config.test_format = lit.formats.ShTest(execute_external=False)
-if sys.platform.startswith("win") or sys.platform.startswith("cygwin"):
-    config.available_features.add("system-windows")

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-bad-arg.txt b/llvm/utils/lit/tests/Inputs/shtest-umask/umask-bad-arg.txt
deleted file mode 100644
index 639bfd4b7b4f3..0000000000000
--- a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-bad-arg.txt
+++ /dev/null
@@ -1 +0,0 @@
-# RUN: umask bad

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-ok.txt b/llvm/utils/lit/tests/Inputs/shtest-umask/umask-ok.txt
deleted file mode 100644
index 9d43efbddf2cf..0000000000000
--- a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-ok.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-## Windows has no umask so this test makes no sense.
-# UNSUPPORTED: system-windows
-
-# RUN: touch %t
-# RUN: chmod 644 %t && ls -l %t | cut -f 1 -d ' ' > %t.644
-# RUN: chmod 600 %t && ls -l %t | cut -f 1 -d ' ' > %t.600
-# RUN: chmod 666 %t && ls -l %t | cut -f 1 -d ' ' > %t.666
-
-# RUN: umask 022 && rm %t && touch %t && ls -l %t | cut -f 1 -d ' ' | cmp - %t.644
-# RUN: umask 177 && rm %t && touch %t && ls -l %t | cut -f 1 -d ' ' | cmp - %t.600
-# RUN: umask 000 && rm %t && touch %t && ls -l %t | cut -f 1 -d ' ' | cmp - %t.666

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-too-many-args.txt b/llvm/utils/lit/tests/Inputs/shtest-umask/umask-too-many-args.txt
deleted file mode 100644
index 0b7461b5bc3fe..0000000000000
--- a/llvm/utils/lit/tests/Inputs/shtest-umask/umask-too-many-args.txt
+++ /dev/null
@@ -1 +0,0 @@
-# RUN: umask 0 0

diff  --git a/llvm/utils/lit/tests/shtest-umask.py b/llvm/utils/lit/tests/shtest-umask.py
deleted file mode 100644
index daec3cf479fc7..0000000000000
--- a/llvm/utils/lit/tests/shtest-umask.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Check the umask command
-
-# RUN: not %{lit} -a -v %{inputs}/shtest-umask | FileCheck -match-full-lines %s
-
-# CHECK: -- Testing: 3 tests{{.*}}
-
-# CHECK-LABEL: FAIL: shtest-umask :: umask-bad-arg.txt ({{[^)]*}})
-# CHECK: umask bad
-# CHECK: # | Error: 'umask': invalid literal {{.*}}
-
-# CHECK-LABEL: FAIL: shtest-umask :: umask-too-many-args.txt ({{[^)]*}})
-# CHECK: umask 0 0
-# CHECK: # | 'umask' supports only one argument
-
-# CHECK: Total Discovered Tests: 3
-# CHECK: {{Passed|Unsupported}}: 1 {{\([0-9]*\.[0-9]*%\)}}
-# CHECK: Failed{{ *}}: 2 {{\([0-9]*\.[0-9]*%\)}}
-# CHECK-NOT: {{.}}


        


More information about the llvm-branch-commits mailing list