[PATCH] D41097: [ELF] Use shell to check the file permissions

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 16:15:17 PST 2017


phosek updated this revision to Diff 126467.
phosek retitled this revision from "[ELF] Only check user permissions in the file access test" to "[ELF] Use shell to check the file permissions".
phosek edited the summary of this revision.
phosek added a comment.

Done


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41097

Files:
  test/ELF/file-access.s
  test/lit.cfg.py


Index: test/lit.cfg.py
===================================================================
--- test/lit.cfg.py
+++ test/lit.cfg.py
@@ -91,11 +91,3 @@
     if 'GNU tar' in tar_version.stdout.read().decode():
         config.available_features.add('gnutar')
     tar_version.wait()
-
-stat_executable = lit.util.which('stat', config.environment['PATH'])
-if stat_executable:
-    stat_version = subprocess.Popen(
-        [stat_executable, '--version'], stdout=subprocess.PIPE, env={'LANG': 'C'})
-    if 'GNU coreutils' in stat_version.stdout.read().decode():
-        config.available_features.add('gnustat')
-    stat_version.wait()
Index: test/ELF/file-access.s
===================================================================
--- test/ELF/file-access.s
+++ test/ELF/file-access.s
@@ -1,15 +1,15 @@
-# REQUIRES: x86, gnustat
+# REQUIRES: x86, linux, shell
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: ld.lld -r %t.o -o %t1.o
-# RUN: stat -c %%A %t1.o | FileCheck --check-prefix=CHECK-RELOC %s
-# CHECK-RELOC: -rw-r--r--
+# RUN: [ ! -x %t1.o ] && echo "n" | FileCheck --check-prefix=CHECK-RELOC %s
+# CHECK-RELOC: n
 # RUN: ld.lld -shared %t.o -o %t2.so
-# RUN: stat -c %%A %t2.so | FileCheck --check-prefix=CHECK-SHARED %s
-# CHECK-SHARED: -rwxr-xr-x
+# RUN: [ -x %t2.so ] && echo "y" | FileCheck --check-prefix=CHECK-SHARED %s
+# CHECK-SHARED: y
 # RUN: ld.lld %t.o -o %t3
-# RUN: stat -c %%A %t3 | FileCheck --check-prefix=CHECK-EXEC %s
-# CHECK-EXEC: -rwxr-xr-x
+# RUN: [ -x %t3 ] && echo "y" | FileCheck --check-prefix=CHECK-EXEC %s
+# CHECK-EXEC: y
 
 .global _start
 _start:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41097.126467.patch
Type: text/x-patch
Size: 1621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/33a19987/attachment.bin>


More information about the llvm-commits mailing list