From 598b77988aa6ba2004c8b99b8fe09dbf09e560fa Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Tue, 27 Dec 2016 14:10:50 +0800 Subject: bugfix: clean results directory error change 'rm -rf /home/opnfv/functest' to 'rm -rf /home/opnfv/functest/results' and extract the clean logic to a common method clean_results_dir Change-Id: I8aa0b09b58d9c14e53c2d4f2bb39376239e41168 Signed-off-by: SerenaFeng --- run_unit_tests.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'run_unit_tests.sh') diff --git a/run_unit_tests.sh b/run_unit_tests.sh index 71d21c9d..b098f37b 100755 --- a/run_unit_tests.sh +++ b/run_unit_tests.sh @@ -2,6 +2,13 @@ set -o errexit set -o pipefail +function clean_results_dir { + if [ -d "/home/opnfv/functest/results" ] + then + sudo rm -rf /home/opnfv/functest/results + fi +} + # ****************************** # prepare the env for the tests # ****************************** @@ -9,10 +16,7 @@ set -o pipefail # should be done at the end # but in case of crash during unit test # clean it anyway -if [ -d "/home/opnfv/functest/results" ] -then - sudo rm -rf /home/opnfv/functest -fi +clean_results_dir # TODO clean that... # Create log dir if needed @@ -67,9 +71,6 @@ deactivate # clean # ******* # Clean useless logs -if [ -d "/home/opnfv/functest/results" ] -then - sudo rm -rf /home/opnfv/functest/results -fi +clean_results_dir exit $rc -- cgit 1.2.3-korg