public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/fonts] rhel9: generic_alias: Add a feature to skip fontconfig files
@ 2026-08-13 10:29 Akira TAGOH
  0 siblings, 0 replies; only message in thread
From: Akira TAGOH @ 2026-08-13 10:29 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : tests/fonts
Branch : rhel9
Commit : 177244d0aec3d337f751549cb533b22e10216bd3
Author : Akira TAGOH <akira@tagoh.org>
Date   : 2024-07-12T01:12:25+09:00
Stats  : +30/-6 in 2 file(s)
URL    : https://src.fedoraproject.org/tests/fonts/c/177244d0aec3d337f751549cb533b22e10216bd3?branch=rhel9

Log:
generic_alias: Add a feature to skip fontconfig files

---
diff --git a/README.rst b/README.rst
index e223e8c..df3469b 100644
--- a/README.rst
+++ b/README.rst
@@ -101,6 +101,10 @@ Available test cases
 
     default value is normal.
 
+  - FONT_CONF_EXCLUDE_FILES (optional)
+
+    Set a regex to skip some bogus fontconfig config files.
+
 - Language coverage
 
   A test case to check if a font in PACKAGE has sufficient coverage for FONT_LANG.
@@ -175,7 +179,7 @@ FAQ
   You can put required variables into a file on plans directory like the following format::
 
     # comment
-    PACKAGE;FONT_ALIAS;FONT_LANG;FONT_WIDTH;FONT_FAMILY;DEFAULT_SANS;DEFAULT_SERIF;DEFAULT_MONO;DEFAULT_EMOJI;DEFAULT_MATH;FONT_LANG_EXCLUDE_FILES;FONT_VALIDATE_EXCLUDE_FILES;
+    PACKAGE;FONT_ALIAS;FONT_LANG;FONT_WIDTH;FONT_FAMILY;DEFAULT_SANS;DEFAULT_SERIF;DEFAULT_MONO;DEFAULT_EMOJI;DEFAULT_MATH;FONT_LANG_EXCLUDE_FILES;FONT_VALIDATE_EXCLUDE_FILES;FONT_CONF_EXCLUDE_FILES;
     ...
 
   And then set a filename to VARLIST like::

diff --git a/tests/generic_alias/test.sh b/tests/generic_alias/test.sh
index b9cc12d..03b6869 100755
--- a/tests/generic_alias/test.sh
+++ b/tests/generic_alias/test.sh
@@ -7,13 +7,32 @@ FONT_ALIAS=${FONT_ALIAS:-"sans-serif"}
 FONT_FAMILY=${FONT_FAMILY:-"family name"}
 FONT_LANG=${FONT_LANG:-"en"}
 FONT_WIDTH=${FONT_WIDTH:-"normal"}
+FONT_CONF_EXCLUDE_FILES=${FONT_CONF_EXCLUDE_FILES:-}
 PACKAGE=${PACKAGE:-"blahblah-fonts"}
 VARLIST=${VARLIST:-}
 
+function check_exception {
+    local exregex=$1
+    local file=$2
+
+    if [ "x$exregex" == "x" ]; then
+        echo -n 1
+    else
+        echo $file | grep -E "$exregex" 2>&1 > /dev/null
+        echo -n $?
+    fi
+}
+
 function prepare_test {
     local pkg=$1
+    local fcexpat=${2:-}
+    local conffiles=()
 
-    rlRun "conffiles=\$(rpm -ql $pkg | grep conf.d | tr '\n' ' ')"
+    rlRun "_conffiles=\$(rpm -ql $pkg | grep conf.d | tr '\n' ' ')"
+    for f in $_conffiles; do
+        [[ $(check_exception $fcexpat $f) -ne 0 ]] && conffiles+=($f)
+    done
+    rlAssertNotEquals "Check if config is available" ${#conffiles[@]} 0
     rlRun "conf=\$(for i in $conffiles; do echo \"  <include>\$i</include>\"; done)"
     rlRun "cat <<_E_> $tmpconfd/$pkg.conf
 <fontconfig>
@@ -38,9 +57,10 @@ function test_generic_alias {
     local fclang=${3:-"en"}
     local fcwidth=${4:-"normal"}
     local fcresult=${5:-"unknown family"}
+    local fcexpat=${6:-}
 
     rlPhaseStartTest "Generic alias test for $pkg"
-        prepare_test $pkg
+        prepare_test $pkg $fcexpat
         rlRun "cat $tmpconfd/$pkg.conf"
 	if [ "$fclang" == "-" ]; then
             rlLogInfo "$pkg:$fcfamily: Skipped."
@@ -62,13 +82,13 @@ rlJournalStart
 
     if [ -n "$VARLIST" ] && [ -f "$TMT_TREE/plans/$VARLIST" ]; then
         rlLogInfo "Reading variables from $VARLIST"
-        cat "$TMT_TREE/plans/$VARLIST" | grep -E -v "^#" | while IFS=";" read -r PACKAGE FONT_ALIAS FONT_LANG FONT_WIDTH FONT_FAMILY dummy; do
+        cat "$TMT_TREE/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 FONT_VALIDATE_EXCLUDE_FILES FONT_CONF_EXCLUDE_FILES dummy; do
             test_pkg "$PACKAGE"
-            test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY"
+            test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY" "$FONT_CONF_EXCLUDE_FILES"
         done
     else
         test_pkg "$PACKAGE"
-        test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY"
+        test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY" "$FONT_CONF_EXCLUDE_FILES"
     fi
 
     rlPhaseStartCleanup

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-13 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-13 10:29 [tests/fonts] rhel9: generic_alias: Add a feature to skip fontconfig files Akira TAGOH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox