lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250305041913.1720599-1-Ayush.jain3@amd.com>
Date: Wed, 5 Mar 2025 04:19:13 +0000
From: Ayush Jain <Ayush.jain3@....com>
To: <rostedt@...dmis.org>, <warthog9@...lescrag.net>
CC: <linux-kernel@...r.kernel.org>, <srikanth.aithal@....com>,
	<kalpana.shetty@....com>, Ayush Jain <Ayush.jain3@....com>
Subject: [PATCH v2] ktest: Fix Test Failures Due to Missing LOG_FILE Directories

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@....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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