--- a/test/run-test-map.sh +++ b/test/run-test-map.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # fontconfig/test/run-test-cache-map.sh # # Copyright © 2018 Keith Packard @@ -41,9 +41,8 @@ FCLIST=../fc-list/fc-list$EXEEXT FCCACHE=../fc-cache/fc-cache$EXEEXT -which bwrap > /dev/null 2>&1 -if [ $? -eq 0 ]; then - BWRAP=`which bwrap` +if command -v bwrap > /dev/null 2>&1; then + BWRAP=$(command -v bwrap) fi FONT1=$TESTDIR/4x6.pcf --- a/test/run-test.d/remap-flatpak.sh +++ b/test/run-test.d/remap-flatpak.sh @@ -83,13 +83,13 @@ $BWRAP --bind / / --ro-bind "$TESTCACHE2DIR" /usr/lib/fontconfig/cache --ro-bind "$TESTFONT2DIR" /usr/share/fonts --bind "$TESTBUILD2DIR" /usr/share/fontconfig --ro-bind "$TESTRUNDIR" "$TESTRUNDIR" --ro-bind "$TESTCACHE1DIR" "$TESTRUNDIR"/fonts-cache --ro-bind "$TESTFONT1DIR" "$TESTRUNDIR"/fonts --dev-bind /dev /dev --setenv FONTCONFIG_FILE "$TESTBUILD2DIR"/bind-fonts.conf ls $(sed 's/:file=//' "$TESTRESULT3") > /dev/null # Check the amount of cache files -if [ $(ls "$TESTCACHE1DIR"|wc -l) == 2 ]; then : ; else +if [ "$(ls "$TESTCACHE1DIR" | wc -l)" -eq 2 ]; then : ; else echo "*** Test failed: $TEST" echo "Too much cache files created at host cache dir." ls "$TESTCACHE1DIR" exit 1 fi -if [ $(ls "$TESTCACHE2DIR"|wc -l) == 2 ]; then : ; else +if [ "$(ls "$TESTCACHE2DIR" | wc -l)" -eq 2 ]; then : ; else echo "*** Test failed: $TEST" echo "Too much cache files created at runtime cache dir." ls "$TESTCACHE2DIR" --- a/test/wrapper-script.sh +++ b/test/wrapper-script.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh set -e @@ -7,16 +7,20 @@ case "$1" in *.exe) export WINEPATH=$(${CC} -print-sysroot)/mingw/bin - fccwd=`pwd` - cd $(IFS=:;for i in $PATH; do echo $i|grep mingw> /dev/null; [ $? -eq 0 ] && echo $i; done) - if [ "x$(dirname $@)" = "x." ]; then - /usr/bin/env wine $fccwd/$@ + fccwd=$(pwd) + mingw_path=$(IFS=:; for i in $PATH; do + case "$i" in + *mingw*) printf '%s\n' "$i"; break ;; + esac + done) + cd "$mingw_path" || exit 1 + if [ "$(dirname "$1")" = "." ]; then + /usr/bin/env wine "$fccwd/$1" else - /usr/bin/env wine $@ + /usr/bin/env wine "$@" fi ;; *) - $@ + "$@" ;; esac -