Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org, ryszard.knop@intel.com,
	lucas.demarchi@intel.com, katarzyna.piecielska@intel.com,
	Jonathan Cavitt <jonathan.cavitt@intel.com>
Subject: Re: [PATCH i-g-t v4 2/2] runner/executor: Integrate igt_kmemleak scans
Date: Mon, 3 Feb 2025 10:10:53 +0100	[thread overview]
Message-ID: <f766e3af-cdc2-4e9f-a672-c323c19298b5@linux.intel.com> (raw)
In-Reply-To: <20250131125018.daqboesdcfuvsqrw@kamilkon-desk.igk.intel.com>

Hi Kamil,

Thank you for the review.

[...]

>>  		igt_facts_lists_init();
>>  
>> +	if (settings->kmemleak)
>> +		if (!igt_kmemleak_init(NULL)) {
>> +			errf("Failed to initialize kmemleak. Is kernel support enabled?\n");
>> +			errf("Disabling kmemleak on igt_runner and continuing...\n");
> 
> Make it one errf() call, split string if needed.
chekcpatch does not like multi-line strings. Can you show me the code
you want me to use here that satisfies you and checkpatch at the same time?


[...]
> 
>> +			settings->kmemleak = settings->kmemleak_each = false;
> 
> Avoid this, write two assinments here.

I personally find this very elegant, but sure, I will make the change.

[...]

>> @@ -718,6 +723,7 @@ igt_main
>>  	igt_subtest("parse-clears-old-data") {
>>  		const char *argv[] = { "runner",
>>  				       "-n", "foo",
>> +				       "--overwrite",
> 
> Do not make unrelated changes, add only kmemleak.
> You also didn't write about this change in description, if you
> think it is a fix it should go in separate patch, not here.

These are not unrelated. First as this is unit testing, this has no
downstream effects. Second, I am adding --overwrite to grow the argv
array. The reason for that is to be able to test the new argument.

As I had explained to Jonathan Cavitt in a previous email, the alternative
to adding an extra option would be to change how the entire file allocates
argv[] which felt like an overkill. If adding an extra option that has no
downstream effect is unacceptable, please let me know how you want me to
grow the array with an example.

> 
>>  				       "--dry-run",
>>  				       "--allow-non-root",
>>  				       "test-root-dir",
>> @@ -727,21 +733,29 @@ igt_main
>>  		igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, settings));
>>  
>>  		igt_assert_eqstr(settings->name, "foo");
>> +		igt_assert(settings->overwrite);
> 
> Same here, unrelated.
Updating the unit testing to take overwrite into account.

> 
>>  		igt_assert(settings->dry_run);
>>  		igt_assert(!settings->test_list);
>>  		igt_assert(!settings->facts);
>> +		igt_assert(!settings->kmemleak);
>>  		igt_assert(!settings->sync);
>>  
>>  		argv[1] = "--test-list";
>> +		argv[2] = "foo"; /* Unchanged */
> 
> Same here, unrelated.
This is unchanged as the comment indicates. It is here only for documentation.
It was defined a few lines before: const char *argv[] = { "runner", "-n", "foo",

> 
>>  		argv[3] = "--facts";
>> -		argv[4] = "--sync";
> 
> Same here, unrelated.
Just read the next two lines please.

> 
>> +		argv[4] = "--kmemleak";
>> +		argv[5] = "--sync";
> 
> Same here, unrelated.
Just read the previous two lines please.

> 
>> +		argv[6] = "test-root-dir"; /* Unchanged */
> 
> Same here, unrelated.
Same explanation as 'foo'. No changes.
> 
>> +		argv[7] = "results-path"; /* Unchanged */
> 
> Same here, unrelated.
Same explanation as 'foo'. No changes.

> 
>>  
>>  		igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, settings));
>>  
>>  		igt_assert_eqstr(settings->name, "results-path");
>>  		igt_assert(!settings->dry_run);
>> +		igt_assert(!settings->overwrite);
> 
> Same here, unrelated.

Same as before.

[...]

