summaryrefslogtreecommitdiffstats
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
commit7099558499904e0b308f127ac866a54d6b88f78d (patch)
tree71cc9828560dfea845fe727368368d9d40f5feab
parent5e5b85098dbeaea2cfa5d01695b5d2982634d7dd (diff)
downloadbcm5719-llvm-7099558499904e0b308f127ac866a54d6b88f78d.tar.gz
bcm5719-llvm-7099558499904e0b308f127ac866a54d6b88f78d.zip
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. llvm-svn: 225407
-rw-r--r--lldb/test/lldbinline.py83
-rw-r--r--lldb/test/lldbtest.py10
2 files changed, 46 insertions, 47 deletions
diff --git a/lldb/test/lldbinline.py b/lldb/test/lldbinline.py
index 37c57f39e88..21b716aa049 100644
--- a/lldb/test/lldbinline.py
+++ b/lldb/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/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 84eaf410c0e..80d1d29efc2 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/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
OpenPOWER on IntegriCloud