qa/standalone: deduplicate cleanup code

Signed-off-by: Joao Eduardo Luis <joao@suse.de>
This commit is contained in:
Joao Eduardo Luis 2018-02-14 20:57:57 +00:00
parent 5ba6286834
commit f501458967

View File

@ -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"