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: validate_family: add new test case
Date: Thu, 13 Aug 2026 10:29:08 GMT	[thread overview]
Message-ID: <178661694898.1.14374176407688931974.tests-fonts-865b3f5e6611@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/fonts
            Branch : rhel9
            Commit : 865b3f5e6611f35ab2cb0075e6d7a8db93c679b7
            Author : Akira TAGOH <akira@tagoh.org>
            Date   : 2024-06-21T18:29:28+09:00
            Stats  : +51/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/fonts/c/865b3f5e6611f35ab2cb0075e6d7a8db93c679b7?branch=rhel9

            Log:
            validate_family: add new test case

To check if FONT_FAMILY is really valid in the targeted package

---
diff --git a/README.rst b/README.rst
index e987f86..7d35f95 100644
--- a/README.rst
+++ b/README.rst
@@ -101,6 +101,15 @@ Available test cases
   - PACKAGE
   - FONT_LANG (optional)
 
+- Validate family name
+
+  A test case to check if a given FONT_FAMILY is really valid for this package.
+  This is to prevent some human error.
+  The following parameters are used in this test:
+
+  - PACKAGE
+  - FONT_FAMILY
+
 FAQ
 ---
 

diff --git a/tests/validate_family/main.fmf b/tests/validate_family/main.fmf
new file mode 100644
index 0000000..99fa3a5
--- /dev/null
+++ b/tests/validate_family/main.fmf
@@ -0,0 +1,6 @@
+summary: Validate family name
+description: >
+    This aims to check if the given FONT_FAMILY is valid for this font package
+require+:
+    - fontconfig-devel
+    - pkg-config

diff --git a/tests/validate_family/test.sh b/tests/validate_family/test.sh
new file mode 100755
index 0000000..b6b2685
--- /dev/null
+++ b/tests/validate_family/test.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh || exit 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
+}
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        rlRun "pushd $tmp"
+        rlRun "set -o pipefail"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        for p in $(get_font_path); do
+            for f in $(find $p -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(otc\)?\(pcf.*\)?\(pfa\)?'); do
+                set -f
+                if test -f $f; then
+                    rlRun "fc-scan -f \"%{family[0]}\" $f | tee output" 0 "Querying family name"
+                    rlAssertGrep "$FONT_FAMILY" "output"
+		fi
+            done
+        done
+    rlPhaseEnd
+
+    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=178661694898.1.14374176407688931974.tests-fonts-865b3f5e6611@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