From c528456077e22d58550bc243dd301a9874d65e16 Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Fri, 24 May 2019 06:51:36 +0000 Subject: [PATCH] Update some fixes --- .../files/run-lang-coverage-test | 29 ++++++++++++++----- tests/roles/custom-test-fonts/tasks/main.yml | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/roles/custom-test-fonts/files/run-lang-coverage-test b/tests/roles/custom-test-fonts/files/run-lang-coverage-test index c7823cb..5658cfd 100755 --- a/tests/roles/custom-test-fonts/files/run-lang-coverage-test +++ b/tests/roles/custom-test-fonts/files/run-lang-coverage-test @@ -19,7 +19,8 @@ Options: -l, --lang=LANG Test LANG language coverage (default: en) -p, --path=PATH Test fonts on PATH -a, --artifactsdir=DIR test environment dir to store artifacts --i, --ignore=FILE Ignore FILE to check. +-e, --exclude=FILE Exclude FILE to check. +-i, --include=FILE Include File to check. _EOF_ } @@ -28,14 +29,19 @@ DEBUG="${DEBUG:-}" OPT_LANG="${OPT_LANG:-en}" OPT_PATH="${OPT_PATH:-}" OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}" -OPT_IGNORE=() +OPT_EXCLUDE=() +OPT_INCLUDE=() -opt=$(getopt -n "$0" --options "hvl:p:t:a:i:" --longoptions "help,verbose,lang:,path:,test:,artifactsdir:,ignore:" -- "$@") +opt=$(getopt -n "$0" --options "hvl:p:t:a:e:i:" --longoptions "help,verbose,lang:,path:,test:,artifactsdir:,exclude:,include:" -- "$@") eval set -- "$opt" while [[ $# -gt 0 ]]; do case "$1" in - -i|--ignore) - OPT_IGNORE+=("$2") + -i|--include) + OPT_INCLUDE+=("$2") + shift 2 + ;; + -e|--exclude) + OPT_EXCLUDE+=("$2") shift 2 ;; -a|--artifactsdir) @@ -75,7 +81,8 @@ fi debug "Path: $OPT_PATH" debug "Lang: $OPT_LANG" debug "Artifacts dir: $OPT_ARTIFACTS_DIR" -debug "Ignore: ${OPT_IGNORE[@]}" +debug "Exclude: ${OPT_EXCLUDE[@]}" +debug "Include: ${OPT_INCLUDE[@]}" STR_TEST_DASHED=$(echo "$OPT_PATH" | sed -e 's/\//-/g') clean_exit() { @@ -136,13 +143,21 @@ set -f if test -f $i; then n=`basename $i` set +e - contains "$n" "${OPT_IGNORE[@]}" + contains "$n" "${OPT_EXCLUDE[@]}" ret=$? set -e if [ $ret -eq 1 ]; then debug "ignoring $i" continue fi + set +e + contains "$n" "${OPT_INCLUDE[@]}" + ret=$? + set -e + if [ $ret -eq 0 ]; then + debug "$i isn't targeted file" + continue + fi debug " $i" res=`fc-validate -l $OPT_LANG $i` if echo $res | grep -q Missing; then diff --git a/tests/roles/custom-test-fonts/tasks/main.yml b/tests/roles/custom-test-fonts/tasks/main.yml index 2f5f799..44830cb 100644 --- a/tests/roles/custom-test-fonts/tasks/main.yml +++ b/tests/roles/custom-test-fonts/tasks/main.yml @@ -2,7 +2,7 @@ - block: - name: language coverage - script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].ignore is not defined else "--ignore " + (coverage[item].ignore | join('--ignore ')) }} + script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].ignore is not defined else "--exclude " + (coverage[item].ignore | join('--exclude ')) }} {{ "" if coverage.values is not defined or coverage[item].include is not defined else "--include " + (coverage[item].include | join('--include ')) }} with_items: - "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}" - name: generic family assignment