From: Steven Rostedt <rostedt@goodmis.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Satoru Takeuchi <satoru.takeuchi@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ktest: restore tty settings after closing console
Date: Tue, 27 Jan 2015 17:01:29 -0500 [thread overview]
Message-ID: <20150127170129.7db53047@gandalf.local.home> (raw)
In-Reply-To: <1bb89abc0025cf1d6da657c7ba58bbeb4381a515.1422382008.git.jpoimboe@redhat.com>
On Tue, 27 Jan 2015 12:10:04 -0600
Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> When ktest runs the console program as a child process, the parent and
> child share the same tty for stdin and stderr. This is problematic when
> using a libvirt target. The "virsh console" program makes a lot of
> changes to the tty settings, making ktest's output hard to read
> (carriage returns don't work). After ktest exits, the terminal is
> unusable (CRs broken, stdin isn't echoed).
>
> I think the best way to fix this issue would be to create a
> pseudoterminal (pty pair) so the child process would have a dedicated
> tty, and then use pipes to connect the two ttys. I'm not sure if that's
> overkill, but it's far beyond my current Perl abilities.
And beyond mine too. I tried to get that right a few times, and it
never worked out. Maybe someone with more oyster skilz can fix this.
>
> This patch is a much easier way to (partially) fix this issue. It saves
> the tty settings before opening the console and restores them after
> closing it. There are still a few places where ktest prints mangled
> output while the console is open, but the output is much more legible
> overall, and the terminal works just fine after ktest exits.
Thanks, I'll add this, and make sure that it doesn't break anything, as
I use ktest daily.
-- Steve
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
> tools/testing/ktest/ktest.pl | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index b9cd036..ba20f89 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -178,6 +178,7 @@ my $checkout;
> my $localversion;
> my $iteration = 0;
> my $successes = 0;
> +my $stty;
>
> my $bisect_good;
> my $bisect_bad;
> @@ -1349,6 +1350,9 @@ sub open_console {
>
> my $flags;
>
> + # save terminal settings
> + $stty = `stty -g`;
> +
> my $pid = open($fp, "$console|") or
> dodie "Can't open console $console";
>
> @@ -1368,6 +1372,9 @@ sub close_console {
>
> print "closing!\n";
> close($fp);
> +
> + # restore terminal settings
> + system("stty $stty");
> }
>
> sub start_monitor {
next prev parent reply other threads:[~2015-01-27 22:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 18:10 Josh Poimboeuf
2015-01-27 22:01 ` Steven Rostedt [this message]
2015-01-28 14:59 ` Josh Poimboeuf
2015-01-28 15:08 ` Steven Rostedt
2015-01-28 15:15 ` Josh Poimboeuf
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=20150127170129.7db53047@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®