public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/fonts] rhel9: generic_alias: fix shellcheck error
@ 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 : 22d3ffb43faaa0f94099e5692033abe4efbdadb0
Author : Akira TAGOH <akira@tagoh.org>
Date   : 2024-11-15T18:14:19+09:00
Stats  : +13/-11 in 1 file(s)
URL    : https://src.fedoraproject.org/tests/fonts/c/22d3ffb43faaa0f94099e5692033abe4efbdadb0?branch=rhel9

Log:
generic_alias: fix shellcheck error

---
diff --git a/tests/generic_alias/test.sh b/tests/generic_alias/test.sh
index 4e0d2c6..24d5967 100755
--- a/tests/generic_alias/test.sh
+++ b/tests/generic_alias/test.sh
@@ -16,10 +16,10 @@ function check_exception {
     local exregex=$1
     local file=$2
 
-    if [ "x$exregex" == "x" ]; then
+    if [ "$exregex" == "" ]; then
         echo -n 1
     else
-        echo $file | grep -E "$exregex" 2>&1 > /dev/null
+        echo "$file" | grep -E "$exregex" > /dev/null 2>&1
         echo -n $?
     fi
 }
@@ -29,11 +29,12 @@ function prepare_test {
     local fcexpat=${2:-}
     local conffiles=()
 
-    for f in $(rpm -ql $pkg | grep conf.d | tr '\n' ' '); do
-        [[ $(check_exception $fcexpat $f) -ne 0 ]] && conffiles+=($f)
+    for f in $(rpm -ql "$pkg" | grep conf.d | tr '\n' ' '); 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)"
+    # shellcheck disable=SC2154
     rlRun "cat <<_E_> $tmpconfd/$pkg.conf
 <fontconfig>
   <dir>/usr/share/fonts</dir>
@@ -48,7 +49,7 @@ function test_pkg {
 
     rlPhaseStartTest "Package installation test for $pkg"
     {
-        rlAssertRpm $pkg
+        rlAssertRpm "$pkg"
     }
     rlPhaseEnd
 }
@@ -63,19 +64,19 @@ function test_generic_alias {
 
     rlPhaseStartTest "Generic alias test for $pkg"
     {
-        prepare_test $pkg $fcexpat
+        prepare_test "$pkg" "$fcexpat"
         rlRun "cat $tmpconfd/$pkg.conf"
         if [ "$fclang" == "-" ]; then
             rlLogInfo "$pkg:$fcfamily: Skipped."
         else
             rlRun "FONTCONFIG_FILE=$tmpconfd/$pkg.conf fc-match -f \"%{family[0]}\\n\" \":family=$fcfamily:lang=$fclang:width=$fcwidth\" > output" 0 "Matching a font"
             rlLogInfo "    Actual result: $(cat output)"
-            rlAssertGrep "^$fcresult\$" "output"
-            if [ $? -ne 0 ]; then
+            if ! rlAssertGrep "^$fcresult\$" "output"; then
                 rlLogInfo "    Hints:"
                 rlLogInfo "      This failed because of:"
                 rlLogInfo "        1) There are no generic alias rule in fontconfig file."
             fi
+        fi
     }
     rlPhaseEnd
 }
@@ -85,6 +86,7 @@ rlJournalStart
     rlPhaseStartSetup
     {
         rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        # shellcheck disable=SC2154
         rlRun "pushd $tmp"
         rlRun "set -o pipefail"
         rlRun "cachedir=\$(pkg-config --variable cachedir fontconfig)" 0 "Set cachedir"
@@ -94,9 +96,9 @@ 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 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" "$FONT_CONF_EXCLUDE_FILES"
+        grep -E -v "^#" "$TMT_TREE/plans/$VARLIST" | 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" "$_FONT_CONF_EXCLUDE_FILES"
         done
     else
         test_pkg "$PACKAGE"

^ 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: fix shellcheck error Akira TAGOH

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