Skip to contentSkip to conversation

ktest: Added CLOSE_CONSOLE_SIGNAL

PATCH New Steven Rostedt 1 participant 3 messages Dec 3, 2013 Ktest

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover ktest: Added CLOSE_CONSOLE_SIGNAL

ktest updates for linux-next.

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git
for-next

Head SHA1: 298a0d1d575026edec7fbb9b7e8cbb8fe18498cd

Satoru Takeuchi (1):
ktest: Make the signal to terminate the console configurable

Steven Rostedt (Red Hat) (1):
ktest: Add documentation of CLOSE_CONSOLE_SIGNAL

----

 tools/testing/ktest/ktest.pl    | 5 ++++-
 tools/testing/ktest/sample.conf | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
author maintainer
#1 lore raw

PATCH 1/2 ktest: Make the signal to terminate the console configurable

From: Satoru Takeuchi <[email protected]>

Currently ktest sends SIGINT to terminate the console. However, there are consoles which do not exit by this signal, for example, in my case, "virsh console <guest OS>". In such case, ktest is blocked in close_console(). It prevents this automate test.

This patch adds new option CLOSE_CONSOLE_SIGNAL which mean the signal to terminate the console. Since its default value is "INT", the original behavior isn't changed.

---
 tools/testing/ktest/ktest.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/ktest/ktest.pl +4 -1
index 0d7fd8b..5dc5704 100755
@@ -25,6 +25,7 @@ my %default = (
     "TEST_TYPE"			=> "build",
     "BUILD_TYPE"		=> "randconfig",
     "MAKE_CMD"			=> "make",
+    "CLOSE_CONSOLE_SIGNAL"	=> "INT",
     "TIMEOUT"			=> 120,
     "TMP_DIR"			=> "/tmp/ktest/\${MACHINE}",
     "SLEEP_TIME"		=> 60,	# sleep time between tests
@@ -163,6 +164,7 @@ my $timeout;
 my $booted_timeout;
 my $detect_triplefault;
 my $console;
+my $close_console_signal;
 my $reboot_success_line;
 my $success_line;
 my $stop_after_success;
@@ -285,6 +287,7 @@ my %option_map = (
     "TIMEOUT"			=> \$timeout,
     "BOOTED_TIMEOUT"		=> \$booted_timeout,
     "CONSOLE"			=> \$console,
+    "CLOSE_CONSOLE_SIGNAL"	=> \$close_console_signal,
     "DETECT_TRIPLE_FAULT"	=> \$detect_triplefault,
     "SUCCESS_LINE"		=> \$success_line,
     "REBOOT_SUCCESS_LINE"	=> \$reboot_success_line,
@@ -1296,7 +1299,7 @@ sub close_console {
     my ($fp, $pid) = @_;
 
     doprint "kill child process $pid\n";
-    kill 2, $pid;
+    kill $close_console_signal, $pid;
 
     print "closing!\n";
     close($fp);
Signature · 1 line
1.8.4.rc3
author maintainer
#2 lore raw

PATCH 2/2 ktest: Add documentation of CLOSE_CONSOLE_SIGNAL

In reply to Steven Rostedt

From: "Steven Rostedt (Red Hat)" <[email protected]>

The sample.conf file needs to document all available options. With the new CLOSE_CONSOE_SIGNAL option, it too needs to be document.

---
 tools/testing/ktest/sample.conf | 7 +++++++
 1 file changed, 7 insertions(+)
tools/testing/ktest/sample.conf +7 -0
index 0a290fb..2eb4bd2 100644
@@ -328,6 +328,13 @@
 # For a virtual machine with guest name "Guest".
 #CONSOLE =  virsh console Guest
 
+# Signal to send to kill console.
+# ktest.pl will create a child process to monitor the console.
+# When the console is finished, ktest will kill the child process
+# with this signal.
+# (default INT)
+#CLOSE_CONSOLE_SIGNAL = HUP
+
 # Required version ending to differentiate the test
 # from other linux builds on the system.
 #LOCALVERSION = -test
Signature · 1 line
1.8.4.rc3