Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] metaparse: Map arrays with designated initializers to JSON objects
Date: Fri, 11 Jul 2025 13:33:04 +0200	[thread overview]
Message-ID: <aHD2cISM0-xPAHz_@yuki.lan> (raw)
In-Reply-To: <c712df4f-2438-4376-8c21-c20b623a5bfa@suse.com>

Hi!
> This patch is actually causing documentation build failure due to the 
> way we are defining .hugepages as:
> 
>      .hugepages = {TST_NO_HUGEPAGES},
> 
> The shmget02 metadata (for instance) will have an empty hugepages 
> dictionary:

Ah, right, I've missed a special case in the C structure parsing.

This on the top of the patchset fixes the problem:

diff --git a/metadata/metaparse.c b/metadata/metaparse.c
index e9e9aee10..36736ac06 100644
--- a/metadata/metaparse.c
+++ b/metadata/metaparse.c
@@ -379,13 +379,17 @@ static int array_is_hash(FILE *f)
        long pos = ftell(f);
        int has_ids = 1;
        int elem_seen = 0;
+       int comma_last = 0;
        int in_id = 1;
        char *token;

        while ((token = next_token(f, NULL))) {

-               if (!strcmp(token, "}"))
+               if (!strcmp(token, "}")) {
+                       if (in_id && !comma_last)
+                               has_ids = 0;
                        goto ret;
+               }

                elem_seen = 1;

@@ -419,8 +423,12 @@ static int array_is_hash(FILE *f)
                        }

                        in_id = 1;
+
+                       comma_last = 1;
                } else if (!strcmp(token, "=")) {
                        in_id = 0;
+               } else {
+                       comma_last = 0;
                }
        }


I will send a new version.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-07-11 11:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 15:43 [LTP] [PATCH 0/2] Two more metadata parser fixes Cyril Hrubis
2025-06-20 15:43 ` [LTP] [PATCH 1/2] metadata: data_storage: Fix hash to json object serialization Cyril Hrubis
2025-06-20 15:43 ` [LTP] [PATCH 2/2] metaparse: Map arrays with designated initializers to JSON objects Cyril Hrubis
2025-07-11  9:28   ` Andrea Cervesato via ltp
2025-07-11 11:33     ` Cyril Hrubis [this message]
2025-06-23  8:16 ` [LTP] [PATCH 0/2] Two more metadata parser fixes Andrea Cervesato via ltp
2025-07-07  9:23 ` Andrea Cervesato via ltp
2025-07-07 11:10   ` Cyril Hrubis
2025-07-07 11:27     ` Andrea Cervesato via ltp
2025-07-11 13:25 ` Andrea Cervesato via ltp

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=aHD2cISM0-xPAHz_@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox