Author: stella.stamenova
Date: Mon May  7 14:57:00 2018
New Revision: 331686

URL: http://llvm.org/viewvc/llvm-project?rev=331686&view=rev
Log:
[lit, lldbsuite] Fixes for several tests LLDB tests for Python 3 or Windows

Summary:
In decorators.py, when opening streams, open them in text mode. In Py3, if they 
are not opened in text mode, the data is also expected to be binary, but we 
always use text data.
In TestLinuxCore, skip the tests that are not applicable on Windows
In the python api main.c, update the code to be compilable on Windows

Reviewers: asmith, zturner

Reviewed By: zturner

Subscribers: zturner

Differential Revision: https://reviews.llvm.org/D46440

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/decorators.py
    
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/main.c

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=331686&r1=331685&r2=331686&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon May  7 14:57:00 
2018
@@ -680,7 +680,7 @@ def skipUnlessSupportedTypeAttribute(att
         compiler_path = self.getCompiler()
         f = tempfile.NamedTemporaryFile()
         cmd = [self.getCompiler(), "-x", "c++", "-c", "-o", f.name, "-"]
-        p = subprocess.Popen(cmd, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen(cmd, stdin=subprocess.PIPE, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
         stdout, stderr = p.communicate('struct __attribute__((%s)) Test 
{};'%attr)
         if attr in stderr:
             return "Compiler does not support attribute %s"%(attr)
@@ -715,7 +715,7 @@ def skipUnlessUndefinedBehaviorSanitizer
 
     def is_compiler_clang_with_ubsan(self):
         # Write out a temp file which exhibits UB.
-        inputf = tempfile.NamedTemporaryFile(suffix='.c')
+        inputf = tempfile.NamedTemporaryFile(suffix='.c', mode='w')
         inputf.write('int main() { int x = 0; return x / x; }\n')
         inputf.flush()
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=331686&r1=331685&r2=331686&view=diff
==============================================================================
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Mon May  7 14:57:00 2018
@@ -46,16 +46,19 @@ class LinuxCoreTestCase(TestBase):
         """Test that lldb can read the process information from an i386 linux 
core file."""
         self.do_test("linux-i386", self._i386_pid, self._i386_regions, "a.out")
 
+    @skipIf(oslist=['windows'])
     def test_mips_o32(self):
         """Test that lldb can read the process information from an MIPS O32 
linux core file."""
         self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid,
                 self._mips_regions, "linux-mipsel-gn")
 
+    @skipIf(oslist=['windows'])
     def test_mips_n32(self):
         """Test that lldb can read the process information from an MIPS N32 
linux core file """
         self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid,
                 self._mips_regions, "linux-mips64el-")
 
+    @skipIf(oslist=['windows'])
     def test_mips_n64(self):
         """Test that lldb can read the process information from an MIPS N64 
linux core file """
         self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid,

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/main.c?rev=331686&r1=331685&r2=331686&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/main.c 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/main.c Mon 
May  7 14:57:00 2018
@@ -1,5 +1,11 @@
 #include <stdio.h>
+#ifdef _MSC_VER
+#include <windows.h>
+#define sleep(x) Sleep((x) * 1000)
+#else
 #include <unistd.h>
+#endif
+
 int main(int argc, char const *argv[])
 {
     lldb_enable_attach();


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to