test suite reviews and discussions
 help / color / mirror / Atom feed
From: Haiyang Zhao <haiyangx.zhao@intel.com>
To: dts@dpdk.org, lijuan.tu@intel.com
Cc: Haiyang Zhao <haiyangx.zhao@intel.com>
Subject: [dts] [PATCH V1 2/2] framework/excel_reporter: fix issue of msg exceed xlwt maximum cell length
Date: Fri, 13 Nov 2020 18:06:05 +0800	[thread overview]
Message-ID: <20201113100605.20669-3-haiyangx.zhao@intel.com> (raw)
In-Reply-To: <20201113100605.20669-1-haiyangx.zhao@intel.com>

truncate msg length if it exceed xlwt maximun cell
legth in case of saving result failed and DTS terminated.

Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
 framework/excel_reporter.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/excel_reporter.py b/framework/excel_reporter.py
index 5b8e4cf..65d26b6 100644
--- a/framework/excel_reporter.py
+++ b/framework/excel_reporter.py
@@ -167,7 +167,7 @@ class ExcelReporter(object):
                 self.sheet.write(self.row, self.col + 1, result)
             else:
                 self.sheet.write(
-                    self.row, self.col + 1, result, self.failed_style)
+                    self.row, self.col + 1, result if len(result) < 5000 else result[:2000] + '\r\n...\r\n...\r\n...\r\n' + result[-2000:], self.failed_style)
 
     def __write_cases(self, dut, target, suite):
         for case in set(self.result.all_test_cases(dut, target, suite)):
@@ -198,7 +198,7 @@ class ExcelReporter(object):
 
     def __write_failed_target(self, dut, target):
         msg = "TARGET ERROR '%s'" % self.result.target_failed_msg(dut, target)
-        self.sheet.write(self.row, self.col + 4, msg, self.failed_style)
+        self.sheet.write(self.row, self.col + 4, msg if len(msg) < 5000 else msg[:2000] + '\r\n...\r\n...\r\n...\r\n' + msg[-2000:], self.failed_style)
         self.row += 1
 
     def __write_targets(self, dut):
@@ -214,7 +214,7 @@ class ExcelReporter(object):
 
     def __write_failed_dut(self, dut):
         msg = "PREREQ FAILED '%s'" % self.result.dut_failed_msg(dut)
-        self.sheet.write(self.row, self.col + 5, msg, self.failed_style)
+        self.sheet.write(self.row, self.col + 5, msg if len(msg) < 5000 else msg[:2000] + '\r\n...\r\n...\r\n...\r\n' + msg[-2000:], self.failed_style)
         self.row += 1
 
     def __parse_result(self):
-- 
2.17.1


  parent reply	other threads:[~2020-11-13 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 10:06 [dts] [PATCH V1 0/2] framework: fix error msg too long cause saving result failed Haiyang Zhao
2020-11-13 10:06 ` [dts] [PATCH V1 1/2] framework/project_dpdk: drop the detailed errors when complie failed Haiyang Zhao
2020-11-13 10:06 ` Haiyang Zhao [this message]
2020-11-13 10:18 ` [dts] [PATCH V1 0/2] framework: fix error msg too long cause saving result failed Zhao, HaiyangX
2020-11-18  3:26 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201113100605.20669-3-haiyangx.zhao@intel.com \
    --to=haiyangx.zhao@intel.com \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).