Skip to content

Commit

Permalink
Check before using platform specific attributes.
Browse files Browse the repository at this point in the history
Summary: `os.uname` in TestUniversal and `os.geteuid` in TestTerminal.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 239135
  • Loading branch information
chaoren committed Jun 5, 2015
1 parent 2d45554 commit 52cf8ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lldb/test/functionalities/tty/TestTerminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lldb/test/macosx/universal/TestUniversal.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def setUp(self):

@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.
Expand All @@ -36,7 +37,8 @@ def test_sbdebugger_create_target_with_file_and_target_triple(self):
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
Expand Down

0 comments on commit 52cf8ec

Please sign in to comment.