]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: run-standalone.sh skip core_pattern if already set 17098/head
authorDavid Zafman <dzafman@redhat.com>
Fri, 18 Aug 2017 17:00:10 +0000 (10:00 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 18 Aug 2017 17:27:12 +0000 (10:27 -0700)
If sudo requires a password it is nice to be able to avoid
sudo sysctl by setting core_pattern ahead of time.

Signed-off-by: David Zafman <dzafman@redhat.com>
qa/run-standalone.sh

index d470e0401acc3120af5f12d3bfbd2ebf1456d184..3be6121f6ff3d075f920dbbb36c9f1491df05b9c 100755 (executable)
@@ -55,7 +55,12 @@ count=0
 errors=0
 userargs=""
 precore="$(sysctl -n $KERNCORE)"
-sudo sysctl -w ${KERNCORE}=${COREPATTERN}
+# If corepattern already set, avoid having to use sudo
+if [ "$precore" = "$COREPATTERN" ]; then
+    precore=""
+else
+    sudo sysctl -w ${KERNCORE}=${COREPATTERN}
+fi
 ulimit -c unlimited
 for f in $(cd $location ; find . -perm $exec_mode -type f)
 do
@@ -105,7 +110,9 @@ do
         fi
     fi
 done
-sudo sysctl -w ${KERNCORE}=${precore}
+if [ -n "$precore" ]; then
+    sudo sysctl -w ${KERNCORE}=${precore}
+fi
 
 if [ "$errors" != "0" ]; then
     echo "$errors TESTS FAILED, $count TOTAL TESTS"