Added the JSON VOL connector plugin framework and a test to
ensure that the plugin can be loaded.
This commit is contained in:
84
test/test_json_vol.sh.in
Normal file
84
test/test_json_vol.sh.in
Normal file
@@ -0,0 +1,84 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright by The HDF Group.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of HDF5. The full HDF5 copyright notice, including
|
||||
# terms governing use, modification, and redistribution, is contained in
|
||||
# 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.
|
||||
#
|
||||
# This shell script is for testing basic JSON VOL operations.
|
||||
#
|
||||
srcdir=@srcdir@
|
||||
TOP_BUILDDIR=@top_builddir@
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_FAILURE=1
|
||||
|
||||
nerrors=0
|
||||
verbose=yes
|
||||
exit_code=$EXIT_SUCCESS
|
||||
|
||||
TEST_NAME=json_vol
|
||||
TEST_BIN=`pwd`/$TEST_NAME
|
||||
FROM_DIR=`pwd`/.libs
|
||||
case $(uname) in
|
||||
CYGWIN* )
|
||||
JSON_VOL_PLUGIN="$FROM_DIR/cygjson_vol_connector*"
|
||||
;;
|
||||
*)
|
||||
JSON_VOL_PLUGIN="$FROM_DIR/libjson_vol_connector*"
|
||||
;;
|
||||
esac
|
||||
TEMP_PLUGIN_DIR=json_vol_plugin_dir
|
||||
CP="cp -p" # Use -p to preserve mode,ownership, timestamps
|
||||
RM="rm -rf"
|
||||
|
||||
# Print a line-line message left justified in a field of 70 characters
|
||||
# beginning with the word "Testing".
|
||||
#
|
||||
TESTING() {
|
||||
SPACES=" "
|
||||
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
|
||||
}
|
||||
|
||||
# Main Body
|
||||
# Create test directory if necessary.
|
||||
test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to create VOL connector plugin test directory ($TEMP_PLUGIN_DIR)"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
# Copy plugin for the tests.
|
||||
$CP $JSON_VOL_PLUGIN $TEMP_PLUGIN_DIR
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to copy JSON VOL plugin ($JSON_VOL_PLUGIN) to test directory."
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
# setup plugin path
|
||||
ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}"
|
||||
|
||||
# Run the test
|
||||
$ENVCMD $TEST_BIN
|
||||
if [ $? != 0 ]; then
|
||||
nerrors=`expr $nerrors + 1`
|
||||
fi
|
||||
|
||||
# print results
|
||||
if test $nerrors -ne 0 ; then
|
||||
echo "$nerrors errors encountered"
|
||||
exit_code=$EXIT_FAILURE
|
||||
else
|
||||
echo "All JSON VOL plugin tests passed."
|
||||
exit_code=$EXIT_SUCCESS
|
||||
fi
|
||||
|
||||
# Clean up temporary files/directories and leave
|
||||
$RM $TEMP_PLUGIN_DIR
|
||||
|
||||
exit $exit_code
|
||||
Reference in New Issue
Block a user