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: Add common functions to allow taking care of multiple versions of list file
Date: Thu, 13 Aug 2026 10:29:31 GMT	[thread overview]
Message-ID: <178661697174.1.9624162136736429571.tests-fonts-fcee438e2953@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : tests/fonts
Branch : rhel9
Commit : fcee438e2953954593555638139d5a1103ea7142
Author : Akira TAGOH <akira@tagoh.org>
Date   : 2025-11-25T11:29:37+09:00
Stats  : +46/-0 in 1 file(s)
URL    : https://src.fedoraproject.org/tests/fonts/c/fcee438e2953954593555638139d5a1103ea7142?branch=rhel9

Log:
Add common functions to allow taking care of multiple versions of list file

---
diff --git a/tests/functions b/tests/functions
new file mode 100644
index 0000000..20d9056
--- /dev/null
+++ b/tests/functions
@@ -0,0 +1,46 @@
+#! /bin/bash
+# SPDX-License-Identifier: MIT
+
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+function call_test() {
+    local func=${1}
+    shift
+    local cbparams=("$@")
+    local funcargs=()
+
+    for v in "${cbparams[@]}"; do
+        rlLogInfo "  ${v}: ${!v}"
+        funcargs+=("${!v}")
+    done
+    "${func}" "${funcargs[@]}"
+}
+function read_varlist() {
+    local listfile=${1}
+    local func=${2}
+    shift 2
+    local cbparams=("$@")
+    local v1format=("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" "FONT_VALIDATE_INDEXES" "FONT_LANG_INDEXES")
+    local v2format=("PACKAGE" "FONT_ALIAS" "FONT_LANG" "FONT_WIDTH" "FONT_FAMILY" "DEFAULT_SANS" "DEFAULT_SERIF" "DEFAULT_MONO" "DEFAULT_EMOJI" "DEFAULT_MATH" "DEFAULT_SYSTEMUI" "FONT_LANG_EXCLUDE_FILES" "FONT_VALIDATE_EXCLUDE_FILES" "FONT_CONF_EXCLUDE_FILES" "FONT_VALIDATE_INDEXES" "FONT_LANG_INDEXES")
+    declare -A varformat
+    varformat[1]="v1format"
+    varformat[2]="v2format"
+
+    if [ ! -f "${listfile}" ]; then
+        rlDie "File not found: $listfile"
+    fi
+    version=$(grep -E "^#[[:space:]]+version=" "${listfile}"|sed -e 's/^#[ \t].*version=\([0-9].*\)$/\1/g'|head -1)
+    if [ -z "$version" ]; then
+        version="1"
+    fi
+    if [ -z "${varformat[$version]}" ]; then
+        rlLogWarning "Invalid version. using version 1: $version"
+        version="1"
+    fi
+    rlLogInfo "  Reading parameters from: ${listfile}"
+    rlLogInfo "  List format version: ${version}"
+    declare -n refparams="${varformat["$version"]}"
+    grep -E -v "^#" "${listfile}" | while IFS=";" read -r "${refparams[@]}" dummy; do
+        call_test "$func" "${cbparams[@]}"
+    done
+}

                 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=178661697174.1.9624162136736429571.tests-fonts-fcee438e2953@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