public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/fonts] rhel9: Add common functions to allow taking care of multiple versions of list 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 : 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
+}

^ 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: Add common functions to allow taking care of multiple versions of list 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