summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-01-07 22:25:50 +0000
committerGreg Clayton <gclayton@apple.com>2015-01-07 22:25:50 +0000
commitbeaf434a0daf074e833aac0bdad9dd3254fdd2e3 (patch)
tree8e9eb83bc757172f3ec95db758526476f5a07ef8
parentededbc19cf40d452b9f17cda8fa041e605d533a4 (diff)
Fix inlined test cases so they print out the correct command to run when they fail instead of printing out incorrect information.
To fix this I added a new method to TestBase: def getRerunArgs(self): return " -f %s.%s" % (self.__class__.__name__, self._testMethodName) The InlineTest which inherits from TestBase then overrides this function with a custom version which does the right thing. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225407 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/lldbinline.py83
-rw-r--r--test/lldbtest.py10
2 files changed, 46 insertions, 47 deletions
diff --git a/test/lldbinline.py b/test/lldbinline.py
index 37c57f39e..21b716aa0 100644
--- a/test/lldbinline.py
+++ b/test/lldbinline.py
@@ -66,63 +66,63 @@ class CommandParser:
test.execute_user_command(breakpoint['command'])
return
-def BuildMakefile(mydir):
- if os.path.exists("Makefile"):
- return
+class InlineTest(TestBase):
+ # Internal implementation
- categories = {}
+ def getRerunArgs(self):
+ # The -N option says to NOT run a if it matches the option argument, so
+ # if we are using dSYM we say to NOT run dwarf (-N dwarf) and vice versa.
+ if self.using_dsym:
+ return "-N dwarf %s" % (self.mydir)
+ else:
+ return "-N dsym %s" % (self.mydir)
+
+ def BuildMakefile(self):
+ if os.path.exists("Makefile"):
+ return
- for f in os.listdir(os.getcwd()):
- t = source_type(f)
- if t:
- if t in categories.keys():
- categories[t].append(f)
- else:
- categories[t] = [f]
+ categories = {}
- makefile = open("Makefile", 'w+')
+ for f in os.listdir(os.getcwd()):
+ t = source_type(f)
+ if t:
+ if t in categories.keys():
+ categories[t].append(f)
+ else:
+ categories[t] = [f]
- level = os.sep.join([".."] * len(mydir.split(os.sep))) + os.sep + "make"
+ makefile = open("Makefile", 'w+')
- makefile.write("LEVEL = " + level + "\n")
-
- for t in categories.keys():
- line = t + " := " + " ".join(categories[t])
- makefile.write(line + "\n")
+ level = os.sep.join([".."] * len(self.mydir.split(os.sep))) + os.sep + "make"
- if ('OBJCXX_SOURCES' in categories.keys()) or ('OBJC_SOURCES' in categories.keys()):
- makefile.write("LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
+ makefile.write("LEVEL = " + level + "\n")
- if ('CXX_SOURCES' in categories.keys()):
- makefile.write("CXXFLAGS += -std=c++11\n")
+ for t in categories.keys():
+ line = t + " := " + " ".join(categories[t])
+ makefile.write(line + "\n")
- makefile.write("include $(LEVEL)/Makefile.rules\n")
- makefile.flush()
- makefile.close()
+ if ('OBJCXX_SOURCES' in categories.keys()) or ('OBJC_SOURCES' in categories.keys()):
+ makefile.write("LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
-def CleanMakefile():
- # Do nothing for now, since the Makefile on disk could be checked into the repo.
- pass
+ if ('CXX_SOURCES' in categories.keys()):
+ makefile.write("CXXFLAGS += -std=c++11\n")
-class InlineTest(TestBase):
- # Internal implementation
+ makefile.write("include $(LEVEL)/Makefile.rules\n")
+ makefile.flush()
+ makefile.close()
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
- def buildDsymWithImplicitMakefile(self):
- BuildMakefile(self.mydir)
- self.buildDsym()
-
- def buildDwarfWithImplicitMakefile(self):
- BuildMakefile(self.mydir)
- self.buildDwarf()
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def __test_with_dsym(self):
- self.buildDsymWithImplicitMakefile()
+ self.using_dsym = True
+ self.BuildMakefile()
+ self.buildDsym()
self.do_test()
def __test_with_dwarf(self):
- self.buildDwarfWithImplicitMakefile()
+ self.using_dsym = False
+ self.BuildMakefile()
+ self.buildDwarf()
self.do_test()
def execute_user_command(self, __command):
@@ -146,9 +146,6 @@ class InlineTest(TestBase):
parser.handle_breakpoint(self, breakpoint_id)
process.Continue()
- @classmethod
- def classCleanup(cls):
- CleanMakefile()
# Utilities for testcases
diff --git a/test/lldbtest.py b/test/lldbtest.py
index 84eaf410c..80d1d29ef 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -1167,6 +1167,9 @@ class Base(unittest2.TestCase):
else:
print >> sbuf, "unexpected success (problem id:" + str(bugnumber) + ")"
+ def getRerunArgs(self):
+ return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
+
def dumpSessionInfo(self):
"""
Dump the debugger interactions leading to a test error/failure. This
@@ -1229,10 +1232,9 @@ class Base(unittest2.TestCase):
print >> f, "Session info generated @", datetime.datetime.now().ctime()
print >> f, self.session.getvalue()
print >> f, "To rerun this test, issue the following command from the 'test' directory:\n"
- print >> f, "./dotest.py %s -v %s -f %s.%s" % (self.getRunOptions(),
- ('+b' if benchmarks else '-t'),
- self.__class__.__name__,
- self._testMethodName)
+ print >> f, "./dotest.py %s -v %s %s" % (self.getRunOptions(),
+ ('+b' if benchmarks else '-t'),
+ self.getRerunArgs())
# ====================================================
# Config. methods supported through a plugin interface