All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: Re: [PATCH i-g-t v2 2/2] runner/executor: Report command used for test exec
Date: Mon, 26 Oct 2026 16:44:01 -0300	[thread overview]
Message-ID: <87wlr49ri6.fsf@intel.com> (raw)
In-Reply-To: <20261026141702.44811-3-kamil.konieczny@linux.intel.com>

Kamil Konieczny <kamil.konieczny@linux.intel.com> writes:

> Add printing of command line used for executing a test, when
> the log level is normal or above.
>
> v2: move constructing exec command string to separate function
>     (Gustavo)
>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
>  runner/executor.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/runner/executor.c b/runner/executor.c
> index 5bd95b929..91ad05d58 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -1626,6 +1626,49 @@ static void free_test_command(struct igt_vec *arg_vec)
>  	igt_vec_fini(arg_vec);
>  }
>  
> +static char *entry_exec_cmd(struct igt_vec *arg_vec)
> +{
> +	char *m, *n;
> +	int mlen, s_len, vec_len;
> +
> +	mlen = 4096;
> +	m = malloc(mlen);
> +	if (!m)
> +		return NULL;
> +
> +	vec_len = igt_vec_length(arg_vec);
> +	s_len = 0;
> +	for (size_t i = 0; i < vec_len; i++) {
> +		int nlen;
> +
> +		n = *((char **)igt_vec_elem(arg_vec, i));
> +		if (!n)
> +			break;
> +
> +		nlen = strlen(n);
> +		if (s_len + nlen + 2 > mlen) {
> +			char *p;
> +
> +			mlen *= 2;
> +			p = realloc(m, mlen);
> +			if (!p)
> +				break;
> +
> +			m = p;
> +		}
> +
> +		if (i)
> +			m[s_len++] = ' ';
> +
> +		memcpy(m + s_len, n, nlen);
> +		s_len += nlen;
> +	}
> +
> +	m[s_len++] = 0;
> +
> +	return m;
> +}
> +
>  static void build_test_command(struct settings *settings,
>  			       struct job_list_entry *entry,
>  			       struct igt_vec *arg_vec)
> @@ -1849,7 +1892,7 @@ static int execute_next_entry(struct execute_state *state,
>  
>  	if (settings->log_level >= LOG_LEVEL_NORMAL) {
>  		char buf[100];
> -		char *displayname;
> +		char *displayname, *cmd;
>  		int width = digits(total);
>  		int len;
>  
> @@ -1864,6 +1907,11 @@ static int execute_next_entry(struct execute_state *state,
>  		free(displayname);
>  
>  		outf("%s\n", buf);
> +		cmd = entry_exec_cmd(&arg_vec);
> +		if (cmd) {
> +			outf("cmd: %s\n", cmd);
> +			free(cmd);
> +		}

The function entry_exec_cmd() and its usage look correct to me, but I
wonder if we could avoid the memory allocation with something like
below:

    outf("cmd:");

    for (size_t i = 0;
         i < igt_vec_length(&arg_vec) && *(char **)igt_vec_elem(&arg_vec, i);
         i++)
    	outf(" %s", *(char **)igt_vec_elem(&arg_vec, i));

    outf("\n");

--
Gustavo Sousa

>  	}
>  
>  	/*
> -- 
> 2.55.0

  reply	other threads:[~2026-10-26 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 14:17 [PATCH i-g-t v2 0/2] Runner: report test command line Kamil Konieczny
2026-10-26 14:17 ` [PATCH i-g-t v2 1/2] runner/executor: Build test command line before fork Kamil Konieczny
2026-10-26 19:38   ` Gustavo Sousa
2026-10-26 14:17 ` [PATCH i-g-t v2 2/2] runner/executor: Report command used for test exec Kamil Konieczny
2026-10-26 19:44   ` Gustavo Sousa [this message]
2026-10-28 12:37     ` Kamil Konieczny
2026-10-26 18:38 ` ✓ Xe.CI.BAT: success for Runner: report test command line (rev2) Patchwork
2026-10-26 18:58 ` ✓ i915.CI.BAT: " Patchwork
2026-10-27  0:16 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-28 12:38   ` Kamil Konieczny
2026-10-27  0:18 ` ✗ i915.CI.Full: " Patchwork
2026-10-28 12:38   ` Kamil Konieczny

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=87wlr49ri6.fsf@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@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 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.