* [LTP] [PATCH] Fixes of the tcore test
@ 2009-02-17 22:58 Jiri Palecek
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Palecek @ 2009-02-17 22:58 UTC (permalink / raw)
Cc: ltp-list
Hello,
these are little fixes of the tcore.sh script
- use $BIN_DIR for auxiliary files, and $TEST_DIR as temporary
directory
- don't run "cd -" if previous "cd something" failed
- fixup the value of core_pattern, to replace possibly customized
patterns using absolute paths or not using the name "core" for
corefiles
- don't hide error messages from expect
Regards
Jiri Palecek
Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
testcases/misc/tcore_patch_test_suites/tcore.sh | 39 ++++++++++++++++-------
1 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
index d210fa5..f087fa7 100755
--- a/testcases/misc/tcore_patch_test_suites/tcore.sh
+++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
@@ -19,7 +19,8 @@
# Test suite for the t-core kernel patch
export TCID=tcore01
PTHREAD_DIR="/lib/i686"
-TEST_DIR="."
+BIN_DIR=$LTPROOT/testcases/bin/
+TEST_DIR=$(mktemp -dt)
OSTYPE="redhat"
# Do some preparation to generate the correct core dump
# files
@@ -42,6 +43,14 @@ os_check()
fi
}
+cleanup()
+{
+ rm -rf $TEST_DIR
+ [ -f /proc/sys/kernel/core_dumps_threads ] && ! [ -z "$OLD_PATTERN" ] &&
+ echo "$OLD_PATTERN" > /proc/sys/kernel/core_dumps_threads
+ exit $1
+}
+
prepare_dump()
{
ulimit -c 20000000 >/dev/null 2>&1
@@ -52,18 +61,23 @@ prepare_dump()
echo "1">/proc/sys/kernel/core_dumps_threads
fi
fi
+ if [ -f /proc/sys/kernel/core_pattern ]; then
+ OLD_PATTERN=$(cat /proc/sys/kernel/core_pattern)
+ echo 'core.%p' > /proc/sys/kernel/core_pattern
+ fi
#Recover the lipthread.so.0 lib to generate the correct
#core dump file
os_check
if [ $OSTYPE = "redhat" ];then
- cd $PTHREAD_DIR
- if [ -f libpthread.so.0.orig ];then
- test=`ls -l libpthread.so.0.orig|awk '{print $11}'`
- if [ $test = "libpthread-0.9.so" ];then
- mv libpthread.so.0.orig libpthread.so.0
+ cd $PTHREAD_DIR && {
+ if [ -f libpthread.so.0.orig ];then
+ test=`ls -l libpthread.so.0.orig|awk '{print $11}'`
+ if [ $test = "libpthread-0.9.so" ];then
+ mv libpthread.so.0.orig libpthread.so.0
+ fi
fi
- fi
- cd -
+ cd -
+ }
fi
}
#Prepare for the gdb dump
@@ -71,7 +85,7 @@ prepare_gdb()
{
os_check
if [ $OSTYPE = "redhat" ];then
- cd $PTHREAD_DIR
+ cd $PTHREAD_DIR && {
if [ -f libpthread.so.0 ];then
test=`ls -l libpthread.so.0|awk '{print $11}'`
if [ $test = "libpthread-0.9.so" ];then
@@ -80,6 +94,7 @@ prepare_gdb()
fi
ln -s /lib/libpthread.so.0 libpthread.so.0 >/dev/null 2>&1
cd -
+ }
fi
}
#Test whether the system can generate the needed core files
@@ -91,7 +106,7 @@ Test_gen_core()
if [ -f core.* ];then
rm -f core.*
fi
- pid=`$TEST_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
+ pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
echo -e "Test whether we can generate the needed core file"
if [ -f core.* ];then
echo -e "PASS"
@@ -110,7 +125,7 @@ Test_core_file()
prepare_gdb
mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
echo -e "Test whether the core support bt,fpu and threads commands "
- expect ./tcore.exp >/dev/null 2>&1
+ expect $BIN_DIR/tcore.exp
return=$?
pass=`expr $pass + $return`
fail=`expr 3 - $return + $fail`
@@ -123,7 +138,7 @@ Test_core_file
echo "Linux Tcore test results" > results
echo "Total pass fail" >> results
echo " 5 $pass $fail" >> results
-exit $fail
+cleanup $fail
--
1.6.3.1
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH] Fixes of the tcore test
[not found] <200906220102.n5M12lQI021373@e35.co.us.ibm.com>
@ 2009-06-23 14:48 ` Subrata Modak
0 siblings, 0 replies; 2+ messages in thread
From: Subrata Modak @ 2009-06-23 14:48 UTC (permalink / raw)
To: Jiri Palecek; +Cc: ltp-list
On Tue, 2009-02-17 at 23:58 +0100, Jiri Palecek wrote:
> Hello,
>
> these are little fixes of the tcore.sh script
>
> - use $BIN_DIR for auxiliary files, and $TEST_DIR as temporary
> directory
> - don't run "cd -" if previous "cd something" failed
> - fixup the value of core_pattern, to replace possibly customized
> patterns using absolute paths or not using the name "core" for
> corefiles
> - don't hide error messages from expect
>
> Regards
> Jiri Palecek
>
> Signed-off-by: Jiri Palecek <jpalecek@web.de>
Thanks. But, arrived quite late.
Regards--
Subrata
> ---
> testcases/misc/tcore_patch_test_suites/tcore.sh | 39 ++++++++++++++++-------
> 1 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/testcases/misc/tcore_patch_test_suites/tcore.sh b/testcases/misc/tcore_patch_test_suites/tcore.sh
> index d210fa5..f087fa7 100755
> --- a/testcases/misc/tcore_patch_test_suites/tcore.sh
> +++ b/testcases/misc/tcore_patch_test_suites/tcore.sh
> @@ -19,7 +19,8 @@
> # Test suite for the t-core kernel patch
> export TCID=tcore01
> PTHREAD_DIR="/lib/i686"
> -TEST_DIR="."
> +BIN_DIR=$LTPROOT/testcases/bin/
> +TEST_DIR=$(mktemp -dt)
> OSTYPE="redhat"
> # Do some preparation to generate the correct core dump
> # files
> @@ -42,6 +43,14 @@ os_check()
> fi
> }
>
> +cleanup()
> +{
> + rm -rf $TEST_DIR
> + [ -f /proc/sys/kernel/core_dumps_threads ] && ! [ -z "$OLD_PATTERN" ] &&
> + echo "$OLD_PATTERN" > /proc/sys/kernel/core_dumps_threads
> + exit $1
> +}
> +
> prepare_dump()
> {
> ulimit -c 20000000 >/dev/null 2>&1
> @@ -52,18 +61,23 @@ prepare_dump()
> echo "1">/proc/sys/kernel/core_dumps_threads
> fi
> fi
> + if [ -f /proc/sys/kernel/core_pattern ]; then
> + OLD_PATTERN=$(cat /proc/sys/kernel/core_pattern)
> + echo 'core.%p' > /proc/sys/kernel/core_pattern
> + fi
> #Recover the lipthread.so.0 lib to generate the correct
> #core dump file
> os_check
> if [ $OSTYPE = "redhat" ];then
> - cd $PTHREAD_DIR
> - if [ -f libpthread.so.0.orig ];then
> - test=`ls -l libpthread.so.0.orig|awk '{print $11}'`
> - if [ $test = "libpthread-0.9.so" ];then
> - mv libpthread.so.0.orig libpthread.so.0
> + cd $PTHREAD_DIR && {
> + if [ -f libpthread.so.0.orig ];then
> + test=`ls -l libpthread.so.0.orig|awk '{print $11}'`
> + if [ $test = "libpthread-0.9.so" ];then
> + mv libpthread.so.0.orig libpthread.so.0
> + fi
> fi
> - fi
> - cd -
> + cd -
> + }
> fi
> }
> #Prepare for the gdb dump
> @@ -71,7 +85,7 @@ prepare_gdb()
> {
> os_check
> if [ $OSTYPE = "redhat" ];then
> - cd $PTHREAD_DIR
> + cd $PTHREAD_DIR && {
> if [ -f libpthread.so.0 ];then
> test=`ls -l libpthread.so.0|awk '{print $11}'`
> if [ $test = "libpthread-0.9.so" ];then
> @@ -80,6 +94,7 @@ prepare_gdb()
> fi
> ln -s /lib/libpthread.so.0 libpthread.so.0 >/dev/null 2>&1
> cd -
> + }
> fi
> }
> #Test whether the system can generate the needed core files
> @@ -91,7 +106,7 @@ Test_gen_core()
> if [ -f core.* ];then
> rm -f core.*
> fi
> - pid=`$TEST_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
> + pid=`$BIN_DIR/tcore |grep "consumer pid"|awk '{print $2}'|cut -d = -f 2`
> echo -e "Test whether we can generate the needed core file"
> if [ -f core.* ];then
> echo -e "PASS"
> @@ -110,7 +125,7 @@ Test_core_file()
> prepare_gdb
> mv -f $TEST_DIR/core.* $TEST_DIR/corefile >/dev/null 2>&1
> echo -e "Test whether the core support bt,fpu and threads commands "
> - expect ./tcore.exp >/dev/null 2>&1
> + expect $BIN_DIR/tcore.exp
> return=$?
> pass=`expr $pass + $return`
> fail=`expr 3 - $return + $fail`
> @@ -123,7 +138,7 @@ Test_core_file
> echo "Linux Tcore test results" > results
> echo "Total pass fail" >> results
> echo " 5 $pass $fail" >> results
> -exit $fail
> +cleanup $fail
>
>
>
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-23 14:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200906220102.n5M12lQI021373@e35.co.us.ibm.com>
2009-06-23 14:48 ` [LTP] [PATCH] Fixes of the tcore test Subrata Modak
2009-02-17 22:58 Jiri Palecek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox