From: Li Wang <liwang@redhat.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH 2/3] ltp/pounder: Don't let the testing log output to /dev/tty
Date: Tue, 18 Aug 2015 16:36:45 +0800 [thread overview]
Message-ID: <1439887006-17985-2-git-send-email-liwang@redhat.com> (raw)
In-Reply-To: <1439887006-17985-1-git-send-email-liwang@redhat.com>
During the pounder21 test, it gives many errors like:
./pounder: line 262: /dev/tty: No such device or address
./pounder: line 263: /dev/tty: No such device or address
After google '/dev/tty', got this description:
/dev/tty is the controlling terminal for the current process, if there is such a terminal.
Do ps -a and look for /dev/tty. If it doesn't appear then that process doesn't have a
controlling terminal. It is quite normal for there to be no controlling terminal. So if
there is no device associated with it then the kernel will just ignore anything you send
to that file. It only cares if it has attached a device (possibly pseudo) to that node. If
it does care, and echoing is on, then anything you send to the (special) file will be echoed.
The second part may be related to the login shell. Check in /etc/passwd and make sure that
you really do start bash for the user you are logging in as. Using /bin/sh instead is a likely cause.
So do grep username /etc/passwd and look for the path to the program that is launched at the end of
the text line. If its /bin/sh then you have the wrong shell. What you should have is /bin/bash.
Signed-off-by: Li Wang <liwang@redhat.com>
---
tools/pounder21/Install | 2 +-
tools/pounder21/fancy_timed_loop.c | 2 +-
tools/pounder21/infinite_loop.c | 2 +-
tools/pounder21/pounder | 14 +++++++-------
tools/pounder21/test_scripts/memtest | 2 +-
tools/pounder21/timed_loop.c | 2 +-
6 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/pounder21/Install b/tools/pounder21/Install
index bf13528..6fb3a8f 100755
--- a/tools/pounder21/Install
+++ b/tools/pounder21/Install
@@ -65,7 +65,7 @@ done
# Set up optdir
mkdir -p "$POUNDER_OPTDIR"
if [ ! -d "$POUNDER_OPTDIR" ]; then
- echo "Could not create $POUNDER_OPTDIR; aborting." > /dev/tty
+ echo "Could not create $POUNDER_OPTDIR; aborting."
exit 1
fi
diff --git a/tools/pounder21/fancy_timed_loop.c b/tools/pounder21/fancy_timed_loop.c
index cf8580e..50305c3 100644
--- a/tools/pounder21/fancy_timed_loop.c
+++ b/tools/pounder21/fancy_timed_loop.c
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
tty_fp = fdopen(3, "w+");
if (tty_fp == NULL) {
- tty_fp = fopen("/dev/tty", "w+");
+ tty_fp = fdopen(STDOUT_FILENO, "w+");
if (tty_fp == NULL) {
perror("stdout");
exit(2);
diff --git a/tools/pounder21/infinite_loop.c b/tools/pounder21/infinite_loop.c
index d78b442..804dd2e 100644
--- a/tools/pounder21/infinite_loop.c
+++ b/tools/pounder21/infinite_loop.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
tty_fp = fdopen(3, "w+");
if (tty_fp == NULL) {
- tty_fp = fopen("/dev/tty", "w+");
+ tty_fp = fdopen(STDOUT_FILENO, "w+");
if (tty_fp == NULL) {
perror("stdout");
exit(2);
diff --git a/tools/pounder21/pounder b/tools/pounder21/pounder
index c3defcf..caf60d3 100755
--- a/tools/pounder21/pounder
+++ b/tools/pounder21/pounder
@@ -201,8 +201,8 @@ shift `expr $OPTIND - 1`
# Are we already running?
if [ -f "$POUNDER_PIDFILE" ]; then
- echo "File $POUNDER_PIDFILE exists; pounder may already be running." > /dev/tty
- echo "Either run 'pounder -k' to stop all tests, or remove it." > /dev/tty
+ echo "File $POUNDER_PIDFILE exists; pounder may already be running."
+ echo "Either run 'pounder -k' to stop all tests, or remove it."
exit 1
fi
@@ -225,21 +225,21 @@ fi
# Set up log directory
mkdir -p "$POUNDER_LOGDIR" 2> /dev/null
if [ ! -d "$POUNDER_LOGDIR" ]; then
- echo "Could not create $POUNDER_LOGDIR; aborting." > /dev/tty
+ echo "Could not create $POUNDER_LOGDIR; aborting."
exit 1
fi
# Set up dir for optional components
mkdir -p "$POUNDER_OPTDIR"
if [ ! -d "$POUNDER_OPTDIR" ]; then
- echo "Could not create $POUNDER_OPTDIR; aborting." > /dev/tty
+ echo "Could not create $POUNDER_OPTDIR; aborting."
exit 1
fi
# Set up tmpdir
mkdir -p "$POUNDER_TMPDIR"
if [ ! -d "$POUNDER_TMPDIR" ]; then
- echo "Could not create $POUNDER_TMPDIR; aborting." > /dev/tty
+ echo "Could not create $POUNDER_TMPDIR; aborting."
exit 1
fi
@@ -259,8 +259,8 @@ fi
export > "$POUNDER_LOGDIR/environment"
echo "Starting $POUNDER_VERSION"
-echo "STARTING TESTS." > /dev/tty
-echo "To kill all tests, run 'pounder -k' or press ^C."> /dev/tty
+echo "STARTING TESTS."
+echo "To kill all tests, run 'pounder -k' or press ^C."
# Handle the duration thing...
function kill_after {
diff --git a/tools/pounder21/test_scripts/memtest b/tools/pounder21/test_scripts/memtest
index c040147..e212bde 100755
--- a/tools/pounder21/test_scripts/memtest
+++ b/tools/pounder21/test_scripts/memtest
@@ -22,7 +22,7 @@
# Can we find the script?
if [ ! -f "$POUNDER_OPTDIR/memtest.sh" ]; then
- echo "Can't find memtest.sh; did you run Install?" > /dev/tty
+ echo "Can't find memtest.sh; did you run Install?"
exit -1
fi
diff --git a/tools/pounder21/timed_loop.c b/tools/pounder21/timed_loop.c
index 966c08a..0cd7305 100644
--- a/tools/pounder21/timed_loop.c
+++ b/tools/pounder21/timed_loop.c
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
tty_fp = fdopen(3, "w+");
if (tty_fp == NULL) {
- tty_fp = fopen("/dev/tty", "w+");
+ tty_fp = fdopen(STDOUT_FILENO, "w+");
if (tty_fp == NULL) {
perror("stdout");
exit(2);
--
1.8.3.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-08-18 8:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 8:36 [LTP] [PATCH 1/3] ltp/tools: remove the scripts/numa_test.sh file Li Wang
2015-08-18 8:36 ` Li Wang [this message]
2015-08-18 8:36 ` [LTP] [PATCH 3/3] pounder/cpufreq: Skip the test if processors are not supported by cpufreq Li Wang
2015-08-20 15:58 ` Cyril Hrubis
2015-08-20 15:52 ` [LTP] [PATCH 2/3] ltp/pounder: Don't let the testing log output to /dev/tty Cyril Hrubis
2015-08-20 15:44 ` [LTP] [PATCH 1/3] ltp/tools: remove the scripts/numa_test.sh file Cyril Hrubis
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=1439887006-17985-2-git-send-email-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=ltp-list@lists.sourceforge.net \
/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