From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 5/5] mem/vma05.sh: Convert to the new shell library
Date: Mon, 16 Dec 2024 18:16:09 +0100 [thread overview]
Message-ID: <Z2BgWWKUWr4cBuxZ@yuki.lan> (raw)
In-Reply-To: <20241210233453.GA386508@pevik>
Hi!
> > +# env
> > +# {
> > +# "needs_root": true,
> > +# "needs_tmpdir": true,
> > +# "needs_cmds": ["gdb"],
> > +# "save_restore": [
> > +# ["/proc/sys/kernel/core_pattern", "TBROK"],
> > +# ["/proc/sys/kernel/core_uses_pid", "TBROK"]
> C API .save_restore has 3 members:
>
> struct tst_path_val {
> const char *path;
> const char *val;
> unsigned int flags;
> };
>
> Why don't you use it here? (e.g. NULL).
I did look at the parsed metadata in the ltp.json to check if we match
the format there and it seems that the parsing is broken, so there is no
point in designing the interface before we fix the C parser I guess.
This is there for the ksm01:
"save_restore": [
[
"/sys/kernel/mm/ksm/run",
"TST_SR_TBROK"
],
[
"/sys/kernel/mm/ksm/sleep_millisecs",
"TST_SR_TBROK"
],
[
"/sys/kernel/mm/ksm/max_page_sharing",
"TST_SR_SKIP_MISSING",
"TST_SR_TCONF_RO"
],
[
"/sys/kernel/mm/ksm/merge_across_nodes",
"1",
"TST_SR_SKIP_MISSING",
"TST_SR_TCONF_RO"
],
[
"/sys/kernel/mm/ksm/smart_scan",
"0",
"TST_SR_SKIP_MISSING",
"TST_SR_TBROK_RO"
]
],
This is because the anonymous structures are parsed by the array parsing
code in the metaparse.c which is overly simplistics. And there are more
bugs in there unfortunately. I can fix the most pressing problems there:
- missing macro expansion
- missing NULL in the middle of intiliaziation
- properly concatenate entries
- limited recursive #include directive
Which will produce much saner output, but we will likely never be able
to produce clean enough output without using a proper tooling that can
do compile time arithmetics. Yes we have things like .needs_hugepages
with number of hugepages defined as (5 + 1) * 5 after a macro expansion.
Which ends up in the JSON as "(ARSZ + 1) * LOOP" which ends up as
"(50 + 1)*5" after this patch. Which is stil way better than the mess we
had there before.
Anyways, I will send a patch for the metaparse.c tomorrow, so that we
can fix that first.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-12-16 17:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 15:15 [LTP] [PATCH 0/5] First new shell library converted test Cyril Hrubis
2024-12-03 15:15 ` [LTP] [PATCH 1/5] tst_run_shell: Add save_restore parser Cyril Hrubis
2024-12-10 23:39 ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 2/5] libs/ujson: Fix "Garbage after JSON string!" in strict mode Cyril Hrubis
2024-12-16 12:33 ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 3/5] tst_run_shell: Better errors for metadata extractor Cyril Hrubis
2024-12-10 23:56 ` Petr Vorel
2024-12-03 15:15 ` [LTP] [PATCH 4/5] lib/tst_res_.c: Add TBROK handler + more verbose errors Cyril Hrubis
2024-12-11 0:11 ` Petr Vorel
2024-12-11 9:52 ` Cyril Hrubis
2024-12-11 19:36 ` Petr Vorel
2024-12-12 9:03 ` Cyril Hrubis
2024-12-03 15:15 ` [LTP] [PATCH 5/5] mem/vma05.sh: Convert to the new shell library Cyril Hrubis
2024-12-04 7:17 ` Andrea Cervesato via ltp
2024-12-04 7:17 ` Andrea Cervesato via ltp
2024-12-04 7:56 ` Cyril Hrubis
2024-12-10 23:34 ` Petr Vorel
2024-12-16 17:16 ` Cyril Hrubis [this message]
2024-12-10 23:54 ` Petr Vorel
2024-12-11 9:45 ` [LTP] [PATCH 0/5] First new shell library converted test 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=Z2BgWWKUWr4cBuxZ@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/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