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 \" \$i\"; done)"
+ # shellcheck disable=SC2154
rlRun "cat <<_E_> $tmpconfd/$pkg.conf
/usr/share/fonts
@@ -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"