All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
To: fuego@lists.linuxfoundation.org
Subject: [Fuego] [PATCH 1/3] dynvars: add support for simple variable assignments
Date: Fri,  5 Oct 2018 10:30:53 +0900	[thread overview]
Message-ID: <1538703055-9252-2-git-send-email-daniel.sangorrin@toshiba.co.jp> (raw)
In-Reply-To: <1538703055-9252-1-git-send-email-daniel.sangorrin@toshiba.co.jp>

Before dynamic-vars require a python dictionary style notation
to define dynamic variables. This was an overkill for simple
variable assignments, as Tim noted. For that reason, this patch
introduces support for simple variable assignments in the
form of "VAR1=VALUE1,VAR2=VALUE2". Internally, these are parsed
and converted into a python dictionary.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
---
 engine/scripts/ftc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index 4ab4ef2..23f09ca 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -243,7 +243,7 @@ You can obtain a list of run_ids for runs on the local system with
     """Usage: ftc run-test -b <board> -t <test> [-s <spec>] [-p <phases>]
     [-k <kill timeout>] [--rebuild <true|false>] [--reboot <true|false>]
     [--precleanup <true|false>] [--postcleanup <true|false>]
-    [--dynamic-vars python_dict]
+    [--dynamic-vars variable assignments or python_dict]
 Run the indicated test on the specified board.  Use the
 indicated spec, if one is provided.
 
@@ -254,6 +254,7 @@ reboot: if true reboot the board before the test.
 precleanup: if true clean the board's test folder before the test.
 postcleanup: if true clean the board's test folder after the test.
 dynamic-vars: allows overriding the variables in a spec from the command line.
+  Example: ftc run-test -b bbb -t Functional.bc -s bc-add --dynamic-vars "EXPR=3+4,RESULT=7"
   Example: ftc run-test -b bbb -t Benchmark.Dhrystone --dynamic-vars "{'LOOPS':'400000000'}"
 
 A list of phase characters may be provided, to execute only those phases
@@ -3366,9 +3367,16 @@ def do_run_test(conf, options):
 
     if '--dynamic-vars' in options:
         try:
-            import ast
             dyn_vars_str = options[options.index('--dynamic-vars') + 1]
-            dyn_vars = ast.literal_eval(dyn_vars_str)
+            if dyn_vars_str[0] == '{':
+                import ast
+                dyn_vars = ast.literal_eval(dyn_vars_str)
+            else:
+                dyn_vars = dict()
+                for var_definition in dyn_vars_str.split(','):
+                    key = var_definition.split('=')[0]
+                    value = var_definition.split('=')[1]
+                    dyn_vars[key] = value
         except IndexError:
             error_out('Dynamic vars not provided after --dynamic-vars.')
         options.remove(dyn_vars_str)
-- 
2.7.4


  reply	other threads:[~2018-10-05  1:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05  1:30 [Fuego] A few fixes and a bug report Daniel Sangorrin
2018-10-05  1:30 ` Daniel Sangorrin [this message]
2018-10-06  1:17   ` [Fuego] [PATCH 1/3] dynvars: add support for simple variable assignments Tim.Bird
2018-10-05  1:30 ` [Fuego] [PATCH 2/3] run-test: use makedirs instead of mkdir Daniel Sangorrin
2018-10-06  1:16   ` Tim.Bird
2018-10-05  1:30 ` [Fuego] [PATCH 3/3] ovgen: remove test spec strip and generation code Daniel Sangorrin
2018-10-06  1:15   ` Tim.Bird
2018-10-05  1:39 ` [Fuego] A few fixes and a bug report Tim.Bird

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=1538703055-9252-2-git-send-email-daniel.sangorrin@toshiba.co.jp \
    --to=daniel.sangorrin@toshiba.co.jp \
    --cc=fuego@lists.linuxfoundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.