diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 37 | ||||
-rw-r--r-- | test/Makefile.in | 100 | ||||
-rw-r--r-- | test/dynlib1.c | 93 | ||||
-rw-r--r-- | test/test_plugin.sh.in | 10 |
4 files changed, 188 insertions, 52 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 37975f2..df6a9e5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -24,10 +24,15 @@ include $(top_srcdir)/config/commence.am INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh -check_SCRIPTS = $(TEST_SCRIPT) -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) plugin$(EXEEXT) +if HAVE_SHARED_CONDITIONAL + TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh + SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) plugin$(EXEEXT) +else + TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh + SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) +endif +check_SCRIPTS = $(TEST_SCRIPT) # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. @@ -50,8 +55,11 @@ TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ # 'make check' doesn't run them directly, so they are not included in TEST_PROG. # Also build testmeta, which is used for timings test. It builds quickly, # and this lets automake keep all its test programs in one place. -check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_env plugin - +if HAVE_SHARED_CONDITIONAL + check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_env plugin +else + check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta links_env +endif # These programs generate test files for the tests. They don't need to be # compiled every time we want to test the library. However, putting @@ -69,8 +77,19 @@ if BUILD_ALL_CONDITIONAL noinst_PROGRAMS=$(BUILD_ALL_PROGS) endif -# The libh5test library provides common support code for the tests. -noinst_LTLIBRARIES=libh5test.la +if HAVE_SHARED_CONDITIONAL + # The libh5test library provides common support code for the tests. + noinst_LTLIBRARIES=libh5test.la libdynlib1.la + + # The libdynlib1 library for testing plugin module plugin.c. + # Build it as shared library if configure is enabled for shared library. + libdynlib1_la_SOURCES=dynlib1.c + libdynlib1_la_LDFLAGS=-rpath /tmp +else + # The libh5test library provides common support code for the tests. + noinst_LTLIBRARIES=libh5test.la +endif + libh5test_la_SOURCES=h5test.c testframe.c cache_common.c # Use libhd5test.la to compile all of the tests @@ -120,7 +139,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 \ + multi_file-[rs].h5 core_file 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 objcopy_src.h5 objcopy_dst.h5 \ @@ -128,7 +147,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse earray.h5 efc[0-5].h5 log_vfd_out.log \ new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ - file_image_core_test.h5.copy plugin.h5 + file_image_core_test.h5.copy # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/Makefile.in b/test/Makefile.in index 81681ef..2864a56 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -75,9 +75,19 @@ DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.am \ $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \ $(top_srcdir)/config/commence.am \ $(top_srcdir)/config/conclude.am COPYING -check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \ - err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT) \ - links_env$(EXEEXT) plugin$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_FALSE@check_PROGRAMS = $(am__EXEEXT_1) \ +@HAVE_SHARED_CONDITIONAL_FALSE@ error_test$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_FALSE@ err_compat$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_FALSE@ tcheck_version$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_FALSE@ testmeta$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_FALSE@ links_env$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_TRUE@check_PROGRAMS = $(am__EXEEXT_1) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ error_test$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ err_compat$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ tcheck_version$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ testmeta$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ links_env$(EXEEXT) \ +@HAVE_SHARED_CONDITIONAL_TRUE@ plugin$(EXEEXT) @BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2) TESTS = $(am__EXEEXT_1) $(TEST_SCRIPT) subdir = test @@ -91,13 +101,23 @@ CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir_str.h \ testlibinfo.sh testlinks_env.sh test_plugin.sh CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libh5test_la_LIBADD = -am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo -libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) +libdynlib1_la_LIBADD = +am__libdynlib1_la_SOURCES_DIST = dynlib1.c +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlib1_la_OBJECTS = dynlib1.lo +libdynlib1_la_OBJECTS = $(am_libdynlib1_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +libdynlib1_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdynlib1_la_LDFLAGS) $(LDFLAGS) -o $@ +@HAVE_SHARED_CONDITIONAL_TRUE@am_libdynlib1_la_rpath = +libh5test_la_LIBADD = +am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo +libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) +@HAVE_SHARED_CONDITIONAL_FALSE@am_libh5test_la_rpath = +@HAVE_SHARED_CONDITIONAL_TRUE@am_libh5test_la_rpath = am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \ cache_tagging$(EXEEXT) pool$(EXEEXT) accum$(EXEEXT) \ @@ -469,7 +489,25 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ +SOURCES = $(libdynlib1_la_SOURCES) $(libh5test_la_SOURCES) accum.c \ + app_ref.c big.c bittests.c btree2.c cache.c cache_api.c \ + cache_tagging.c cmpd_dset.c cross_read.c dangle.c dsets.c \ + dt_arith.c dtransform.c dtypes.c earray.c efc.c \ + enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \ + err_compat.c error_test.c extend.c external.c farray.c fheap.c \ + file_image.c fillval.c filter_fail.c flush1.c flush2.c \ + freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ + gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \ + gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ + gen_new_super.c gen_noencoder.c gen_nullspace.c gen_plist.c \ + gen_sizes_lheap.c gen_specmetaread.c gen_udlinks.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c links_env.c mf.c \ + mount.c mtime.c ntypes.c objcopy.c ohdr.c plugin.c pool.c \ + reserved.c set_extent.c space_overflow.c stab.c \ + tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ + $(ttsafe_SOURCES) unlink.c vfd.c +DIST_SOURCES = $(am__libdynlib1_la_SOURCES_DIST) \ + $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ earray.c efc.c enc_dec_plist.c enc_dec_plist_with_endianess.c \ @@ -485,23 +523,6 @@ SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ reserved.c set_extent.c space_overflow.c stab.c \ tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ $(ttsafe_SOURCES) unlink.c vfd.c -DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \ - bittests.c btree2.c cache.c cache_api.c cache_tagging.c \ - cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c \ - dtransform.c dtypes.c earray.c efc.c enc_dec_plist.c \ - enc_dec_plist_with_endianess.c enum.c err_compat.c \ - error_test.c extend.c external.c farray.c fheap.c file_image.c \ - fillval.c filter_fail.c flush1.c flush2.c freespace.c \ - gen_bad_ohdr.c gen_bogus.c gen_cross.c gen_deflate.c \ - gen_file_image.c gen_filespace.c gen_filters.c gen_new_array.c \ - gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \ - gen_noencoder.c gen_nullspace.c gen_plist.c gen_sizes_lheap.c \ - gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \ - istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \ - ntypes.c objcopy.c ohdr.c plugin.c pool.c reserved.c \ - set_extent.c space_overflow.c stab.c tcheck_version.c \ - $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ - vfd.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -815,21 +836,22 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ 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 new_move_[ab].h5 ntypes.h5 \ - dangle.h5 error_test.h5 err_compat.h5 dtransform.h5 \ + multi_file-[rs].h5 core_file 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 objcopy_src.h5 objcopy_dst.h5 \ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \ earray.h5 efc[0-5].h5 log_vfd_out.log new_multi_file_v16-r.h5 \ new_multi_file_v16-s.h5 split_get_file_image_test-m.h5 \ - split_get_file_image_test-r.h5 file_image_core_test.h5.copy \ - plugin.h5 + split_get_file_image_test-r.h5 file_image_core_test.h5.copy INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src +@HAVE_SHARED_CONDITIONAL_FALSE@TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh # Test script for error_test and err_compat -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh +@HAVE_SHARED_CONDITIONAL_TRUE@TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_plugin.sh +@HAVE_SHARED_CONDITIONAL_FALSE@SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) +@HAVE_SHARED_CONDITIONAL_TRUE@SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) plugin$(EXEEXT) check_SCRIPTS = $(TEST_SCRIPT) -SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) plugin$(EXEEXT) # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. @@ -859,9 +881,10 @@ BUILD_ALL_PROGS = gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_n gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \ gen_sizes_lheap gen_file_image gen_plist - -# The libh5test library provides common support code for the tests. -noinst_LTLIBRARIES = libh5test.la +@HAVE_SHARED_CONDITIONAL_FALSE@noinst_LTLIBRARIES = libh5test.la +@HAVE_SHARED_CONDITIONAL_TRUE@noinst_LTLIBRARIES = libh5test.la libdynlib1.la +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlib1_la_SOURCES = dynlib1.c +@HAVE_SHARED_CONDITIONAL_TRUE@libdynlib1_la_LDFLAGS = -rpath /tmp libh5test_la_SOURCES = h5test.c testframe.c cache_common.c # Use libhd5test.la to compile all of the tests @@ -961,8 +984,10 @@ clean-noinstLTLIBRARIES: echo rm -f $${locs}; \ rm -f $${locs}; \ } +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) $(LIBS) libh5test.la: $(libh5test_la_OBJECTS) $(libh5test_la_DEPENDENCIES) $(EXTRA_libh5test_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libh5test_la_OBJECTS) $(libh5test_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(am_libh5test_la_rpath) $(libh5test_la_OBJECTS) $(libh5test_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ @@ -1229,6 +1254,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dt_arith.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtransform.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtypes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib1.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earray.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/efc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc_dec_plist.Po@am__quote@ @@ -1580,6 +1606,12 @@ uninstall-am: help: @$(top_srcdir)/bin/makehelp +@HAVE_SHARED_CONDITIONAL_TRUE@ # The libh5test library provides common support code for the tests. + +@HAVE_SHARED_CONDITIONAL_TRUE@ # The libdynlib1 library for testing plugin module plugin.c. +@HAVE_SHARED_CONDITIONAL_TRUE@ # Build it as shared library if configure is enabled for shared library. +@HAVE_SHARED_CONDITIONAL_FALSE@ # The libh5test library provides common support code for the tests. + # Additional target for running timing test timings _timings: testmeta @for timing in $(TIMINGS) dummy; do \ diff --git a/test/dynlib1.c b/test/dynlib1.c new file mode 100644 index 0000000..b879ca2 --- /dev/null +++ b/test/dynlib1.c @@ -0,0 +1,93 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. 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 <hdf5.h> + +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 */ +}}; + +const H5PL_type_t H5PL_get_plugin_type(void) {return H5PL_TYPE_FILTER;} +const H5Z_class2_t* H5PL_get_plugin_info(void) {return H5Z_DYNLIB1;} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib1 + * + * Purpose: A dynlib1 compression method that doesn't do anything. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + * Programmer: Robb Matzke + * Tuesday, April 21, 1998 + * + *------------------------------------------------------------------------- + */ +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]<0 || cd_values[0]>9) + return(0); + + add_on = 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; +} diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in index c00df8c..f2f3a1a 100644 --- a/test/test_plugin.sh.in +++ b/test/test_plugin.sh.in @@ -30,20 +30,12 @@ DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@" nerrors=0 verbose=yes -#test -d ./plugin_lib -MAKE_CMD=make -CD=cd TEST_NAME=plugin TEST_BIN=`pwd`/$TEST_NAME -ENVCMD="env HDF5_PLUGIN_PATH=`pwd`/plugin_lib" +ENVCMD="env HDF5_PLUGIN_PATH=`pwd`/.libs" # Run the test -$CD ./plugin_lib -echo "$MAKE_CMD" -$MAKE_CMD -$CD ../ $ENVCMD $TEST_BIN -echo "$HDF5_PLUGIN_PATH" # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". |