All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [CI i-g-t 09/10] runner/settings: Serialize command line
Date: Sat, 8 Feb 2025 14:08:46 +0100	[thread overview]
Message-ID: <4e69d895-05b6-4749-ade1-ae2344384618@linux.intel.com> (raw)
In-Reply-To: <20250207231039.2883195-11-lucas.demarchi@intel.com>



On 08.02.2025 00:09, Lucas De Marchi wrote:
> Serialize the command line to metadata.txt. The expected format in the
> metadata.txt is like below:
> 
> 	cmdline.argc : 6
> 	cmdline.argv[0] : ./build/runner/igt_runner
> 	cmdline.argv[1] : -o
> 	cmdline.argv[2] : --test-list
> 	cmdline.argv[3] : /tmp/testlist.txt
> 	cmdline.argv[4] : build/tests/
> 	cmdline.argv[5] : /tmp/results
> 

Tested-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
Reviewed-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
> Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  runner/settings.c | 24 ++++++++++++++++++++++++
>  runner/settings.h |  4 ++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/runner/settings.c b/runner/settings.c
> index 1da005806..a2fddcaf6 100644
> --- a/runner/settings.c
> +++ b/runner/settings.c
> @@ -530,6 +530,17 @@ static void free_hook_strs(struct igt_vec *hook_strs)
>  	igt_vec_fini(hook_strs);
>  }
>  
> +static void free_array_deep(void **arr, size_t n)
> +{
> +	if (!arr)
> +		return;
> +
> +	for (size_t i = 0; i < n; i++)
> +		free(arr[i]);
> +
> +	free(arr);
> +}
> +
>  static bool file_exists_at(int dirfd, const char *filename)
>  {
>  	return faccessat(dirfd, filename, F_OK, 0) == 0;
> @@ -647,6 +658,7 @@ void clear_settings(struct settings *settings)
>  	free_regexes(&settings->exclude_regexes);
>  	free_env_vars(&settings->env_vars);
>  	free_hook_strs(&settings->hook_strs);
> +	free_array_deep((void **)settings->cmdline.argv, settings->cmdline.argc);
>  
>  	init_settings(settings);
>  }
> @@ -876,6 +888,16 @@ bool parse_options(int argc, char **argv,
>  		goto error;
>  	}
>  
> +	settings->cmdline.argv = calloc(argc, sizeof(*settings->cmdline.argv));
> +	if (!settings->cmdline.argv)
> +		goto error;
> +
> +	settings->cmdline.argc = argc;
> +	for (int i = 0; i < argc; i++) {
> +		settings->cmdline.argv[i] = strdup(argv[i]);
> +		if (!settings->cmdline.argv[i])
> +			goto error;
> +	}
>  
>  	return true;
>  
> @@ -1204,6 +1226,7 @@ bool serialize_settings(struct settings *settings)
>  	SERIALIZE_INT(f, settings, enable_code_coverage);
>  	SERIALIZE_INT(f, settings, cov_results_per_test);
>  	SERIALIZE_STR(f, settings, code_coverage_script);
> +	SERIALIZE_STR_ARRAY(f, settings, cmdline.argv, cmdline.argc);
>  
>  	if (settings->sync) {
>  		fflush(f);
> @@ -1319,6 +1342,7 @@ bool read_settings_from_file(struct settings *settings, FILE *f)
>  		PARSE_INT(settings, name, val, enable_code_coverage);
>  		PARSE_INT(settings, name, val, cov_results_per_test);
>  		PARSE_STR(settings, name, val, code_coverage_script);
> +		PARSE_STR_ARRAY(settings, name, val, cmdline.argv, cmdline.argc);
>  
>  		printf("Warning: Unknown field in settings file: %s = %s\n",
>  		       name, val);
> diff --git a/runner/settings.h b/runner/settings.h
> index f69f09778..2266118a7 100644
> --- a/runner/settings.h
> +++ b/runner/settings.h
> @@ -75,6 +75,10 @@ struct settings {
>  	char *code_coverage_script;
>  	bool enable_code_coverage;
>  	bool cov_results_per_test;
> +	struct {
> +		int argc;
> +		char **argv;
> +	} cmdline;
>  };
>  
>  /**


  reply	other threads:[~2025-02-08 13:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 23:09 [CI i-g-t 00/10] Add igt_runner's cmdline to results Lucas De Marchi
2025-02-07 23:09 ` [CI i-g-t 01/10] runner/settings: Fix code_coverage_script leak Lucas De Marchi
2025-02-07 23:09 ` [CI i-g-t 02/10] runner: Free settings at the end Lucas De Marchi
2025-02-07 23:09 ` [CI i-g-t 03/10] runner/settings: Deduplicate cleanup Lucas De Marchi
2025-02-07 23:09 ` [CI i-g-t 04/10] runner/settings: Use wrapper macros for each type Lucas De Marchi
2025-02-08 13:07   ` Peter Senna Tschudin
2025-02-07 23:09 ` [CI i-g-t 05/10] runner/settings: Match serialization to parse Lucas De Marchi
2025-02-08 13:07   ` Peter Senna Tschudin
2025-02-07 23:09 ` [CI i-g-t 06/10] runner/settings: Drop extra strdup Lucas De Marchi
2025-02-07 23:09 ` [CI i-g-t 07/10] runner: Fix use of newline on arguments Lucas De Marchi
2025-02-08 13:08   ` Peter Senna Tschudin
2025-02-07 23:09 ` [CI i-g-t 08/10] runner/settings: Add helpers to serialize/parse array Lucas De Marchi
2025-02-08 13:08   ` Peter Senna Tschudin
2025-02-07 23:09 ` [CI i-g-t 09/10] runner/settings: Serialize command line Lucas De Marchi
2025-02-08 13:08   ` Peter Senna Tschudin [this message]
2025-02-07 23:09 ` [CI i-g-t 10/10] runner/resultgen: Add cmdline to results.json Lucas De Marchi
2025-02-08  3:47 ` ✓ Xe.CI.BAT: success for Add igt_runner's cmdline to results (rev6) Patchwork
2025-02-08  4:00 ` ✓ i915.CI.BAT: " Patchwork
2025-02-08 13:10 ` [CI i-g-t 00/10] Add igt_runner's cmdline to results Peter Senna Tschudin
2025-02-08 19:39 ` ✗ i915.CI.Full: failure for Add igt_runner's cmdline to results (rev6) Patchwork
2025-02-08 21:19 ` ✗ Xe.CI.Full: " Patchwork
2025-02-10 19:27 ` [CI i-g-t 00/10] Add igt_runner's cmdline to results Lucas De Marchi

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=4e69d895-05b6-4749-ade1-ae2344384618@linux.intel.com \
    --to=peter.senna@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lucas.demarchi@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 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.