Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: Peter Senna Tschudin <peter.senna@linux.intel.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Petri Latvala <adrinael@adrinael.net>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH i-g-t v3 05/10] runner/settings: Match serialization to parse
Date: Fri, 7 Feb 2025 16:13:07 -0300	[thread overview]
Message-ID: <173895558746.1963.18303137497681364078@intel.com> (raw)
In-Reply-To: <20250130172149.3657144-6-lucas.demarchi@intel.com>

Quoting Lucas De Marchi (2025-01-30 14:21:44-03:00)
>Use similarly named macros on both sides of serialize/parse.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>

>---
> runner/settings.c | 58 +++++++++++++++++++++++++----------------------
> 1 file changed, 31 insertions(+), 27 deletions(-)
>
>diff --git a/runner/settings.c b/runner/settings.c
>index 340d3802a..73d8aa13d 100644
>--- a/runner/settings.c
>+++ b/runner/settings.c
>@@ -1052,10 +1052,12 @@ static bool serialize_hook_strs(struct settings *settings, int dirfd)
>         return true;
> }
> 
>+#define SERIALIZE_LINE(f, s, name, fmt) fprintf(f, "%s : " fmt "\n", #name, s->name)
>+#define SERIALIZE_INT(f, s, name) SERIALIZE_LINE(f, s, name, "%d")
>+#define SERIALIZE_UL(f, s, name) SERIALIZE_LINE(f, s, name, "%lu")
>+#define SERIALIZE_STR(f, s, name) SERIALIZE_LINE(f, s, name, "%s")
> bool serialize_settings(struct settings *settings)
> {
>-#define SERIALIZE_LINE(f, s, name, format) fprintf(f, "%s : " format "\n", #name, s->name)
>-
>         FILE *f;
>         int dirfd, covfd;
>         char path[PATH_MAX];
>@@ -1097,31 +1099,31 @@ bool serialize_settings(struct settings *settings)
>                 return false;
>         }
> 
>-        SERIALIZE_LINE(f, settings, abort_mask, "%d");
>-        SERIALIZE_LINE(f, settings, disk_usage_limit, "%zd");
>+        SERIALIZE_INT(f, settings, abort_mask);
>+        SERIALIZE_UL(f, settings, disk_usage_limit);
>         if (settings->test_list)
>-                SERIALIZE_LINE(f, settings, test_list, "%s");
>+                SERIALIZE_STR(f, settings, test_list);
>         if (settings->name)
>-                SERIALIZE_LINE(f, settings, name, "%s");
>-        SERIALIZE_LINE(f, settings, dry_run, "%d");
>-        SERIALIZE_LINE(f, settings, allow_non_root, "%d");
>-        SERIALIZE_LINE(f, settings, facts, "%d");
>-        SERIALIZE_LINE(f, settings, sync, "%d");
>-        SERIALIZE_LINE(f, settings, log_level, "%d");
>-        SERIALIZE_LINE(f, settings, overwrite, "%d");
>-        SERIALIZE_LINE(f, settings, multiple_mode, "%d");
>-        SERIALIZE_LINE(f, settings, inactivity_timeout, "%d");
>-        SERIALIZE_LINE(f, settings, per_test_timeout, "%d");
>-        SERIALIZE_LINE(f, settings, overall_timeout, "%d");
>-        SERIALIZE_LINE(f, settings, use_watchdog, "%d");
>-        SERIALIZE_LINE(f, settings, piglit_style_dmesg, "%d");
>-        SERIALIZE_LINE(f, settings, dmesg_warn_level, "%d");
>-        SERIALIZE_LINE(f, settings, prune_mode, "%d");
>-        SERIALIZE_LINE(f, settings, test_root, "%s");
>-        SERIALIZE_LINE(f, settings, results_path, "%s");
>-        SERIALIZE_LINE(f, settings, enable_code_coverage, "%d");
>-        SERIALIZE_LINE(f, settings, cov_results_per_test, "%d");
>-        SERIALIZE_LINE(f, settings, code_coverage_script, "%s");
>+                SERIALIZE_STR(f, settings, name);
>+        SERIALIZE_INT(f, settings, dry_run);
>+        SERIALIZE_INT(f, settings, allow_non_root);
>+        SERIALIZE_INT(f, settings, facts);
>+        SERIALIZE_INT(f, settings, sync);
>+        SERIALIZE_INT(f, settings, log_level);
>+        SERIALIZE_INT(f, settings, overwrite);
>+        SERIALIZE_INT(f, settings, multiple_mode);
>+        SERIALIZE_INT(f, settings, inactivity_timeout);
>+        SERIALIZE_INT(f, settings, per_test_timeout);
>+        SERIALIZE_INT(f, settings, overall_timeout);
>+        SERIALIZE_INT(f, settings, use_watchdog);
>+        SERIALIZE_INT(f, settings, piglit_style_dmesg);
>+        SERIALIZE_INT(f, settings, dmesg_warn_level);
>+        SERIALIZE_INT(f, settings, prune_mode);
>+        SERIALIZE_STR(f, settings, test_root);
>+        SERIALIZE_STR(f, settings, results_path);
>+        SERIALIZE_INT(f, settings, enable_code_coverage);
>+        SERIALIZE_INT(f, settings, cov_results_per_test);
>+        SERIALIZE_STR(f, settings, code_coverage_script);
> 
>         if (settings->sync) {
>                 fflush(f);
>@@ -1149,9 +1151,11 @@ bool serialize_settings(struct settings *settings)
> 
>         close(dirfd);
>         return true;
>-
>-#undef SERIALIZE_LINE
> }
>+#undef SERIALIZE_STR
>+#undef SERIALIZE_UL
>+#undef SERIALIZE_INT
>+#undef SERIALIZE_LINE
> 
> static int parse_int(char **val)
> {
>-- 
>2.48.0
>

  reply	other threads:[~2025-02-07 19:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 17:21 [PATCH i-g-t v3 00/10] Add igt_runner's cmdline to results Lucas De Marchi
2025-01-30 17:21 ` [PATCH i-g-t v3 01/10] runner/settings: Fix code_coverage_script leak Lucas De Marchi
2025-01-30 17:21 ` [PATCH i-g-t v3 02/10] runner: Free settings at the end Lucas De Marchi
2025-01-30 17:21 ` [PATCH i-g-t v3 03/10] runner/settings: Deduplicate cleanup Lucas De Marchi
2025-01-30 17:21 ` [PATCH i-g-t v3 04/10] runner/settings: Use wrapper macros for each type Lucas De Marchi
2025-02-07 18:34   ` Gustavo Sousa
2025-01-30 17:21 ` [PATCH i-g-t v3 05/10] runner/settings: Match serialization to parse Lucas De Marchi
2025-02-07 19:13   ` Gustavo Sousa [this message]
2025-01-30 17:21 ` [PATCH i-g-t v3 06/10] runner/settings: Drop extra strdup Lucas De Marchi
2025-01-30 17:21 ` [PATCH i-g-t v3 07/10] runner: Fix use of newline on arguments Lucas De Marchi
2025-01-31  9:21   ` Peter Senna Tschudin
2025-01-31 15:58     ` Lucas De Marchi
2025-02-03 18:09       ` Lucas De Marchi
2025-02-07 20:15         ` Gustavo Sousa
2025-01-30 17:21 ` [PATCH i-g-t v3 08/10] runner/settings: Add helpers to serialize/parse array Lucas De Marchi
2025-02-07 20:26   ` Gustavo Sousa
2025-01-30 17:21 ` [PATCH i-g-t v3 09/10] runner/settings: Serialize command line Lucas De Marchi
2025-02-07 20:36   ` Gustavo Sousa
2025-02-07 20:41     ` Gustavo Sousa
2025-01-30 17:21 ` [PATCH i-g-t v3 10/10] runner/resultgen: Add cmdline to results.json Lucas De Marchi
2025-01-30 19:00   ` Kamil Konieczny
2025-01-30 19:17     ` Lucas De Marchi
2025-01-31  9:31       ` Peter Senna Tschudin
2025-01-31 12:16       ` Kamil Konieczny
2025-01-31 15:39         ` Lucas De Marchi
2025-01-30 19:12 ` ✓ Xe.CI.BAT: success for Add igt_runner's cmdline to results (rev3) Patchwork
2025-01-30 19:12 ` ✓ i915.CI.BAT: " Patchwork
2025-01-30 21:21 ` ✗ i915.CI.Full: failure " Patchwork
2025-01-30 22:06 ` ✓ Xe.CI.Full: success " Patchwork

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=173895558746.1963.18303137497681364078@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=adrinael@adrinael.net \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=peter.senna@linux.intel.com \
    /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