From f501458967954c0e074643ba4999653cea58d8d1 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Wed, 14 Feb 2018 20:57:57 +0000 Subject: [PATCH] qa/standalone: deduplicate cleanup code Signed-off-by: Joao Eduardo Luis --- qa/run-standalone.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qa/run-standalone.sh b/qa/run-standalone.sh index c69b3bf9c8f..8bd56d9253b 100755 --- a/qa/run-standalone.sh +++ b/qa/run-standalone.sh @@ -44,10 +44,14 @@ else COREPATTERN="core.%e.%p.%t" fi -function finish() { +function cleanup() { if [ -n "$precore" ]; then sudo sysctl -w ${KERNCORE}=${precore} fi +} + +function finish() { + cleanup exit 0 } @@ -135,9 +139,7 @@ do fi fi done -if [ -n "$precore" ]; then - sudo sysctl -w ${KERNCORE}="${precore}" -fi +cleanup if [ "$errors" != "0" ]; then echo "$errors TESTS FAILED, $count TOTAL TESTS"