[Lldb-commits] [lldb] r114926 - in /lldb/trunk/test/types: AbstractBase.py TestBasicTypes.py TestFloatTypes.py TestIntegerTypes.py
Johnny Chen
johnny.chen at apple.com
Mon Sep 27 16:46:46 PDT 2010
Author: johnny
Date: Mon Sep 27 18:46:46 2010
New Revision: 114926
URL: http://llvm.org/viewvc/llvm-project?rev=114926&view=rev
Log:
Use a better name for the abstract base class which contains the generic_type_tester()
method. Renamed it to be AbstractBase.py, which contains the GenericTester class that
both IntegerTypesTestCase and FloatTypesTestCase inherit from.
Added:
lldb/trunk/test/types/AbstractBase.py
- copied, changed from r114923, lldb/trunk/test/types/TestBasicTypes.py
Removed:
lldb/trunk/test/types/TestBasicTypes.py
Modified:
lldb/trunk/test/types/TestFloatTypes.py
lldb/trunk/test/types/TestIntegerTypes.py
Copied: lldb/trunk/test/types/AbstractBase.py (from r114923, lldb/trunk/test/types/TestBasicTypes.py)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?p2=lldb/trunk/test/types/AbstractBase.py&p1=lldb/trunk/test/types/TestBasicTypes.py&r1=114923&r2=114926&rev=114926&view=diff
==============================================================================
--- lldb/trunk/test/types/TestBasicTypes.py (original)
+++ lldb/trunk/test/types/AbstractBase.py Mon Sep 27 18:46:46 2010
@@ -10,7 +10,7 @@
def Msg(var, val):
return "'frame variable %s' matches the compiler's output: %s" % (var, val)
-class AbstractBase(TestBase):
+class GenericTester(TestBase):
# This is the pattern by design to match the " var = 'value'" output from
# printf() stmts (see basic_type.cpp).
Removed: lldb/trunk/test/types/TestBasicTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestBasicTypes.py?rev=114925&view=auto
==============================================================================
--- lldb/trunk/test/types/TestBasicTypes.py (original)
+++ lldb/trunk/test/types/TestBasicTypes.py (removed)
@@ -1,87 +0,0 @@
-"""
-Abstract base class of basic types provides a generic type tester method.
-"""
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-
-def Msg(var, val):
- return "'frame variable %s' matches the compiler's output: %s" % (var, val)
-
-class AbstractBase(TestBase):
-
- # This is the pattern by design to match the " var = 'value'" output from
- # printf() stmts (see basic_type.cpp).
- pattern = re.compile(" (\*?a[^=]*) = '([^=]*)'$")
-
- def generic_type_tester(self, atoms, quotedDisplay=False):
- """Test that variables with basic types are displayed correctly."""
-
- # First, capture the golden output emitted by the oracle, i.e., the
- # series of printf statements.
- go = system("./a.out")
- # This golden list contains a list of (variable, value) pairs extracted
- # from the golden output.
- gl = []
-
- # Scan the golden output line by line, looking for the pattern:
- #
- # variable = 'value'
- #
- # Filter out the following lines, for the time being:
- #
- # 'a_ref = ...'
- # 'a_class_ref.m_a = ...'
- # 'a_class_ref.m_b = ...'
- # 'a_struct_ref.a = ...'
- # 'a_struct_ref.b = ...'
- # 'a_union_zero_ref.a = ...'
- # 'a_union_nonzero_ref.u.a = ...'
- #
- # rdar://problem/8471016 frame variable a_ref should display the referenced value as well
- # rdar://problem/8470987 frame variable a_class_ref.m_a does not work
- notnow = set(['a_ref',
- 'a_class_ref.m_a', 'a_class_ref.m_b',
- 'a_struct_ref.a', 'a_struct_ref.b',
- 'a_union_zero_ref.a', 'a_union_nonzero_ref.u.a'])
- for line in go.split(os.linesep):
- match = self.pattern.search(line)
- if match:
- var, val = match.group(1), match.group(2)
- if var in notnow:
- continue
- gl.append((var, val))
- #print "golden list:", gl
-
- # Bring the program to the point where we can issue a series of
- # 'frame variable' command.
- self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.runCmd("breakpoint set --name Puts")
- self.runCmd("run", RUN_SUCCEEDED)
- self.runCmd("thread step-out", STEP_OUT_SUCCEEDED)
-
- #self.runCmd("frame variable")
-
- # Now iterate through the golden list, comparing against the output from
- # 'frame variable var'.
- for var, val in gl:
- self.runCmd("frame variable %s" % var)
- output = self.res.GetOutput()
-
- # The input type is in a canonical form as a set named atoms.
- # The display type string must conatin each and every element.
- dt = re.match("^\((.*)\)", output).group(1)
-
- # Expect the display type string to contain each and every atoms.
- self.expect(dt,
- "Display type: '%s' must contain the type atoms: '%s'" %
- (dt, atoms),
- exe=False,
- substrs = list(atoms))
-
- # The (var, val) pair must match, too.
- nv = (" %s = '%s'" if quotedDisplay else " %s = %s") % (var, val)
- self.expect(output, Msg(var, val), exe=False,
- substrs = [nv])
Modified: lldb/trunk/test/types/TestFloatTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestFloatTypes.py?rev=114926&r1=114925&r2=114926&view=diff
==============================================================================
--- lldb/trunk/test/types/TestFloatTypes.py (original)
+++ lldb/trunk/test/types/TestFloatTypes.py Mon Sep 27 18:46:46 2010
@@ -2,11 +2,11 @@
Test that variables of floating point types are displayed correctly.
"""
-import TestBasicTypes
+import AbstractBase
import unittest2
import lldb
-class FloatTypesTestCase(TestBasicTypes.AbstractBase):
+class FloatTypesTestCase(AbstractBase.GenericTester):
mydir = "types"
Modified: lldb/trunk/test/types/TestIntegerTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestIntegerTypes.py?rev=114926&r1=114925&r2=114926&view=diff
==============================================================================
--- lldb/trunk/test/types/TestIntegerTypes.py (original)
+++ lldb/trunk/test/types/TestIntegerTypes.py Mon Sep 27 18:46:46 2010
@@ -2,11 +2,11 @@
Test that variables of integer basic types are displayed correctly.
"""
-import TestBasicTypes
+import AbstractBase
import unittest2
import lldb
-class IntegerTypesTestCase(TestBasicTypes.AbstractBase):
+class IntegerTypesTestCase(AbstractBase.GenericTester):
mydir = "types"
More information about the lldb-commits
mailing list