Permalink
Browse files

winetricks: return a specific exit code when a verb is unsupported on…

… a given WINEARCH

Then use that to skip tests instead of failing in tests/winetricks-test
  • Loading branch information...
austin987 committed Sep 22, 2017
1 parent 28b9a87 commit b5ab30ac1e18dbd590b63de0042211cdfb7ed648
Showing with 53 additions and 30 deletions.
  1. +2 −0 src/winetricks
  2. +51 −30 tests/winetricks-test
View
@@ -304,13 +304,15 @@ w_package_broken_win64()
# Some packages don't support win64, die with an appropriate message
# Note: this is for packages that natively don't support win64, not packages that are broken on wine64, for that, use w_package_broken_win64()
# Returns 32 (for tests/winetricks-test)
w_package_unsupported_win64()
{
if [ "$W_ARCH" = "win64" ] ; then
case $LANG in
ru*) w_die "Данный пакет не работает в 64-битном окружении. Используйте префикс, созданный с помощью WINEARCH=win32." ;;
*) w_die "This package ($W_PACKAGE) does not work on a 64-bit installation. You must use a prefix made with WINEARCH=win32." ;;
esac
exit 32
fi
}
View
@@ -128,6 +128,7 @@ QUICKCHECK="flash steam"
passes=0
errors=0
skips=0
# Check for programs this script (or winetricks) uses.
# Better to find out they're missing now than in the
@@ -156,10 +157,16 @@ pass()
passes=$((passes + 1))
}
skip()
{
echo "SKIP: $*"
skips=$((skips + 1))
was_skipped=1
}
w_die()
{
echo "$*"
exit 1
}
@@ -270,6 +277,7 @@ total_df()
test_app()
{
app=$1
was_skipped=0
# Watch transient disk space
DF_START=$(total_df)
@@ -283,29 +291,33 @@ test_app()
test_command --verify "$app"
# Post install:
# Don't check whether metaverbs are installed
case "$app" in
allcodecs) ;;
*)
# no xvfb needed
./winetricks -q list-installed > "${outputdir}/list-installed.out"
if ! grep -w "$app" "${outputdir}/list-installed.out"; then
fail "test app $app not installed after install?"
fi
;;
esac
if [ $was_skipped = 1 ]; then
skip "post-install file check for skipped verb $app"
else
# Post install:
# Don't check whether metaverbs are installed
case "$app" in
allcodecs) ;;
*)
# no xvfb needed
./winetricks -q list-installed > "${outputdir}/list-installed.out"
if ! grep -w "$app" "${outputdir}/list-installed.out"; then
fail "test app $app not installed after install?"
fi
;;
esac
# Cleanup..
rm "${outputdir}/df-daemon"
# Total max disk usage = max df change plus any initial blocks in cache
DF_MIN=$(awk '{ if (min == "" || $1 < min) min=$1; } END {printf "%d\n", min}' < "${outputdir}/df-during.log" )
DF_DIFF=$((DF_START - DF_MIN))
TOTAL=$((DF_DIFF + DU_CACHE_START))
echo "test_app: ${app}: max_disk $TOTAL blocks."
TOTAL_MB=$((TOTAL / 1024))
mkdir -p "${outputdir}/measurements"
echo "${app}:size_MB=${TOTAL_MB},time_sec=${seconds}" >> "${outputdir}/measurements/$app.dat"
# Cleanup..
rm "${outputdir}/df-daemon"
# Total max disk usage = max df change plus any initial blocks in cache
DF_MIN=$(awk '{ if (min == "" || $1 < min) min=$1; } END {printf "%d\n", min}' < "${outputdir}/df-during.log" )
DF_DIFF=$((DF_START - DF_MIN))
TOTAL=$((DF_DIFF + DU_CACHE_START))
echo "test_app: ${app}: max_disk $TOTAL blocks."
TOTAL_MB=$((TOTAL / 1024))
mkdir -p "${outputdir}/measurements"
echo "${app}:size_MB=${TOTAL_MB},time_sec=${seconds}" >> "${outputdir}/measurements/$app.dat"
fi
}
test_command()
@@ -327,14 +339,23 @@ test_command()
echo "Installing $command"
# shellcheck disable=SC2086
$XVFB $WINETRICKS --no-isolate -q nocrashdialog "$@"
return=$?
rm "${outputdir}/df-daemon"
if [ "$EXPECT_FAIL" = "yes" ] ; then
# A success is failure:
# shellcheck disable=SC2086
$XVFB $WINETRICKS --no-isolate -q nocrashdialog "$@" && fail "$command succeeded, should have failed"
elif ! w_time $XVFB $WINETRICKS --no-isolate -q nocrashdialog "$@" ; then
rm "${outputdir}/df-daemon"
fail "test_command $command failed!"
return
if [ "$return" = "0" ] ; then
fail "$command succeeded, should have failed"
elif [ "$return" = "32" ] && [ "$WINEARCH" != "win32" ]; then
skip "$command is not supported on $WINEARCH, requires win32"
elif [ "$return" = "64" ] && [ "$WINEARCH" != "win64" ]; then
skip "$command is not supported on $WINEARCH, requires win64"
else
fail "test_command $command failed!"
return
fi
else
echo "winetricks $* completed"
fi
@@ -769,7 +790,7 @@ case "$1" in
*) echo "Usage: $0 quick\|full" ; exit 1 ;;
esac
echo "Test over, $errors failures, $passes successes."
echo "Test over, $errors failures, $passes successes, $skips skipped."
if [ $errors = 0 ] && [ $passes -gt 0 ] ; then
echo PASS
exit 0

0 comments on commit b5ab30a

Please sign in to comment.