Skip to contentSkip to conversation

ltp/tools: remove the scripts/numa_test.sh file

PATCH In review Li Wang 2 participants 6 messages Aug 18, 2015 – Aug 20, 2015

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/3 ltp/tools: remove the scripts/numa_test.sh file

Not only ltp/Makefile cancel the calling of the numa_test.sh, but there are no any other testcases using it.

per: ef77253961f909f87e82e6d2b620e87af33e9665

ltp also has another copy of it: /testcases/kernel/numa/test.sh

---
 tools/scripts/numa_test.sh | 53 ----------------------------------------------
 1 file changed, 53 deletions(-)
 delete mode 100755 tools/scripts/numa_test.sh
tools/scripts/numa_test.sh deleted +0 -53
deleted file mode 100755
index 1b46149..0000000
@@ -1,53 +0,0 @@
-#############################################################################
-##
-## Copyright (c) International Business Machines  Corp., 2007
-##
-## This program is free software;  you can redistribute it and#or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program;  if not, write to the Free Software
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-##
-#############################################################################
-#
-# Author         Pradeep Kumar Surisetty, [email protected]
-#
-# History        Nov 27 2007 -created- pradeep kumar surisetty
-#! /bin/sh
-#
-# File :         numa_test.sh
-
-
-#!/bin/sh
-x=0
-chk_ifexist()
-{
-if [ ! -d /sys/devices/system/node ]
-then
-x=0
-else
-x=$(ls /sys/devices/system/node | wc -l)
-fi
-if [ $x -gt 1 ]
-then
-	if [ ! -f /usr/include/numa.h ]
-	then
-		echo no;
- 	else
-		echo yes;
-	fi
-else
-        echo no;     #numa is not present
-
-fi
-}
-chk_ifexist
-
Signature · 8 lines
1.8.3.1


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#1 lore raw

PATCH 2/3 ltp/pounder: Don't let the testing log output to /dev/tty

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.

---
 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(-)
tools/pounder21/Install +1 -1
index bf13528..6fb3a8f 100755
@@ -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
 
tools/pounder21/fancy_timed_loop.c +1 -1
index cf8580e..50305c3 100644
@@ -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);
tools/pounder21/infinite_loop.c +1 -1
index d78b442..804dd2e 100644
@@ -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);
tools/pounder21/pounder +7 -7
index c3defcf..caf60d3 100755
@@ -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 {
tools/pounder21/test_scripts/memtest +1 -1
index c040147..e212bde 100755
@@ -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
 
tools/pounder21/timed_loop.c +1 -1
index 966c08a..0cd7305 100644
@@ -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);
Signature · 8 lines
1.8.3.1


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
author
#2 lore raw

PATCH 3/3 pounder/cpufreq: Skip the test if processors are not supported by cpufreq

During the pounder21/cpufreq test, it print so many errors:

[2015-08-17 08:43:24] (17818) cpufreq.bin: FAIL with code 4. [2015-08-17 08:43:24] (17818) cpufreq.bin: START loop #2. [2015-08-17 08:43:25] (17812) cpufreq.bin: FAIL with code 4. [2015-08-17 08:43:25] (17812) cpufreq.bin: START loop #2. [2015-08-17 08:43:27] (17812) cpufreq.bin: FAIL with code 4.
...

The reason is that the case canceled some cpufreq check steps before, now reuse them to make sure it could be skiped on a system without cpufreq support.

---
 tools/pounder21/test_scripts/cpufreq | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/pounder21/test_scripts/cpufreq +5 -5
index ba94a76..4df70a9 100755
@@ -21,12 +21,12 @@
 
 
 # Do any CPU support cpufreq?
-#CPUFREQ_ENABLED_CPUS=`/bin/ls -lad /sys/devices/system/cpu/cpu*/cpufreq 2> /dev/null | wc -l`
+CPUFREQ_ENABLED_CPUS=`/bin/ls -lad /sys/devices/system/cpu/cpu*/cpufreq 2> /dev/null | wc -l`
 
-#if [ "$CPUFREQ_ENABLED_CPUS" -lt 1 ]; then
-#	echo "None of your CPUs support cpufreq.  Bye."
-#	exit 255
-#fi
+if [ "$CPUFREQ_ENABLED_CPUS" -lt 1 ]; then
+	echo "None of your CPUs support cpufreq.  Bye."
+	exit 255
+fi
 
 # Turn on acpi_pstate_strict to ensure that state transitions actually happen...
 if [ -f /sys/module/acpi_cpufreq/parameters/acpi_pstate_strict ]; then
Signature · 8 lines
1.8.3.1


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#4 lore raw

Re: [LTP] [PATCH 2/3] ltp/pounder: Don't let the testing log output to /dev/tty

In reply to Li Wang

Hi!

Quoted 5 lines

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

Quoted 8 lines

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.

Writing directly to /dev/tty is indeed wrong thing to do.

Quoted 4 lines

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.

Eh? I do not understand this part at all. It does not seem to be related to the problem at all.

Quoted 28 lines
---
 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(-)
tools/pounder21/Install +1 -1
index bf13528..6fb3a8f 100755
@@ -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
 
tools/pounder21/fancy_timed_loop.c +0 -0
index cf8580e..50305c3 100644

tools/pounder21/fancy_timed_loop.c int main(int argc, char *argv[]) · line 98

Quoted 8 lines
tools/pounder21/fancy_timed_loop.c +1 -1
@@ -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);

Can't we rather rename the FILE * to 'out' or similar, naming it tty_fp when it does not point to tty is kind of confusing.

Also we can simply do FILE *out = stdout; If we reopen it by it's file descriptior we will end up with two different file objects, each of them will buffer data and we will end up with messed output when something will write to stdout and not the one we created.

Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#3 lore raw

Re: [LTP] [PATCH 3/3] pounder/cpufreq: Skip the test if processors are not supported by cpufreq

In reply to Li Wang

Hi!

tools/pounder21/test_scripts/cpufreq line 24

Quoted 3 lines

# Do any CPU support cpufreq?

tools/pounder21/test_scripts/cpufreq +1 -1
-#CPUFREQ_ENABLED_CPUS=`/bin/ls -lad /sys/devices/system/cpu/cpu*/cpufreq 2> /dev/null | wc -l`
+CPUFREQ_ENABLED_CPUS=`/bin/ls -lad /sys/devices/system/cpu/cpu*/cpufreq 2> /dev/null | wc -l`

Calling ls by full path is simply wrong.

tools/pounder21/test_scripts/cpufreq line 29

Quoted 8 lines
tools/pounder21/test_scripts/cpufreq +4 -4
-#if [ "$CPUFREQ_ENABLED_CPUS" -lt 1 ]; then
-#	echo "None of your CPUs support cpufreq.  Bye."
-#	exit 255
-#fi
+if [ "$CPUFREQ_ENABLED_CPUS" -lt 1 ]; then
+	echo "None of your CPUs support cpufreq.  Bye."
+	exit 255
+fi

This part of code was specially disabled in one commit, unfortunately it does not say why exactly it was disabled. So I'm hesitant to enable it unless we are sure that the code actually works fine on several distributions.

Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list