From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Satoru Takeuchi <satoru.takeuchi@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] ktest: cleanup terminal on dodie() failure
Date: Thu, 29 Jan 2015 20:54:53 -0600 [thread overview]
Message-ID: <20150130025453.GB20952@treble.redhat.com> (raw)
In-Reply-To: <20150129170751.0b399ecb@gandalf.local.home>
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
prev parent reply other threads:[~2015-01-30 2:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 19:38 [PATCH v2 0/2] ktest: console pty support Josh Poimboeuf
2015-01-28 19:38 ` [PATCH v2 1/2] ktest: give console process a dedicated tty Josh Poimboeuf
2015-01-28 19:38 ` [PATCH v2 2/2] ktest: enable user input to the console Josh Poimboeuf
2015-01-29 20:44 ` [PATCH v2 0/2] ktest: console pty support Steven Rostedt
2015-01-29 21:39 ` Josh Poimboeuf
2015-01-29 22:07 ` Steven Rostedt
2015-01-30 2:54 ` Josh Poimboeuf [this message]
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=20150130025453.GB20952@treble.redhat.com \
--to=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=satoru.takeuchi@gmail.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