[llvm] r190465 - [python-bindings] Fixed 3 test failures caused by typos.

Michael Gottesman mgottesman at apple.com
Tue Sep 10 17:41:02 PDT 2013


Author: mgottesman
Date: Tue Sep 10 19:41:02 2013
New Revision: 190465

URL: http://llvm.org/viewvc/llvm-project?rev=190465&view=rev
Log:
[python-bindings] Fixed 3 test failures caused by typos.

Modified:
    llvm/trunk/bindings/python/llvm/core.py
    llvm/trunk/bindings/python/llvm/tests/test_core.py

Modified: llvm/trunk/bindings/python/llvm/core.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/python/llvm/core.py?rev=190465&r1=190464&r2=190465&view=diff
==============================================================================
--- llvm/trunk/bindings/python/llvm/core.py (original)
+++ llvm/trunk/bindings/python/llvm/core.py Tue Sep 10 19:41:02 2013
@@ -125,8 +125,9 @@ class Module(LLVMObject):
 
     def print_module_to_file(self, filename):
         out = c_char_p(None)
-        result = lib.LLVMPrintModuleToFile(self, filename, byref(out))
-        if not result:
+        # Result is inverted so 0 means everything was ok.
+        result = lib.LLVMPrintModuleToFile(self, filename, byref(out))        
+        if result:
             raise RuntimeError("LLVM Error: %s" % out.value)
 
 class Context(LLVMObject):

Modified: llvm/trunk/bindings/python/llvm/tests/test_core.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/python/llvm/tests/test_core.py?rev=190465&r1=190464&r2=190465&view=diff
==============================================================================
--- llvm/trunk/bindings/python/llvm/tests/test_core.py (original)
+++ llvm/trunk/bindings/python/llvm/tests/test_core.py Tue Sep 10 19:41:02 2013
@@ -37,7 +37,7 @@ class TestCore(TestBase):
 
     def test_create_module_with_name(self):
         # Make sure we can not create a module without a LLVMModuleRef.
-        with self.assertRaises(RuntimeError):
+        with self.assertRaises(TypeError):
             m = Module()
         m = Module.CreateWithName("test-module")
 
@@ -49,7 +49,8 @@ class TestCore(TestBase):
 
     def test_module_getset_target(self):
         m = Module.CreateWithName("test-module")
-        m.target = "thumbv7-apple-ios5.0.0"
+        target = "thumbv7-apple-ios5.0.0"
+        m.target = target
         self.assertEqual(m.target, target)
 
     def test_module_print_module_to_file(self):





More information about the llvm-commits mailing list