Skip to content

Commit bfae99c

Browse files
author
Johnny Chen
committed
Modify the test cases (there are a bunch of them) under test/types so that they
employ different executable names when creating the target for lldb to debug. Comparing the log files for the same test case with success/failure results show that the failed one was setting the breakpoint on some different address than the succeeded one, leading us to suspect that the file system maybe think it knows better and caches the wrong executable file (they were all named 'a.out' before) which lldb subsequently reads from. Now './dotest.py -v types' passes without specifying the '-w' option. rdar://problem/9644488 rdar://problem/9649573 llvm-svn: 133649
1 parent 5dc6b79 commit bfae99c

6 files changed

Lines changed: 152 additions & 163 deletions

File tree

lldb/test/types/AbstractBase.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,12 @@ class GenericTester(TestBase):
2020
# Assert message.
2121
DATA_TYPE_GROKKED = "Data type from expr parser output is parsed correctly"
2222

23-
# FIXME: Remove this method when/if we find out the cause of the failures
24-
# if no delays are inserted between test cases.
25-
# def setUp(self):
26-
# # Call super's setUp().
27-
# TestBase.setUp(self)
28-
# # Insert some delay for running test cases under test/types if not
29-
# # already so by the TestBase.setUp().
30-
# if "LLDB_WAIT_BETWEEN_TEST_CASES" not in os.environ:
31-
# #print "some delay, please ...."
32-
# time.sleep(1.0)
33-
34-
def generic_type_tester(self, atoms, quotedDisplay=False):
23+
def generic_type_tester(self, exe_name, atoms, quotedDisplay=False):
3524
"""Test that variables with basic types are displayed correctly."""
3625

3726
# First, capture the golden output emitted by the oracle, i.e., the
3827
# series of printf statements.
39-
go = system("./a.out", sender=self)[0]
28+
go = system("./%s" % exe_name, sender=self)[0]
4029
# This golden list contains a list of (variable, value) pairs extracted
4130
# from the golden output.
4231
gl = []
@@ -54,7 +43,7 @@ def generic_type_tester(self, atoms, quotedDisplay=False):
5443

