public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/fonts] rhel9: validate_family: 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 : 4d5d37aa0877d08ca714cc4f551f242edffe3522
Author : Akira TAGOH <akira@tagoh.org>
Date : 2024-11-15T19:06:46+09:00
Stats : +28/-19 in 1 file(s)
URL : https://src.fedoraproject.org/tests/fonts/c/4d5d37aa0877d08ca714cc4f551f242edffe3522?branch=rhel9
Log:
validate_family: fix shellcheck error
---
diff --git a/tests/validate_family/test.sh b/tests/validate_family/test.sh
index f1fcac4..352df08 100755
--- a/tests/validate_family/test.sh
+++ b/tests/validate_family/test.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+# -*- tab-width: 4, indent-tabs-mode: nil -*-
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
@@ -11,26 +12,27 @@ VARLIST=${VARLIST:-}
function get_font_path {
local pkg=$1
- rpm -ql $pkg|grep /usr/share/fonts/
+ rpm -ql "$pkg"|grep /usr/share/fonts/
}
function check_exception {
local exregex=$1
local file=$2
- if [ "x$exregex" == "x" ]; then
- echo -n 1
- else
- echo $file | grep -E "$exregex" 2>&1 > /dev/null
- echo -n $?
+ if [ "$exregex" == "" ]; then
+ return 1
fi
+ echo "$file" | grep -E "$exregex" > /dev/null 2>&1
+ return $?
}
function test_pkg {
local pkg=$1
- rlPhaseStartTest "Package installation test for $pkg" #{
- rlRun "rpm -q $pkg" 0 "Package installation test" #}
+ rlPhaseStartTest "Package installation test for $pkg"
+ {
+ rlAssertRpm "$pkg"
+ }
rlPhaseEnd
}
@@ -39,44 +41,51 @@ function test_validate_family {
local fcfamily=${2:-"unknown family"}
local fcexpat=${3:-}
- test_pkg $pkg
+ test_pkg "$pkg"
rlPhaseStartTest "Validate family name for $pkg"
- for f in $(get_font_path $pkg); do
- if echo $f|grep -Eq "\.(t1|ttf|otf|ttc|otc|pcf.*|pfa)$"; then
+ {
+ for f in $(get_font_path "$pkg"); do
+ if echo "$f"|grep -Eq "\.(t1|ttf|otf|ttc|otc|pcf.*|pfa)$"; then
set -f
- if [ $(check_exception $fcexpat $f) -ne 0 ] && [ -f $f ]; then
+ if ! check_exception "$fcexpat" "$f" && [ -f "$f" ]; then
rlRun "fc-scan -f \"%{family[0]}\\n\" $f | tee output" 0 "Querying family name"
- rlAssertGrep "^$FONT_FAMILY\$" "output"
- else
+ rlAssertGrep "^$fcfamily\$" "output"
+ else
rlLogInfo "Skipping $f (according to FONT_VALIDATE_EXCLUDE_FILES)"
fi
set +f
fi
- done
+ done
+ }
rlPhaseEnd
}
rlJournalStart
-
+{
rlPhaseStartSetup
+ {
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+ # shellcheck disable=SC2154
rlRun "pushd $tmp"
rlRun "set -o pipefail"
+ }
rlPhaseEnd
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 dummy; do
- test_validate_family "$PACKAGE" "$FONT_FAMILY" "$FONT_VALIDATE_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 dummy; do
+ test_validate_family "$_PACKAGE" "$_FONT_FAMILY" "$_FONT_VALIDATE_EXCLUDE_FILES"
done
else
test_validate_family "$PACKAGE" "$FONT_FAMILY" "$FONT_VALIDATE_EXCLUDE_FILES"
fi
rlPhaseStartCleanup
+ {
rlRun "popd"
rlRun "rm -r $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: validate_family: 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