gobject: Use TEST_FUNCTIONS framework in tests.

This commit is contained in:
Richard W.M. Jones
2017-06-29 11:45:25 +01:00
parent 707f5bcfe0
commit 2cb0413049
4 changed files with 28 additions and 14 deletions

View File

@@ -18,9 +18,9 @@
set -e
if [ -z "$GJS" ]; then
echo "GObject bind tests skipped: gjs is missing"
exit 77
fi
$TEST_FUNCTIONS
skip_if_skipped
skip_unless_environment_variable_set GJS
skip_unless_phony_guest fedora.img
$GJS $srcdir/tests-misc.js

View File

@@ -18,13 +18,12 @@
set -e
if [ -z "$GJS" ]; then
echo "GObject bind tests skipped: gjs is missing"
exit 77
fi
$TEST_FUNCTIONS
skip_if_skipped
skip_unless_environment_variable_set GJS
echo "GObject bind tests skipped: Int64, OInt64 and OStringList are all broken"
exit 77
# This test is disabled until we fix 64 bit support.
skip_because "Int64, OInt64 and OStringList are all broken"
rm -f bindtests.tmp

View File

@@ -18,9 +18,8 @@
set -e
if [ -z "$GJS" ]; then
echo "GObject bind tests skipped: gjs is missing"
exit 77
fi
$TEST_FUNCTIONS
skip_if_skipped
skip_unless_environment_variable_set GJS
$GJS $srcdir/bindtests-retvalues.js 2>/dev/null

View File

@@ -211,6 +211,15 @@ skip_unless_libvirt_minimum_version ()
fi
}
# Skip unless the environment variable named is set to a non-empty value.
skip_unless_environment_variable_set ()
{
if [ -z "${!1}" ]; then
echo "$(basename $0): test skipped because \$$1 is not set"
exit 77
fi
}
# Run an external command and skip if the command fails. This can be
# used to test if a command exists. Normally you should use
# `cmd --help' or `cmd --version' or similar.
@@ -222,6 +231,13 @@ skip_unless ()
fi
}
# Use this if a test is broken. "$1" should contain the reason.
skip_because ()
{
echo "$(basename $0): test skipped because: $1"
exit 77
}
# Skip if the user is trying to run a test as root.
# Tests shouldn't be run as root, but a few are especially dangerous.
skip_if_root ()