Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sharma, Swati2" <swati2.sharma@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	Naladala Ramanaidu <ramanaidu.naladala@intel.com>,
	<igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH 3/5] runner/settings: Add function to set IMGDIR environment variable
Date: Fri, 13 Dec 2024 18:40:10 +0530	[thread overview]
Message-ID: <a74b3f67-a2cd-4e61-b170-4e2b9b70dd7c@intel.com> (raw)
In-Reply-To: <20241211091447.js7h3rukaido7utt@kamilkon-desk.igk.intel.com>

Hi Ramanaidu,

On 11-12-2024 02:44 pm, Kamil Konieczny wrote:
> Hi Naladala,
> On 2024-11-19 at 13:22:57 +0530, Naladala Ramanaidu wrote:
>> Introduced set_imgdir() function in settings.c to set the IMGDIR
> imho better name is IGT_DATA or IGT_IMAGES, also you do not
> need to write about which file you changed, it is already in patch
> itself.
>
> Swati, do you have suggestions here for this env var?
Agree with Kamil, IGT_DATA might be better choice for environment variable
which is inline with other env var too like 
IGT_RUNNER_DISABLE_SOCKET_COMMUNICATION,
IGT_HOOK*, etc.
>> environment variable. The function uses absolute_path() to convert
>> the relative path "../share/igt-gpu-tools" to an absolute path.
>> Added the declaration of set_imgdir() in settings.h with a brief
>> description.
> Drop this "C to description", it is in patch.
>
>> Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala@intel.com>
>> ---
>>   runner/runner.c   |  2 ++
>>   runner/settings.c | 13 +++++++++++++
>>   runner/settings.h |  8 ++++++++
>>   3 files changed, 23 insertions(+)
>>
>> diff --git a/runner/runner.c b/runner/runner.c
>> index 4855ad641..a52834197 100644
>> --- a/runner/runner.c
>> +++ b/runner/runner.c
>> @@ -49,6 +49,8 @@ int main(int argc, char **argv)
>>   		exitcode = 1;
>>   	}
>>   
>> +	unsetenv("IMGDIR");
> imho you should have a flag and do not unset this
> if user sets this before runner starts, e.g. honor
> user environment.
>
>> +
> Remove this empty line.
>
>>   	printf("Done.\n");
> Why this print is here?
>
> While at this, could you add newline here?
>
>>   	return exitcode;
>>   }
>> diff --git a/runner/settings.c b/runner/settings.c
>> index dd4b08dd7..d42f3a68a 100644
>> --- a/runner/settings.c
>> +++ b/runner/settings.c
>> @@ -587,6 +587,15 @@ char *absolute_path(const char *path)
>>   	return result;
>>   }
>>   
>> +int set_imgdir(void)
>> +{
>> +	const char *path = "../share/igt-gpu-tools";
>> +	char *abpath;
>> +
>> +	abpath = absolute_path(path);
>> +	return setenv("IMGDIR", abpath, 1);
> Repeated string here shows we need a global const char for it.
>
>> +}
>> +
>>   static char *bin_path(char *fname)
>>   {
>>   	char *path, *p;
>> @@ -863,6 +872,10 @@ bool parse_options(int argc, char **argv,
>>   		settings->test_root = absolute_path(env_test_root);
>>   	}
>>   
>> +	if (set_imgdir() != 0) {
>> +		usage(stderr, "img dir not set");
>> +	}
>> +
>>   	if (!settings->test_root) {
>>   		usage(stderr, "Test root not set");
>>   		goto error;
>> diff --git a/runner/settings.h b/runner/settings.h
>> index 6246d0c3d..a7abe19fd 100644
>> --- a/runner/settings.h
>> +++ b/runner/settings.h
>> @@ -150,4 +150,12 @@ bool serialize_settings(struct settings *settings);
>>   bool read_settings_from_file(struct settings *settings, FILE* f);
>>   bool read_settings_from_dir(struct settings *settings, int dirfd);
>>   
>> +/**
>> + * set_imgdir:
>> + *
>> + * The function will set the environment variable.
>> + *
>> + */
> Description is needed in C source, not in header.
>
> Regards,
> Kamil
>
>> +int set_imgdir(void);
>> +
>>   #endif
>> -- 
>> 2.43.0
>>

  reply	other threads:[~2024-12-13 13:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19  7:52 [PATCH 0/5] Update image assets Naladala Ramanaidu
2024-11-19  7:52 ` [PATCH 1/5] data: create new data directory Naladala Ramanaidu
2024-12-11  9:25   ` Kamil Konieczny
2024-11-19  7:52 ` [PATCH 2/5] runner/settings: Update absolute_path function to accept const char* parameter Naladala Ramanaidu
2024-11-19  7:52 ` [PATCH 3/5] runner/settings: Add function to set IMGDIR environment variable Naladala Ramanaidu
2024-12-11  9:14   ` Kamil Konieczny
2024-12-13 13:10     ` Sharma, Swati2 [this message]
2024-11-19  7:52 ` [PATCH 4/5] lib: update fopen() to accomodate imgdir Naladala Ramanaidu
2024-11-20  3:06   ` Reddy Guddati, Santhosh
2024-11-19  7:52 ` [PATCH 5/5] HAX patch do not merge Naladala Ramanaidu
2024-11-19 22:42 ` ✗ GitLab.Pipeline: warning for Update image assets Patchwork
2024-11-19 22:45 ` ✗ CI.xeBAT: failure " Patchwork
2024-11-19 23:04 ` ✗ Fi.CI.BAT: " Patchwork
2024-11-20 11:14 ` ✗ CI.xeFULL: " 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=a74b3f67-a2cd-4e61-b170-4e2b9b70dd7c@intel.com \
    --to=swati2.sharma@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=ramanaidu.naladala@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