[Lldb-commits] [lldb] r239135 - Check before using platform specific attributes.

Chaoren Lin chaorenl at google.com
Thu Jun 4 23:28:43 PDT 2015


Author: chaoren
Date: Fri Jun  5 01:28:43 2015
New Revision: 239135

URL: http://llvm.org/viewvc/llvm-project?rev=239135&view=rev
Log:
Check before using platform specific attributes.

Summary: `os.uname` in TestUniversal and `os.geteuid` in TestTerminal.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10202

Modified:
    lldb/trunk/test/functionalities/tty/TestTerminal.py
    lldb/trunk/test/macosx/universal/TestUniversal.py

Modified: lldb/trunk/test/functionalities/tty/TestTerminal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/tty/TestTerminal.py?rev=239135&r1=239134&r2=239135&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/tty/TestTerminal.py (original)
+++ lldb/trunk/test/functionalities/tty/TestTerminal.py Fri Jun  5 01:28:43 2015
@@ -20,7 +20,8 @@ class LaunchInTerminalTestCase(TestBase)
 
     # If the test is being run under sudo, the spawned terminal won't retain that elevated
     # privilege so it can't open the socket to talk back to the test case
-    @unittest2.skipUnless(os.geteuid() != 0, "test cannot be run as root")
+    @unittest2.skipUnless(not hasattr(os, 'geteuid') or os.geteuid() != 0,
+            "test cannot be run as root")
 
     # Do we need to disable this test if the testsuite is being run on a remote system?
     # This env var is only defined when the shell is running in a local mac terminal window

Modified: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=239135&r1=239134&r2=239135&view=diff
==============================================================================
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py Fri Jun  5 01:28:43 2015
@@ -18,7 +18,8 @@ class UniversalTestCase(TestBase):
 
     @python_api_test
     @skipUnlessDarwin
-    @unittest2.skipUnless(os.uname()[4] in ['i386', 'x86_64'], "requires i386 or x86_64")
+    @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
+            "requires i386 or x86_64")
     def test_sbdebugger_create_target_with_file_and_target_triple(self):
         """Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
         # Invoke the default build rule.
@@ -36,7 +37,8 @@ class UniversalTestCase(TestBase):
         self.assertTrue(process, PROCESS_IS_VALID)
 
     @skipUnlessDarwin
-    @unittest2.skipUnless(os.uname()[4] in ['i386', 'x86_64'], "requires i386 or x86_64")
+    @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
+            "requires i386 or x86_64")
     def test_process_launch_for_universal(self):
         """Test process launch of a universal binary."""
         from lldbutil import print_registers





More information about the lldb-commits mailing list