summaryrefslogtreecommitdiffstats
path: root/test/test_plugin.sh.in
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-03-10 18:22:16 (GMT)
committerGitHub <noreply@github.com>2022-03-10 18:22:16 (GMT)
commitb9470be379354af209daf8418b6c571dde99e776 (patch)
treeeabf683eef30f9ebaa65a5d706ba43fc410bd8f2 /test/test_plugin.sh.in
parentd5ddf61803f30e87bdfa629339fabf6fe1eb4a3c (diff)
downloadhdf5-b9470be379354af209daf8418b6c571dde99e776.zip
hdf5-b9470be379354af209daf8418b6c571dde99e776.tar.gz
hdf5-b9470be379354af209daf8418b6c571dde99e776.tar.bz2
Plugin test cleanup (#1479)
* Autotools plugin test cleanup * Combines filter, VFD, and VOL plugin tests * Adds VFD plugin tests to the Autotools * Implements a uniform shell script naming scheme in test/ * codespell fix * Changes after code review
Diffstat (limited to 'test/test_plugin.sh.in')
-rw-r--r--test/test_plugin.sh.in140
1 files changed, 140 insertions, 0 deletions
diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in
new file mode 100644
index 0000000..d958b4b
--- /dev/null
+++ b/test/test_plugin.sh.in
@@ -0,0 +1,140 @@
+#!/usr/bin/env bash
+#
+# 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://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+# This shell script is for testing filter, VFD, and VOL plugins.
+#
+srcdir=@srcdir@
+TOP_BUILDDIR=@top_builddir@
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+CP="cp -p" # Use -p to preserve mode,ownership, timestamps
+RM="rm -rf"
+
+nerrors=0
+verbose=yes
+exit_code=$EXIT_SUCCESS
+
+# Test binary names
+FILTER_TEST_NAME=filter_plugin
+FILTER_TEST_BIN=`pwd`/$FILTER_TEST_NAME
+
+VFD_TEST_NAME=vfd_plugin
+VFD_TEST_BIN=`pwd`/$VFD_TEST_NAME
+
+VOL_TEST_NAME=vol_plugin
+VOL_TEST_BIN=`pwd`/$VOL_TEST_NAME
+
+# Paths to actual plugins ("libraries" in test directory are just stubs)
+FROM_DIR=`pwd`/.libs
+case $(uname) in
+ CYGWIN* )
+ NULL_VFD_PLUGIN="$FROM_DIR/cygnull_vfd_plugin*"
+ NULL_VOL_PLUGIN="$FROM_DIR/cygnull_vol_connector*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*"
+ ;;
+ *)
+ NULL_VFD_PLUGIN="$FROM_DIR/libnull_vfd_plugin*"
+ NULL_VOL_PLUGIN="$FROM_DIR/libnull_vol_connector*"
+ PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*"
+ PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*"
+ ;;
+esac
+
+# Directories where we'll copy plugins
+TEMP_PLUGIN_DIR=temp_plugins
+TEMP_FILTER_DIR1=temp_filter_plugin_dir1
+TEMP_FILTER_DIR2=temp_filter_plugin_dir2
+
+# Function to 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 plugin directories
+test -d $TEMP_PLUGIN_DIR || mkdir -p $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to create plugin test directory ($TEMP_PLUGIN_DIR)"
+ exit $EXIT_FAILURE
+fi
+test -d $TEMP_FILTER_DIR1 || mkdir -p $TEMP_FILTER_DIR1
+if [ $? != 0 ]; then
+ echo "Failed to create filter plugin test directory ($TEMP_FILTER_DIR1)"
+ exit $EXIT_FAILURE
+fi
+test -d $TEMP_FILTER_DIR2 || mkdir -p $TEMP_FILTER_DIR2
+if [ $? != 0 ]; then
+ echo "Failed to create filter plugin test directory ($TEMP_FILTER_DIR2)"
+ exit $EXIT_FAILURE
+fi
+
+# Copy plugins for the tests
+$CP $NULL_VFD_PLUGIN $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to copy NULL VFD plugin ($NULL_VFD_PLUGIN) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $NULL_VOL_PLUGIN $TEMP_PLUGIN_DIR
+if [ $? != 0 ]; then
+ echo "Failed to copy NULL VOL plugin ($NULL_VOL_PLUGIN) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $PLUGINS_FOR_DIR1 $TEMP_FILTER_DIR1
+if [ $? != 0 ]; then
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory."
+ exit $EXIT_FAILURE
+fi
+$CP $PLUGINS_FOR_DIR2 $TEMP_FILTER_DIR2
+if [ $? != 0 ]; then
+ echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory."
+ exit $EXIT_FAILURE
+fi
+
+# Set plugin path
+ENVCMD="env HDF5_PLUGIN_PATH=${TEMP_PLUGIN_DIR}:${TEMP_FILTER_DIR1}:${TEMP_FILTER_DIR2}"
+
+# Run the tests
+$ENVCMD $FILTER_TEST_BIN
+if [ $? != 0 ]; then
+ nerrors=`expr $nerrors + 1`
+fi
+$ENVCMD $VFD_TEST_BIN
+if [ $? != 0 ]; then
+ nerrors=`expr $nerrors + 1`
+fi
+$ENVCMD $VOL_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 plugin tests passed."
+ exit_code=$EXIT_SUCCESS
+fi
+
+# Clean up temporary files/directories and leave
+$RM $TEMP_PLUGIN_DIR $TEMP_FILTER_DIR1 $TEMP_FILTER_DIR2
+
+exit $exit_code