[Fuego] [PATCH] ftc: add support for --header_fields and --fields to gen-report

Tim.Bird at sony.com Tim.Bird at sony.com
Thu Mar 8 19:18:23 UTC 2018


Allow options for specifying header_fields and fields (via
a comma-separated field list for each one) for the report.
This allows for very flexible customization of the report
contents.

Signed-off-by: Tim Bird <tim.bird at sony.com>
---
 engine/scripts/ftc | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index b6073fd..78d36f3 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -296,6 +296,8 @@ the 'foo' function from the board file, you would use do this:
 "gen-report":("Generate a report from a set of runs",
     """Usage: ftc gen-report [--where <where-clause1>[,<where_clausen>]...] \\
             [--format [txt|html|pdf|excel|csv]] \\
+            [--header_fields <field_list>] \\
+            [--fields <field_list>] \\
             [--layout <report_name>]
 
   Generates a report from test run data as specified.  The where option
@@ -315,6 +317,15 @@ the 'foo' function from the board file, you would use do this:
      --where test=bonnie,board=beaglebone
      --where "start_time>2 hours ago"
      --where batch_id=12
+
+  The --header_fields and --fields options allow specifying a list of
+  field names (comma-separated) for inclusion in the header and body
+  of the report, respectively.  The default field lists, if none are
+  specified are: (for headers) test,board,kernel,timestamp,report_date
+  and (for fields) test_name,spec,board,timestamp,tguid,tguid:result.
+
+  Here is an example:
+    ftc gen-report --header_fields test --fields timestamp,tguid,tguid:result
   """),
 
 "wait-for":("Wait for a condition to be true.",
@@ -2182,9 +2193,19 @@ def do_gen_report(conf, options):
         error_out("Layouts not handled yet!")
 
     else:
-        header_fields = ["test", "board", "kernel", "timestamp",
-            "report_date"]
-        fields = ["test_name", "spec", "board", "timestamp", "tguid", "tguid:result"]
+        if "--header_fields" in options:
+            headers_str = options[options.index("--header_fields")+1]
+            header_fields = [field.strip() for field in headers_str.split(",")]
+        else:
+            header_fields = ["test", "board", "kernel", "timestamp",
+                "report_date"]
+        if "--fields" in options:
+            fields_str = options[options.index("--fields")+1]
+            fields = [field.strip() for field in fields_str.split(",")]
+        else:
+            fields = ["test_name", "spec", "board", "timestamp", "tguid", "tguid:result"]
+
+        # other example field lists
         #fields = ["test_name", "spec", "board", "timestamp", "tguid", "status"]
         #rfields = ["test_name", "spec", "board", "timestamp", "tguid", "tguid:measure", "tguid:unit", "tguid:status", "tguid:result"]
 
-- 
1.9.1



More information about the Fuego mailing list