2007-03-28 04:17:03 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright by The HDF Group.
|
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
2017-04-18 03:32:16 +08:00
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
2007-03-28 04:17:03 +08:00
|
|
|
#
|
|
|
|
# HDF Utilities Test script
|
|
|
|
|
2007-04-10 02:25:18 +08:00
|
|
|
|
2008-07-02 21:54:35 +08:00
|
|
|
TESTFILE1="$srcdir/testfiles/h52giftst.h5"
|
|
|
|
TESTFILE2="$srcdir/testfiles/image1.gif"
|
2015-03-30 13:28:13 +08:00
|
|
|
TESTFILE3="$srcdir/testfiles/ex_image2.h5"
|
2007-03-29 02:47:15 +08:00
|
|
|
|
2007-03-28 04:17:03 +08:00
|
|
|
# initialize errors variable
|
|
|
|
errors=0
|
|
|
|
|
|
|
|
TESTING() {
|
|
|
|
SPACES=" "
|
|
|
|
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
|
|
|
|
}
|
|
|
|
|
2007-04-10 02:25:18 +08:00
|
|
|
|
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# Verify the test runs with success (return code is 0)
|
|
|
|
TOOLTEST()
|
2007-03-28 04:17:03 +08:00
|
|
|
{
|
2015-03-30 13:28:13 +08:00
|
|
|
# for now, discard any error messages generated.
|
|
|
|
$RUNSERIAL $* > /dev/null 2>&1
|
|
|
|
|
|
|
|
RET=$?
|
|
|
|
if [ $RET = 0 ] ; then
|
|
|
|
echo " PASSED"
|
|
|
|
else
|
|
|
|
echo "*FAILED*"
|
|
|
|
errors="` expr $errors + 1 `";
|
|
|
|
fi
|
2007-04-10 02:25:18 +08:00
|
|
|
|
2007-03-28 04:17:03 +08:00
|
|
|
}
|
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# Verify the test runs with failure (return code is not 0)
|
|
|
|
# Use for testing if tool can handle error conditions like
|
|
|
|
# illegal input, bad arguments, exeeding limits, ...
|
|
|
|
TOOLTESTFAIL()
|
2007-04-03 04:47:29 +08:00
|
|
|
{
|
2015-03-30 13:28:13 +08:00
|
|
|
# for now, discard any error messages generated.
|
|
|
|
$RUNSERIAL $* > /dev/null 2>&1
|
|
|
|
|
|
|
|
RET=$?
|
|
|
|
if [ $RET != 0 ] ; then
|
|
|
|
echo " PASSED"
|
|
|
|
else
|
|
|
|
echo "*FAILED*"
|
|
|
|
errors="` expr $errors + 1 `";
|
|
|
|
fi
|
2007-04-03 04:47:29 +08:00
|
|
|
}
|
|
|
|
|
2007-03-28 04:17:03 +08:00
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# Positive tests for gif2h5
|
|
|
|
echo "**validate the gif2h5 tool processes input correctly..."
|
|
|
|
TESTING "./gif2h5 image1.gif image1.h5"
|
|
|
|
TOOLTEST ./gif2h5 $TESTFILE2 image1.h5
|
|
|
|
echo ""
|
2007-03-28 04:17:03 +08:00
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# Positive tests for h52gif
|
|
|
|
echo "**validate the h52gif tool processes input correctly..."
|
2020-04-21 07:12:00 +08:00
|
|
|
TESTING "./h52gif h52giftst.h5 image1.gif -i image"
|
2015-03-30 13:28:13 +08:00
|
|
|
TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image
|
|
|
|
echo ""
|
2007-03-28 04:17:03 +08:00
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# Negative tests.
|
2016-01-29 02:24:01 +08:00
|
|
|
echo "**verify that the h52gif tool handles error conditions correctly..."
|
2015-03-30 13:28:13 +08:00
|
|
|
# nonexisting dataset name
|
2020-04-21 07:12:00 +08:00
|
|
|
TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image"
|
|
|
|
TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image"
|
2015-03-30 13:28:13 +08:00
|
|
|
# this test should have failed but it did not. Comment it out for now.
|
2020-04-21 07:12:00 +08:00
|
|
|
#TESTING "./h52gif h52giftst.h5 image.gif -i palette"
|
|
|
|
#TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i palette"
|
|
|
|
TESTING "./h52gif h52giftst.h5 image24.gif -i image24bitpixel"
|
|
|
|
TOOLTESTFAIL "./h52gif $TESTFILE3 image24.gif -i image24bitpixel"
|
2015-03-30 13:28:13 +08:00
|
|
|
echo ""
|
2007-03-28 04:17:03 +08:00
|
|
|
|
2015-03-30 13:28:13 +08:00
|
|
|
# all done. summarize results.
|
2009-12-25 20:37:55 +08:00
|
|
|
if test $errors -eq 0 ; then
|
2015-03-30 13:28:13 +08:00
|
|
|
echo "All gif2h5 and h52gif tests passed."
|
2009-12-25 20:37:55 +08:00
|
|
|
exit 0
|
|
|
|
else
|
2015-03-30 13:28:13 +08:00
|
|
|
echo "Some gif2h5 or h52gif tests failed with $errors errors."
|
2009-12-25 20:37:55 +08:00
|
|
|
exit 1
|
|
|
|
fi
|