5544
# Bring the program to the point where we can issue a series of
5645
# 'frame variable -T' command.
57-
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
46+
self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
5847
puts_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables")
5948
self.expect("breakpoint set -f basic_type.cpp -l %d" % puts_line,
6049
BREAKPOINT_CREATED,
@@ -98,12 +87,12 @@ def generic_type_tester(self, atoms, quotedDisplay=False):
9887
self.expect(output, Msg(var, val, True), exe=False,
9988
substrs = [nv])
10089

101-
def generic_type_expr_tester(self, atoms, quotedDisplay=False):
90+
def generic_type_expr_tester(self, exe_name, atoms, quotedDisplay=False):
10291
"""Test that variable expressions with basic types are evaluated correctly."""
10392

10493
# First, capture the golden output emitted by the oracle, i.e., the
10594
# series of printf statements.
106-
go = system("./a.out", sender=self)[0]
95+
go = system("./%s" % exe_name, sender=self)[0]
10796
# This golden list contains a list of (variable, value) pairs extracted
10897
# from the golden output.
10998
gl = []
@@ -121,7 +110,7 @@ def generic_type_expr_tester(self, atoms, quotedDisplay=False):
121110

122111
# Bring the program to the point where we can issue a series of
123112
# 'expr' command.
124-
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
113+
self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
125114
puts_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
126115
self.expect("breakpoint set -f basic_type.cpp -l %d" % puts_line,
127116
BREAKPOINT_CREATED,

lldb/test/types/TestFloatTypes.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,42 @@ class FloatTypesTestCase(AbstractBase.GenericTester):
1212
mydir = "types"
1313

1414
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
15-
def test_float_types_with_dsym(self):
15+
def test_float_type_with_dsym(self):
1616
"""Test that float-type variables are displayed correctly."""
17-
d = {'CXX_SOURCES': 'float.cpp'}
17+
d = {'CXX_SOURCES': 'float.cpp', 'EXE': 'float_type_dsym'}
1818
self.buildDsym(dictionary=d)
1919
self.setTearDownCleanup(dictionary=d)
20-
self.float_type()
20+
self.float_type('float_type_dsym')
2121

2222
def test_float_type_with_dwarf(self):
2323
"""Test that float-type variables are displayed correctly."""
24-
d = {'CXX_SOURCES': 'float.cpp'}
24+
d = {'CXX_SOURCES': 'float.cpp', 'EXE': 'float_type_dwarf'}
2525
self.buildDwarf(dictionary=d)
2626
self.setTearDownCleanup(dictionary=d)
27-
self.float_type()
27+
self.float_type('float_type_dwarf')
2828

2929
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
3030
def test_double_type_with_dsym(self):
3131
"""Test that double-type variables are displayed correctly."""
32-
d = {'CXX_SOURCES': 'double.cpp'}
32+
d = {'CXX_SOURCES': 'double.cpp', 'EXE': 'double_type_dsym'}
3333
self.buildDsym(dictionary=d)
3434
self.setTearDownCleanup(dictionary=d)
35-
self.double_type()
35+
self.double_type('double_type_dsym')
3636

3737
def test_double_type_with_dwarf(self):
3838
"""Test that double-type variables are displayed correctly."""
39-
d = {'CXX_SOURCES': 'double.cpp'}
39+
d = {'CXX_SOURCES': 'double.cpp', 'EXE': 'double_type_dwarf'}
4040
self.buildDwarf(dictionary=d)
4141
self.setTearDownCleanup(dictionary=d)
42-
self.double_type()
42+
self.double_type('double_type_dwarf')
4343

44-
def float_type(self):
44+
def float_type(self, exe_name):
4545
"""Test that float-type variables are displayed correctly."""
46-
self.generic_type_tester(set(['float']))
46+
self.generic_type_tester(exe_name, set(['float']))
4747

48-
def double_type(self):
48+
def double_type(self, exe_name):
4949
"""Test that double-type variables are displayed correctly."""
50-
self.generic_type_tester(set(['double']))
50+
self.generic_type_tester(exe_name, set(['double']))
5151

5252

5353
if __name__ == '__main__':

lldb/test/types/TestFloatTypesExpr.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ class FloatTypesExprTestCase(AbstractBase.GenericTester):
1515
# test/types failures for Test*TypesExpr.py: element offset computed wrong and sign error?
1616

1717
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
18-
def test_float_types_with_dsym(self):
18+
def test_float_type_with_dsym(self):
1919
"""Test that float-type variable expressions are evaluated correctly."""
20-
d = {'CXX_SOURCES': 'float.cpp'}
20+
d = {'CXX_SOURCES': 'float.cpp', 'EXE': 'float_type_dsym'}
2121
self.buildDsym(dictionary=d)
2222
self.setTearDownCleanup(dictionary=d)
23-
self.float_type_expr()
23+
self.float_type_expr('float_type_dsym')
2424

2525
def test_float_type_with_dwarf(self):
2626
"""Test that float-type variable expressions are evaluated correctly."""
27-
d = {'CXX_SOURCES': 'float.cpp'}
27+
d = {'CXX_SOURCES': 'float.cpp', 'EXE': 'float_type_dwarf'}
2828
self.buildDwarf(dictionary=d)
2929
self.setTearDownCleanup(dictionary=d)
30-
self.float_type_expr()
30+
self.float_type_expr('float_type_dwarf')
3131

3232
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
3333
def test_double_type_with_dsym(self):
3434
"""Test that double-type variable expressions are evaluated correctly."""
35-
d = {'CXX_SOURCES': 'double.cpp'}
35+
d = {'CXX_SOURCES': 'double.cpp', 'EXE': 'double_type_dsym'}
3636
self.buildDsym(dictionary=d)
3737
self.setTearDownCleanup(dictionary=d)
38-
self.double_type_expr()
38+
self.double_type_expr('double_type_dsym')
3939

4040
def test_double_type_with_dwarf(self):
4141
"""Test that double-type variable expressions are evaluated correctly."""
42-
d = {'CXX_SOURCES': 'double.cpp'}
42+
d = {'CXX_SOURCES': 'double.cpp', 'EXE': 'double_type_dwarf'}
4343
self.buildDwarf(dictionary=d)
4444
self.setTearDownCleanup(dictionary=d)
45-
self.double_type_expr()
45+
self.double_type_expr('double_type_dwarf')
4646

47-
def float_type_expr(self):
47+
def float_type_expr(self, exe_name):
4848
"""Test that float-type variable expressions are evaluated correctly."""
49-
self.generic_type_expr_tester(set(['float']))
49+
self.generic_type_expr_tester(exe_name, set(['float']))
5050

51-
def double_type_expr(self):
51+
def double_type_expr(self, exe_name):
5252
"""Test that double-type variable expressions are evaluated correctly."""
53-
self.generic_type_expr_tester(set(['double']))
53+
self.generic_type_expr_tester(exe_name, set(['double']))
5454

5555

5656
if __name__ == '__main__':

0 commit comments

Comments
 (0)