summaryrefslogtreecommitdiffstats
path: root/tools/run_tests.sh
diff options
context:
space:
mode:
authorrexlee8776 <limingjiang@huawei.com>2019-02-12 08:15:26 +0000
committerrexlee8776 <limingjiang@huawei.com>2019-02-12 08:15:26 +0000
commit85899baa90714ae15add21a330316793071168ae (patch)
tree0c5007654afe25debd934bf4a11607fbfa7d84c6 /tools/run_tests.sh
parent9c9383a1465c1e4339507fc8462aecc067bd520c (diff)
Yardstick verify job could base on the filetype to run the test
run the unit test, coverage test, functional test when the change includes postfix py change. could add yaml/yml to run yamlint JIRA: YARDSTICK-1598 Change-Id: I7d9199ec20575fc91cf0f38d84a05b02d63e316c Signed-off-by: rexlee8776 <limingjiang@huawei.com>
Diffstat (limited to 'tools/run_tests.sh')
-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