public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/fonts] rhel9: generic_alias: Add a feature to read variables from file
@ 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 : f774e88feca85e90079ecc99e801cb4ff679250a
Author : Akira TAGOH <akira@tagoh.org>
Date : 2024-07-05T16:48:23+09:00
Stats : +61/-21 in 2 file(s)
URL : https://src.fedoraproject.org/tests/fonts/c/f774e88feca85e90079ecc99e801cb4ff679250a?branch=rhel9
Log:
generic_alias: Add a feature to read variables from file
---
diff --git a/README.rst b/README.rst
index 7ec3791..ed827ce 100644
--- a/README.rst
+++ b/README.rst
@@ -162,3 +162,11 @@ FAQ
However, for some limitation in the implementation, it can't be done for
TTC/OTC. So you may want to have separate plan file per faces in TTC/OTC.
See `adobe-source-han-mono-fonts package <https://src.fedoraproject.org/rpms/adobe-source-han-mono-fonts/blob/rawhide/f/plans>`_ for example.
+
+- I saw "No space left on device" error during testing.
+- Too many sub packages. How can this be simplified?
+
+ You can put required variables into a file like the following format::
+
+ # comment
+ PACKAGE;FONT_ALIAS;FONT_LANG;FONT_WIDTH;FONT_FAMILY;
diff --git a/tests/generic_alias/test.sh b/tests/generic_alias/test.sh
index 021158b..f146329 100755
--- a/tests/generic_alias/test.sh
+++ b/tests/generic_alias/test.sh
@@ -1,5 +1,8 @@
#!/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_ALIAS=${FONT_ALIAS:-"sans-serif"}
@@ -7,39 +10,68 @@ FONT_FAMILY=${FONT_FAMILY:-"family name"}
FONT_LANG=${FONT_LANG:-"en"}
FONT_WIDTH=${FONT_WIDTH:-"normal"}
PACKAGE=${PACKAGE:-"blahblah-fonts"}
+VARLIST=${VARLIST:-}
-rlJournalStart
- rlPhaseStartSetup
- rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
- rlRun "pushd $tmp"
- rlRun "set -o pipefail"
- rlRun "cachedir=\$(pkg-config --variable cachedir fontconfig)" 0 "Set cachedir"
- rlRun "tmpconfd=\$(mktemp -d)" 0 "Create tmp conf.d directory"
- rlRun "conffiles=\$(rpm -ql $PACKAGE | grep conf.d | tr '\n' ' ')"
- rlRun "conf=\$(for i in $conffiles; do
- echo \"<include>\$i</include>\"
-done)"
- rlRun "cat <<_E_> $tmpconfd/fonts.conf
+function prepare_test {
+ local pkg=$1
+
+ rlRun "conffiles=\$(rpm -ql $pkg | grep conf.d | tr '\n' ' ')"
+ rlRun "conf=\$(for i in $conffiles; do echo \" <include>\$i</include>\"; done)"
+ rlRun "cat <<_E_> $tmpconfd/$pkg.conf
<fontconfig>
<dir>/usr/share/fonts</dir>
- $conf
+$conf
<cachedir>$cachedir</cachedir>
</fontconfig>
-_E_" 0 "Create fonts.conf"
+_E_" 0 "Create fonts.conf for $pkg"
+}
+
+function test_pkg {
+ local pkg=$1
+
+ rlPhaseStartTest "Package installation test for $pkg" #{
+ rlRun "rpm -q $pkg" 0 "Package installation test" #}
rlPhaseEnd
+}
+
+function test_generic_alias {
+ local pkg=${1:-"unknown package"}
+ local fcfamily=${2:-"undefined family"}
+ local fclang=${3:-"en"}
+ local fcwidth=${4:-"normal"}
+ local fcresult=${5:-"unknown family"}
- rlPhaseStartTest
- rlRun "rpm -q $PACKAGE" 0 "Package installation test"
+ rlPhaseStartTest "Generic alias test for $pkg"
+ prepare_test $pkg
+ rlRun "cat $tmpconfd/$pkg.conf"
+ rlRun "FONTCONFIG_FILE=$tmpconfd/$pkg.conf fc-match -f \"%{family[0]}\\n\" \":family=$fcfamily:lang=$fclang:width=$fcwidth\" | tee output" 0 "Matching a font"
+ rlAssertGrep "^$fcresult\$" "output"
rlPhaseEnd
+}
- rlPhaseStartTest
- rlRun "cat $tmpconfd/fonts.conf"
- rlRun "FONTCONFIG_FILE=$tmpconfd/fonts.conf fc-match -f \"%{family[0]}\\n\" \":family=$FONT_ALIAS:lang=$FONT_LANG:width=$FONT_WIDTH\" | tee output" 0 "Matching a font"
- rlAssertGrep "$FONT_FAMILY" "output"
+rlJournalStart
+ rlPhaseStartSetup
+ rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+ rlRun "pushd $tmp"
+ rlRun "set -o pipefail"
+ rlRun "cachedir=\$(pkg-config --variable cachedir fontconfig)" 0 "Set cachedir"
+ rlRun "tmpconfd=\$(mktemp -d)" 0 "Create tmp conf.d directory"
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 dummy; do
+ test_pkg "$PACKAGE"
+ test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY"
+ done
+ else
+ test_pkg "$PACKAGE"
+ test_generic_alias "$PACKAGE" "$FONT_ALIAS" "$FONT_LANG" "$FONT_WIDTH" "$FONT_FAMILY"
+ fi
+
rlPhaseStartCleanup
rlRun "popd"
- rlRun "rm -r $tmp" 0 "Remove tmp directory"
+ rlRun "rm -r $tmpconfd $tmp" 0 "Remove tmp directory"
rlPhaseEnd
+
rlJournalEnd
^ 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 read variables from file Akira TAGOH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox