diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-12-27 14:10:50 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-12-27 14:15:50 +0800 |
commit | 598b77988aa6ba2004c8b99b8fe09dbf09e560fa (patch) | |
tree | 318fa8719771d04df5cfbfb62cc244d0a9ecaca9 | |
parent | 4d8ea4bd3209398189f6e44366867c7f3362d4d5 (diff) |
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 <feng.xiaowei@zte.com.cn>
-rwxr-xr-x | run_unit_tests.sh | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/run_unit_tests.sh b/run_unit_tests.sh index 71d21c9db..b098f37b2 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 |