test suite reviews and discussions
 help / color / mirror / Atom feed
From: ohilyard@iol.unh.edu
To: lijuan.tu@intel.com
Cc: dts@dpdk.org, Owen Hilyard <ohilyard@iol.unh.edu>
Subject: [dts] [PATCH] framework/config: fix issue with string values
Date: Fri, 25 Jun 2021 09:07:52 -0400
Message-ID: <20210625130753.18155-1-ohilyard@iol.unh.edu> (raw)

From: Owen Hilyard <ohilyard@iol.unh.edu>

String values were ran through 'eval' like everything else as part of
parsing config files. This will work the first time if there are quotes
around the value, but if the --update-expected flag is passed, it will
re-write the config file without quotes around the string value. This
then cause an error when the value is 'eval'ed again, since it will now
be evaluated as a variable.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
 framework/config.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/config.py b/framework/config.py
index 30604773..88ae8ea5 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -147,7 +147,10 @@ class SuiteConf(UserConf):
         conf = dict(case_confs)
         for key, data_string in list(conf.items()):
-            case_cfg[key] = eval(data_string)
+            try:
+                case_cfg[key] = eval(data_string)
+            except NameError:  # happens when data_string is actually a string, not an int, bool or dict
+                case_cfg[key] = data_string
         return case_cfg

             reply	other threads:[~2021-06-25 13:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 13:07 ohilyard [this message]
2021-07-01  8:49 ` 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:

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

  git send-email \
    --in-reply-to=20210625130753.18155-1-ohilyard@iol.unh.edu \
    --to=ohilyard@iol.unh.edu \
    --cc=dts@dpdk.org \
    --cc=lijuan.tu@intel.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git