>>  	settings->dmesg_warn_level = -1;
>>  	settings->prune_mode = -1;
>>  
>> -	while ((c = getopt_long(argc, argv, "hn:dt:x:e:fsl:omb:L",
>> +	while ((c = getopt_long(argc, argv, "hn:dt:x:e:fsl:omb:Lk::",
> 
> Why there are two colons at end? Also imho 'k' should be placed after 'f'
> like below:

From Getopt documentation*: If an option character is followed by two colons
(‘::’), its argument is optional;

> 
> 	while ((c = getopt_long(argc, argv, "hn:dt:x:e:fk:sl:omb:L",

This is wrong as it is missing one ':'. I will fix the order.

> 
> especially that you add its code after OPT_FACTS below.
> 
>>  				long_options, NULL)) != -1) {
>>  		switch (c) {
>>  		case OPT_VERSION:
>> @@ -742,6 +754,19 @@ bool parse_options(int argc, char **argv,
>>  		case OPT_FACTS:
>>  			settings->facts = true;
>>  			break;
>> +		case OPT_KMEMLEAK:
>> +			settings->kmemleak = true;
>> +			if (optarg) {
>> +				if (strcmp(optarg, "once") == 0)
>> +					settings->kmemleak_each = false;
>> +				else if (strcmp(optarg, "each") == 0)
>> +					settings->kmemleak_each = true;
>> +				else {
>> +					usage(stderr, "Invalid kmemleak option");
>> +					goto error;
>> +				}
> 
> Use braces here: if () { ... } else if (...) { ... } else { ... }

Sure

[...]

* - https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html

  reply	other threads:[~2025-02-03  9:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 15:15 [PATCH i-g-t v4 0/2] Integrate kmemleak scans in igt_runner Peter Senna Tschudin
2025-01-28 15:15 ` [PATCH i-g-t v4 1/2] lib/igt_kmemleak: library to interact with kmemleak Peter Senna Tschudin
2025-01-31 12:34   ` Kamil Konieczny
2025-02-03  9:23     ` Peter Senna Tschudin
2025-02-11 16:17       ` Zbigniew Kempczyński
2025-02-11 19:12         ` Peter Senna Tschudin
2025-02-12  8:36           ` Zbigniew Kempczyński
2025-02-12  9:18             ` Peter Senna Tschudin
2025-02-12 10:01               ` Zbigniew Kempczyński
2025-02-12 13:12                 ` Peter Senna Tschudin
2025-02-12 13:41                   ` Kamil Konieczny
2025-02-12 14:57                     ` Peter Senna Tschudin
2025-02-25 13:46         ` Peter Senna Tschudin
2025-02-25 18:06           ` Peter Senna Tschudin
2025-01-31 12:38   ` Kamil Konieczny
2025-02-03  9:14     ` Peter Senna Tschudin
2025-02-12 14:26       ` Kamil Konieczny
2025-01-28 15:15 ` [PATCH i-g-t v4 2/2] runner/executor: Integrate igt_kmemleak scans Peter Senna Tschudin
2025-01-31 12:50   ` Kamil Konieczny
2025-02-03  9:10     ` Peter Senna Tschudin [this message]
2025-02-12 14:24       ` Kamil Konieczny
2025-02-12 14:53         ` Peter Senna Tschudin
2025-01-28 20:48 ` ✓ i915.CI.BAT: success for Integrate kmemleak scans in igt_runner (rev2) Patchwork
2025-01-28 20:49 ` Patchwork
2025-01-28 20:52 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-29 10:40 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-29 13:18   ` Peter Senna Tschudin
2025-01-29 11:25 ` ✗ i915.CI.Full: " Patchwork
2025-01-29 13:19   ` Peter Senna Tschudin
2025-01-30  6:18     ` Ravali, JupallyX
2025-01-30  5:26 ` ✓ i915.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=f766e3af-cdc2-4e9f-a672-c323c19298b5@linux.intel.com \
    --to=peter.senna@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=katarzyna.piecielska@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=ryszard.knop@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