diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 918bf73431..2f79706b69 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -1,4 +1,22 @@ -# source this file; set up for tests +# test-lib.sh: source this file; set up for tests + +# Copyright (C) 2008-2013 Red Hat, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see +# . +# +# Based on an idea from GNU coreutils test -z "$abs_srcdir" && abs_srcdir=$(pwd) test -z "$abs_builddir" && abs_builddir=$(pwd) @@ -158,15 +176,12 @@ require_selinux_() esac } -very_expensive_() +test_expensive() { - if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then + if test "$VIR_TEST_EXPENSIVE" != 1; then skip_test_ ' This test is very expensive, so it is disabled by default. -To run it anyway, rerun make check with the RUN_VERY_EXPENSIVE_TESTS -environment variable set to yes. E.g., - - env RUN_VERY_EXPENSIVE_TESTS=yes make check +To run it anyway, rerun: make check VIR_TEST_EXPENSIVE=1 ' fi } diff --git a/tests/testutils.c b/tests/testutils.c index 72aa5b3ae2..c5215528b0 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -66,6 +66,7 @@ static unsigned int testDebug = -1; static unsigned int testVerbose = -1; +static unsigned int testExpensive = -1; static unsigned int testOOM = 0; static size_t testCounter = 0; @@ -581,6 +582,13 @@ virTestGetVerbose(void) { return testVerbose || virTestGetDebug(); } +unsigned int +virTestGetExpensive(void) { + if (testExpensive == -1) + testExpensive = virTestGetFlag("VIR_TEST_EXPENSIVE"); + return testExpensive; +} + int virtTestMain(int argc, char **argv, int (*func)(void)) diff --git a/tests/testutils.h b/tests/testutils.h index 8583747bfa..ef0ca3cf58 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -65,6 +65,7 @@ int virtTestDifferenceBin(FILE *stream, unsigned int virTestGetDebug(void); unsigned int virTestGetVerbose(void); +unsigned int virTestGetExpensive(void); char *virtTestLogContentAndReset(void);