diff --git a/test/long_stochastic.sh b/test/long_stochastic.sh index 29e70949..d75607ec 100755 --- a/test/long_stochastic.sh +++ b/test/long_stochastic.sh @@ -275,7 +275,11 @@ case ${UNAME} in ulimit -c unlimited if [ "$(cat /proc/sys/kernel/core_pattern)" != "core.%p" ]; then echo "core.%p > /proc/sys/kernel/core_pattern" >&2 - echo "core.%p" | sudo tee /proc/sys/kernel/core_pattern || true + if [ $(id -u) -ne 0 -a -n "$(which sudo 2>/dev/null)" ]; then + echo "core.%p" | sudo tee /proc/sys/kernel/core_pattern || true + else + (echo "core.%p" > /proc/sys/kernel/core_pattern) || true + fi fi ;; diff --git a/test/stochastic_small.sh b/test/stochastic_small.sh index 5e216ced..b0aa1cb7 100755 --- a/test/stochastic_small.sh +++ b/test/stochastic_small.sh @@ -213,7 +213,11 @@ case ${UNAME} in ulimit -c unlimited if [ "$(cat /proc/sys/kernel/core_pattern)" != "core.%p" ]; then echo "core.%p > /proc/sys/kernel/core_pattern" >&2 - echo "core.%p" | sudo tee /proc/sys/kernel/core_pattern || true + if [ $(id -u) -ne 0 -a -n "$(which sudo 2>/dev/null)" ]; then + echo "core.%p" | sudo tee /proc/sys/kernel/core_pattern || true + else + (echo "core.%p" > /proc/sys/kernel/core_pattern) || true + fi fi ;;