From 17d71c014cdd93a71b9c6801c7da3344f893ba97 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Tue, 12 Dec 2017 00:31:46 +0000 Subject: [PATCH] [ELF] Use shell to check the file permissions This is less error-prone to mask settings than stat. Differential Revision: https://reviews.llvm.org/D41097 llvm-svn: 320442 --- lld/test/ELF/file-access.s | 11 ++++------- lld/test/lit.cfg.py | 8 -------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lld/test/ELF/file-access.s b/lld/test/ELF/file-access.s index ed887c5a13b6..5a9e53b11140 100644 --- a/lld/test/ELF/file-access.s +++ b/lld/test/ELF/file-access.s @@ -1,15 +1,12 @@ -# REQUIRES: x86, gnustat +# REQUIRES: x86, 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 ] # 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 ] # 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 ] .global _start _start: diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py index f8436cab6135..ae0dd187c607 100644 --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -91,11 +91,3 @@ if tar_executable: 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()