* [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
@ 2025-03-05 4:19 Ayush Jain
2025-03-06 0:01 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Ayush Jain @ 2025-03-05 4:19 UTC (permalink / raw)
To: rostedt, warthog9
Cc: linux-kernel, srikanth.aithal, kalpana.shetty, Ayush Jain
Handle missing parent directories for LOG_FILE path to prevent test
failures. If the parent directories don't exist, create them to ensure
the tests proceed successfully.
Signed-off-by: Ayush Jain <Ayush.jain3@amd.com>
---
v1..v2:
https://lore.kernel.org/all/20250128051427.405808-1-Ayush.jain3@amd.com/
- Update logic to check for LOG_FILE existence (steven)
---
tools/testing/ktest/ktest.pl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 8c8da966c641..13b97e6b8459 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
if ($opt{"CLEAR_LOG"}) {
unlink $opt{"LOG_FILE"};
}
+
+ if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
+ my $dir = $1;
+ if (! -d $dir) {
+ mkpath($dir) or die "Failed to create directories '$dir': $!";
+ print "\nThe log directory $dir did not exist, so it was created.\n";
+ }
+ }
open(LOG, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
LOG->autoflush(1);
}
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
2025-03-05 4:19 [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories Ayush Jain
@ 2025-03-06 0:01 ` Steven Rostedt
2025-03-06 2:59 ` Jain, Ayush
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2025-03-06 0:01 UTC (permalink / raw)
To: Ayush Jain; +Cc: warthog9, linux-kernel, srikanth.aithal, kalpana.shetty
On Wed, 5 Mar 2025 04:19:13 +0000
Ayush Jain <Ayush.jain3@amd.com> wrote:
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index 8c8da966c641..13b97e6b8459 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
> if ($opt{"CLEAR_LOG"}) {
> unlink $opt{"LOG_FILE"};
> }
> +
> + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
> + my $dir = $1;
> + if (! -d $dir) {
> + mkpath($dir) or die "Failed to create directories '$dir': $!";
> + print "\nThe log directory $dir did not exist, so it was created.\n";
> + }
> + }
Hmm, somehow the indentation is messed up here. Should be:
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 8c8da966c641..13b97e6b8459 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
if ($opt{"CLEAR_LOG"}) {
unlink $opt{"LOG_FILE"};
}
+
+ if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
+ my $dir = $1;
+ if (! -d $dir) {
+ mkpath($dir) or die "Failed to create directories '$dir': $!";
+ print "\nThe log directory $dir did not exist, so it was created.\n";
+ }
+ }
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
2025-03-06 0:01 ` Steven Rostedt
@ 2025-03-06 2:59 ` Jain, Ayush
2025-03-06 4:49 ` Jain, Ayush
0 siblings, 1 reply; 6+ messages in thread
From: Jain, Ayush @ 2025-03-06 2:59 UTC (permalink / raw)
To: Steven Rostedt, Ayush Jain
Cc: warthog9, linux-kernel, srikanth.aithal, kalpana.shetty
Hello steven,
On 3/6/2025 5:31 AM, Steven Rostedt wrote:
> On Wed, 5 Mar 2025 04:19:13 +0000
> Ayush Jain <Ayush.jain3@amd.com> wrote:
>
>> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
>> index 8c8da966c641..13b97e6b8459 100755
>> --- a/tools/testing/ktest/ktest.pl
>> +++ b/tools/testing/ktest/ktest.pl
>> @@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
>> if ($opt{"CLEAR_LOG"}) {
>> unlink $opt{"LOG_FILE"};
>> }
>> +
>> + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
>> + my $dir = $1;
>> + if (! -d $dir) {
>> + mkpath($dir) or die "Failed to create directories '$dir': $!";
>> + print "\nThe log directory $dir did not exist, so it was created.\n";
>> + }
>> + }
> Hmm, somehow the indentation is messed up here. Should be:
Sure, will update it in next version
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index 8c8da966c641..13b97e6b8459 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
> if ($opt{"CLEAR_LOG"}) {
> unlink $opt{"LOG_FILE"};
> }
> +
> + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
> + my $dir = $1;
> + if (! -d $dir) {
> + mkpath($dir) or die "Failed to create directories '$dir': $!";
> + print "\nThe log directory $dir did not exist, so it was created.\n";
> + }
> + }
>
> -- Steve
Regards,
Ayush Jain
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
2025-03-06 2:59 ` Jain, Ayush
@ 2025-03-06 4:49 ` Jain, Ayush
2025-03-06 15:12 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Jain, Ayush @ 2025-03-06 4:49 UTC (permalink / raw)
To: Steven Rostedt, Ayush Jain
Cc: warthog9, linux-kernel, srikanth.aithal, kalpana.shetty
Hello steven,
On 3/6/2025 8:29 AM, Jain, Ayush wrote:
> Hello steven,
>
> On 3/6/2025 5:31 AM, Steven Rostedt wrote:
>> On Wed, 5 Mar 2025 04:19:13 +0000
>> Ayush Jain <Ayush.jain3@amd.com> wrote:
>>
>>> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
>>> index 8c8da966c641..13b97e6b8459 100755
>>> --- a/tools/testing/ktest/ktest.pl
>>> +++ b/tools/testing/ktest/ktest.pl
>>> @@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
>>> if ($opt{"CLEAR_LOG"}) {
>>> unlink $opt{"LOG_FILE"};
>>> }
>>> +
>>> + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
>>> + my $dir = $1;
>>> + if (! -d $dir) {
>>> + mkpath($dir) or die "Failed to create directories '$dir': $!";
>>> + print "\nThe log directory $dir did not exist, so it was created.\n";
>>> + }
>>> + }
>> Hmm, somehow the indentation is messed up here. Should be:
> Sure, will update it in next version
Just to be clear on my end, you mean 4 space wide tab for indentation here.
- Ayush
>> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
>> index 8c8da966c641..13b97e6b8459 100755
>> --- a/tools/testing/ktest/ktest.pl
>> +++ b/tools/testing/ktest/ktest.pl
>> @@ -4303,6 +4303,14 @@ if (defined($opt{"LOG_FILE"})) {
>> if ($opt{"CLEAR_LOG"}) {
>> unlink $opt{"LOG_FILE"};
>> }
>> +
>> + if (! -e $opt{"LOG_FILE"} && $opt{"LOG_FILE"} =~ m,^(.*/),) {
>> + my $dir = $1;
>> + if (! -d $dir) {
>> + mkpath($dir) or die "Failed to create directories '$dir': $!";
>> + print "\nThe log directory $dir did not exist, so it was created.\n";
>> + }
>> + }
>>
>> -- Steve
> Regards,
>
> Ayush Jain
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
2025-03-06 4:49 ` Jain, Ayush
@ 2025-03-06 15:12 ` Steven Rostedt
2025-03-07 4:12 ` Jain, Ayush
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2025-03-06 15:12 UTC (permalink / raw)
To: Jain, Ayush
Cc: Ayush Jain, warthog9, linux-kernel, srikanth.aithal, kalpana.shetty
On Thu, 6 Mar 2025 10:19:04 +0530
"Jain, Ayush" <ayushjai@amd.com> wrote:
> Just to be clear on my end, you mean 4 space wide tab for indentation here.
Correct. That's what the rest of the file has.
....[indent 1]
\t[indent 2]
\t....[indent 3]
Where . is a space and \t is a tab.
So for every 8 spaces, use a tab, and then add 4 spaces at the end of those
not divisible by 8.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories
2025-03-06 15:12 ` Steven Rostedt
@ 2025-03-07 4:12 ` Jain, Ayush
0 siblings, 0 replies; 6+ messages in thread
From: Jain, Ayush @ 2025-03-07 4:12 UTC (permalink / raw)
To: Steven Rostedt
Cc: Ayush Jain, warthog9, linux-kernel, srikanth.aithal, kalpana.shetty
On 3/6/2025 8:42 PM, Steven Rostedt wrote:
> On Thu, 6 Mar 2025 10:19:04 +0530
> "Jain, Ayush" <ayushjai@amd.com> wrote:
>
>> Just to be clear on my end, you mean 4 space wide tab for indentation here.
> Correct. That's what the rest of the file has.
>
>
> ....[indent 1]
> \t[indent 2]
> \t....[indent 3]
>
> Where . is a space and \t is a tab.
>
> So for every 8 spaces, use a tab, and then add 4 spaces at the end of those
> not divisible by 8.
>
> -- Steve
Ok, thank you for explaining, will update in next the version.
Thanks,
Ayush
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-03-07 4:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-05 4:19 [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories Ayush Jain
2025-03-06 0:01 ` Steven Rostedt
2025-03-06 2:59 ` Jain, Ayush
2025-03-06 4:49 ` Jain, Ayush
2025-03-06 15:12 ` Steven Rostedt
2025-03-07 4:12 ` Jain, Ayush
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®