[Fuego] [PATCH 1/3] ftc: gen-report: Add support getting report_dir from -o, option

Hoang Van Tuyen tuyen.hoangvan at toshiba-tsdv.com
Tue Mar 13 10:15:48 UTC 2018


The default value of report_dir is /fuego-rw/reports/.
Now, We can use -o option to override the report_dir variable

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

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index 3263fe6..7fa0333 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -299,6 +299,7 @@ the 'foo' function from the board file, you would 
use do this:
              [--header_fields <field_list>] \\
              [--fields <field_list>] \\
              [--layout <report_name>]
+            [-o report_dir]

    Generates a report from test run data as specified.  The where option
    controls which runs are included in the report.  The format option 
controls
@@ -2225,8 +2226,17 @@ def do_gen_report(conf, options):

      # create a directory to save report files
      report_dir = "/fuego-rw/reports/"
-    if not os.path.exists(report_dir):
-        os.makedirs(report_dir)
+    if "-o" in options:
+        report_dir = options[options.index("-o")+1]
+        options.remove(report_dir)
+        options.remove("-o")
+    try:
+        if not os.path.isdir(report_dir):
+            os.mkdir(report_dir)
+    except:
+        # Sometimes value of report_dir exists like a file or something 
which
+        # make we cannot create a directory.
+        error_out("Invalid report directory '%s'" % report_dir)

      # get data for report
      header_data = get_report_header_data(run_list, run_map, header_fields)
-- 
2.1.4

_______________________________________________
Fuego mailing list
Fuego at lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/fuego

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/fuego/attachments/20180313/7f5fd5c4/attachment.html>
-------------- next part --------------
From df5b8804a6352149100e6380c05d6547779df93f Mon Sep 17 00:00:00 2001
From: Hoang Van Tuyen <tuyen.hoangvan at toshiba-tsdv.com>
Date: Tue, 13 Mar 2018 14:40:21 +0700
Subject: [PATCH 1/3] ftc: gen-report: Add support getting report_dir from -o
 option

The default value of report_dir is /fuego-rw/reports/.
Now, We can use -o option to override the report_dir variable

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

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index 3263fe6..7fa0333 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -299,6 +299,7 @@ the 'foo' function from the board file, you would use do this:
             [--header_fields <field_list>] \\
             [--fields <field_list>] \\
             [--layout <report_name>]
+            [-o report_dir]
 
   Generates a report from test run data as specified.  The where option
   controls which runs are included in the report.  The format option controls
@@ -2225,8 +2226,17 @@ def do_gen_report(conf, options):
 
     # create a directory to save report files
     report_dir = "/fuego-rw/reports/"
-    if not os.path.exists(report_dir):
-        os.makedirs(report_dir)
+    if "-o" in options:
+        report_dir = options[options.index("-o")+1]
+        options.remove(report_dir)
+        options.remove("-o")
+    try:
+        if not os.path.isdir(report_dir):
+            os.mkdir(report_dir)
+    except:
+        # Sometimes value of report_dir exists like a file or something which
+        # make we cannot create a directory.
+        error_out("Invalid report directory '%s'" % report_dir)
 
     # get data for report
     header_data = get_report_header_data(run_list, run_map, header_fields)
-- 
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