All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Fu <vincent.fu@samsung.com>
To: "axboe@kernel.dk" <axboe@kernel.dk>,
	"fio@vger.kernel.org" <fio@vger.kernel.org>
Cc: Vincent Fu <vincent.fu@samsung.com>
Subject: [PATCH 4/6] t/run-fio-tests: improve json data decoding
Date: Mon, 23 May 2022 17:57:12 +0000	[thread overview]
Message-ID: <20220523175650.130895-5-vincent.fu@samsung.com> (raw)
In-Reply-To: <20220523175650.130895-1-vincent.fu@samsung.com>

Instead of skipping up to five lines, just skip everything until the
opening curly brace when trying to decode JSON data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
---
 t/run-fio-tests.py | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py
index ecceb67e..32cdbc19 100755
--- a/t/run-fio-tests.py
+++ b/t/run-fio-tests.py
@@ -311,21 +311,15 @@ class FioJobTest(FioExeTest):
         #
         # Sometimes fio informational messages are included at the top of the
         # JSON output, especially under Windows. Try to decode output as JSON
-        # data, lopping off up to the first four lines
+        # data, skipping everything until the first {
         #
         lines = file_data.splitlines()
-        for i in range(5):
-            file_data = '\n'.join(lines[i:])
-            try:
-                self.json_data = json.loads(file_data)
-            except json.JSONDecodeError:
-                continue
-            else:
-                logging.debug("Test %d: skipped %d lines decoding JSON data", self.testnum, i)
-                return
-
-        self.failure_reason = "{0} unable to decode JSON data,".format(self.failure_reason)
-        self.passed = False
+        file_data = '\n'.join(lines[lines.index("{"):])
+        try:
+            self.json_data = json.loads(file_data)
+        except json.JSONDecodeError:
+            self.failure_reason = "{0} unable to decode JSON data,".format(self.failure_reason)
+            self.passed = False
 
 
 class FioJobTest_t0005(FioJobTest):
-- 
2.25.1

  parent reply	other threads:[~2022-05-23 18:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220523175712uscas1p20c6cf25d74d7616e5f3406db923b22c4@uscas1p2.samsung.com>
2022-05-23 17:57 ` [PATCH 0/6] cleanups, parse /proc/meminfo for huge page size Vincent Fu
     [not found]   ` <CGME20220523175712uscas1p2c81666b4057700908d887bddb644ff89@uscas1p2.samsung.com>
2022-05-23 17:57     ` [PATCH 1/6] steadystate: delete incorrect comment Vincent Fu
     [not found]   ` <CGME20220523175713uscas1p2f3ee56d2e2f5918b12be64634d6b818b@uscas1p2.samsung.com>
2022-05-23 17:57     ` [PATCH 2/6] configure: refer to zlib1g-dev package for zlib support Vincent Fu
     [not found]   ` <CGME20220523175713uscas1p2554fb9f5a5cc7b150f3fdc08bfb4a113@uscas1p2.samsung.com>
2022-05-23 17:57     ` Vincent Fu [this message]
     [not found]   ` <CGME20220523175713uscas1p1fdef83b69c4e85c245176318cbec3dee@uscas1p1.samsung.com>
2022-05-23 17:57     ` [PATCH 3/6] HOWTO: add blank line for prettier formatting Vincent Fu
     [not found]   ` <CGME20220523175713uscas1p1e0e247cd89c13bf395863183f07cd1e1@uscas1p1.samsung.com>
2022-05-23 17:57     ` [PATCH 5/6] mem: try to parse /proc/meminfo to get huge page size Vincent Fu
2022-05-23 18:12       ` Jens Axboe
2022-05-23 22:56         ` Vincent Fu
     [not found]   ` <CGME20220523175713uscas1p26b156f466662f82746e78f1673e4461a@uscas1p2.samsung.com>
2022-05-23 17:57     ` [PATCH 6/6] docs: update for huge page size parsing Vincent Fu

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=20220523175650.130895-5-vincent.fu@samsung.com \
    --to=vincent.fu@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.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.