aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex Lee <limingjiang@huawei.com>2019-03-30 04:12:53 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-03-30 04:12:53 +0000
commit7548f560bef0d833ae778a4ea9d81b3cc2c3d463 (patch)
treef038f1c87e9cd6ac8d2a532141b3039667eba61c
parent6c587908f4bb925f97cc8592a099ef14940c393d (diff)
parent85899baa90714ae15add21a330316793071168ae (diff)
Merge "Yardstick verify job could base on the filetype to run the test"
-rwxr-xr-xtools/run_tests.sh21
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/run_tests.sh b/tools/run_tests.sh
index 49f628eec..40b21cab9 100755
--- a/tools/run_tests.sh
+++ b/tools/run_tests.sh
@@ -66,16 +66,21 @@ run_functional_test() {
fi
}
-if [[ $opts =~ "--unit" ]]; then
- run_tests
-fi
+# get file types of the last change on git
+file_types=$(git diff-tree -r --name-only HEAD~1 HEAD | awk -F[/] '{print $NF}' | awk -F[.] 'NF>1 {print $NF}' | uniq)
-if [[ $opts =~ "--coverage" ]]; then
- run_coverage
-fi
+if [[ $file_types =~ "py" ]]; then
+ if [[ $opts =~ "--unit" ]]; then
+ run_tests
+ fi
-if [[ $opts =~ "--functional" ]]; then
- run_functional_test
+ if [[ $opts =~ "--coverage" ]]; then
+ run_coverage
+ fi
+
+ if [[ $opts =~ "--functional" ]]; then
+ run_functional_test
+ fi
fi
if [[ -z $opts ]]; then