From 1a8f603120de01726a0cc05067e33cce03a5ec8f Mon Sep 17 00:00:00 2001
From: grev <grev>
Date: Tue, 12 Aug 2008 12:40:03 +0000
Subject: [PATCH] b=16622 i=Nathan.Rutman test_107 fix: save and restore the
 original kernel core pattern

---
 lustre/tests/sanity.sh | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 6fa8aaa12c..40d4b6f3e5 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -4132,14 +4132,19 @@ run_test 106 "attempt exec of dir followed by chown of that dir"
 test_107() {
         CDIR=`pwd`
         cd $DIR
+
+        local file=core
+        rm -f $file
+
+        local save_pattern=$(sysctl -n kernel.core_pattern)
+        local save_uses_pid=$(sysctl -n kernel.core_uses_pid)
+        sysctl -w kernel.core_pattern=$file
+        sysctl -w kernel.core_uses_pid=0
+
         ulimit -c unlimited
         sleep 60 &
         SLEEPPID=$!
 
-        file=`sysctl -n kernel.core_pattern`
-        core_pid=`sysctl -n kernel.core_uses_pid`
-        [ $core_pid -eq 1 ] && file=$file.$SLEEPPID
-        rm -f $file
         sleep 1
 
         kill -s 11 $SLEEPPID
@@ -4151,6 +4156,8 @@ test_107() {
                 error "Fail to create core file $file"
         fi
         rm -f $file
+        sysctl -w kernel.core_pattern=$save_pattern
+        sysctl -w kernel.core_uses_pid=$save_uses_pid
         cd $CDIR
 }
 run_test 107 "Coredump on SIG"
-- 
GitLab