Author: labath Date: Mon Mar 26 05:47:40 2018 New Revision: 328489 URL: http://llvm.org/viewvc/llvm-project?rev=328489&view=rev Log: 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. Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=328489&r1=328488&r2=328489&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Mar 26 05:47:40 2018 @@ -656,12 +656,11 @@ def skipUnlessSupportedTypeAttribute(att """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) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits