--- gobject/run-live-tests | 8 ++++---- gobject/run-tests | 11 +++++------ gobject/run-tests-retvalues | 7 +++---- tests/test-functions.sh | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/gobject/run-live-tests b/gobject/run-live-tests index 2d93de2ca..5bedb2309 100755 --- a/gobject/run-live-tests +++ b/gobject/run-live-tests @@ -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 diff --git a/gobject/run-tests b/gobject/run-tests index 7393e7339..28e38d955 100755 --- a/gobject/run-tests +++ b/gobject/run-tests @@ -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 diff --git a/gobject/run-tests-retvalues b/gobject/run-tests-retvalues index e20321ea2..569040de4 100755 --- a/gobject/run-tests-retvalues +++ b/gobject/run-tests-retvalues @@ -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 diff --git a/tests/test-functions.sh b/tests/test-functions.sh index e5e824681..44ccd37b9 100755 --- a/tests/test-functions.sh +++ b/tests/test-functions.sh @@ -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 () -- 2.13.2 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs