mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
Plugin test rework
Cleanup of plugin test code. Renames many files. Prep for VOL branch merge.
This commit is contained in:
parent
51b80a8d85
commit
00ade113c5
12
MANIFEST
12
MANIFEST
@ -936,10 +936,6 @@
|
||||
./test/dt_arith.c
|
||||
./test/dtypes.c
|
||||
./test/dtransform.c
|
||||
./test/dynlib1.c
|
||||
./test/dynlib2.c
|
||||
./test/dynlib3.c
|
||||
./test/dynlib4.c
|
||||
./test/earray.c
|
||||
./test/efc.c
|
||||
./test/enc_dec_plist.c
|
||||
@ -967,6 +963,11 @@
|
||||
./test/fill_old.h5
|
||||
./test/fillval.c
|
||||
./test/filter_fail.c
|
||||
./test/filter_plugin.c
|
||||
./test/filter_plugin1_dsets.c
|
||||
./test/filter_plugin2_dsets.c
|
||||
./test/filter_plugin3_dsets.c
|
||||
./test/filter_plugin4_groups.c
|
||||
./test/flush1.c
|
||||
./test/flush2.c
|
||||
./test/flushrefresh.c
|
||||
@ -1030,7 +1031,6 @@
|
||||
./test/page_buffer.c
|
||||
./test/paged_nopersist.h5
|
||||
./test/paged_persist.h5
|
||||
./test/plugin.c
|
||||
./test/reserved.c
|
||||
./test/pool.c
|
||||
./test/set_extent.c
|
||||
@ -1065,12 +1065,12 @@
|
||||
./test/testerror.sh.in
|
||||
./test/testlinks_env.sh.in
|
||||
./test/test_filenotclosed.sh.in
|
||||
./test/test_filter_plugin.sh.in
|
||||
./test/testflushrefresh.sh.in
|
||||
./test/testframe.c
|
||||
./test/testhdf5.c
|
||||
./test/testhdf5.h
|
||||
./test/testlibinfo.sh.in
|
||||
./test/test_plugin.sh.in
|
||||
./test/test_usecases.sh.in
|
||||
./test/testmeta.c
|
||||
./test/testswmr.sh.in
|
||||
|
@ -3369,17 +3369,17 @@ AC_CONFIG_FILES([src/libhdf5.settings
|
||||
Makefile
|
||||
src/Makefile
|
||||
test/Makefile
|
||||
test/H5srcdir_str.h
|
||||
test/testcheck_version.sh
|
||||
test/testerror.sh
|
||||
test/testflushrefresh.sh
|
||||
test/H5srcdir_str.h
|
||||
test/testlibinfo.sh
|
||||
test/testlinks_env.sh
|
||||
test/test_filenotclosed.sh
|
||||
test/testswmr.sh
|
||||
test/test_plugin.sh
|
||||
test/test_usecases.sh
|
||||
test/testvdsswmr.sh
|
||||
test/test_filenotclosed.sh
|
||||
test/test_filter_plugin.sh
|
||||
test/test_usecases.sh
|
||||
testpar/Makefile
|
||||
tools/Makefile
|
||||
tools/lib/Makefile
|
||||
|
@ -70,73 +70,73 @@ if (BUILD_SHARED_LIBS)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# If plugin library tests can be tested
|
||||
# If filter plugin tests can be tested
|
||||
#-----------------------------------------------------------------------------
|
||||
# make plugins dir
|
||||
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir1")
|
||||
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2")
|
||||
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1")
|
||||
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Define Plugin Test Sources
|
||||
# Define Filter Plugin Test Sources
|
||||
#-----------------------------------------------------------------------------
|
||||
set (TEST_PLUGIN_LIBS
|
||||
dynlib1
|
||||
dynlib3
|
||||
set (FILTER_PLUGINS_FOR_DIR1
|
||||
filter_plugin1_dsets
|
||||
filter_plugin3_dsets
|
||||
)
|
||||
set (TEST2_PLUGIN_LIBS
|
||||
dynlib2
|
||||
dynlib4
|
||||
set (FILTER_PLUGINS_FOR_DIR2
|
||||
filter_plugin2_dsets
|
||||
filter_plugin4_groups
|
||||
)
|
||||
|
||||
foreach (test_lib ${TEST_PLUGIN_LIBS})
|
||||
set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}")
|
||||
set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
|
||||
set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
|
||||
foreach (plugin_name ${FILTER_PLUGINS_FOR_DIR1})
|
||||
set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}")
|
||||
set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}")
|
||||
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
|
||||
add_definitions (${HDF_EXTRA_C_FLAGS})
|
||||
INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
|
||||
|
||||
add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c)
|
||||
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ")
|
||||
target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
|
||||
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
|
||||
set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
|
||||
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
|
||||
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ")
|
||||
target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET})
|
||||
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
|
||||
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copy plugin library to a plugins folder
|
||||
# Copy the filter plugin to a plugins folder
|
||||
#-----------------------------------------------------------------------------
|
||||
add_custom_command (
|
||||
TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
|
||||
TARGET ${HDF5_TEST_PLUGIN_TARGET}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
"$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
|
||||
"${CMAKE_BINARY_DIR}/testdir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
|
||||
"$<TARGET_FILE:${HDF5_TEST_PLUGIN_TARGET}>"
|
||||
"${CMAKE_BINARY_DIR}/filter_plugin_dir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_TARGET}>"
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
foreach (test_lib ${TEST2_PLUGIN_LIBS})
|
||||
set (HDF5_TEST_PLUGIN_LIB_CORENAME "${test_lib}")
|
||||
set (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
|
||||
set (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
|
||||
foreach ( plugin_name ${FILTER_PLUGINS_FOR_DIR2})
|
||||
set (HDF5_TEST_PLUGIN_CORENAME "${plugin_name}")
|
||||
set (HDF5_TEST_PLUGIN_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_CORENAME}")
|
||||
set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME})
|
||||
add_definitions (${HDF_EXTRA_C_FLAGS})
|
||||
INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
|
||||
|
||||
add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c)
|
||||
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ")
|
||||
target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
|
||||
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
|
||||
set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
|
||||
add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c)
|
||||
TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ")
|
||||
target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_LIB_TARGET})
|
||||
H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
|
||||
set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copy plugin library to a plugins folder
|
||||
# Copy the filter plugin to a plugins folder
|
||||
#-----------------------------------------------------------------------------
|
||||
add_custom_command (
|
||||
TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
|
||||
TARGET ${HDF5_TEST_PLUGIN_TARGET}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
"$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
|
||||
"${CMAKE_BINARY_DIR}/testdir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
|
||||
"$<TARGET_FILE:${HDF5_TEST_PLUGIN_TARGET}>"
|
||||
"${CMAKE_BINARY_DIR}/filter_plugin_dir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_TARGET}>"
|
||||
)
|
||||
endforeach ()
|
||||
|
||||
@ -411,17 +411,17 @@ endif ()
|
||||
### P L U G I N T E S T S
|
||||
##############################################################################
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
|
||||
TARGET_NAMING (plugin SHARED)
|
||||
TARGET_C_PROPERTIES (plugin SHARED " " " ")
|
||||
target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET})
|
||||
set_target_properties (plugin PROPERTIES FOLDER test)
|
||||
add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
|
||||
TARGET_NAMING (filter_plugin SHARED)
|
||||
TARGET_C_PROPERTIES (filter_plugin SHARED " " " ")
|
||||
target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET})
|
||||
set_target_properties (filter_plugin PROPERTIES FOLDER test)
|
||||
else ()
|
||||
add_executable (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
|
||||
TARGET_NAMING (plugin STATIC)
|
||||
TARGET_C_PROPERTIES (plugin STATIC " " " ")
|
||||
target_link_libraries (plugin ${HDF5_TEST_LIB_TARGET})
|
||||
set_target_properties (plugin PROPERTIES FOLDER test)
|
||||
add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c)
|
||||
TARGET_NAMING (filter_plugin STATIC)
|
||||
TARGET_C_PROPERTIES (filter_plugin STATIC " " " ")
|
||||
target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET})
|
||||
set_target_properties (filter_plugin PROPERTIES FOLDER test)
|
||||
endif ()
|
||||
|
||||
##############################################################################
|
||||
|
@ -1,4 +1,4 @@
|
||||
#
|
||||
|
||||
# Copyright by The HDF Group.
|
||||
# All rights reserved.
|
||||
#
|
||||
@ -520,7 +520,7 @@ set (test_CLEANFILES
|
||||
multi_file-r.h5
|
||||
multi_file-s.h5
|
||||
core_file
|
||||
plugin.h5
|
||||
filter_plugin.h5
|
||||
new_move_a.h5
|
||||
new_move_b.h5
|
||||
ntypes.h5
|
||||
@ -1013,7 +1013,7 @@ if (BUILD_SHARED_LIBS)
|
||||
endif ()
|
||||
|
||||
##############################################################################
|
||||
### P L U G I N T E S T S
|
||||
### F I L T E R P L U G I N T E S T S
|
||||
##############################################################################
|
||||
if (WIN32)
|
||||
set (CMAKE_SEP "\;")
|
||||
@ -1023,9 +1023,9 @@ else ()
|
||||
set (BIN_REL_PATH "../")
|
||||
endif ()
|
||||
|
||||
add_test (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>)
|
||||
set_tests_properties (H5PLUGIN-plugin PROPERTIES
|
||||
ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/testdir2;srcdir=${HDF5_TEST_BINARY_DIR}"
|
||||
add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>)
|
||||
set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES
|
||||
ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}"
|
||||
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
|
||||
)
|
||||
|
||||
|
@ -26,11 +26,12 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
# testlibinfo.sh:
|
||||
# testcheck_version.sh: tcheck_version
|
||||
# testlinks_env.sh: links_env
|
||||
# test_filenotclosed.sh: filenotclosed.c
|
||||
# testflushrefresh.sh: flushrefresh
|
||||
# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
|
||||
# testswmr.sh: swmr*
|
||||
# testvdsswmr.sh: vds_swmr*
|
||||
# test_filenotclosed.sh: filenotclosed.c
|
||||
# test_filter_plugin.sh: filter_plugin.c
|
||||
# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
|
||||
TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\
|
||||
testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh
|
||||
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_filenotclosed$(EXEEXT) \
|
||||
@ -40,8 +41,8 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) test_
|
||||
swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
|
||||
vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT)
|
||||
if HAVE_SHARED_CONDITIONAL
|
||||
TEST_SCRIPT += test_plugin.sh
|
||||
SCRIPT_DEPEND += plugin$(EXEEXT)
|
||||
TEST_SCRIPT += test_filter_plugin.sh
|
||||
SCRIPT_DEPEND += filter_plugin$(EXEEXT)
|
||||
endif
|
||||
|
||||
check_SCRIPTS = $(TEST_SCRIPT)
|
||||
@ -81,7 +82,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
|
||||
swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \
|
||||
swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer
|
||||
if HAVE_SHARED_CONDITIONAL
|
||||
check_PROGRAMS+= plugin
|
||||
check_PROGRAMS+= filter_plugin
|
||||
endif
|
||||
|
||||
# These programs generate test files for the tests. They don't need to be
|
||||
@ -102,29 +103,17 @@ endif
|
||||
|
||||
if HAVE_SHARED_CONDITIONAL
|
||||
# The libh5test library provides common support code for the tests.
|
||||
# The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
|
||||
# Build them as shared libraries if configure is enabled for shared library.
|
||||
noinst_LTLIBRARIES=libh5test.la libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
|
||||
libdynlib1_la_SOURCES=dynlib1.c
|
||||
libdynlib2_la_SOURCES=dynlib2.c
|
||||
libdynlib3_la_SOURCES=dynlib3.c
|
||||
libdynlib4_la_SOURCES=dynlib4.c
|
||||
libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
|
||||
libdynlib1.la: $(libdynlib1_la_OBJECTS) $(libdynlib1_la_DEPENDENCIES) $(EXTRA_libdynlib1_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlib1_la_LINK) $(am_libdynlib1_la_rpath) $(libdynlib1_la_OBJECTS) $(libdynlib1_la_LIBADD)
|
||||
|
||||
libdynlib2.la: $(libdynlib2_la_OBJECTS) $(libdynlib2_la_DEPENDENCIES) $(EXTRA_libdynlib2_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlib2_la_LINK) $(am_libdynlib2_la_rpath) $(libdynlib2_la_OBJECTS) $(libdynlib2_la_LIBADD)
|
||||
|
||||
libdynlib3.la: $(libdynlib3_la_OBJECTS) $(libdynlib3_la_DEPENDENCIES) $(EXTRA_libdynlib3_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlib3_la_LINK) $(am_libdynlib3_la_rpath) $(libdynlib3_la_OBJECTS) $(libdynlib3_la_LIBADD)
|
||||
|
||||
libdynlib4.la: $(libdynlib4_la_OBJECTS) $(libdynlib4_la_DEPENDENCIES) $(EXTRA_libdynlib4_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlib4_la_LINK) $(am_libdynlib4_la_rpath) $(libdynlib4_la_OBJECTS) $(libdynlib4_la_LIBADD)
|
||||
# The filter_plugin* libraries are for use in filter_plugin.c.
|
||||
# Build them as shared libraries if that option was enabled in configure.
|
||||
noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la
|
||||
libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c
|
||||
libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c
|
||||
libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c
|
||||
libfilter_plugin4_groups_la_SOURCES=filter_plugin4_groups.c
|
||||
libfilter_plugin1_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libfilter_plugin2_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libfilter_plugin3_dsets_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libfilter_plugin4_groups_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
else
|
||||
# The libh5test library provides common support code for the tests.
|
||||
noinst_LTLIBRARIES=libh5test.la
|
||||
@ -185,7 +174,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
|
||||
tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \
|
||||
getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \
|
||||
family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \
|
||||
multi_file-[rs].h5 core_file plugin.h5 \
|
||||
multi_file-[rs].h5 core_file filter_plugin.h5 \
|
||||
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
|
||||
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
|
||||
unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \
|
||||
@ -215,7 +204,7 @@ use_append_mchunks_SOURCES=use_append_mchunks.c use_common.c
|
||||
use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c
|
||||
|
||||
# Temporary files.
|
||||
DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh \
|
||||
DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \
|
||||
testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh
|
||||
|
||||
include $(top_srcdir)/config/conclude.am
|
||||
|
@ -1,95 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/*
|
||||
* Programmer: Raymond Lu
|
||||
* 13 February 2013
|
||||
*
|
||||
* Purpose: Tests the plugin module (H5PL)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define H5Z_FILTER_DYNLIB1 257
|
||||
|
||||
static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* This message derives from H5Z */
|
||||
const H5Z_class2_t H5Z_DYNLIB1[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
H5Z_FILTER_DYNLIB1, /* Filter id number */
|
||||
1, 1, /* Encoding and decoding enabled */
|
||||
"dynlib1", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)H5Z_filter_dynlib1, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB1;}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Z_filter_dynlib1
|
||||
*
|
||||
* Purpose: A dynlib1 filter method that adds on and subtract from
|
||||
* the original value with another value. It will be built
|
||||
* as a shared library. plugin.c test will load and use
|
||||
* this filter library.
|
||||
*
|
||||
* Return: Success: Data chunk size
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* 29 March 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes,
|
||||
size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
int add_on = 0;
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if(cd_nelmts == 0)
|
||||
return(0);
|
||||
|
||||
/* Check that permanent parameters are set correctly */
|
||||
if(cd_values[0] > 9)
|
||||
return(0);
|
||||
|
||||
add_on = (int)cd_values[0];
|
||||
|
||||
if(flags & H5Z_FLAG_REVERSE) { /*read*/
|
||||
/* Substract the "add on" value to all the data values */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ -= add_on;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end if */
|
||||
else { /*write*/
|
||||
/* Add the "add on" value to all the data values */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ += add_on;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end else */
|
||||
|
||||
return nbytes;
|
||||
} /* end H5Z_filter_dynlib1() */
|
||||
|
@ -1,92 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/*
|
||||
* Programmer: Raymond Lu
|
||||
* 13 February 2013
|
||||
*
|
||||
* Purpose: Tests the plugin module (H5PL)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define H5Z_FILTER_DYNLIB2 258
|
||||
#define MULTIPLIER 3
|
||||
|
||||
static size_t H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* This message derives from H5Z */
|
||||
const H5Z_class2_t H5Z_DYNLIB2[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
H5Z_FILTER_DYNLIB2, /* Filter id number */
|
||||
1, 1, /* Encoding and decoding enabled */
|
||||
"dynlib2", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)H5Z_filter_dynlib2, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB2;}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Z_filter_dynlib2
|
||||
*
|
||||
* Purpose: A dynlib2 filter method that multiplies the original value
|
||||
* during write and divide the original value during read. It
|
||||
* will be built as a shared library. plugin.c test will load
|
||||
* and use this filter library.
|
||||
*
|
||||
* Return: Success: Data chunk size
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* 29 March 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5Z_filter_dynlib2(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes,
|
||||
size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if(cd_nelmts > 0)
|
||||
return(0);
|
||||
|
||||
/* Assignment to eliminate unused parameter warning. */
|
||||
cd_values = cd_values;
|
||||
|
||||
if(flags & H5Z_FLAG_REVERSE) { /*read*/
|
||||
/* Divide the original value with MULTIPLIER */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ /= MULTIPLIER;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end if */
|
||||
else { /*write*/
|
||||
/* Multiply the original value with MULTIPLIER */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ *= MULTIPLIER;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end else */
|
||||
|
||||
return nbytes;
|
||||
} /* end H5Z_filter_dynlib2() */
|
||||
|
103
test/dynlib3.c
103
test/dynlib3.c
@ -1,103 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/*
|
||||
* Programmer: Raymond Lu
|
||||
* 1 April 2013
|
||||
*
|
||||
* Purpose: Tests the plugin module (H5PL)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define H5Z_FILTER_DYNLIB3 259
|
||||
#define SUFFIX_LEN 8
|
||||
#define GROUP_SUFFIX ".h5group"
|
||||
|
||||
static size_t H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* This message derives from H5Z */
|
||||
const H5Z_class2_t H5Z_DYNLIB3[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
H5Z_FILTER_DYNLIB3, /* Filter id number */
|
||||
1, 1, /* Encoding and decoding enabled */
|
||||
"dynlib3", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)H5Z_filter_dynlib3, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB3;}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Z_filter_dynlib3
|
||||
*
|
||||
* Purpose: A dynlib3 filter method that is used to test groups. It
|
||||
* appends the suffix ".h5group" to each group name during
|
||||
* write and takes it out during read.
|
||||
*
|
||||
* Return: Success: Data chunk size
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* 1 April 2013
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes,
|
||||
size_t *buf_size, void **buf)
|
||||
{
|
||||
size_t ret_value; /* Return value */
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if(cd_nelmts > 0)
|
||||
return(0);
|
||||
|
||||
/* Assignment to eliminate unused parameter warning. */
|
||||
cd_values = cd_values;
|
||||
|
||||
if(flags & H5Z_FLAG_REVERSE) { /*read*/
|
||||
ret_value = *buf_size = nbytes - SUFFIX_LEN;
|
||||
} /* end if */
|
||||
else { /*write*/
|
||||
void *outbuf = NULL; /* Pointer to new buffer */
|
||||
unsigned char *dst; /* Temporary pointer to destination buffer */
|
||||
|
||||
dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0));
|
||||
|
||||
/* Copy raw data */
|
||||
memcpy((void*)dst, (void*)(*buf), nbytes);
|
||||
|
||||
/* Append suffix to raw data for storage */
|
||||
dst += nbytes;
|
||||
memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN);
|
||||
|
||||
/* Free input buffer */
|
||||
H5free_memory(*buf);
|
||||
|
||||
/* Set return values */
|
||||
*buf_size = nbytes + SUFFIX_LEN;
|
||||
*buf = outbuf;
|
||||
outbuf = NULL;
|
||||
ret_value = *buf_size;
|
||||
} /* end else */
|
||||
|
||||
return ret_value;
|
||||
} /* H5Z_filter_dynlib3() */
|
||||
|
102
test/dynlib4.c
102
test/dynlib4.c
@ -1,102 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/*
|
||||
* Purpose: Tests the plugin module (H5PL)
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define H5Z_FILTER_DYNLIB4 260
|
||||
|
||||
#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
|
||||
|
||||
static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* This message derives from H5Z */
|
||||
const H5Z_class2_t H5Z_DYNLIB4[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
H5Z_FILTER_DYNLIB4, /* Filter id number */
|
||||
1, 1, /* Encoding and decoding enabled */
|
||||
"dynlib4", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Z_filter_dynlib4
|
||||
*
|
||||
* Purpose: A dynlib4 filter method that adds on and subtract from
|
||||
* the original value with another value. It will be built
|
||||
* as a shared library. plugin.c test will load and use
|
||||
* this filter library. Designed to call a HDF function.
|
||||
*
|
||||
* Return: Success: Data chunk size
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes,
|
||||
size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
int add_on = 0;
|
||||
unsigned ver_info[3];
|
||||
|
||||
/* Check for the library version */
|
||||
if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
|
||||
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
|
||||
return(0);
|
||||
}
|
||||
/* Check for the correct number of parameters */
|
||||
if(cd_nelmts == 0)
|
||||
return(0);
|
||||
|
||||
/* Check that permanent parameters are set correctly */
|
||||
if(cd_values[0] > 9)
|
||||
return(0);
|
||||
|
||||
if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
|
||||
PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
|
||||
return(0);
|
||||
}
|
||||
|
||||
add_on = (int)cd_values[0];
|
||||
|
||||
if(flags & H5Z_FLAG_REVERSE) { /*read*/
|
||||
/* Substract the "add on" value to all the data values */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ -= add_on;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end if */
|
||||
else { /*write*/
|
||||
/* Add the "add on" value to all the data values */
|
||||
while(buf_left > 0) {
|
||||
*int_ptr++ += add_on;
|
||||
buf_left -= sizeof(int);
|
||||
} /* end while */
|
||||
} /* end else */
|
||||
|
||||
return nbytes;
|
||||
} /* end H5Z_filter_dynlib4() */
|
||||
|
1511
test/filter_plugin.c
Normal file
1511
test/filter_plugin.c
Normal file
File diff suppressed because it is too large
Load Diff
93
test/filter_plugin1_dsets.c
Normal file
93
test/filter_plugin1_dsets.c
Normal file
@ -0,0 +1,93 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Purpose: Test dataset filter plugin for the filter_pluging.c test.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define FILTER1_ID 257
|
||||
|
||||
static size_t add_sub_value(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* Filter class struct */
|
||||
const H5Z_class2_t FILTER_INFO[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
FILTER1_ID, /* Filter ID number */
|
||||
1, /* Encoding enabled */
|
||||
1, /* Decoding enabled */
|
||||
"test filter plugin 1", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)add_sub_value, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: add_sub_value
|
||||
*
|
||||
* Purpose: On write:
|
||||
* Adds a caller-supplied value to the element
|
||||
* On read:
|
||||
* Subtracts a caller-supplied value from the element
|
||||
*
|
||||
* Return: Success: Data chunk size in bytes
|
||||
* Failure: 0
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
add_sub_value(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
|
||||
size_t nbytes, size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
int value = 0; /* Data value to add/subtract */
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if (0 == cd_nelmts)
|
||||
return 0;
|
||||
|
||||
/* Check that permanent parameters are set correctly */
|
||||
if (cd_values[0] > 9)
|
||||
return 0;
|
||||
|
||||
value = (int)cd_values[0];
|
||||
|
||||
if (flags & H5Z_FLAG_REVERSE) {
|
||||
/* READ - Substract the given value from all the data values */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ -= value;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* WRITE - Add the given value to all the data values */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ += value;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
|
||||
} /* end add_sub_value() */
|
||||
|
88
test/filter_plugin2_dsets.c
Normal file
88
test/filter_plugin2_dsets.c
Normal file
@ -0,0 +1,88 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Purpose: Test dataset filter plugin for the filter_pluging.c test.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define FILTER2_ID 258
|
||||
#define MULTIPLIER 3
|
||||
|
||||
static size_t mult_div_value(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* Filter class struct */
|
||||
const H5Z_class2_t FILTER_INFO[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
FILTER2_ID, /* Filter ID number */
|
||||
1, /* Encoding enabled */
|
||||
1, /* Decoding enabled */
|
||||
"test filter plugin 2", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)mult_div_value, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: mult_div_value
|
||||
*
|
||||
* Purpose: On write:
|
||||
* Multiplies an element by a constant value.
|
||||
* On read:
|
||||
* Divides an element by a constant value.
|
||||
*
|
||||
* Return: Success: Data chunk size in bytes
|
||||
* Failure: 0
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
mult_div_value(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if (cd_nelmts > 0)
|
||||
return 0;
|
||||
|
||||
/* Assignment to eliminate unused parameter warning */
|
||||
cd_values = cd_values;
|
||||
|
||||
if (flags & H5Z_FLAG_REVERSE) {
|
||||
/* READ - Divide the original value by MULTIPLIER */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ /= MULTIPLIER;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* WRITE - Multiply the original value by MULTIPLIER */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ *= MULTIPLIER;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
} /* end mult_div_value() */
|
||||
|
119
test/filter_plugin3_dsets.c
Normal file
119
test/filter_plugin3_dsets.c
Normal file
@ -0,0 +1,119 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Purpose: Test dataset filter plugin for the filter_pluging.c test.
|
||||
* This filter makes an HDF5 API call to ensure that works correctly.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define FILTER3_ID 259
|
||||
|
||||
#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
|
||||
|
||||
static size_t add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* Filter class struct */
|
||||
const H5Z_class2_t FILTER_INFO[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
FILTER3_ID, /* Filter ID number */
|
||||
1, /* Encoding enabled */
|
||||
1, /* Decoding enabled */
|
||||
"test filter plugin 3", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)add_sub_value_hdf5, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: add_sub_value_hdf5
|
||||
*
|
||||
* Purpose: On write:
|
||||
* Adds a caller-supplied value to the element
|
||||
* On read:
|
||||
* Subtracts a caller-supplied value from the element
|
||||
*
|
||||
* NOTE: This filter is identical to filter #1 only it makes
|
||||
* an HDF5 library call to ensure doing that doesn't
|
||||
* cause problems.
|
||||
*
|
||||
* Return: Success: Data chunk size in bytes
|
||||
* Failure: 0
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
add_sub_value_hdf5(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values,
|
||||
size_t nbytes, size_t *buf_size, void **buf)
|
||||
{
|
||||
int *int_ptr = (int *)*buf; /* Pointer to the data values */
|
||||
size_t buf_left = *buf_size; /* Amount of data buffer left to process */
|
||||
int value = 0; /* Data value to add/subtract */
|
||||
unsigned majnum = 0; /* Output data from the HDF5 library call */
|
||||
unsigned minnum = 0;
|
||||
unsigned relnum = 0;
|
||||
|
||||
/* Check for the library version.
|
||||
* We don't do anything with this information - it's just to ensure that
|
||||
* HDF5 library calls work properly from inside filter plugins.
|
||||
*/
|
||||
if (H5get_libversion(&majnum, &minnum, &relnum) < 0) {
|
||||
PUSH_ERR("filter plugin 3", H5E_CALLBACK, "H5get_libversion");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if (cd_nelmts == 0)
|
||||
return 0;
|
||||
|
||||
/* Check that permanent parameters are set correctly */
|
||||
if (cd_values[0] > 9)
|
||||
return 0;
|
||||
|
||||
/* Ensure that the version numbers match what was passed in.
|
||||
* Again, this is trivial work, just to ensure that the library calls are
|
||||
* working properly.
|
||||
*/
|
||||
if (majnum != cd_values[1] || minnum != cd_values[2]) {
|
||||
PUSH_ERR("filter plugin 3", H5E_CALLBACK, "library versions do not match");
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = (int)cd_values[0];
|
||||
|
||||
if (flags & H5Z_FLAG_REVERSE) {
|
||||
/* READ - Substract the given value from all the data values */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ -= value;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* WRITE - Add the given value to all the data values */
|
||||
while (buf_left > 0) {
|
||||
*int_ptr++ += value;
|
||||
buf_left -= sizeof(int);
|
||||
}
|
||||
}
|
||||
|
||||
return nbytes;
|
||||
} /* end add_sub_value_hdf5() */
|
||||
|
106
test/filter_plugin4_groups.c
Normal file
106
test/filter_plugin4_groups.c
Normal file
@ -0,0 +1,106 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Purpose: Test group filter plugin for the filter_pluging.c test.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "H5PLextern.h"
|
||||
|
||||
#define FILTER4_ID 260
|
||||
#define SUFFIX_LEN 8
|
||||
#define GROUP_SUFFIX ".h5group"
|
||||
|
||||
static size_t append_to_group_name(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
|
||||
|
||||
/* Filter class struct */
|
||||
const H5Z_class2_t FILTER_INFO[1] = {{
|
||||
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
|
||||
FILTER4_ID, /* Filter ID number */
|
||||
1, /* Encoding enabled */
|
||||
1, /* Decoding enabled */
|
||||
"test filter plugin 4", /* Filter name for debugging */
|
||||
NULL, /* The "can apply" callback */
|
||||
NULL, /* The "set local" callback */
|
||||
(H5Z_func_t)append_to_group_name, /* The actual filter function */
|
||||
}};
|
||||
|
||||
H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
|
||||
const void *H5PLget_plugin_info(void) {return FILTER_INFO;}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: append_to_group_name
|
||||
*
|
||||
* Purpose: On write:
|
||||
* Appends the suffix ".h5group" to the group name
|
||||
* On read:
|
||||
* Removes the ".h5group" suffix from the group name
|
||||
*
|
||||
* Return: Success: Data size in bytes
|
||||
* Failure: 0
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
append_to_group_name(unsigned int flags, size_t cd_nelmts,
|
||||
const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf)
|
||||
{
|
||||
size_t new_name_size = 0; /* Return value */
|
||||
|
||||
/* Check for the correct number of parameters */
|
||||
if (cd_nelmts > 0)
|
||||
return 0;
|
||||
|
||||
/* Assignment to eliminate unused parameter warning. */
|
||||
cd_values = cd_values;
|
||||
|
||||
if (flags & H5Z_FLAG_REVERSE) {
|
||||
/* READ - Remove the suffix from the group name */
|
||||
new_name_size = *buf_size = nbytes - SUFFIX_LEN;
|
||||
}
|
||||
else {
|
||||
/* WRITE - Append the suffix to the group name */
|
||||
void *outbuf = NULL; /* Pointer to new buffer */
|
||||
unsigned char *dst = NULL; /* Temporary pointer to destination buffer */
|
||||
|
||||
/* Get memory for the new, larger string buffer using the
|
||||
* library's memory allocator.
|
||||
*/
|
||||
if (NULL == (dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0))))
|
||||
return 0;
|
||||
|
||||
/* Copy raw data */
|
||||
memcpy((void *)dst, (const void *)(*buf), nbytes);
|
||||
|
||||
/* Append suffix to raw data for storage */
|
||||
dst += nbytes;
|
||||
memcpy((void *)dst, (const void *)GROUP_SUFFIX, SUFFIX_LEN);
|
||||
|
||||
/* Free the passed-in buffer using the library's allocator */
|
||||
H5free_memory(*buf);
|
||||
|
||||
/* Set return values */
|
||||
*buf_size = nbytes + SUFFIX_LEN;
|
||||
*buf = outbuf;
|
||||
outbuf = NULL;
|
||||
new_name_size = *buf_size;
|
||||
}
|
||||
|
||||
return new_name_size;
|
||||
} /* append_to_group_name() */
|
||||
|
1217
test/plugin.c
1217
test/plugin.c
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,7 @@
|
||||
srcdir=@srcdir@
|
||||
TOP_BUILDDIR=@top_builddir@
|
||||
|
||||
# Determine backward compatibility options enabled
|
||||
# Determine if backward compatibility options enabled
|
||||
DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
@ -23,21 +23,21 @@ nerrors=0
|
||||
verbose=yes
|
||||
exit_code=$EXIT_SUCCESS
|
||||
|
||||
TEST_NAME=plugin
|
||||
TEST_NAME=filter_plugin
|
||||
TEST_BIN=`pwd`/$TEST_NAME
|
||||
FROM_DIR=`pwd`/.libs
|
||||
case $(uname) in
|
||||
CYGWIN* )
|
||||
PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*"
|
||||
PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*"
|
||||
PLUGINS_FOR_DIR1="$FROM_DIR/cygfilter_plugin1* $FROM_DIR/cygfilter_plugin3*"
|
||||
PLUGINS_FOR_DIR2="$FROM_DIR/cygfilter_plugin2* $FROM_DIR/cygfilter_plugin4*"
|
||||
;;
|
||||
*)
|
||||
PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*"
|
||||
PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*"
|
||||
PLUGINS_FOR_DIR1="$FROM_DIR/libfilter_plugin1* $FROM_DIR/libfilter_plugin3*"
|
||||
PLUGINS_FOR_DIR2="$FROM_DIR/libfilter_plugin2* $FROM_DIR/libfilter_plugin4*"
|
||||
;;
|
||||
esac
|
||||
PLUGIN_LIBDIR1=testdir1
|
||||
PLUGIN_LIBDIR2=testdir2
|
||||
PLUGIN_DIR1=filter_plugin_dir1
|
||||
PLUGIN_DIR2=filter_plugin_dir2
|
||||
CP="cp -p" # Use -p to preserve mode,ownership,timestamps
|
||||
RM="rm -rf"
|
||||
|
||||
@ -50,34 +50,34 @@ TESTING() {
|
||||
}
|
||||
|
||||
# Main Body
|
||||
# Create test directories if not exists yet.
|
||||
test -d $PLUGIN_LIBDIR1 || mkdir -p $PLUGIN_LIBDIR1
|
||||
# Create test directories if necessary.
|
||||
test -d $PLUGIN_DIR1 || mkdir -p $PLUGIN_DIR1
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to create test directory($PLUGIN_LIBDIR1)"
|
||||
echo "Failed to create filter plugin test directory ($PLUGIN_DIR1)"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
test -d $PLUGIN_LIBDIR2 || mkdir -p $PLUGIN_LIBDIR2
|
||||
test -d $PLUGIN_DIR2 || mkdir -p $PLUGIN_DIR2
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to create test directory($PLUGIN_LIBDIR2)"
|
||||
echo "Failed to create filter plugin test directory ($PLUGIN_DIR2)"
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
# copy plugin library for test
|
||||
$CP $PLUGIN_LIB1 $PLUGIN_LIBDIR1
|
||||
# Copy plugins for the tests.
|
||||
$CP $PLUGINS_FOR_DIR1 $PLUGIN_DIR1
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to copy plugin library ($PLUGIN_LIB1) for test."
|
||||
echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR1) to test directory."
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
$CP $PLUGIN_LIB2 $PLUGIN_LIBDIR2
|
||||
$CP $PLUGINS_FOR_DIR2 $PLUGIN_DIR2
|
||||
if [ $? != 0 ]; then
|
||||
echo "Failed to copy plugin library ($PLUGIN_LIB2) for test."
|
||||
echo "Failed to copy filter plugins ($PLUGINS_FOR_DIR2) to test directory."
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
# setup plugin path
|
||||
ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR1}:${PLUGIN_LIBDIR2}"
|
||||
ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_DIR1}:${PLUGIN_DIR2}"
|
||||
|
||||
# Run the test
|
||||
$ENVCMD $TEST_BIN
|
||||
@ -87,9 +87,9 @@ fi
|
||||
|
||||
############################################
|
||||
# HDFFV-9655 test for relative path disabled
|
||||
# setup plugin path relative to test
|
||||
# setup filter plugin path relative to test
|
||||
# actual executable is in the .libs folder
|
||||
#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_LIBDIR1}:@/../${PLUGIN_LIBDIR2}"
|
||||
#ENVCMD="env HDF5_PLUGIN_PATH=@/../${PLUGIN_DIR1}:@/../${PLUGIN_DIR2}"
|
||||
#
|
||||
# Run the test
|
||||
#$ENVCMD $TEST_BIN
|
||||
@ -103,11 +103,11 @@ if test $nerrors -ne 0 ; then
|
||||
echo "$nerrors errors encountered"
|
||||
exit_code=$EXIT_FAILURE
|
||||
else
|
||||
echo "All Plugin API tests passed."
|
||||
echo "All filter plugin tests passed."
|
||||
exit_code=$EXIT_SUCCESS
|
||||
fi
|
||||
|
||||
# Clean up temporary files/directories and leave
|
||||
$RM $PLUGIN_LIBDIR1 $PLUGIN_LIBDIR2
|
||||
$RM $PLUGIN_DIR1 $PLUGIN_DIR2
|
||||
|
||||
exit $exit_code
|
@ -53,9 +53,6 @@ if HAVE_SHARED_CONDITIONAL
|
||||
noinst_LTLIBRARIES=libdynlibdiff.la
|
||||
libdynlibdiff_la_SOURCES=dynlib_diff.c
|
||||
libdynlibdiff_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
|
||||
libdynlibdiff.la: $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_DEPENDENCIES) $(EXTRA_libdynlibdiff_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlibdiff_la_LINK) $(am_libdynlibdiff_la_rpath) $(libdynlibdiff_la_OBJECTS) $(libdynlibdiff_la_LIBADD)
|
||||
endif
|
||||
|
||||
# Temporary files. *.h5 are generated by h5diff. They should
|
||||
|
@ -42,9 +42,6 @@ if HAVE_SHARED_CONDITIONAL
|
||||
noinst_LTLIBRARIES=libdynlibdump.la
|
||||
libdynlibdump_la_SOURCES=dynlib_dump.c
|
||||
libdynlibdump_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
|
||||
libdynlibdump.la: $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_DEPENDENCIES) $(EXTRA_libdynlibdump_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlibdump_la_LINK) $(am_libdynlibdump_la_rpath) $(libdynlibdump_la_OBJECTS) $(libdynlibdump_la_LIBADD)
|
||||
endif
|
||||
|
||||
# Temporary files. *.h5 are generated by h5dumpgentest. They should
|
||||
|
@ -39,9 +39,6 @@ if HAVE_SHARED_CONDITIONAL
|
||||
noinst_LTLIBRARIES=libdynlibls.la
|
||||
libdynlibls_la_SOURCES=dynlib_ls.c
|
||||
libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
|
||||
libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD)
|
||||
endif
|
||||
|
||||
|
||||
|
@ -50,11 +50,6 @@ if HAVE_SHARED_CONDITIONAL
|
||||
libdynlibvers_la_SOURCES=dynlib_vrpk.c
|
||||
libdynlibadd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
libdynlibvers_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
|
||||
|
||||
libdynlibadd.la: $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_DEPENDENCIES) $(EXTRA_libdynlibadd_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlibadd_la_LINK) $(am_libdynlibadd_la_rpath) $(libdynlibadd_la_OBJECTS) $(libdynlibadd_la_LIBADD)
|
||||
libdynlibvers.la: $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_DEPENDENCIES) $(EXTRA_libdynlibvers_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libdynlibvers_la_LINK) $(am_libdynlibvers_la_rpath) $(libdynlibvers_la_OBJECTS) $(libdynlibvers_la_LIBADD)
|
||||
endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user