diff options
author | Pavel Labath <labath@google.com> | 2018-03-26 12:47:40 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-03-26 12:47:40 +0000 |
commit | 22dccd008e3de35eeb29f61c363d618345f58a96 (patch) | |
tree | e1cf27f513734c71d0c1c674d0451abc03cf1099 /lldb/packages/Python/lldbsuite | |
parent | d5ee7ab47e3f3093c49a9fe0fab7326b14ff27d4 (diff) | |
download | bcm5719-llvm-22dccd008e3de35eeb29f61c363d618345f58a96.tar.gz bcm5719-llvm-22dccd008e3de35eeb29f61c363d618345f58a96.zip |
Make @skipUnlessSupportedTypeAttribute windows-compatible
- close_fds is not compatible with stdin/out redirection on windows. I
just remove it, as this is not required for correct operation.
- the command string was assuming a posix shell. I rewrite the Popen
invocation to avoid the need for passing the arguments through a shell.
llvm-svn: 328489
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/decorators.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 228a8bd390e..aad78043a0d 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -656,12 +656,11 @@ def skipUnlessSupportedTypeAttribute(attr): """Decorate the item to skip test unless Clang supports type __attribute__(attr).""" def compiler_doesnt_support_struct_attribute(self): compiler_path = self.getCompiler() - compiler = os.path.basename(compiler_path) f = tempfile.NamedTemporaryFile() - cmd = "echo 'struct __attribute__((%s)) Test {};' | %s -x c++ -c -o %s - ; exit" % (attr, compiler_path, f.name) - p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) - test_result = p.stderr.read() - if attr in test_result: + cmd = [self.getCompiler(), "-x", "c++", "-c", "-o", f.name, "-"] + p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = p.communicate('struct __attribute__((%s)) Test {};'%attr) + if attr in stderr: return "Compiler does not support attribute %s"%(attr) return None return skipTestIfFn(compiler_doesnt_support_struct_attribute) |