[Libguestfs] [PATCH v5 7/7] yara_scan: added API tests

Richard W.M. Jones rjones at redhat.com
Wed Apr 5 08:58:01 UTC 2017


On Tue, Apr 04, 2017 at 07:39:29PM +0300, Matteo Cafasso wrote:
> +
> +# Test the yara_scan command.
> +
> +set -e
> +
> +if [ -n "$SKIP_TEST_YARA_SCAN_SH" ]; then
> +    echo "$0: test skipped because environment variable is set."
> +    exit 77
> +fi
> +
> +rm -f test-yara-rules.yar
> +
> +# Skip if Yara is not supported by the appliance.
> +if ! guestfish add /dev/null : run : available "libyara"; then
> +    echo "$0: skipped because Yara is not available in the appliance"
> +    exit 77
> +fi
> +
> +if [ ! -s ../../test-data/phony-guests/blank-fs.img ]; then
> +    echo "$0: skipped because blank-fs.img is zero-sized"
> +    exit 77
> +fi

Please use the new $TEST_FUNCTIONS macro and test functions added in
commit e66be4401674f63b9af49264d2610b25a199fef0.  There are many
examples of how to use them throughout all the tests.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list