Print out logs in more failure cases.
authorTim Newsome <tim@sifive.com>
Thu, 13 Jul 2017 03:26:21 +0000 (20:26 -0700)
committerTim Newsome <tim@sifive.com>
Thu, 13 Jul 2017 03:26:21 +0000 (20:26 -0700)
debug/testlib.py

index c44a763f212837bfe509e941a07d36f303f19d0a..ce2ec2e16d7675b4c410bde62986753663aa1ffc 100644 (file)
@@ -540,8 +540,15 @@ class BaseTest(object):
     def classSetup(self):
         self.compile()
         self.target_process = self.target.create()
-        self.server = self.target.server()
-        self.logs.append(self.server.logname)
+        if self.target_process:
+            self.logs.append(self.target_process.logname)
+        try:
+            self.server = self.target.server()
+            self.logs.append(self.server.logname)
+        except Exception:
+            for log in self.logs:
+                print_log(log)
+            raise
 
     def classTeardown(self):
         del self.server
@@ -564,9 +571,8 @@ class BaseTest(object):
 
         self.start = time.time()
 
-        self.classSetup()
-
         try:
+            self.classSetup()
             self.setup()
             result = self.test()    # pylint: disable=no-member
         except TestNotApplicable: