public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Akira TAGOH <akira@tagoh.org>
To: git-commits@fedoraproject.org
Subject: [tests/fonts] rhel9: lang_coverage: Add a feature to read variables from file
Date: Thu, 13 Aug 2026 10:29:16 GMT [thread overview]
Message-ID: <178661695668.1.11914692094132689260.tests-fonts-542bdf2b1cc3@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/fonts
Branch : rhel9
Commit : 542bdf2b1cc3373772e89385809f2003a0d0b1e6
Author : Akira TAGOH <akira@tagoh.org>
Date : 2024-07-05T18:18:00+09:00
Stats : +54/-36 in 1 file(s)
URL : https://src.fedoraproject.org/tests/fonts/c/542bdf2b1cc3373772e89385809f2003a0d0b1e6?branch=rhel9
Log:
lang_coverage: Add a feature to read variables from file
---
diff --git a/tests/lang_coverage/test.sh b/tests/lang_coverage/test.sh
index 59c6320..31aa0e8 100755
--- a/tests/lang_coverage/test.sh
+++ b/tests/lang_coverage/test.sh
@@ -1,70 +1,88 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+
+basedir=$(pwd)
+
. /usr/share/beakerlib/beakerlib.sh || exit 1
FONT_LANG=${FONT_LANG:-"en"}
FONT_LANG_EXCLUDE_FILES=${FONT_LANG_EXCLUDE_FILES:-}
PACKAGE=${PACKAGE:-"blahblah-fonts"}
+VARLIST=${VARLIST:-}
+
+function get_font_path {
+ local pkg=$1
-function get_font_path() {
- fontlist=$(rpm -ql $PACKAGE|grep /usr/share/fonts)
- ret=$(for f in $fontlist; do
- dirname $f
- done|sort|uniq|grep /usr/share/fonts/)
- echo -n $ret
+ rpm -ql $pkg|grep /usr/share/fonts/
}
-function check_exception() {
- if [ "x$FONT_LANG_EXCLUDE_FILES" == "x" ]; then
+function check_exception {
+ local exregex=$1
+ local file=$2
+
+ if [ "x$exregex" == "x" ]; then
echo -n 1
else
- echo $1 | grep -E "$FONT_LANG_EXCLUDE_FILES" 2>&1 > /dev/null
+ echo $file | grep -E "$exregex" 2>&1 > /dev/null
echo -n $?
fi
}
-function check_lang_coverage() {
- ret=0
- for p in $(get_font_path); do
- for f in $(find $p -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(otc\)?\(pcf.*\)?\(pfa\)?'); do
- set -f
- if [ $(check_exception $f) -ne 0 -a -f $f ]; then
- IFS=, read -ra langlist <<< "$FONT_LANG"
- for l in "${langlist[@]}"; do
- res=$(fc-validate -l $l $f || :)
- if echo $res | grep -q Missing; then
- ret=1
- echo $res
- else
- echo $res
- fi
- done
+function test_pkg {
+ local pkg=$1
+
+ rlPhaseStartTest "Package installation test for $pkg" #{
+ rlRun "rpm -q $pkg" 0 "Package installation test" #}
+ rlPhaseEnd
+}
+
+function test_lang_coverage {
+ local pkg=${1:-"unknown package"}
+ local fclang=${2:-"en"}
+ local fcexpat=${3:-}
+
+ test_pkg $pkg
+
+ rlPhaseStartTest "Language coverage test for $pkg"
+ for f in $(get_font_path $pkg); do
+ if echo $f|grep -Eq "\.(t1|ttf|otf|ttc|otc|pcf.*|pfa)$"; then
+ set -f
+ if [ $(check_exception $fcexpat $f) -ne 0 ] && [ -f $f ]; then
+ IFS=, read -ra langlist <<< "$fclang"
+ for l in "${langlist[@]}"; do
+ rlRun "fc-validate -l $l $f" 0 "$pkg:$(basename $f): Check language coverage for $l"
+ done
+ else
+ rlLogInfo "Skipping $f (according to FONT_LANG_EXCLUDE_FILES)"
+ fi
+ set +f
else
- rlLogInfo "Skipping $f"
+ rlLogInfo "Skipping $f (non-font file)"
fi
- set +f
done
- done
- return $ret
+ rlPhaseEnd
}
rlJournalStart
+
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
rlRun "set -o pipefail"
rlPhaseEnd
- rlPhaseStartTest
- rlRun "rpm -q $PACKAGE" 0 "Package installation test"
- rlPhaseEnd
-
- rlPhaseStartTest
- rlRun "check_lang_coverage" 0 "Check Language Coverage"
- rlPhaseEnd
+ if [ -n "$VARLIST" ] && [ -f "$basedir/../../plans/$VARLIST" ]; then
+ rlLogInfo "Reading variables from $VARLIST"
+ cat "$basedir/../../plans/$VARLIST" | grep -E -v "^#" | while IFS=";" read -r PACKAGE FONT_ALIAS FONT_LANG FONT_WIDTH FONT_FAMILY SANS SERIF MONO EMOJI MATH FONT_LANG_EXCLUDE_FILES dummy; do
+ test_lang_coverage "$PACKAGE" "$FONT_LANG" "$FONT_LANG_EXCLUDE_FILES"
+ done
+ else
+ test_lang_coverage "$PACKAGE" "$FONT_LANG" "$FONT_LANG_EXCLUDE_FILES"
+ fi
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
+
rlJournalEnd
reply other threads:[~2026-08-13 10:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178661695668.1.11914692094132689260.tests-fonts-542bdf2b1cc3@fedoraproject.org \
--to=akira@tagoh.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox