From de90f1dd93f2f857629e684e51957fc949599bae Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Wed, 27 Apr 2011 17:43:07 +0000 Subject: [PATCH] Change the rest of lldbutil.py's function names to all lower case formats to be consistent. And modify the test cases accordingly. llvm-svn: 130314 --- lldb/test/array_types/TestArrayTypes.py | 10 +++++----- lldb/test/bitfields/TestBitfields.py | 4 ++-- lldb/test/class_static/TestStaticVariables.py | 4 ++-- lldb/test/class_types/TestClassTypes.py | 6 +++--- lldb/test/expression_command/test/TestExprs.py | 6 +++--- lldb/test/foundation/TestObjCMethods.py | 4 ++-- lldb/test/hello_world/TestHelloWorld.py | 4 ++-- lldb/test/inferior-crashing/TestInferiorCrashing.py | 2 +- lldb/test/lldbtest.py | 6 +++--- lldb/test/lldbutil.py | 8 ++++---- lldb/test/objc-stepping/TestObjCStepping.py | 4 ++-- lldb/test/python_api/lldbutil/TestPrintStackTraces.py | 2 +- lldb/test/python_api/process/TestProcessAPI.py | 4 ++-- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lldb/test/array_types/TestArrayTypes.py b/lldb/test/array_types/TestArrayTypes.py index 8c5c46444ccf..f4540b6c0a91 100644 --- a/lldb/test/array_types/TestArrayTypes.py +++ b/lldb/test/array_types/TestArrayTypes.py @@ -124,9 +124,9 @@ class ArrayTypesTestCase(TestBase): # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # Sanity check the print representation of thread. thr = repr(thread) @@ -201,15 +201,15 @@ class ArrayTypesTestCase(TestBase): # Last, check that "long_6" has a value type of eValueTypeVariableLocal # and "argc" has eValueTypeVariableArgument. - from lldbutil import ValueTypeString + from lldbutil import value_type_to_str self.assertTrue(variable.GetValueType() == lldb.eValueTypeVariableLocal, "Variable 'long_6' should have '%s' value type." % - ValueTypeString(lldb.eValueTypeVariableLocal)) + value_type_to_str(lldb.eValueTypeVariableLocal)) argc = frame.FindVariable("argc") self.DebugSBValue(frame, argc) self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument, "Variable 'argc' should have '%s' value type." % - ValueTypeString(lldb.eValueTypeVariableArgument)) + value_type_to_str(lldb.eValueTypeVariableArgument)) if __name__ == '__main__': diff --git a/lldb/test/bitfields/TestBitfields.py b/lldb/test/bitfields/TestBitfields.py index 3db3a1da54a9..f99c6e6e3bf1 100644 --- a/lldb/test/bitfields/TestBitfields.py +++ b/lldb/test/bitfields/TestBitfields.py @@ -100,9 +100,9 @@ class BitfieldsTestCase(TestBase): # The stop reason of the thread should be breakpoint. thread = target.GetProcess().GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # The breakpoint should have a hit count of 1. self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) diff --git a/lldb/test/class_static/TestStaticVariables.py b/lldb/test/class_static/TestStaticVariables.py index 465607f69141..c9f9fc3bcd80 100644 --- a/lldb/test/class_static/TestStaticVariables.py +++ b/lldb/test/class_static/TestStaticVariables.py @@ -88,9 +88,9 @@ class StaticVariableTestCase(TestBase): # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # Get the SBValue of 'A::g_points' and 'g_points'. frame = thread.GetFrameAtIndex(0) diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py index 68867051226d..a1fdd63df800 100644 --- a/lldb/test/class_types/TestClassTypes.py +++ b/lldb/test/class_types/TestClassTypes.py @@ -129,14 +129,14 @@ class ClassTypesTestCase(TestBase): if self.process.GetState() != lldb.eStateStopped: self.fail("Process should be in the 'stopped' state, " "instead the actual state is: '%s'" % - lldbutil.StateTypeString(self.process.GetState())) + lldbutil.state_type_to_str(self.process.GetState())) # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # The filename of frame #0 should be 'main.cpp' and the line number # should be 93. diff --git a/lldb/test/expression_command/test/TestExprs.py b/lldb/test/expression_command/test/TestExprs.py index ace628c6a9c3..b3dc440c2b06 100644 --- a/lldb/test/expression_command/test/TestExprs.py +++ b/lldb/test/expression_command/test/TestExprs.py @@ -109,14 +109,14 @@ class BasicExprCommandsTestCase(TestBase): if self.process.GetState() != lldb.eStateStopped: self.fail("Process should be in the 'stopped' state, " "instead the actual state is: '%s'" % - lldbutil.StateTypeString(self.process.GetState())) + lldbutil.state_type_to_str(self.process.GetState())) # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # The filename of frame #0 should be 'main.cpp' and function is main. self.expect(lldbutil.get_filenames(thread)[0], diff --git a/lldb/test/foundation/TestObjCMethods.py b/lldb/test/foundation/TestObjCMethods.py index 9485cb57327b..9bbf1c088822 100644 --- a/lldb/test/foundation/TestObjCMethods.py +++ b/lldb/test/foundation/TestObjCMethods.py @@ -220,9 +220,9 @@ class FoundationTestCase(TestBase): # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # Make sure we stopped at the first breakpoint. diff --git a/lldb/test/hello_world/TestHelloWorld.py b/lldb/test/hello_world/TestHelloWorld.py index e6c7bd3f21ab..fd7c7e3013aa 100644 --- a/lldb/test/hello_world/TestHelloWorld.py +++ b/lldb/test/hello_world/TestHelloWorld.py @@ -71,9 +71,9 @@ class HelloWorldTestCase(TestBase): thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # The breakpoint should have a hit count of 1. self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) diff --git a/lldb/test/inferior-crashing/TestInferiorCrashing.py b/lldb/test/inferior-crashing/TestInferiorCrashing.py index 45b090db99a2..66d697983864 100644 --- a/lldb/test/inferior-crashing/TestInferiorCrashing.py +++ b/lldb/test/inferior-crashing/TestInferiorCrashing.py @@ -64,7 +64,7 @@ class CrashingInferiorTestCase(TestBase): if self.process.GetState() != lldb.eStateStopped: self.fail("Process should be in the 'stopped' state, " "instead the actual state is: '%s'" % - lldbutil.StateTypeString(self.process.GetState())) + lldbutil.state_type_to_str(self.process.GetState())) thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonException) if not thread: diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 5d85c7bfac3c..583cf14a3261 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -863,7 +863,7 @@ class TestBase(unittest2.TestCase): thread = process.GetThreadAtIndex(0) SR = thread.GetStopReason() with recording(self, trace) as sbuf: - print >> sbuf, "StopReason =", StopReasonString(SR) + print >> sbuf, "StopReason =", stop_reason_to_str(SR) if SR == StopReasonEnum("Breakpoint"): frame = thread.GetFrameAtIndex(0) @@ -932,7 +932,7 @@ class TestBase(unittest2.TestCase): def DebugSBValue(self, frame, val): """Debug print a SBValue object, if traceAlways is True.""" - from lldbutil import ValueTypeString + from lldbutil import value_type_to_str if not traceAlways: return @@ -943,7 +943,7 @@ class TestBase(unittest2.TestCase): err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n') err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n') err.write('\t' + "Value -> " + str(val.GetValue(frame)) + '\n') - err.write('\t' + "ValueType -> " + ValueTypeString(val.GetValueType()) + '\n') + err.write('\t' + "ValueType -> " + value_type_to_str(val.GetValueType()) + '\n') err.write('\t' + "Summary -> " + str(val.GetSummary(frame)) + '\n') err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n') err.write('\t' + "Location -> " + val.GetLocation(frame) + '\n') diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py index 34d8aae48660..948fe469478c 100644 --- a/lldb/test/lldbutil.py +++ b/lldb/test/lldbutil.py @@ -166,7 +166,7 @@ def get_description(obj, option=None): # Convert some enum value to its string counterpart # ================================================= -def StateTypeString(enum): +def state_type_to_str(enum): """Returns the stateType string given an enum.""" if enum == lldb.eStateInvalid: return "invalid" @@ -195,7 +195,7 @@ def StateTypeString(enum): else: raise Exception("Unknown StateType enum") -def StopReasonString(enum): +def stop_reason_to_str(enum): """Returns the stopReason string given an enum.""" if enum == lldb.eStopReasonInvalid: return "invalid" @@ -216,7 +216,7 @@ def StopReasonString(enum): else: raise Exception("Unknown StopReason enum") -def ValueTypeString(enum): +def value_type_to_str(enum): """Returns the valueType string given an enum.""" if enum == lldb.eValueTypeInvalid: return "invalid" @@ -404,7 +404,7 @@ def print_stacktrace(thread, string_buffer = False): addrs = get_pc_addresses(thread) if thread.GetStopReason() != lldb.eStopReasonInvalid: - desc = "stop reason=" + StopReasonString(thread.GetStopReason()) + desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason()) else: desc = "" print >> output, "Stack trace for thread id={0:#x} name={1} queue={2} ".format( diff --git a/lldb/test/objc-stepping/TestObjCStepping.py b/lldb/test/objc-stepping/TestObjCStepping.py index 86481fc28dae..a0ea86890f66 100644 --- a/lldb/test/objc-stepping/TestObjCStepping.py +++ b/lldb/test/objc-stepping/TestObjCStepping.py @@ -71,9 +71,9 @@ class TestObjCStepping(TestBase): # The stop reason of the thread should be breakpoint. thread = self.process.GetThreadAtIndex(0) if thread.GetStopReason() != lldb.eStopReasonBreakpoint: - from lldbutil import StopReasonString + from lldbutil import stop_reason_to_str self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS % - StopReasonString(thread.GetStopReason())) + stop_reason_to_str(thread.GetStopReason())) # Make sure we stopped at the first breakpoint. diff --git a/lldb/test/python_api/lldbutil/TestPrintStackTraces.py b/lldb/test/python_api/lldbutil/TestPrintStackTraces.py index 22b8d263f28d..cdd8c41b1b24 100644 --- a/lldb/test/python_api/lldbutil/TestPrintStackTraces.py +++ b/lldb/test/python_api/lldbutil/TestPrintStackTraces.py @@ -44,7 +44,7 @@ class ThreadsStackTracesTestCase(TestBase): if self.process.GetState() != lldb.eStateStopped: self.fail("Process should be in the 'stopped' state, " "instead the actual state is: '%s'" % - lldbutil.StateTypeString(self.process.GetState())) + lldbutil.state_type_to_str(self.process.GetState())) if self.TraceOn(): lldbutil.print_stacktraces(self.process) diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index 6b227b1ae47a..a2f432afe84a 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -5,7 +5,7 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. import os, time import unittest2 import lldb -from lldbutil import get_stopped_thread, StateTypeString +from lldbutil import get_stopped_thread, state_type_to_str from lldbtest import * class ProcessAPITestCase(TestBase): @@ -258,7 +258,7 @@ class ProcessAPITestCase(TestBase): process = target.Launch (self.dbg.GetListener(), None, None, os.ctermid(), os.ctermid(), os.ctermid(), None, 0, False, error) if self.TraceOn(): - print "process state:", StateTypeString(process.GetState()) + print "process state:", state_type_to_str(process.GetState()) self.assertTrue(process.GetState() != lldb.eStateConnected) success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)