From 599d7622dd0bd7f73145cc229b576d5de7f04fda Mon Sep 17 00:00:00 2001 From: David Zafman Date: Fri, 18 Aug 2017 10:00:10 -0700 Subject: [PATCH] tests: run-standalone.sh skip core_pattern if already set 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 --- qa/run-standalone.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qa/run-standalone.sh b/qa/run-standalone.sh index d470e0401acc3..3be6121f6ff3d 100755 --- a/qa/run-standalone.sh +++ b/qa/run-standalone.sh @@ -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" -- 2.39.5