lkml.org 
[lkml]   [2015]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ktest: cleanup terminal on dodie() failure
On Thu, Jan 29, 2015 at 05:07:51PM -0500, Steven Rostedt wrote:
> On Thu, 29 Jan 2015 15:39:39 -0600
> Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
>
> > Can you tell if it died via dodie()? Looks like that wouldn't clean up
> > the stty settings.
> >
>
> Looks to have happen in monitor where it called:
>
> fail "failed - got a bug report" and return 0;
>
> And must have had $die_on_failure set because it did not post a KTEST
> RESULT message. That means yes, it would hit dodie() called by fail().

This fixes it for me:

--8<--

Subject: [PATCH] ktest: cleanup terminal on dodie() failure

If dodie() is called with the console open, restore the terminal's
original settings before dying.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
tools/testing/ktest/ktest.pl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index acaf05b..04e9391 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1342,6 +1342,11 @@ sub dodie {
print " See $opt{LOG_FILE} for more info.\n";
}

+ if ($monitor_cnt) {
+ # restore terminal settings
+ system("stty $stty_orig");
+ }
+
die @_, "\n";
}

@@ -1384,7 +1389,7 @@ sub exec_console {
close($pts);

exec $console or
- dodie "Can't open console $console";
+ die "Can't open console $console";
}

sub open_console {
--
2.1.0


\
 
 \ /
  Last update: 2015-01-30 04:01    [W:0.036 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site