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 000f0cb..629e3ee 100755 --- a/tests/roles/custom-test-fonts/files/run-lang-coverage-test +++ b/tests/roles/custom-test-fonts/files/run-lang-coverage-test @@ -19,6 +19,7 @@ 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. _EOF_ } @@ -27,11 +28,16 @@ DEBUG="${DEBUG:-}" OPT_LANG="${OPT_LANG:-en}" OPT_PATH="${OPT_PATH:-}" OPT_ARTIFACTS_DIR="${OPT_ARTIFACTS_DIR:-}" +OPT_IGNORE=() -opt=$(getopt -n "$0" --options "hvl:p:t:a:" --longoptions "help,verbose,lang:,path:,test:,artifactsdir:" -- "$@") +opt=$(getopt -n "$0" --options "hvl:p:t:a:i:" --longoptions "help,verbose,lang:,path:,test:,artifactsdir:,ignore:" -- "$@") eval set -- "$opt" while [[ $# -gt 0 ]]; do case "$1" in + -i|--ignore) + OPT_IGNORE+=("$2") + shift 2 + ;; -a|--artifactsdir) OPT_ARTIFACTS_DIR="$2" shift 2 @@ -69,6 +75,7 @@ fi debug "Path: $OPT_PATH" debug "Lang: $OPT_LANG" debug "Artifacts dir: $OPT_ARTIFACTS_DIR" +debug "Ignore: ${OPT_IGNORE[@]}" STR_TEST_DASHED=$(echo "$OPT_PATH" | sed -e 's/\//-/g') clean_exit() { @@ -114,11 +121,28 @@ logfile_stdout="$OPT_ARTIFACTS_DIR/$STR_TEST_DASHED.log" logfile_stderr="$OPT_ARTIFACTS_DIR/$STR_TEST_DASHED-err.log" exec 3>&1 4>&2 1> >(tee -a "$logfile_stdout" >&3) 2> >(tee -a "$logfile_stderr" >&4) +contains() { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 1; done + return 0 +} + debug "Check language coverage" set +f -for i in $OPT_PATH/*.t1 $OPT_PATH/*.ttf $OPT_PATH/*.otf $OPT_PATH/*.ttf $OPT_PATH/*.ttc; do -set -f +for i in $OPT_PATH/*.t1 $OPT_PATH/*.ttf $OPT_PATH/*.otf $OPT_PATH/*.ttc; do + set -f + echo $i if test -f $i; then + n=`basename $i` + set +e + contains "$n" "${OPT_IGNORE[@]}" + ret=$? + set -e + if [ $ret -eq 1 ]; then + debug "ignoring $i" + 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 39f0033..2c700e2 100644 --- a/tests/roles/custom-test-fonts/tasks/main.yml +++ b/tests/roles/custom-test-fonts/tasks/main.yml @@ -2,9 +2,9 @@ - block: - name: language coverage - script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" + script: run-lang-coverage-test --lang "{{ item }}" --path "{{ path_prefix }}" --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined and coverage[item].ignore is not defined else "--ignore " + (coverage[item].ignore | join('--ignore ')) }} with_items: - - "{{ coverage }}" + - "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}" - name: generic family assignment script: run-family-test --lang {{ item.lang }} --family '{{ item.family }}' --alias {{ item.alias }} --artifactsdir {{ remote_artifacts }} --package {{ package }} with_items: