[Fuego] [PATCH 1/2] ftc: gen_report: should check run_list is not null, earlier

Hoang Van Tuyen tuyen.hoangvan at toshiba-tsdv.com
Thu Feb 22 10:50:26 UTC 2018


In the future, We will support several other report formats (like html, 
pdf, ...).
We should check the run_list is null or not in do_gen_report function, 
not in the
gen_text_report function.

Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
---
  engine/scripts/ftc | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index bde3694..44e4da7 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -1857,11 +1857,6 @@ def gen_text_report(run_list, run_map, 
header_fields, fields):
      report += "           **** %s ****\n" % title
      report_date = time.strftime("%Y-%m-%d_%H:%M:%S")

-    if not run_list:
-        report += "  *** No runs to report, based on requested/filtered 
runs ***\n"
-        report += ddash_line
-        return report
-
      for field in header_fields:
          if field=="report_date":
              val_str = time.strftime("%Y-%m-%d_%H:%M:%S")
@@ -1969,6 +1964,9 @@ def do_gen_report(conf, options):
      else:
          run_list = run_map.keys()

+    if not run_list:
+        error_out ('No runs to report, based on requested/filtered runs')
+
      run_list.sort()

      fmt="txt"
-- 
2.1.4



-- 
================================================================
Hoang Van Tuyen (Mr.)
TOSHIBA SOFTWARE DEVELOPMENT (VIETNAM) CO., LTD.
16th Floor, VIT Building, 519 Kim Ma Str., Ba Dinh Dist., Hanoi, Vietnam
Tel: 84-4-22208801 (Company) - Ext.251
Fax: 84-4-22208802 (Company)
Email: tuyen.hoangvan at toshiba-tsdv.com
================================================================

-------------- next part --------------
From a07e132c66cdf4050860479a9551d53afc377fa7 Mon Sep 17 00:00:00 2001
From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
Date: Mon, 12 Feb 2018 11:36:53 +0700
Subject: [PATCH 1/2] ftc: gen_report: should check run_list is not null
 earlier

In the future, We will support several other report formats (like html, pdf, ...).
We should check the run_list is null or not in do_gen_report function, not in the
gen_text_report function.

Signed-off-by: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
---
 engine/scripts/ftc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index bde3694..44e4da7 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -1857,11 +1857,6 @@ def gen_text_report(run_list, run_map, header_fields, fields):
     report += "           **** %s ****\n" % title
     report_date = time.strftime("%Y-%m-%d_%H:%M:%S")
 
-    if not run_list:
-        report += "  *** No runs to report, based on requested/filtered runs ***\n"
-        report += ddash_line
-        return report
-
     for field in header_fields:
         if field=="report_date":
             val_str = time.strftime("%Y-%m-%d_%H:%M:%S")
@@ -1969,6 +1964,9 @@ def do_gen_report(conf, options):
     else:
         run_list = run_map.keys()
 
+    if not run_list:
+        error_out ('No runs to report, based on requested/filtered runs')
+
     run_list.sort()
 
     fmt="txt"
-- 
2.1.4
-------------- next part --------------
-- 
This mail was scanned by BitDefender
For more information please visit http://www.bitdefender.com


More information about the Fuego mailing list