summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt88
-rw-r--r--test/plugin_lib/CMakeLists.txt83
-rw-r--r--test/plugin_lib/Makefile.in45
-rw-r--r--test/plugin_lib/dynlib1.c98
4 files changed, 68 insertions, 246 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index dfd6a8e..75f398d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,22 +7,14 @@ PROJECT (HDF5_TEST)
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
-# If plugin library tests can be tested
+# Generate the H5srcdir_str.h file containing user settings needed by compilation
#-----------------------------------------------------------------------------
-IF (BUILD_SHARED_LIBS)
- IF (EXISTS "${HDF5_TEST_SOURCE_DIR}/plugin_lib" AND IS_DIRECTORY "${HDF5_TEST_SOURCE_DIR}/plugin_lib")
- ADD_SUBDIRECTORY (${HDF5_TEST_SOURCE_DIR}/plugin_lib ${PROJECT_BINARY_DIR}/plugin_lib)
- ENDIF (EXISTS "${HDF5_TEST_SOURCE_DIR}/plugin_lib" AND IS_DIRECTORY "${HDF5_TEST_SOURCE_DIR}/plugin_lib")
-ELSE (BUILD_SHARED_LIBS)
- MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ")
- ADD_TEST (
- NAME H5PLUGIN-SKIPPED
- COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING"
- )
-ENDIF (BUILD_SHARED_LIBS)
+SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
+INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
#-----------------------------------------------------------------------------
-# Define Sources
+# Define Test Library Sources
#-----------------------------------------------------------------------------
SET (TEST_LIB_SRCS
${HDF5_TEST_SOURCE_DIR}/h5test.c
@@ -34,13 +26,6 @@ SET (TEST_LIB_HEADERS
${HDF5_TEST_SOURCE_DIR}/h5test.h
)
-#-----------------------------------------------------------------------------
-# Generate the H5srcdir_str.h file containing user settings needed by compilation
-#-----------------------------------------------------------------------------
-SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
-CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
-
ADD_LIBRARY (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS})
IF (MSVC)
TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib")
@@ -52,6 +37,50 @@ TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE})
SET_TARGET_PROPERTIES (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test)
+#-----------------------------------------------------------------------------
+# If plugin library tests can be tested
+#-----------------------------------------------------------------------------
+IF (BUILD_SHARED_LIBS)
+ SET (HDF5_TEST_PLUGIN_LIB_CORENAME "dynlib1")
+ 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})
+ ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
+ INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
+
+ #-----------------------------------------------------------------------------
+ # Define Sources
+ #-----------------------------------------------------------------------------
+
+ SET (H5_TEST_PLUGIN_LIB_SRCS
+ ${HDF5_TEST_SOURCE_DIR}/dynlib1.c
+ )
+
+ ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${H5_TEST_PLUGIN_LIB_SRCS})
+ 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}
+ ${LIB_TYPE}
+ HDF5_TEST_PLUGIN_LIB_NAME_RELEASE
+ HDF5_TEST_PLUGIN_LIB_NAME_DEBUG
+ )
+ SET_TARGET_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
+
+ #-----------------------------------------------------------------------------
+ # Copy plugin library to a plugins folder
+ #-----------------------------------------------------------------------------
+
+ # make plugins dir
+ FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+ ADD_CUSTOM_COMMAND (
+ TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
+ )
+ENDIF (BUILD_SHARED_LIBS)
+
# --------------------------------------------------------------------
# Copy all the HDF5 files from the test directory into the source directory
# --------------------------------------------------------------------
@@ -569,6 +598,25 @@ ENDIF (\${TEST_RESULT} STREQUAL \"0\")
ADD_TEST (NAME testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}")
##############################################################################
+### 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 ${LIB_TYPE})
+ TARGET_LINK_LIBRARIES (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET})
+ SET_TARGET_PROPERTIES (plugin PROPERTIES FOLDER test)
+
+ ADD_TEST (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>)
+ SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/plugins")
+ELSE (BUILD_SHARED_LIBS)
+ MESSAGE (STATUS " **** Plugins libraries must be built as shared libraries **** ")
+ ADD_TEST (
+ NAME H5PLUGIN-SKIPPED
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP H5PLUGIN TESTING"
+ )
+ENDIF (BUILD_SHARED_LIBS)
+
+##############################################################################
##############################################################################
### V F D T E S T S ###
##############################################################################
diff --git a/test/plugin_lib/CMakeLists.txt b/test/plugin_lib/CMakeLists.txt
deleted file mode 100644
index 9428153..0000000
--- a/test/plugin_lib/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-cmake_minimum_required (VERSION 2.8.10)
-PROJECT (HDF5_TEST_PLUGIN_LIB)
-
-#-----------------------------------------------------------------------------
-# Set the core name of the library
-#-----------------------------------------------------------------------------
-SET (HDF5_TEST_PLUGIN_LIB_CORENAME "dynlib1")
-
-#-----------------------------------------------------------------------------
-# Set the true names of all the libraries if customized by external project
-#-----------------------------------------------------------------------------
-SET (HDF5_TEST_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_PLUGIN_LIB_CORENAME}")
-
-#-----------------------------------------------------------------------------
-# Set the target names of all the libraries
-#-----------------------------------------------------------------------------
-SET (HDF5_TEST_PLUGIN_LIB_TARGET ${HDF5_TEST_PLUGIN_LIB_CORENAME})
-
-#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
-
-#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
-
-#-----------------------------------------------------------------------------
-# Define Sources
-#-----------------------------------------------------------------------------
-
-SET (H5_TEST_PLUGIN_LIB_SRCS
- ${HDF5_TEST_PLUGIN_LIB_SOURCE_DIR}/dynlib1.c
-)
-
-#-----------------------------------------------------------------------------
-# Generate the H5srcdir_str.h file containing user settings needed by compilation
-#-----------------------------------------------------------------------------
-SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
-CONFIGURE_FILE (${HDF5_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
-INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
-
-ADD_LIBRARY (${HDF5_TEST_PLUGIN_LIB_TARGET} ${LIB_TYPE} ${H5_TEST_PLUGIN_LIB_SRCS})
-TARGET_LINK_LIBRARIES (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-#SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_PLUGIN_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (
- ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME}
- ${LIB_TYPE}
- HDF5_TEST_PLUGIN_LIB_NAME_RELEASE
- HDF5_TEST_PLUGIN_LIB_NAME_DEBUG
-)
-SET_TARGET_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN)
-
-#
-# Copy plugin library to a plugins folder
-#
-
-# make plugins dir
-FILE (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
-ADD_CUSTOM_COMMAND (
- TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different
- "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
- "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>"
- )
-
-##############################################################################
-##############################################################################
-### T E S T S ###
-##############################################################################
-##############################################################################
-
-#-- Adding test for plugin
-ADD_EXECUTABLE (plugin ${HDF5_TEST_SOURCE_DIR}/plugin.c)
-TARGET_NAMING (plugin ${LIB_TYPE})
-TARGET_LINK_LIBRARIES (plugin ${HDF5_TEST_PLUGIN_LIB_TARGET})
-SET_TARGET_PROPERTIES (plugin PROPERTIES FOLDER test)
-
-ADD_TEST (NAME H5PLUGIN-plugin COMMAND $<TARGET_FILE:plugin>)
-SET_TESTS_PROPERTIES (H5PLUGIN-plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/plugins")
diff --git a/test/plugin_lib/Makefile.in b/test/plugin_lib/Makefile.in
deleted file mode 100644
index 00a2ea5..0000000
--- a/test/plugin_lib/Makefile.in
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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.
-#
-# HDF5 Library Test Makefile(.in)
-#
-# This Makefile.in is NOT generated by automake. Since we want to build
-# shared libraries for testing, automake can't create shared libraries when
-# configure asks to build static library.
-#
-CFLAGS = -fPIC -g
-CC = @CC@
-SRCDIR = @srcdir@
-TOP_SRCDIR = @top_srcdir@
-TOP_BUILDDIR = @top_builddir@
-MAJOR = 0
-MINOR = 1
-NAME1 = dynlib1
-VERSION = $(MAJOR).$(MINOR)
-
-# Include files in hdf5/src build/src directories for hdf5.h and H5pubconf.h
-INCLUDES = -I$(TOP_SRCDIR)/src -I$(TOP_BUILDDIR)/src
-
-lib: lib$(NAME1).so.$(VERSION)
-
-$(NAME1).o: $(SRCDIR)/$(NAME1).c
- $(CC) $(CFLAGS) $(INCLUDES) -c $(SRCDIR)/$(NAME1).c
-
-lib$(NAME1).so.$(VERSION): $(NAME1).o
- $(CC) -shared $^ -o $@
-
-clean:
- $(RM) *.o *.so* Makefile
-
-distclean:
- $(RM) *.o *.so* Makefile
diff --git a/test/plugin_lib/dynlib1.c b/test/plugin_lib/dynlib1.c
deleted file mode 100644
index d663bd7..0000000
--- a/test/plugin_lib/dynlib1.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * 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;
-
-/*fprintf(stderr, "cd_nelmts=%d, cd_values=%d\n", cd_nelmts, cd_values[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];
-
-/*fprintf(stderr, "add_on=%d\n", add_on);*/
-
- 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 */
-
-/*fprintf(stderr, "nbytes=%d\n", nbytes);*/
-
- return nbytes;
-}