diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 034e577c135..f32c4bce759 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -94,11 +94,11 @@ jobs: name: "Autotools TestExpress Workflows" uses: ./.github/workflows/testxpr-auto.yml - call-release-auto-julia: - name: "Autotools Julia Workflows" - uses: ./.github/workflows/julia-auto.yml - with: - build_mode: "production" +# call-release-auto-julia: +# name: "Autotools Julia Workflows" +# uses: ./.github/workflows/julia-auto.yml +# with: +# build_mode: "production" # workflow-msys2-autotools: # name: "CMake msys2 Workflows" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9636ec49c71..0305d10c530 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -109,11 +109,11 @@ jobs: name: "CMake TestExpress Workflows" uses: ./.github/workflows/testxpr-cmake.yml - call-release-cmake-julia: - name: "CMake Julia Workflows" - uses: ./.github/workflows/julia-cmake.yml - with: - build_mode: "Release" +# call-release-cmake-julia: +# name: "CMake Julia Workflows" +# uses: ./.github/workflows/julia-cmake.yml +# with: +# build_mode: "Release" call-release-cmake-msys2: name: "CMake Msys2 Workflows" diff --git a/CMakePresets.json b/CMakePresets.json index 24f89c628dd..18ae431dbbe 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -68,7 +68,7 @@ "LZF_PACKAGE_NAME": {"type": "STRING", "value": "lzf"}, "SZ_TGZ_NAME": {"type": "STRING", "value": "SZ-2.1.12.5.tar.gz"}, "SZ_PACKAGE_NAME": {"type": "STRING", "value": "SZ"}, - "ZFP_TGZ_NAME": {"type": "STRING", "value": "zfp-1.0.0.tar.gz"}, + "ZFP_TGZ_NAME": {"type": "STRING", "value": "zfp-1.0.1.tar.gz"}, "ZFP_PACKAGE_NAME": {"type": "STRING", "value": "zfp"}, "ZSTD_TGZ_NAME": {"type": "STRING", "value": "zstd-1.5.6.tar.gz"}, "ZSTD_PACKAGE_NAME": {"type": "STRING", "value": "zstd"} diff --git a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.ddl b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.ddl index a8e66c08054..8dadf939143 100644 --- a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.ddl +++ b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.ddl @@ -10,7 +10,7 @@ GROUP "/" { FILTERS { USER_DEFINED_FILTER { FILTER_ID 32013 - COMMENT H5Z-ZFP-1.1.1 (ZFP-1.0.0) github.com/LLNL/H5Z-ZFP + COMMENT H5Z-ZFP-1.1.1 (ZFP-1.0.1) github.com/LLNL/H5Z-ZFP PARAMS { XXXX } } } diff --git a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.tst b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.tst index dd7197cda78..8b95b6e205b 100644 --- a/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.tst +++ b/HDF5Examples/C/H5FLT/tfiles/h5ex_d_zfp.tst @@ -4,8 +4,8 @@ zfp filter is available for encoding and decoding. ....Close the file and reopen for reading ........ Filter info is available from the dataset creation property Filter identifier is 32013 - Number of parameters is 6 with the value 268456209 - To find more about the filter check H5Z-ZFP-1.1.1 (ZFP-1.0.0) github.com/LLNL/H5Z-ZFP + Number of parameters is 6 with the value 269504785 + To find more about the filter check H5Z-ZFP-1.1.1 (ZFP-1.0.1) github.com/LLNL/H5Z-ZFP ....Reading zfp compressed data ................ Maximum value in DS1 is 1890.0000 zfp filter is available now since H5Dread triggered loading of the filter. diff --git a/bin/process_source.sh b/bin/process_source.sh new file mode 100755 index 00000000000..728857578af --- /dev/null +++ b/bin/process_source.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the LICENSE 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. +# + +# A convenience script to process HDF5 source. This recreates some header files +# from their input files and runs the trace script to update the H5ARG_TRACE +# macros. +# +# This does NOT regenerate the parser code in the high-level library, since +# that would probably generate a lot of churn due to different flex, etc. +# versions. If you want to regenerate that code, use the genparser script +# from the bin directory. + +echo +echo "******************************" +echo "* HDF5 process source script *" +echo "******************************" +echo +echo "*** NOTE: Must be run from the source root! ***" +echo + +# Run trace script +# The trace script updates H5ARG_TRACE macros in library source files. +echo "Running arg trace script:" +bin/trace src/H5*.c || exit 1 +echo + +# Run make_err +# make_err automatically generates the H5E headers that create error message +# types for HDF5. +echo "Running error generation script:" +bin/make_err src/H5err.txt || exit 1 +echo + +# Run make_vers +# make_vers automatically generates the public headers that define the API version +# macros for HDF5. +echo "Running API version generation script:" +bin/make_vers src/H5vers.txt || exit 1 +echo + +# Run make_overflow +# make_overflow automatically generates macros for detecting overflows for type +# conversion. +echo "Running overflow macro generation script:" +bin/make_overflow src/H5overflow.txt || exit 1 +echo + +echo "*** SUCCESS ***" + +echo +exit 0 diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 93cb9332e94..851e7c5987e 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -229,7 +229,7 @@ set (ZFP_GIT_URL "https://github.com/LLNL/zfp.git" CACHE STRING "Use ZFP from G set (ZFP_GIT_BRANCH "develop" CACHE STRING "" FORCE) set (ZFP_TGZ_ORIGPATH "https://github.com/LLNL/zfp/releases/download/1.0.0" CACHE STRING "Use PLUGINS from original location" FORCE) -set (ZFP_TGZ_NAME "zfp-1.0.0.tar.gz" CACHE STRING "Use ZFP from compressed file" FORCE) +set (ZFP_TGZ_NAME "zfp-1.0.1.tar.gz" CACHE STRING "Use ZFP from compressed file" FORCE) set (ZFP_PACKAGE_NAME "zfp" CACHE STRING "Name of ZFP package" FORCE) diff --git a/doxygen/aliases b/doxygen/aliases index 0d355c001f0..cbc6e81f6cf 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -7,10 +7,12 @@ ALIASES += THG="The HDF Group" ALIASES += HDFURL="support.hdfgroup.org" # URL for archived files ALIASES += ARCURL="\HDFURL/archive/support/HDF5/doc" +# URL for release files +ALIASES += RELURL="\HDFURL/releases/hdf5" # URL for documentation -ALIASES += DOCURL="\HDFURL/releases/hdf5/documentation" +ALIASES += DOCURL="\RELURL/documentation" # URL for downloads -ALIASES += DWNURL="\HDFURL/releases/hdf5/downloads" +ALIASES += DWNURL="\RELURL/downloads/latest" # URL for RFCs ALIASES += RFCURL="\DOCURL/rfc" ALIASES += AEXURL="\HDFURL/archive/support/ftp/HDF5/examples" @@ -260,7 +262,6 @@ ALIASES += sa_metadata_ops="\sa \li H5Pget_all_coll_metadata_ops() \li H5Pget_co ################################################################################ ALIASES += ref_cons_semantics="Enabling a Strict Consistency Semantics Model in Parallel HDF5" -ALIASES += ref_file_image_ops="HDF5 File Image Operations" ALIASES += ref_filter_pipe="Data Flow Pipeline for H5Dread()" ALIASES += ref_group_impls="Group implementations in HDF5" ALIASES += ref_h5lib_relver="HDF5 Library Release Version Numbers" @@ -327,7 +328,6 @@ ALIASES += ref_rfc20121114="HDF5 File Space Management" ALIASES += ref_rfc20120828="New HDF5 API Routines for HPC Applications - Read/Write Multiple Datasets in an HDF5 file" ALIASES += ref_rfc20120523="HDF5 File Space Management: Paged Aggregation" -ALIASES += ref_rfc20120501="HDF5 File Image Operations" ALIASES += ref_rfc20120305="Enabling a Strict Consistency Semantics Model in Parallel HDF5" ALIASES += ref_rfc20120220="h5repack: Improved Hyperslab selections for Large Chunked Datasets" ALIASES += ref_rfc20120120="A Maintainer's Guide for the Datatype Module in HDF5 Library" diff --git a/doxygen/dox/ExamplesAPI.dox b/doxygen/dox/ExamplesAPI.dox index f3903cec1d2..cf44405db11 100644 --- a/doxygen/dox/ExamplesAPI.dox +++ b/doxygen/dox/ExamplesAPI.dox @@ -150,8 +150,8 @@ Languages are C, Fortran, Java (JHI5), Java Object Package, Python (High Level), JavaObj MATLAB PyHigh PyLow -h5ex_d_rdwrc.h5 -h5ex_d_rdwrc.tst +h5ex_d_rdwr.h5 +h5ex_d_rdwr.tst h5ex_d_rdwr.ddl @@ -483,7 +483,7 @@ FORTRAN h5ex_t_convert.h5 h5ex_t_convert.tst -h5ex_t_convert.ddl +h5ex_t_convert.ddl not applicable Read / Write Complex Compound (Attribute) diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox index d008ddcfc86..e83f8b22280 100644 --- a/doxygen/dox/IntroHDF5.dox +++ b/doxygen/dox/IntroHDF5.dox @@ -625,7 +625,7 @@ For information on compiling in C, C++ and Fortran, see: \ref LBCompiling IDL, MATLAB, and NCL Examples for HDF-EOS Examples of how to access and visualize NASA HDF-EOS files using IDL, MATLAB, and NCL. -Miscellaneous Examples +Miscellaneous Examples These (very old) examples resulted from working with users, and are not fully tested. Most of them are in C, with a few in Fortran and Java. Using Special Values diff --git a/doxygen/dox/LearnBasics.dox b/doxygen/dox/LearnBasics.dox index 4db515c1a57..33426cf1311 100644 --- a/doxygen/dox/LearnBasics.dox +++ b/doxygen/dox/LearnBasics.dox @@ -75,7 +75,7 @@ These examples (C, C++, Fortran, Java, Python) are provided in the HDF5 source c Read and write to a dataset -C Fortran C++ Java Python +C Fortran C++ Java Python @@ -83,7 +83,7 @@ These examples (C, C++, Fortran, Java, Python) are provided in the HDF5 source c Create an attribute -C Fortran C++ Java Python +C Fortran C++ Java Python @@ -99,7 +99,7 @@ These examples (C, C++, Fortran, Java, Python) are provided in the HDF5 source c Create groups in a file using absolute and relative paths -C Fortran C++ Java Python +C Fortran C++ Java Python diff --git a/doxygen/dox/LearnBasics3.dox b/doxygen/dox/LearnBasics3.dox index 6e569aa41bb..c93c23971c0 100644 --- a/doxygen/dox/LearnBasics3.dox +++ b/doxygen/dox/LearnBasics3.dox @@ -968,7 +968,7 @@ or on WINDOWS you may need to add the path to the bin folder to PATH. \section secLBCompilingCMake Compiling an Application with CMake \subsection subsecLBCompilingCMakeScripts CMake Scripts for Building Applications -See Using CMake to Build Applications to build applications with different languages and options. +See Using CMake to Build Applications to build applications with different languages and options. For a more complete script (and to help resolve issues) see the script provided with the HDF5 Examples project. @@ -976,7 +976,7 @@ For a more complete script (and to help resolve issues) see the script provided The installed HDF5 can be verified by compiling the HDF5 Examples project, included with the CMake built HDF5 binaries in the share folder or you can go to the HDF5 Examples in the HDF5 github repository. -Go into the share directory and follow the instructions in Using CMake to Build Examples to build the examples. +Go into the share directory and follow the instructions in Using CMake to Build Examples to build the examples. In general, users must first set the HDF5_ROOT environment variable to the installed location of the CMake configuration files for HDF5. For example, on Windows the following path might be set: diff --git a/doxygen/dox/Overview.dox b/doxygen/dox/Overview.dox index b472d4d2a8d..6caffd147aa 100644 --- a/doxygen/dox/Overview.dox +++ b/doxygen/dox/Overview.dox @@ -21,7 +21,7 @@ documents cover a mix of tasks, concepts, and reference, to help a specific audience succeed. \par Offline reading - You can download it as an archive for offline reading. + You can download it as an archive for offline reading. \par ToDo List There is plenty of unfinished business. diff --git a/doxygen/dox/RFC.dox b/doxygen/dox/RFC.dox index 1b1141b4fd5..0482aee0c98 100644 --- a/doxygen/dox/RFC.dox +++ b/doxygen/dox/RFC.dox @@ -53,7 +53,6 @@ 2012-10-24 \ref_rfc20121024 2012-08-28 \ref_rfc20120828 2012-05-23 \ref_rfc20120523 - 2012-05-01 \ref_rfc20120501 2012-03-05 \ref_rfc20120305 2012-02-20 \ref_rfc20120220 2012-01-20 \ref_rfc20120120 diff --git a/doxygen/dox/TechnicalNotes.dox b/doxygen/dox/TechnicalNotes.dox index 3ea6af63a25..b0f1c8f4cbc 100644 --- a/doxygen/dox/TechnicalNotes.dox +++ b/doxygen/dox/TechnicalNotes.dox @@ -3,7 +3,7 @@ \li \ref api-compat-macros \li \ref APPDBG \li \ref FMTDISC -\li \ref FILEIMGOPS +\li \ref sec_file_image \li \ref subsubsec_dataset_transfer_filter \li \ref IOFLOW \li \ref TNMDC @@ -11,6 +11,7 @@ \li \ref SWMR \li \ref VDS \li \ref RELVERSION +\li \ref UNICODE \li \ref VFL \li HDF5 Library Architecture Overview \li \ref VOL_Connector @@ -31,19 +32,1032 @@ /** \page VFL HDF5 Virtual File Layer -\htmlinclude VFL.html +\section sec_vfl_intro Introduction +The HDF5 file format describes how HDF5 data structures and dataset raw data are mapped +to a linear format address space and the HDF5 library implements that bidirectional mapping +in terms of an API. However, the HDF5 format specifications do not indicate how the format +address space is mapped onto storage and HDF (version 5 and earlier) simply mapped the format +address space directly onto a single file by convention. + +Since early versions of HDF5 it became apparent that users want the ability to map the +format address space onto different types of storage (a single file, multiple files, local +memory, global memory, network distributed global memory, a network protocol, etc.) with +various types of maps. For instance, some users want to be able to handle very large format +address spaces on operating systems that support only 2GB files by partitioning the format +address space into equal-sized parts each served by a separate file. Other users want the +same multi-file storage capability but want to partition the address space according to +purpose (raw data in one file, object headers in another, global heap in a third, etc.) +in order to improve I/O speeds. + +In fact, the number of storage variations is probably larger than the number of methods +that the HDF5 team is capable of implementing and supporting. Therefore, a Virtual File +Layer API is being implemented which will allow application teams or departments to design +and implement their own mapping between the HDF5 format address space and storage, with each +mapping being a separate file driver (possibly written in terms of other file drivers). The +HDF5 team will provide a small set of useful file drivers which will also serve as examples +for those who which to write their own: + + + + + + + + + + + + + + + + +
#H5FD_SEC2This is the default driver which uses Posix file-system functions +like read and write to perform I/O to a single file. All I/O requests are unbuffered +although the driver does optimize file seeking operations to some extent. +
#H5FD_STDIOThis driver uses functions from 'stdio.h' to perform buffered I/O to a single file. +
#H5FD_COREThis driver performs I/O directly to memory and can be +used to create small temporary files that never exist on permanent storage. This +type of storage is generally very fast since the I/O consists only of memory-to-memory copy operations. +
#H5FD_MPIOThis is the driver of choice for accessing files in parallel +using MPI and MPI-IO. It is only predefined if the library is compiled with parallel I/O support. +
#H5FD_FAMILYLarge format address spaces are partitioned into more +manageable pieces and sent to separate storage locations using an underlying driver +of the user's choice. \ref H5TOOL_RT_UG can be used to change the sizes of the family +members when stored as files or to convert a family of files to a single file or vice versa. +
+ +\section sec_vfl_use Using a File Driver +Most application writers will use a driver defined by the HDF5 library or contributed by another +programming team. This chapter describes how existing drivers are used. + +\subsection subsec_vfl_use_hdr Driver Header Files +Each file driver is defined in its own public header file which should be included by any +application which plans to use that driver. The predefined drivers are in header files whose +names begin with 'H5FD' followed by the driver name and '.h'. The 'hdf5.h' header file includes +all the predefined driver header files. + +Once the appropriate header file is included a symbol of the form 'H5FD_' followed by the +upper-case driver name will be the driver identification number.(The driver name is by convention +and might not apply to drivers which are not distributed with HDF5.) However, the value may +change if the library is closed (e.g., by calling #H5close) and the symbol is referenced again. + +\subsection subsec_vfl_use_create Creating and Opening Files +In order to create or open a file one must define the method by which the storage is +accessed(The access method also indicates how to translate the storage name to a storage server +such as a file, network protocol, or memory.) and does so by creating a file access property +list(The term "file access property list" is a misnomer since storage isn't required to be a file.) +which is passed to the #H5Fcreate or #H5Fopen function. A default file access property list is created +by calling #H5Pcreate and then the file driver information is inserted by calling a driver initialization +function such as #H5Pset_fapl_family: +\code +hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); +size_t member_size = 100*1024*1024; /*100MB*/ +H5Pset_fapl_family(fapl, member_size, H5P_DEFAULT); +hid_t file = H5Fcreate("foo%05d.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl); +H5Pclose(fapl); +\endcode -*/ +Each file driver will have its own initialization function whose name is H5Pset_fapl_ followed by +the driver name and which takes a file access property list as the first argument followed by additional +driver-dependent arguments. -/** \page FMTDISC HDF5 File Format Discussion +An alternative to using the driver initialization function is to set the driver directly using the +#H5Pset_driver function.(This function is overloaded to operate on data transfer property lists also, as described below.) +Its second argument is the file driver identifier, which may have a different numeric value from run to run +depending on the order in which the file drivers are registered with the library. The third argument encapsulates +the additional arguments of the driver initialization function. This method only works if the file driver +writer has made the driver-specific property list structure a public datatype, which is often not the case. +\code +hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); +static H5FD_family_fapl_t fa = {100*1024*1024, H5P_DEFAULT}; +H5Pset_driver(fapl, H5FD_FAMILY, &fa); +hid_t file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl); +H5Pclose(fapl); +\endcode -\htmlinclude FileFormat.html +It is also possible to query the file driver information from a file access property list by +calling #H5Pget_driver to determine the driver and then calling a driver-defined query function +to obtain the driver information: +\code +hid_t driver = H5Pget_driver(fapl); +if (H5FD_SEC2==driver) { + /*nothing further to get*/ +} else if (H5FD_FAMILY==driver) { + hid_t member_fapl; + haddr_t member_size; + H5Pget_fapl_family(fapl, &member_size, &member_fapl); +} else if (....) { + .... +} +\endcode + +\subsection subsec_vfl_use_per Performing I/O +The #H5Dread and #H5Dwrite functions transfer data between application memory and the file. They both take +an optional data transfer property list which has some general driver-independent properties and optional +driver-defined properties. An application will typically perform I/O in one of three styles via the +#H5Dread or #H5Dwrite function: + +Like file access properties in the previous section, data transfer properties can be set using a driver +initialization function or a general purpose function. For example, to set the MPI-IO driver to use +independent access for I/O operations one would say: +\code +hid_t dxpl = H5Pcreate(H5P_DATA_XFER); +H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT); +H5Dread(dataset, type, mspace, fspace, buffer, dxpl); +H5Pclose(dxpl); +\endcode + +The alternative is to initialize a driver defined C struct and pass it to the #H5Pset_driver function: +\code +hid_t dxpl = H5Pcreate(H5P_DATA_XFER); +static H5FD_mpio_dxpl_t dx = {H5FD_MPIO_INDEPENDENT}; +H5Pset_driver(dxpl, H5FD_MPIO, &dx); +H5Dread(dataset, type, mspace, fspace, buffer, dxpl); +\endcode + +The transfer property list can be queried in a manner similar to the file access property list: the driver +provides a function (or functions) to return various information about the transfer property list: +\code +hid_t driver = H5Pget_driver(dxpl); +if (H5FD_MPIO==driver) { + H5FD_mpio_xfer_t xfer_mode; + H5Pget_dxpl_mpio(dxpl, &xfer_mode); +} else { + .... +} +\endcode + +\subsection subsec_vfl_use_inter File Driver Interchangeability +The HDF5 specifications describe two things: the mapping of data onto a linear format address +space and the C API which performs the mapping. However, the mapping of the format address space +onto storage intentionally falls outside the scope of the HDF5 specs. This is a direct result of the +fact that it is not generally possible to store information about how to access storage inside the +storage itself. For instance, given only the file name '/arborea/1225/work/f%03d' the HDF5 library +is unable to tell whether the name refers to a file on the local file system, a family of files on +the local file system, a file on host 'arborea' port 1225, a family of files on a remote system, etc. + +Two ways which library could figure out where the storage is located are: storage access information +can be provided by the user, or the library can try all known file access methods. This implementation +uses the former method. + +In general, if a file was created with one driver then it isn't possible to open it with another driver. +There are of course exceptions: a file created with MPIO could probably be opened with the sec2 driver, +any file created by the sec2 driver could be opened as a family of files with one member, etc. In fact, +sometimes a file must not only be opened with the same driver but also with the same driver properties. +The predefined drivers are written in such a way that specifying the correct driver is sufficient for +opening a file. + +\section sec_vfl_imp Implementation of a Driver +A driver is simply a collection of functions and data structures which are registered with the HDF5 +library at runtime. The functions fall into these categories: +\li Functions which operate on modes +\li Functions which operate on files +\li Functions which operate on the address space +\li Functions which operate on data +\li Functions for driver initialization +\li Optimization functions + +\subsection subsec_vfl_imp_mode Mode Functions +Some drivers need information about file access and data transfers which are very specific to the driver. +The information is usually implemented as a pair of pointers to C structs which are allocated and +initialized as part of an HDF5 property list and passed down to various driver functions. There are two +classes of settings: file access modes that describe how to access the file through the driver, and +data transfer modes which are settings that control I/O operations. Each file opened by a particular +driver may have a different access mode; each dataset I/O request for a particular file may have a +different data transfer mode. + +Since each driver has its own particular requirements for various settings, each driver is responsible +for defining the mode structures that it needs. Higher layers of the library treat the structures as +opaque but must be able to copy and free them. Thus, the driver provides either the size of the +structure or a pair of function pointers for each of the mode types. + +Example: The family driver needs to know how the format address space is partitioned and the file +access property list to use for the family members. +\code +// Driver-specific file access properties +typedef struct H5FD_family_fapl_t { + hsize_t memb_size; // size of each family member + hid_t memb_fapl; // file access property list for each family member +} H5FD_family_fapl_t; + +// Driver specific data transfer properties +typedef struct H5FD_family_dxpl_t { + hid_t memb_dxpl_id; //data xfer property list of each member +} H5FD_family_dxpl_t; +\endcode +n order to copy or free one of these structures the member file access or data transfer properties must +also be copied or freed. This is done by providing a copy and close function for each structure: + +Example: The file access property list copy and close functions for the family driver: +\code +static void * +H5FD_family_fapl_copy(const void *_old_fa) +{ + const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa; + H5FD_family_fapl_t *new_fa = malloc(sizeof(H5FD_family_fapl_t)); + assert(new_fa); + + memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); + new_fa->memb_fapl_id = H5Pcopy(old_fa->memb_fapl_id); + return new_fa; +} + +static herr_t +H5FD_family_fapl_free(void *_fa) +{ + H5FD_family_fapl_t *fa = (H5FD_family_fapl_t*)_fa; + H5Pclose(fa->memb_fapl_id); + free(fa); + return 0; +} +\endcode + +Generally when a file is created or opened the file access properties for the driver are copied into the +file pointer which is returned and they may be modified from their original value (for instance, the file +family driver modifies the member size property when opening an existing family). In order to support the +#H5Fget_access_plist function the driver must provide a fapl_get callback which creates a copy of the +driver-specific properties based on a particular file. + +Example: The file family driver copies the member size file access property list into the return value: +\code +static void * +H5FD_family_fapl_get(H5FD_t *_file) +{ + H5FD_family_t *file = (H5FD_family_t*)_file; + H5FD_family_fapl_t *fa = calloc(1, sizeof(H5FD_family_fapl_t*)); + + fa->memb_size = file->memb_size; + fa->memb_fapl_id = H5Pcopy(file->memb_fapl_id); + return fa; +} +\endcode + +\subsection subsec_vfl_imp_file File Functions +The higher layers of the library expect files to have a name and allow the file to be accessed in various modes. +The driver must be able to create a new file, replace an existing file, or open an existing file. Opening or +creating a file should return a handle, a pointer to a specialization of the H5FD_t struct, which allows read-only +or read-write access and which will be passed to the other driver functions as they are called.(Read-only access is +only appropriate when opening an existing file.) +\code +typedef struct { + // Public fields + H5FD_class_t *cls; //class data defined below + + // Private fields -- driver-defined + +} H5FD_t; +\endcode + +Example: The family driver requires handles to the underlying storage, the size of the members for this +particular file (which might be different than the member size specified in the file access property list +if an existing file family is being opened), the name used to open the file in case additional members +must be created, and the flags to use for creating those additional members. The eoa member caches the +size of the format address space so the family members don't have to be queried in order to find it. +\code +// The description of a file belonging to this driver. +typedef struct H5FD_family_t { + H5FD_t pub; // public stuff, must be first + hid_t memb_fapl_id; // file access property list for members + hsize_t memb_size; // maximum size of each member file + int nmembs; // number of family members + int amembs; // number of member slots allocated + H5FD_t **memb; // dynamic array of member pointers + haddr_t eoa; // end of allocated addresses + char *name; // name generator printf format + unsigned flags; // flags for opening additional members +} H5FD_family_t; +\endcode + +Example: The sec2 driver needs to keep track of the underlying Unix file descriptor and also the +end of format address space and current Unix file size. It also keeps track of the current file +position and last operation (read, write, or unknown) in order to optimize calls to lseek. The +device and inode fields are defined on Unix in order to uniquely identify the file and will be +discussed below. +\code +typedef struct H5FD_sec2_t { + H5FD_t pub; // public stuff, must be first + int fd; // the unix file + haddr_t eoa; // end of allocated region + haddr_t eof; // end of file; current file size + haddr_t pos; // current file I/O position + int op; // last operation + dev_t device; // file device number + ino_t inode; // file i-node number +} H5FD_sec2_t; +\endcode + +\subsection subsec_vfl_imp_open Open Files +All drivers must define a function for opening/creating a file. This function should have a prototype which is: + + + + + +
static H5FD_t * open (const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr)The file name name and file access property list fapl are the same as were specified in the #H5Fcreate +or #H5Fopen call. The flags are the same as in those calls also except the flag #H5F_ACC_CREAT is also +present if the call was to H5Fcreate and they are documented in the 'H5Fpublic.h' file. The maxaddr +argument is the maximum format address that the driver should be prepared to handle (the minimum address is always zero).
+ +Example: The sec2 driver opens a Unix file with the requested name and saves information which +uniquely identifies the file (the Unix device number and inode). +\code +static H5FD_t * +H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id/*unused*/, + haddr_t maxaddr) +{ + unsigned o_flags; + int fd; + struct stat sb; + H5FD_sec2_t *file=NULL; + + // Check arguments + if (!name || !*name) return NULL; + if (0==maxaddr || HADDR_UNDEF==maxaddr) return NULL; + if (ADDR_OVERFLOW(maxaddr)) return NULL; + + // Build the open flags + o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; + if (H5F_ACC_TRUNC & flags) o_flags |= O_TRUNC; + if (H5F_ACC_CREAT & flags) o_flags |= O_CREAT; + if (H5F_ACC_EXCL & flags) o_flags |= O_EXCL; + + // Open the file + if ((fd=open(name, o_flags, 0666))<0) return NULL; + if (fstat(fd, &sb)<0) { + close(fd); + return NULL; + } + + // Create the new file struct + file = calloc(1, sizeof(H5FD_sec2_t)); + file->fd = fd; + file->eof = sb.st_size; + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + file->device = sb.st_dev; + file->inode = sb.st_ino; + + return (H5FD_t*)file; +} +\endcode + +\subsection subsec_vfl_imp_close Closing Files +Closing a file simply means that all cached data should be flushed to the next lower layer, the +file should be closed at the next lower layer, and all file-related data structures should be +freed. All information needed by the close function is already present in the file handle. + + + + + +
static herr_t close (H5FD_t *file)The file argument is the handle which was returned by the open function, and the close should +free only memory associated with the driver-specific part of the handle (the public parts will +have already been released by HDF5's virtual file layer).
+ +Example: The sec2 driver just closes the underlying Unix file, making sure that the actual +file size is the same as that known to the library by writing a zero to the last file position +it hasn't been written by some previous operation (which happens in the same code which flushes +the file contents and is shown below). +\code +static herr_t +H5FD_sec2_close(H5FD_t *_file) +{ + H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + + if (H5FD_sec2_flush(_file)<0) return -1; + if (close(file->fd)<0) return -1; + free(file); + return 0; +} +\endcode + +\subsection subsec_vfl_imp_key File Keys +Occasionally an application will attempt to open a single file more than one time in order +to obtain multiple handles to the file. HDF5 allows the files to share information(For instance, +writing data to one handle will cause the data to be immediately visible on the other handle.) +but in order to accomplish this HDF5 must be able to tell when two names refer to the same file. +It does this by associating a driver-defined key with each file opened by a driver and comparing +the key for an open request with the keys for all other files currently open by the same driver. + + + + + +
const int cmp (const H5FD_t *f1, const H5FD_t *f2)The driver may provide a function which compares two files f1 and f2 belonging to the same +driver and returns a negative, positive, or zero value a la the strcmp function.(The ordering +is arbitrary as long as it's consistent within a particular file driver.) If this function is +not provided then HDF5 assumes that all calls to the open callback return unique files regardless +of the arguments and it is up to the application to avoid doing this if that assumption is incorrect.
+ +Each time a file is opened the library calls the cmp function to compare that file with all other files +currently open by the same driver and if one of them matches (at most one can match) then the file +which was just opened is closed and the previously opened file is used instead. + +Opening a file twice with incompatible flags will result in failure. For instance, opening a file with +the truncate flag is a two step process which first opens the file without truncation so keys can be +compared, and if no matching file is found already open then the file is closed and immediately reopened +with the truncation flag set (if a matching file is already open then the truncating open will fail). + +Example: The sec2 driver uses the Unix device and i-node as the key. They were initialized when +the file was opened. +\code +static int +H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +{ + const H5FD_sec2_t *f1 = (const H5FD_sec2_t*)_f1; + const H5FD_sec2_t *f2 = (const H5FD_sec2_t*)_f2; + + if (f1->device < f2->device) return -1; + if (f1->device > f2->device) return 1; + + if (f1->inode < f2->inode) return -1; + if (f1->inode > f2->inode) return 1; + + return 0; +} +\endcode + +\subsection subsec_vfl_imp_save Saving Modes Across Opens +Some drivers may also need to store certain information in the file superblock in order +to be able to reliably open the file at a later date. This is done by three functions: +one to determine how much space will be necessary to store the information in the superblock, +one to encode the information, +and one to decode the information. These functions are optional, but if any one is defined +then the other two must also be defined. + + + + + + + + + + + + + + + + + +
FunctionDescription
static hsize_t sb_size (H5FD_t *file)The sb_size function returns the number of bytes necessary to encode +information needed later if the file is reopened.
static herr_t sb_encode (H5FD_t *file, char *name, unsigned char *buf)The sb_encode function encodes information from the file into buffer buf +allocated by the caller. It also writes an 8-character (plus null termination) into +the name argument, which should be a unique identification for the driver.
static herr_t sb_decode (H5FD_t *file, const char *name, const unsigned char *buf)The sb_decode function looks at the name decodes data from the buffer buf and +updates the file argument with the new information, advancing *p in the process.
+The part of this which is somewhat tricky is that the file must be readable before the +superblock information is decoded. File access modes fall outside the scope of the HDF5 +file format, but they are placed inside the boot block for convenience.(File access modes +do not describe data, but rather describe how the HDF5 format address space is mapped to +the underlying file(s). Thus, in general the mapping must be known before the file +superblock can be read. However, the user usually knows enough about the mapping for +the superblock to be readable and once the superblock is read the library can fill +in the missing parts of the mapping.) + +\section sec_vfl_address Address Space Functions +HDF5 does not assume that a file is a linear address space of bytes. Instead, the library +will call functions to allocate and free portions of the HDF5 format address space, which +in turn map onto functions in the file driver to allocate and free portions of file address +space. The library tells the file driver how much format address space it wants to allocate +and the driver decides what format address to use and how that format address is mapped +onto the file address space. Usually the format address is chosen so that the file address +can be calculated in constant time for data I/O operations (which are always specified by format addresses). + +\subsection subsec_vfl_address_blk Userblock and Superblock +The HDF5 format allows an optional userblock to appear before the actual HDF5 data in such +a way that if the userblock is sucked out of the file and everything remaining is +shifted downward in the file address space, then the file is still a valid HDF5 file. +The userblock size can be zero or any multiple of two greater than or equal to 512 and +the file superblock begins immediately after the userblock. + +HDF5 allocates space for the userblock and superblock by calling an allocation function +defined below, which must return a chunk of memory at format address zero on the first call. + +\subsection subsec_vfl_address_alloc Allocatiion of Format Regions +The library makes many types of allocation requests: + + + + + + + + + + + + + + + + + + + + +
#H5FD_MEM_SUPERuserblock
#H5FD_MEM_BTREEAn allocation request for a node of a B-tree. +
#H5FD_MEM_DRAWAn allocation request for the raw data of a dataset. +
#H5FD_MEM_GHEAPAn allocation request for a global heap collection. Global +heaps are used to store certain types of references such as dataset region references. +The set of all global heap collections can become quite large. +
#H5FD_MEM_LHEAPAn allocation request for a local heap. Local heaps are used +to store the names which are members of a group. The combined size of all local heaps is +a function of the number of object names in the file. +
#H5FD_MEM_OHDRAn allocation request for (part of) an object header. Object +headers are relatively small and include meta information about objects (like the data +space and type of a dataset) and attributes. +
+ +When a chunk of memory is freed the library adds it to a free list and allocation requests +are satisfied from the free list before requesting memory from the file driver. Each type of +allocation request enumerated above has its own free list, but the file driver can specify that +certain object types can share a free list. It does so by providing an array which maps a +request type to a free list. If any value of the map is H5MF_DEFAULT (zero) then the object's +own free list is used. The special value H5MF_NOLIST indicates that the library should not +attempt to maintain a free list for that particular object type, instead calling the file driver +each time an object of that type is freed. + +Mappings predefined in the 'H5FDpublic.h' file are: + + + + + + + + + + +
#H5FD_FLMAP_SINGLEAll memory usage types are mapped to a single free list. +
#H5FD_FLMAP_DICHOTOMYMemory usage is segregated into meta data and raw data +for the purposes of memory management. +
#H5FD_FLMAP_DEFAULTEach memory usage type has its own free list. +
+ +Example: To make a map that manages object headers on one free list and everything else on +another free list one might initialize the map with the following code: (the use of #H5FD_MEM_SUPER is arbitrary) +\code +H5FD_mem_t mt, map[H5FD_MEM_NTYPES]; + +for (mt = 0; mt < H5FD_MEM_NTYPES; mt++) { + map[mt] = (H5FD_MEM_OHDR== mt) ? mt : H5FD_MEM_SUPER; +} +\endcode + +If an allocation request cannot be satisfied from the free list then one of two things happen. +If the driver defines an allocation callback then it is used to allocate space; otherwise new +memory is allocated from the end of the format address space by incrementing the end-of-address marker. + + + + + +
static haddr_t alloc (H5FD_t *file, H5MF_type_t type, hsize_t size)The file argument is the file from which space is to be allocated, type is the type of +memory being requested (from the list above) without being mapped according to the freelist +map and size is the number of bytes being requested. The library is allowed to allocate large +chunks of storage and manage them in a layer above the file driver (although the current library +doesn't do that). The allocation function should return a format address for the first byte +allocated. The allocated region extends from that address for size bytes. If the request cannot +be honored then the undefined address value is returned (#HADDR_UNDEF). The first call to this +function for a file which has never had memory allocated must return a format address of zero +or #HADDR_UNDEF since this is how the library allocates space for the userblock and/or superblock.
+ +\subsection subsec_vfl_address_free Freeing Format Regions +When the library is finished using a certain region of the format address space it will return the +space to the free list according to the type of memory being freed and the free list map described above. +If the free list has been disabled for a particular memory usage type (according to the free list map) +and the driver defines a free callback then it will be invoked. The free callback is also invoked for +all entries on the free list when the file is closed. + + + + + + +
static herr_t free (H5FD_t *file, H5MF_type_t type, haddr_t addr, hsize_t size)The file argument is the file for which space is being freed; type is the type of object being +freed (from the list above) without being mapped according to the freelist map; addr is the first +format address to free; and size is the size in bytes of the region being freed. The region being +freed may refer to just part of the region originally allocated and/or may cross allocation boundaries +provided all regions being freed have the same usage type. However, the library will never attempt +to free regions which have already been freed or which have never been allocated.
+A driver may choose to not define the free function, in which case format addresses will be leaked. +This isn't normally a huge problem since the library contains a simple free list of its own and freeing +parts of the format address space is not a common occurrence. + +\subsection subsec_vfl_address_query Querying the Address Range +Each file driver must have some mechanism for setting and querying the end of address, or +EOA, marker. The EOA marker is the first format address after the last format address ever allocated. +If the last part of the allocated address range is freed then the driver may optionally decrease the eoa marker. + + + + + +
static haddr_t get_eoa (H5FD_t *file)This function returns the current value of the EOA marker for the specified file.
+ +Example: The sec2 driver just returns the current eoa marker value which is cached in the file structure: +\code +static haddr_t +H5FD_sec2_get_eoa(H5FD_t *_file) +{ + H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + return file->eoa; +} +\endcode + +The eoa marker is initially zero when a file is opened and the library may set it to some other value +shortly after the file is opened (after the superblock is read and the saved eoa marker is determined) +or when allocating additional memory in the absence of an alloc callback (described above). + +Example: The sec2 driver simply caches the eoa marker in the file structure and does not extend the +underlying Unix file. When the file is flushed or closed then the Unix file size is extended to match +the eoa marker. +\code +static herr_t +H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr) +{ + H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + file->eoa = addr; + return 0; +} +\endcode + +\section sec_vfl_data Data Functions +These functions operate on data, transferring a region of the format address space between memory and files. + +\subsection subsec_vfl_data_cont Contiguous I/O Functions +A driver must specify two functions to transfer data from the library to the file and vice versa. + + + + + + + + + +
static herr_t read (H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, void *buf)The read function reads data from file file beginning at address addr and continuing +for size bytes into the buffer buf supplied by the caller.
static herr_t write (H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, const void *buf)The write function transfers data +in the opposite direction.
+\li Both functions take a data transfer property list dxpl which +indicates the fine points of how the data is to be transferred and which comes directly +from the #H5Dread or #H5Dwrite function. +\li Both functions receive type of data being written, +which may allow a driver to tune it's behavior for different kinds of data. +\li Both functions should return +a negative value if they fail to transfer the requested data, or non-negative if they +succeed. The library will never attempt to read from unallocated regions of the format address space. + +Example: The sec2 driver just makes system calls. It tries not to call lseek if the current operation +is the same as the previous operation and the file position is correct. It also fills the output buffer +with zeros when reading between the current EOF and EOA markers and restarts system calls which were interrupted. +\code +static herr_t +H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type/*unused*/, hid_t dxpl_id/*unused*/, + haddr_t addr, hsize_t size, void *buf/*out*/) +{ + H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + ssize_t nbytes; + + assert(file && file->pub.cls); + assert(buf); + + /* Check for overflow conditions */ + if (REGION_OVERFLOW(addr, size)) return -1; + if (addr+size>file->eoa) return -1; + + /* Seek to the correct location */ + if ((addr!=file->pos || OP_READ!=file->op) && + file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) { + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + return -1; + } + + /* + * Read data, being careful of interrupted system calls, partial results, + * and the end of the file. + */ + while (size>0) { + do nbytes = read(file->fd, buf, size); + while (-1==nbytes && EINTR==errno); + if (-1==nbytes) { + /* error */ + file->pos = HADDR_UNDEF; + file->op = OP_UNKNOWN; + return -1; + } + if (0==nbytes) { + /* end of file but not end of format address space */ + memset(buf, 0, size); + size = 0; + } + assert(nbytes>=0); + assert((hsize_t)nbytes<=size); + size -= (hsize_t)nbytes; + addr += (haddr_t)nbytes; + buf = (char*)buf + nbytes; + } + + /* Update current position */ + file->pos = addr; + file->op = OP_READ; + return 0; +} +\endcode +Example: The sec2 write callback is similar except it updates the file EOF marker when extending the file. + +\subsection subsec_vfl_data_flush Flushing Cached Data +Some drivers may desire to cache data in memory in order to make larger I/O requests to the +underlying file and thus improving bandwidth. Such drivers should register a cache flushing +function so that the library can insure that data has been flushed out of the drivers in +response to the application calling #H5Fflush. + + + + + +
static herr_t flush (H5FD_t *file)Flush all data for file file to storage.
+ +Example: The sec2 driver doesn't cache any data but it also doesn't extend the Unix file as +aggressively as it should. Therefore, when finalizing a file it should write a zero to the last +byte of the allocated region so that when reopening the file later the EOF marker will be at +least as large as the EOA marker saved in the superblock (otherwise HDF5 will refuse to open +the file, claiming that the data appears to be truncated). +\code +static herr_t +H5FD_sec2_flush(H5FD_t *_file) +{ + H5FD_sec2_t *file = (H5FD_sec2_t*)_file; + + if (file->eoa>file->eof) { + if (-1==file_seek(file->fd, file->eoa-1, SEEK_SET)) return -1; + if (write(file->fd, "", 1)!=1) return -1; + file->eof = file->eoa; + file->pos = file->eoa; + file->op = OP_WRITE; + } + + return 0; +} +\endcode + +\section sec_vfl_opt Optimization Functions +The library is capable of performing several generic optimizations on I/O, but these types of +optimizations may not be appropriate for a given VFL driver. + +Each driver may provide a query function to allow the library to query whether to enable these +optimizations. If a driver lacks a query function, the library will disable all types of +optimizations which can be queried. + + + + + + +
static herr_t query (const H5FD_t *file, unsigned long *flags)This function is called by the library to query which optimizations to enable for I/O to this driver.
+ +These are the flags which are currently defined: + + + + + + + + + + + + + +
H5FD_FEAT_AGGREGATE_METADATA (0x00000001)Defining the H5FD_FEAT_AGGREGATE_METADATA for a VFL driver means that the library will attempt to allocate +a larger block for metadata and then sub-allocate each metadata request from that larger block.
H5FD_FEAT_ACCUMULATE_METADATA (0x00000002)Defining the H5FD_FEAT_ACCUMULATE_METADATA for a VFL driver means that the library will attempt to cache +metadata as it is written to the file and build up a larger block of metadata to eventually pass to the +VFL 'write' routine.
H5FD_FEAT_DATA_SIEVE (0x00000004)Defining the H5FD_FEAT_DATA_SIEVE for a VFL driver means that the library will attempt to cache raw data + as it is read from/written to a file in a "data sieve" buffer.
+ +See Rajeev Thakur's papers: +http://www.mcs.anl.gov/~thakur/papers/romio-coll.ps.gz +http://www.mcs.anl.gov/~thakur/papers/mpio-high-perf.ps.gz + +\section sec_vfl_reg Registration of a Driver +Before a driver can be used the HDF5 library needs to be told of its existence. This is done by +registering the driver, which results in a driver identification number. Instead of passing many +arguments to the registration function, the driver information is entered into a structure and the +address of the structure is passed to the registration function where it is copied. This allows +the HDF5 API to be extended while providing backward compatibility at the source level. + + + + + + +
hid_t H5FDregister (H5FD_class_t *cls)The driver described by struct cls is registered with the library and an ID number for the driver is returned.
+ +The H5FD_class_t type is a struct with the following fields: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
const char *nameA pointer to a constant, null-terminated driver name to be used for debugging purposes.
size_t fapl_sizeThe size in bytes of the file access mode structure or zero if the driver supplies a copy function +or doesn't define the structure.
void *(*fapl_copy)(const void *fapl)An optional function which copies a driver-defined file access mode structure. This field takes +precedence over fm_size when both are defined.
void (*fapl_free)(void *fapl)An optional function to free the driver-defined file access mode structure. If null, then the +library calls the C free function to free the structure.
size_t dxpl_sizeThe size in bytes of the data transfer mode structure or zero if the driver supplies a copy +function or doesn't define the structure.
void *(*dxpl_copy)(const void *dxpl)An optional function which copies a driver-defined data transfer mode structure. This field +takes precedence over xm_size when both are defined.
void (*dxpl_free)(void *dxpl)An optional function to free the driver-defined data transfer mode structure. If null, then +the library calls the C free function to free the structure.
H5FD_t *(*open)(const char *name, unsigned flags, hid_t fapl, haddr_t maxaddr)The function which opens or creates a new file.
herr_t (*close)(H5FD_t *file)The function which ends access to a file.
int (*cmp)(const H5FD_t *f1, const H5FD_t *f2)An optional function to determine whether two open files have the same key. If this function +is not present then the library assumes that two files will never be the same.
int (*query)(const H5FD_t *f, unsigned long *flags)An optional function to determine which library optimizations a driver can support.
haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hsize_t size)An optional function to allocate space in the file.
herr_t (*free)(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)An optional function to free space in the file.
haddr_t (*get_eoa)(H5FD_t *file)A function to query how much of the format address space has been allocated.
herr_t (*set_eoa)(H5FD_t *file, haddr_t)A function to set the end of address space.
haddr_t (*get_eof)(H5FD_t *file)A function to return the current end-of-file marker value.
herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, void *buffer)A function to read data from a file.
herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, hsize_t size, const void *buffer)A function to write data to a file.
herr_t (*flush)(H5FD_t *file)A function which flushes cached data to the file.
H5FD_mem_t fl_map[H5FD_MEM_NTYPES]An array which maps a file allocation request type to a free list.
+ +Example: The sec2 driver would be registered as: +\code +static const H5FD_class_t H5FD_sec2_g = { + "sec2", /*name */ + MAXADDR, /*maxaddr */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + 0, /*fapl_size */ + NULL, /*fapl_get */ + NULL, /*fapl_copy */ + NULL, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_sec2_open, /*open */ + H5FD_sec2_close, /*close */ + H5FD_sec2_cmp, /*cmp */ + H5FD_sec2_query, /*query */ + NULL, /*alloc */ + NULL, /*free */ + H5FD_sec2_get_eoa, /*get_eoa */ + H5FD_sec2_set_eoa, /*set_eoa */ + H5FD_sec2_get_eof, /*get_eof */ + H5FD_sec2_read, /*read */ + H5FD_sec2_write, /*write */ + H5FD_sec2_flush, /*flush */ + H5FD_FLMAP_SINGLE, /*fl_map */ +}; + +hid_t +H5FD_sec2_init(void) +{ + if (!H5FD_SEC2_g) { + H5FD_SEC2_g = H5FDregister(&H5FD_sec2_g); + } + return H5FD_SEC2_g; +} +\endcode + +A driver can be removed from the library by unregistering it + + + + + +
herr_t H5Dunregister (hid_t driver)Where driver is the ID number returned when the driver was registered.
+Unregistering a driver makes it unusable for creating new file access or data transfer property +lists but doesn't affect any property lists or files that already use that driver. + +\subsection subsec_vfl_reg_prog Programming Note for C++ Developers Using C Functions +If a C routine that takes a function pointer as an argument is called from within C++ code, +the C routine should be returned from normally. + +Examples of this kind of routine include callbacks such as #H5Pset_elink_cb +and #H5Pset_type_conv_cb and functions such as #H5Tconvert and #H5Ewalk2. + +Exiting the routine in its normal fashion allows the HDF5 C Library to clean up +its work properly. In other words, if the C++ application jumps out of the routine +back to the C++ “catch” statement, the library is not given the opportunity to close +any temporary data structures that were set up when the routine was called. The C++ +application should save some state as the routine is started so that any problem that +occurs might be diagnosed. + +\section sec_vfl_query Querying Driver Information + + + + + +
void * H5Pget_driver_data (hid_t fapl)
void * H5Pget_driver_data (hid_t fxpl)
This function is intended to be used by driver functions, not applications. It returns a pointer +directly into the file access property list fapl which is a copy of the driver's file access mode +originally provided to the H5Pset_driver function. If its argument is a data transfer property list +fxpl then it returns a pointer to the driver-specific data transfer information instead. +
+ +\section sec_vfl_misc Miscellaneous +The various private H5F_low_* functions will be replaced by public H5FD* functions so they +can be called from drivers. + +All private functions H5F_addr_* which operate on addresses will be renamed as public functions +by removing the first underscore so they can be called by drivers. + +The haddr_t address data type will be passed by value throughout the library. The original +intent was that this type would eventually be a union of file address types for the various +drivers and may become quite large, but that was back when drivers were part of HDF5. It will +become an alias for an unsigned integer type (32 or 64 bits depending on how the library was configured). + +The various H5F*.c driver files will be renamed H5FD*.c and each will have a corresponding header +file. All driver functions except the initializer and API will be declared static. + +This documentation didn't cover optimization functions which would be useful to drivers like MPI-IO. +Some drivers may be able to perform data pipeline operations more efficiently than HDF5 and need to +be given a chance to override those parts of the pipeline. The pipeline would be designed to call +various H5FD optimization functions at various points which return one of three values: the operation +is not implemented by the driver, the operation is implemented but failed in a non-recoverable manner, +the operation is implemented and succeeded. + +Various parts of HDF5 check the only the top-level file driver and do something special if it is +the MPI-IO driver. However, we might want to be able to put the MPI-IO driver under other drivers +such as the raw part of a split driver or under a debug driver whose sole purpose is to accumulate +statistics as it passes all requests through to the MPI-IO driver. Therefore we will probably need +a function which takes a format address and or object type and returns the driver which would have +been used at the lowest level to process the request. */ -/** \page FILEIMGOPS HDF5 File Image Operations +/** \page FMTDISC HDF5 File Format Discussion -\htmlinclude FileImageOps.html +\htmlinclude FileFormat.html */ @@ -80,7 +1094,7 @@ A beneficial side effect of using SWMR access is better fault tolerance. It is m \subsection subsec_swmr_doc Documentation \subsubsection subsubsec_swmr_doc_guide User Guide -SWMR User Guide +SWMR User Guide \subsubsection subsubsec_swmr_doc_apis HDF5 Library APIs @@ -199,6 +1213,150 @@ close properly. It will contain data up to the point that it was interrupted. */ +/** \page UNICODE Using UTF-8 Encoding in HDF5 Applications + +\section sec_unicode_intro Introduction +Text and character data are often discussed as though text means ASCII text. We even go so far as +to call a file containing only ASCII text a plain text file. This works reasonably well for English +(though better for American English than British English), but what if that plain text file is in +French, German, Chinese, or any of several hundred other languages? This document introduces the +use of UTF-8 encoding (see note 1), enabling the use of a much more extensive and flexible character +set that can faithfully represent any of those languages. + +This document assumes a working familiarity with UTF-8 and Unicode. Any reader who is unfamiliar +with UTF-8 encoding should read the [Wikipedia UTF-8 article](https://en.wikipedia.org/wiki/UTF-8) +before proceeding; it provides an excellent primer. + +For our context, the most important UTF-8 concepts are: +\li Multi-byte and variable-size character encodings +\li Limitations of the ASCII character set +\li Risks associated with the use of the term plain text +\li Representation of multiple language alphabets or characters in a single document + +More specific technical details will only become important if they affect the specifics of +your application design or implementation. + +\section sec_unicode_support How and Where Is UTF-8 Supported in HDF5? +HDF5 uses characters in object names (which are actually link names, but that's a story for a +different article), dataset raw data, attribute names, and attribute raw data. Though the +mechanisms differ, you can use either ASCII or UTF-8 character sets in all of these situations. + +\subsection subsec_unicode_support_names Object and Attribute Names +By default, HDF5 creates object and attribute names with ASCII character encoding. An object or +attribute creation property list setting is required to create object names with UTF-8 characters. +This uses the function #H5Pset_char_encoding, which sets the character encoding used for object and attribute names. + +For example, the following call sequence could be used to create a dataset with its name encoded with the UTF-8 character set: + +\code + lcpl_id = H5Pcreate(H5P_LINK_CREATE) ; + error = H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) ; + dataset_id = H5Dcreate2(group_id, "datos_ñ", datatype_id, dataspace_id, + lcpl_id, H5P_DEFAULT, H5P_DEFAULT) ; +\endcode + +If the character encoding of an attribute name is unknown, the combination of an +#H5Aget_create_plist call and an #H5Pget_char_encoding call will reveal that information. +If the character encoding of an object name is unknown, the information can be accessed +through the object's H5L_info_t structure which can be obtained using #H5Lvisit or #H5Lget_info_by_idx calls. + +\subsection subsec_unicode_support_char Character Datatypes in Datasets and Attributes +Like object names, HDF5 character data in datasets and attributes is encoded as ASCII by +default. Setting up attribute or dataset character data to be UTF-8-encoded is accomplished +while defining the attribute or dataset datatype. This makes use of the function #H5Tset_cset, +which sets the character encoding to be used in building a character datatype. + +For example, the following commands could be used to create an 8-character, UTF-8 encoded, +string datatype for use in either an attribute or dataset: + +\code + datatype_id = H5Tcopy(H5T_C_S1); + error = H5Tset_cset(datatype_id, H5T_CSET_UTF8); + error = H5Tset_size(datatype_id, "8"); +\endcode + +If a character or string datatype's character encoding is unknown, the combination of an +#H5Aget_type or #H5Dget_type call and an #H5Tget_cset call can be used to determine that. + +\section sec_unicode_warn Caveats, Pitfalls, and Things to Watch For +Programmers who are accustomed to using ASCII text without accommodating other text +encodings will have to be aware of certain common issues as they begin using UTF-8 encodings. + +\subsection subsec_unicode_warn_port Cross-platform Portability +Since the HDF5 Library handles datatypes directly, UTF-8 encoded text in dataset and +attribute datatypes in a well-designed HDF5 application and file should work transparently +across platforms. The same should be true of handling names of groups, datasets, committed +datatypes, and attributes within a file. + +Be aware, however, of system or application limitations once data or other information +has been extracted from an HDF5 file. The application or system must be designed to +accommodate UTF-8 encodings if the information is then used elsewhere in the application or system environment. + +Data from a UTF-8 encoded HDF5 datatype, in either a dataset or an attribute, +that has been established within an HDF5 application should "just work" within the HDF5 portions of the application. + +\subsection subsec_unicode_warn_names Filenames +Since file access is a system issue, filenames do not fall within the scope +of HDF5's UTF-8 capabilities; filenames are encoded at the system level. + +Linux and Mac OS systems normally handle UTF-8 encoded filenames correctly +while Windows systems generally do not. + +\section sec_unicode_text The *Plain Text* Illusion +Beware the use of the term *plain text*. *Plain text* is at best ambiguous, but often +misleading. Many will assume that *plain text* means ASCII, but plain text German or +French, for example, cannot be represented in ASCII. Plain text is only unambiguous +in the context of English (and even then can be problematic!). + +\subsection subsec_unicode_warn_store Storage Size +Programmers and data users accustomed to working strictly with ASCII data generally make +the reasonable assumption that 1 character, be it in an object name or in data, requires +1 byte of storage. This equation does not work when using UTF-8 or any other Unicode encoding. +With Unicode encoding, number of characters is not synonymous with number of bytes. One must +get used to thinking in terms of number of characters when talking about content, reserving +number of bytes for discussions of storage size. + +When working with Unicode text, one can no longer assume a 1:1 correspondence between the +number of characters and the data storage requirement. + +\subsection subsec_unicode_warn_sys System Dependencies +Linux, Unix, and similar systems generally handle UTF-8 encodings in correct and +predictable ways. There is an apparent consensus in the Linux community that "UTF-8 is just the right way to go." + +Mac OS systems generally handle UTF-8 encodings correctly. + +Windows systems use a different Unicode encoding, UCS-2 (discussed in this UTF-16 article) at +the system level. Within an HDF5 file and application on a Windows system, UTF-8 encoding should +work correctly and as expected. Problems may arise, however, when that UTF-8 encoding is exposed +directly to the Windows system. For example: +\li File open and close calls on files with UTF-8 encoded names are likely to fail as the HDF5 +open and close operations interact directly with the Windows file system interface. +\li Anytime an HDF5 command-line utility (\ref H5TOOL_LS_UG or \ref H5TOOL_DP_UG, for example) emits text output, the +Windows system must interpret the character encodings. If that output is UTF-8 encoded, Windows +will correctly interpret only those characters in the ASCII subset of UTF-8. + +\section sec_unicode_common Common Characters in UTF-8 and ASCII +One interesting feature of UTF-8 and ASCII is that the ASCII character set is a discrete subset of +the UTF-8 character set. And where they overlap, the encodings are identical. This means that a +character string consisting entirely of members of the ASCII character set can be encoded in either +ASCII or UTF-8, the two encodings will be indistinguishable, and the encodings will require exactly the same storage space. + + +\section sec_unicode_also See Also + +- For object and attribute names: + * #H5Pset_char_encoding + * #H5Pget_char_encoding +- For dataset and attribute datatypes: + * #H5Tset_cset + * #H5Tget_cset +- [UTF-8 article on Wikipedia](https://en.wikipedia.org/wiki/UTF-8) + +

NOTES

+1. UTF-8 is the only Unicode standard encoding supported in HDF5. + +*/ + /** \page VDS Introduction to the Virtual Dataset - VDS \section sec_vds_intro Introduction to VDS diff --git a/doxygen/dox/UsersGuide.dox b/doxygen/dox/UsersGuide.dox index f6e4680ccfa..03151473d2a 100644 --- a/doxygen/dox/UsersGuide.dox +++ b/doxygen/dox/UsersGuide.dox @@ -304,12 +304,54 @@
  • \ref subsubsec_vol_compat_opt +\ref sec_file_image +\li \ref subsec_file_image_intro +\li \ref subsec_file_image_api + +\li \ref subsec_file_image_semantics + +\li \ref subsec_file_image_example + +\li \ref subsec_file_image_java +\li \ref subsec_file_image_fort + + \ref sec_async \li \ref subsec_async_intro \ref sec_map \ref sec_cltools +\li \ref H5TOOL_CP_UG +\li \ref H5TOOL_DF_UG +\li \ref H5TOOL_DP_UG +\li \ref H5TOOL_FC_UG +\li \ref H5TOOL_IM_UG +\li \ref H5TOOL_JAM_UG +\li \ref H5TOOL_LS_UG +\li \ref H5TOOL_RP_UG +\li \ref H5TOOL_ST_UG +\li \ref H5TOOL_CR_UG +\li \ref H5TOOL_DG_UG +\li \ref H5TOOL_DT_UG +\li \ref H5TOOL_MG_UG +\li \ref H5TOOL_RT_UG +\li \ref H5TOOL_WH_UG + \ref sec_addition @@ -345,7 +387,7 @@ These documents provide additional information for the use and tuning of specifi -

    Using the Direct Chunk Write Function

    +

    @ref H5DO_UG

    Describes another way that chunks can be written to datasets.

    @@ -377,7 +419,7 @@ These documents provide additional information for the use and tuning of specifi -

    HDF5 File Image Operations

    +

    \ref H5FIM_UG

    Describes how to work with HDF5 files in memory. Disk I/O is not required when file images are opened, created, read from, or written to.

    diff --git a/doxygen/dox/ViewTools.dox b/doxygen/dox/ViewTools.dox index 43686751bfb..6bb000eb71b 100644 --- a/doxygen/dox/ViewTools.dox +++ b/doxygen/dox/ViewTools.dox @@ -303,6 +303,8 @@ GROUP "/" { } \endcode +\see H5TOOL_DP_UG for more information. + \subsection subsecViewToolsViewContent_h5ls h5ls The h5ls tool by default just displays the objects in the root group. It will not display items in groups beneath the root group unless specified. Useful h5ls options for viewing @@ -355,6 +357,8 @@ The output is shown below: /HDFEOS\ INFORMATION/StructMetadata.0 Dataset {SCALAR} \endcode +\see H5TOOL_LS_UG for more information. + \section secViewToolsViewDset Datasets and Dataset Properties Both h5dump and h5ls can be used to view specific datasets. * * The signature of the HDF5 filter function and the accompanying filter structure (see the section below) - * are described in the HDF5 Reference Manual #H5Z_filter_t. + * are described in the \ref RM #H5Z_filter_t. * * \subsubsection subsubsec_filter_plugins_prog_reg Registering a Filter with The HDF Group * If you are writing a filter that will be used by others, it would be a good idea to request a filter diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index b7eb4c78a75..6a65f3a269b 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -816,7 +816,7 @@ * * The in-memory file image feature of HDF5 uses property lists in a manner that differs * substantially from their use elsewhere in HDF5. Those who plan to use in-memory file images - * must study "File Image Operations" (PDF) in the Advanced Topics in HDF5collection. + * must study \ref H5FIM_UG. * * \subsection subsec_plist_notes Notes * diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 09dfac7c0cc..34e4d76181f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -3700,8 +3700,7 @@ H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, - * - * HDF5 File Image Operations. + * \ref H5FIM_UG. * * * \since 1.8.9 @@ -3740,8 +3739,7 @@ H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_l * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, - * - * HDF5 File Image Operations. + * \ref H5FIM_UG. * * \since 1.8.9 * @@ -4683,9 +4681,7 @@ H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); * \par Recommended Reading: * This function is part of the file image * operations feature set. It is highly recommended to study the guide - * [HDF5 File Image Operations] - * (https://\DOCURL/advanced_topics/file_image_ops.md - * ) before using this feature set. See the “See Also” section below + * \ref H5FIM_UG before using this feature set. See the “See Also” section below * for links to other elements of HDF5 file image operations. * * \see @@ -4695,10 +4691,7 @@ H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); * \li H5Pset_file_image_callbacks() * \li H5Pget_file_image_callbacks() * - * \li [HDF5 File Image Operations] - * (https://\DOCURL/advanced_topics/file_image_ops.md) - * in [Advanced Topics in HDF5] - * (https://\DOCURL/advanced_topics_list.md) + * \li \ref H5FIM_UG * * \li Within H5Pset_file_image_callbacks(): * \li Callback #H5FD_file_image_callbacks_t @@ -4720,9 +4713,7 @@ H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); * can then use the file without the overhead of disk I/O.\n * **Recommended Reading:** This function is part of the file * image operations feature set. It is highly recommended to study - * the guide [HDF5 File Image Operations] - * (https://\DOCURL/advanced_topics/file_image_ops.md - * ) before using this feature set. See the “See Also” section below + * the guide \ref H5FIM_UG before using this feature set. See the “See Also” section below * for links to other elements of HDF5 file image operations. * * \fapl_id diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h index 8c1dc467042..d8e01676d6f 100644 --- a/src/H5Zmodule.h +++ b/src/H5Zmodule.h @@ -96,31 +96,7 @@ * behavior. Each filter also has an optional ASCII comment * string. * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Values for #H5Z_filter_tDescription
    0-255These values are reserved for filters predefined and - * registered by the HDF5 library and of use to the general - * public.
    256-511Filter numbers in this range are used for testing only - * and can be used temporarily by any organization. No - * attempt is made to resolve numbering conflicts since all - * definitions are by nature temporary.
    512-65535Reserved for future assignment. Please contact the - * HDF5 development team - * to reserve a value or range of values for - * use by your filters.
    + * \snippet{doc} H5Zpublic.h FiltersIdTable * * Filter identifiers for the filters distributed with the HDF5 * Library are as follows: diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index c3927dc682e..06512f56435 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -14,16 +14,44 @@ #define H5Zpublic_H #include "H5public.h" /* Generic Functions */ - /** * \brief Filter identifiers * - * \details Values 0 through 255 are for filters defined by the HDF5 library. - * Values 256 through 511 are available for testing new filters. - * Subsequent values should be obtained from the HDF5 development team - * at mailto:help@hdfgroup.org. These values will never change because - * they appear in the HDF5 files. - */ + * [FiltersIdTable] + + + + + + + + + + + + + + + + + + + + +
    Values for #H5Z_filter_tDescription
    0-255These values are reserved for filters predefined and + registered by the HDF5 library and of use to the general public.
    256-511Filter values in this range are intended for testing only and can be + temporarily used by any organization. No attempts are made to resolve + numbering conflicts, as all definitions are temporary.
    512-32,767Filter values within this range are designated for filters managed by + The HDF Group, but they are nominally requested, developed, and supported + by third parties. Please contact the + HDF5 development team + to reserve a value or range of values for use by your filters.
    32,768-65,535Filter values in this range are designated for internal company use or + application testing when assessing a feature. The HDF Group does not + track or document the use of filters within this range. +
    + * [FiltersIdTable] +*/ + typedef int H5Z_filter_t; /* Filter IDs */ diff --git a/src/H5module.h b/src/H5module.h index c0fb5ad348a..35429b57a15 100644 --- a/src/H5module.h +++ b/src/H5module.h @@ -706,7 +706,7 @@ * \subsection subsec_program_model The HDF5 Programming Model * In this section we introduce the HDF5 programming model by means of a series of short code * samples. These samples illustrate a broad selection of common HDF5 tasks. More details are - * provided in the following chapters and in the HDF5 Reference Manual. + * provided in the following chapters and in the \ref RM. * * \subsubsection subsubsec_program_model_create Creating an HDF5 File * Before an HDF5 file can be used or referred to in any manner, it must be explicitly created or diff --git a/test/API/CMakeLists.txt b/test/API/CMakeLists.txt index 3813539d433..c953c865d88 100644 --- a/test/API/CMakeLists.txt +++ b/test/API/CMakeLists.txt @@ -403,10 +403,6 @@ if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) foreach (api_test_extra ${HDF5_API_TESTS_EXTRA}) if (TARGET ${api_test_extra}) - set_target_properties (${api_test_extra} - PROPERTIES - OUTPUT_NAME "h5_api_test_${api_test_extra}" - ) install ( TARGETS ${api_test_extra} EXPORT ${HDF5_EXPORTED_TARGETS} diff --git a/test/API/H5_api_async_test.c b/test/API/H5_api_async_test.c index 7646a24cac9..04b604f0761 100644 --- a/test/API/H5_api_async_test.c +++ b/test/API/H5_api_async_test.c @@ -12,40 +12,39 @@ #include "H5_api_async_test.h" -#ifdef H5ESpublic_H - -static int test_one_dataset_io(void); -static int test_multi_dataset_io(void); -static int test_multi_file_dataset_io(void); -static int test_multi_file_grp_dset_io(void); -static int test_set_extent(void); -static int test_attribute_exists(void); -static int test_attribute_io(void); -static int test_attribute_io_tconv(void); -static int test_attribute_io_compound(void); -static int test_group(void); -static int test_link(void); -static int test_ocopy_orefresh(void); -static int test_file_reopen(void); +static void print_async_test_header(const void *params); -/* - * The array of async tests to be performed. - */ -static int (*async_tests[])(void) = { - test_one_dataset_io, - test_multi_dataset_io, - test_multi_file_dataset_io, - test_multi_file_grp_dset_io, - test_set_extent, - test_attribute_exists, - test_attribute_io, - test_attribute_io_tconv, - test_attribute_io_compound, - test_group, - test_link, - test_ocopy_orefresh, - test_file_reopen, -}; +static void +print_async_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Async Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + +#ifndef H5_API_TEST_HAVE_ASYNC + printf("SKIPPED due to no async support\n"); +#endif +} + +#ifdef H5_API_TEST_HAVE_ASYNC + +static void test_one_dataset_io(const void *params); +static void test_multi_dataset_io(const void *params); +static void test_multi_file_dataset_io(const void *params); +static void test_multi_file_grp_dset_io(const void *params); +static void test_set_extent(const void *params); +static void test_attribute_exists(const void *params); +static void test_attribute_io(const void *params); +static void test_attribute_io_tconv(const void *params); +static void test_attribute_io_compound(const void *params); +static void test_group(const void *params); +static void test_link(const void *params); +static void test_ocopy_orefresh(const void *params); +static void test_file_reopen(const void *params); +static void test_file_cleanup(const void *params); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -53,8 +52,8 @@ int max_printf_file = -1; /* * Create file and dataset, write to dataset */ -static int -test_one_dataset_io(void) +static void +test_one_dataset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -70,11 +69,12 @@ test_one_dataset_io(void) TESTING_MULTIPART("single dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -300,7 +300,7 @@ test_one_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -313,14 +313,14 @@ test_one_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_one_dataset_io() */ /* * Create file and multiple datasets, write to them and read from them */ -static int -test_multi_dataset_io(void) +static void +test_multi_dataset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID}; @@ -337,11 +337,12 @@ test_multi_dataset_io(void) TESTING_MULTIPART("multi dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -552,7 +553,7 @@ test_multi_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -566,15 +567,15 @@ test_multi_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_dataset_io() */ /* * Create multiple files, each with a single dataset, write to them and read * from them */ -static int -test_multi_file_dataset_io(void) +static void +test_multi_file_dataset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID}; hid_t dset_id[5] = {H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID, H5I_INVALID_HID}; @@ -591,11 +592,12 @@ test_multi_file_dataset_io(void) TESTING_MULTIPART("multi file dataset I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, dataset, or flush aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -860,7 +862,7 @@ test_multi_file_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -875,15 +877,15 @@ test_multi_file_dataset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_file_dataset_io() */ /* * Create multiple files, each with a single group and dataset, write to them * and read from them */ -static int -test_multi_file_grp_dset_io(void) +static void +test_multi_file_grp_dset_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t grp_id = H5I_INVALID_HID; @@ -901,11 +903,11 @@ test_multi_file_grp_dset_io(void) TESTING_MULTIPART("multi file dataset I/O with groups"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1170,7 +1172,7 @@ test_multi_file_grp_dset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1184,14 +1186,14 @@ test_multi_file_grp_dset_io(void) } H5E_END_TRY - return 1; + return; } /* end test_multi_file_grp_dset_io() */ /* * Create file and dataset, write to dataset */ -static int -test_set_extent(void) +static void +test_set_extent(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1217,12 +1219,13 @@ test_set_extent(void) TESTING("H5Dset_extent() and H5Dget_space()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, or flush aren't supported with " "this connector\n"); - return 0; + return; } /* Create file dataspace */ @@ -1380,7 +1383,7 @@ test_set_extent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1398,14 +1401,14 @@ test_set_extent(void) } H5E_END_TRY - return 1; + return; } /* end test_set_extent() */ /* * Test H5Aexists() */ -static int -test_attribute_exists(void) +static void +test_attribute_exists(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1421,12 +1424,13 @@ test_attribute_exists(void) TESTING("H5Aexists()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1504,7 +1508,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1518,14 +1522,14 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io() */ /* * Create file, dataset, and attribute, write to attribute */ -static int -test_attribute_io(void) +static void +test_attribute_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -1542,12 +1546,13 @@ test_attribute_io(void) TESTING("attribute I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1647,7 +1652,7 @@ test_attribute_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1661,14 +1666,14 @@ test_attribute_io(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io() */ /* * Create file, dataset, and attribute, write to attribute with type conversion */ -static int -test_attribute_io_tconv(void) +static void +test_attribute_io_tconv(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t attr_id = H5I_INVALID_HID; @@ -1684,12 +1689,12 @@ test_attribute_io_tconv(void) TESTING("attribute I/O with type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf( " API functions for basic file, attribute, or flush aren't supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -1783,7 +1788,7 @@ test_attribute_io_tconv(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1796,7 +1801,7 @@ test_attribute_io_tconv(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io_tconv() */ /* @@ -1808,8 +1813,8 @@ typedef struct tattr_cmpd_t { int b; } tattr_cmpd_t; -static int -test_attribute_io_compound(void) +static void +test_attribute_io_compound(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t attr_id = H5I_INVALID_HID; @@ -1830,12 +1835,12 @@ test_attribute_io_compound(void) TESTING("attribute I/O with compound type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf( " API functions for basic file, attribute, or flush aren't supported with this connector\n"); - return 0; + return; } /* Create datatype */ @@ -2095,7 +2100,7 @@ test_attribute_io_compound(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2112,14 +2117,14 @@ test_attribute_io_compound(void) } H5E_END_TRY - return 1; + return; } /* end test_attribute_io_compound() */ /* * Test group interfaces */ -static int -test_group(void) +static void +test_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2136,12 +2141,13 @@ test_group(void) TESTING("group operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, group, or group more aren't supported " "with this connector\n"); - return 0; + return; } /* Create GCPL */ @@ -2264,7 +2270,7 @@ test_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2279,14 +2285,14 @@ test_group(void) } H5E_END_TRY - return 1; + return; } /* end test_group() */ /* * Test link interfaces */ -static int -test_link(void) +static void +test_link(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2305,14 +2311,14 @@ test_link(void) TESTING("link operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { SKIPPED(); printf(" API functions for basic file, link, hard link, soft link, flush, or creation order " "aren't supported with this connector\n"); - return 0; + return; } /* Create GCPL */ @@ -2462,7 +2468,7 @@ test_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2476,14 +2482,14 @@ test_link(void) } H5E_END_TRY - return 1; + return; } /* end test_link() */ /* * Test H5Ocopy() and H5Orefresh() */ -static int -test_ocopy_orefresh(void) +static void +test_ocopy_orefresh(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID; @@ -2497,13 +2503,13 @@ test_ocopy_orefresh(void) TESTING("H5Ocopy() and H5Orefresh()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for basic file, group, dataset, object more, flush, or refresh aren't " "supported with this connector\n"); - return 0; + return; } /* Create dataspace */ @@ -2578,7 +2584,7 @@ test_ocopy_orefresh(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2591,14 +2597,14 @@ test_ocopy_orefresh(void) } H5E_END_TRY - return 1; + return; } /* end test_ocopy_orefresh() */ /* * Test H5Freopen() */ -static int -test_file_reopen(void) +static void +test_file_reopen(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t reopened_file_id = H5I_INVALID_HID; @@ -2609,10 +2615,11 @@ test_file_reopen(void) TESTING("H5Freopen()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { SKIPPED(); printf(" API functions for basic file or file more aren't supported with this connector\n"); - return 0; + return; } /* Create event stack */ @@ -2650,7 +2657,7 @@ test_file_reopen(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2662,14 +2669,14 @@ test_file_reopen(void) } H5E_END_TRY - return 1; + return; } /* end test_file_reopen() */ /* * Cleanup temporary test files */ static void -cleanup_files(void) +test_file_cleanup(const void H5_ATTR_UNUSED *params) { char file_name[64]; int i; @@ -2679,54 +2686,46 @@ cleanup_files(void) for (i = 0; i <= max_printf_file; i++) { snprintf(file_name, sizeof(file_name), ASYNC_API_TEST_FILE_PRINTF, i); remove_test_file(NULL, file_name); - } /* end for */ + } } -int -H5_api_async_test(void) +void +H5_api_async_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC)) { - SKIPPED(); - printf(" Async APIs aren't supported with this connector\n"); - return 0; - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(async_tests); i++) { - nerrors += (*async_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); + + AddTest("test_one_dataset_io", test_one_dataset_io, NULL, NULL, NULL, 0, "single dataset I/O"); + AddTest("test_multi_dataset_io", test_multi_dataset_io, NULL, NULL, NULL, 0, "multi dataset I/O"); + AddTest("test_multi_file_dataset_io", test_multi_file_dataset_io, NULL, NULL, NULL, 0, + "multi file dataset I/O"); + AddTest("test_multi_file_grp_dset_io", test_multi_file_grp_dset_io, NULL, NULL, NULL, 0, + "multi file dataset I/O with groups"); + AddTest("test_set_extent", test_set_extent, NULL, NULL, NULL, 0, "H5Dset_extent() and H5Dget_space()"); + AddTest("test_attribute_exists", test_attribute_exists, NULL, NULL, NULL, 0, "H5Aexists()"); + AddTest("test_attribute_io", test_attribute_io, NULL, NULL, NULL, 0, "attribute I/O"); + AddTest("test_attribute_io_tconv", test_attribute_io_tconv, NULL, NULL, NULL, 0, + "attribute I/O with type conversion"); + AddTest("test_attribute_io_compound", test_attribute_io_compound, NULL, NULL, NULL, 0, + "attribute I/O with compound type conversion"); + AddTest("test_group", test_group, NULL, NULL, NULL, 0, "group operations"); + AddTest("test_link", test_link, NULL, NULL, NULL, 0, "link operations"); + AddTest("test_ocopy_orefresh", test_ocopy_orefresh, NULL, NULL, NULL, 0, "H5Ocopy() and H5Orefresh()"); + AddTest("test_file_reopen", test_file_reopen, NULL, NULL, NULL, 0, "H5Freopen()"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_file_cleanup", test_file_cleanup, NULL, NULL, NULL, 0, "cleanup test files"); } -#else /* H5ESpublic_H */ +#else /* H5_API_TEST_HAVE_ASYNC */ -int -H5_api_async_test(void) +void +H5_api_async_test_add(void) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - printf("SKIPPED due to no async support in HDF5 library\n"); - - return 0; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); } -#endif /* H5ESpublic_H */ +#endif /* H5_API_TEST_HAVE_ASYNC */ diff --git a/test/API/H5_api_async_test.h b/test/API/H5_api_async_test.h index f3139f8ba37..99571efa1a5 100644 --- a/test/API/H5_api_async_test.h +++ b/test/API/H5_api_async_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_async_test(void); +void H5_api_async_test_add(void); /************************************************ * * diff --git a/test/API/H5_api_attribute_test.c b/test/API/H5_api_attribute_test.c index 0e5aee07648..d508889ae31 100644 --- a/test/API/H5_api_attribute_test.c +++ b/test/API/H5_api_attribute_test.c @@ -20,104 +20,71 @@ * order value gets reset when all attributes are removed. */ -static int test_create_attribute_on_root(void); -static int test_create_attribute_on_dataset(void); -static int test_create_attribute_on_datatype(void); -static int test_create_attribute_with_null_space(void); -static int test_create_attribute_with_scalar_space(void); -static int test_create_attribute_with_space_in_name(void); -static int test_create_attribute_invalid_params(void); -static int test_open_attribute(void); -static int test_open_attribute_invalid_params(void); -static int test_write_attribute(void); -static int test_write_attribute_invalid_params(void); -static int test_read_attribute(void); -static int test_read_attribute_invalid_params(void); -static int test_read_empty_attribute(void); -static int test_close_attribute_invalid_id(void); -static int test_get_attribute_space_and_type(void); -static int test_get_attribute_space_and_type_invalid_params(void); -static int test_attribute_property_lists(void); -static int test_get_attribute_name(void); -static int test_get_attribute_name_invalid_params(void); -static int test_get_attribute_storage_size(void); -static int test_get_attribute_info(void); -static int test_get_attribute_info_invalid_params(void); -static int test_rename_attribute(void); -static int test_rename_attribute_invalid_params(void); -static int test_attribute_iterate_group(void); -static int test_attribute_iterate_dataset(void); -static int test_attribute_iterate_datatype(void); -static int test_attribute_iterate_index_saving(void); -static int test_attribute_iterate_invalid_params(void); -static int test_attribute_iterate_0_attributes(void); -static int test_attribute_compound_subset(void); -static int test_attribute_string_encodings(void); -static int test_delete_attribute(void); -static int test_delete_attribute_invalid_params(void); -static int test_attribute_exists(void); -static int test_attribute_exists_invalid_params(void); -static int test_attribute_many(void); -static int test_attribute_duplicate_id(void); -static int test_get_number_attributes(void); -static int test_attr_shared_dtype(void); +static void print_attribute_test_header(const void *params); +static void test_create_attribute_on_root(const void *params); +static void test_create_attribute_on_dataset(const void *params); +static void test_create_attribute_on_datatype(const void *params); +static void test_create_attribute_with_null_space(const void *params); +static void test_create_attribute_with_scalar_space(const void *params); +static void test_create_attribute_with_space_in_name(const void *params); +static void test_create_attribute_invalid_params(const void *params); +static void test_open_attribute(const void *params); +static void test_open_attribute_invalid_params(const void *params); +static void test_write_attribute(const void *params); +static void test_write_attribute_invalid_params(const void *params); +static void test_read_attribute(const void *params); +static void test_read_attribute_invalid_params(const void *params); +static void test_read_empty_attribute(const void *params); +static void test_close_attribute_invalid_id(const void *params); +static void test_get_attribute_space_and_type(const void *params); +static void test_get_attribute_space_and_type_invalid_params(const void *params); +static void test_attribute_property_lists(const void *params); +static void test_get_attribute_name(const void *params); +static void test_get_attribute_name_invalid_params(const void *params); +static void test_get_attribute_storage_size(const void *params); +static void test_get_attribute_info(const void *params); +static void test_get_attribute_info_invalid_params(const void *params); +static void test_rename_attribute(const void *params); +static void test_rename_attribute_invalid_params(const void *params); +static void test_attribute_iterate_group(const void *params); +static void test_attribute_iterate_dataset(const void *params); +static void test_attribute_iterate_datatype(const void *params); +static void test_attribute_iterate_index_saving(const void *params); +static void test_attribute_iterate_invalid_params(const void *params); +static void test_attribute_iterate_0_attributes(const void *params); +static void test_attribute_compound_subset(const void *params); +static void test_attribute_string_encodings(const void *params); +static void test_delete_attribute(const void *params); +static void test_delete_attribute_invalid_params(const void *params); +static void test_attribute_exists(const void *params); +static void test_attribute_exists_invalid_params(const void *params); +static void test_attribute_many(const void *params); +static void test_attribute_duplicate_id(const void *params); +static void test_get_number_attributes(const void *params); +static void test_attr_shared_dtype(const void *params); static herr_t attr_iter_callback1(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); static herr_t attr_iter_callback2(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); -/* - * The array of attribute tests to be performed. - */ -static int (*attribute_tests[])(void) = {test_create_attribute_on_root, - test_create_attribute_on_dataset, - test_create_attribute_on_datatype, - test_create_attribute_with_null_space, - test_create_attribute_with_scalar_space, - test_create_attribute_with_space_in_name, - test_create_attribute_invalid_params, - test_open_attribute, - test_open_attribute_invalid_params, - test_write_attribute, - test_write_attribute_invalid_params, - test_read_attribute, - test_read_attribute_invalid_params, - test_read_empty_attribute, - test_close_attribute_invalid_id, - test_get_attribute_space_and_type, - test_get_attribute_space_and_type_invalid_params, - test_attribute_property_lists, - test_get_attribute_name, - test_get_attribute_name_invalid_params, - test_get_attribute_storage_size, - test_get_attribute_info, - test_get_attribute_info_invalid_params, - test_rename_attribute, - test_rename_attribute_invalid_params, - test_attribute_iterate_group, - test_attribute_iterate_dataset, - test_attribute_iterate_datatype, - test_attribute_iterate_index_saving, - test_attribute_iterate_invalid_params, - test_attribute_iterate_0_attributes, - test_attribute_compound_subset, - test_attribute_string_encodings, - test_delete_attribute, - test_delete_attribute_invalid_params, - test_attribute_exists, - test_attribute_exists_invalid_params, - test_attribute_duplicate_id, - test_attribute_many, - test_get_number_attributes, - test_attr_shared_dtype}; +static void +print_attribute_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Attribute Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that an attribute can be created on * the root group. */ -static int -test_create_attribute_on_root(void) +static void +test_create_attribute_on_root(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -131,7 +98,7 @@ test_create_attribute_on_root(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -232,7 +199,7 @@ test_create_attribute_on_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -246,15 +213,15 @@ test_create_attribute_on_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created on * a dataset. */ -static int -test_create_attribute_on_dataset(void) +static void +test_create_attribute_on_dataset(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -275,7 +242,7 @@ test_create_attribute_on_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or attribute aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -412,7 +379,7 @@ test_create_attribute_on_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -431,15 +398,15 @@ test_create_attribute_on_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created on * a committed datatype. */ -static int -test_create_attribute_on_datatype(void) +static void +test_create_attribute_on_datatype(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -459,7 +426,7 @@ test_create_attribute_on_datatype(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -589,7 +556,7 @@ test_create_attribute_on_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -606,15 +573,15 @@ test_create_attribute_on_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating an attribute with a * NULL dataspace is not problematic. */ -static int -test_create_attribute_with_null_space(void) +static void +test_create_attribute_with_null_space(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -631,7 +598,7 @@ test_create_attribute_with_null_space(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -703,7 +670,7 @@ test_create_attribute_with_null_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -717,15 +684,15 @@ test_create_attribute_with_null_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating an attribute with a * scalar dataspace is not problematic. */ -static int -test_create_attribute_with_scalar_space(void) +static void +test_create_attribute_with_scalar_space(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -742,7 +709,7 @@ test_create_attribute_with_scalar_space(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -814,7 +781,7 @@ test_create_attribute_with_scalar_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -828,15 +795,15 @@ test_create_attribute_with_scalar_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a space in an attribute's name * is not problematic. */ -static int -test_create_attribute_with_space_in_name(void) +static void +test_create_attribute_with_space_in_name(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -855,7 +822,7 @@ test_create_attribute_with_space_in_name(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -919,7 +886,7 @@ test_create_attribute_with_space_in_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -934,15 +901,15 @@ test_create_attribute_with_space_in_name(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be created when * H5Acreate is passed invalid parameters. */ -static int -test_create_attribute_invalid_params(void) +static void +test_create_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -958,7 +925,7 @@ test_create_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1364,7 +1331,7 @@ test_create_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1378,14 +1345,14 @@ test_create_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aopen(_by_idx). */ -static int -test_open_attribute(void) +static void +test_open_attribute(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1402,7 +1369,7 @@ test_open_attribute(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1766,7 +1733,7 @@ test_open_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1781,15 +1748,15 @@ test_open_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be opened when * H5Aopen(_by_name/_by_idx) is passed invalid parameters. */ -static int -test_open_attribute_invalid_params(void) +static void +test_open_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1805,7 +1772,7 @@ test_open_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2282,7 +2249,7 @@ test_open_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2296,15 +2263,15 @@ test_open_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a simple write to an attribute * can be made. */ -static int -test_write_attribute(void) +static void +test_write_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_WRITE_TEST_SPACE_RANK]; size_t i, data_size; @@ -2324,7 +2291,7 @@ test_write_attribute(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or file flush aren't supported with " "this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2410,7 +2377,7 @@ test_write_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2425,15 +2392,15 @@ test_write_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that writing an attribute fails when * H5Awrite is passed invalid parameters. */ -static int -test_write_attribute_invalid_params(void) +static void +test_write_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_WRITE_INVALID_PARAMS_TEST_SPACE_RANK]; size_t i, data_size; @@ -2454,7 +2421,7 @@ test_write_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2599,7 +2566,7 @@ test_write_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2614,7 +2581,7 @@ test_write_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -2622,8 +2589,8 @@ test_write_attribute_invalid_params(void) * and verified after it has been written to an * attribute. */ -static int -test_read_attribute(void) +static void +test_read_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_TEST_SPACE_RANK]; size_t i, data_size; @@ -2644,7 +2611,7 @@ test_read_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2753,7 +2720,7 @@ test_read_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2770,15 +2737,15 @@ test_read_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that reading an attribute fails when * H5Aread is passed invalid parameters. */ -static int -test_read_attribute_invalid_params(void) +static void +test_read_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_INVALID_PARAMS_TEST_SPACE_RANK]; size_t i, data_size; @@ -2800,7 +2767,7 @@ test_read_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2967,7 +2934,7 @@ test_read_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2984,14 +2951,14 @@ test_read_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * Test reading an empty attribute is ok */ -static int -test_read_empty_attribute(void) +static void +test_read_empty_attribute(const void H5_ATTR_UNUSED *params) { hsize_t dims[ATTRIBUTE_READ_EMPTY_SPACE_RANK]; size_t i, data_size; @@ -3011,7 +2978,7 @@ test_read_empty_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3096,7 +3063,7 @@ test_read_empty_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3111,14 +3078,14 @@ test_read_empty_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Aclose fails when it is passed * an invalid attribute ID. */ -static int -test_close_attribute_invalid_id(void) +static void +test_close_attribute_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -3129,7 +3096,7 @@ test_close_attribute_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { SKIPPED(); printf(" API functions for basic file or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3155,7 +3122,7 @@ test_close_attribute_invalid_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3164,7 +3131,7 @@ test_close_attribute_invalid_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -3172,8 +3139,8 @@ test_close_attribute_invalid_id(void) * dataspace and datatype can be retrieved with * H5Aget_space and H5Aget_type, respectively. */ -static int -test_get_attribute_space_and_type(void) +static void +test_get_attribute_space_and_type(const void H5_ATTR_UNUSED *params) { hsize_t attr_dims[ATTRIBUTE_GET_SPACE_TYPE_TEST_SPACE_RANK]; size_t i; @@ -3195,7 +3162,7 @@ test_get_attribute_space_and_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or attribute aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3453,7 +3420,7 @@ test_get_attribute_space_and_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3469,7 +3436,7 @@ test_get_attribute_space_and_type(void) } H5E_END_TRY - return 1; + return; } /* @@ -3477,8 +3444,8 @@ test_get_attribute_space_and_type(void) * can't be retrieved when H5Aget_space and H5Aget_type are passed * invalid parameters, respectively. */ -static int -test_get_attribute_space_and_type_invalid_params(void) +static void +test_get_attribute_space_and_type_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -3498,7 +3465,7 @@ test_get_attribute_space_and_type_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3614,7 +3581,7 @@ test_get_attribute_space_and_type_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3630,7 +3597,7 @@ test_get_attribute_space_and_type_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -3638,8 +3605,8 @@ test_get_attribute_space_and_type_invalid_params(void) * can be persisted and that a valid copy of that ACPL can * be retrieved later with a call to H5Aget_create_plist. */ -static int -test_attribute_property_lists(void) +static void +test_attribute_property_lists(const void H5_ATTR_UNUSED *params) { H5T_cset_t encoding = H5T_CSET_UTF8; htri_t attr_exists; @@ -3658,7 +3625,7 @@ test_attribute_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3897,7 +3864,7 @@ test_attribute_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3915,7 +3882,7 @@ test_attribute_property_lists(void) } H5E_END_TRY - return 1; + return; } /* @@ -3923,8 +3890,8 @@ test_attribute_property_lists(void) * correctly retrieved with H5Aget_name and * H5Aget_name_by_idx. */ -static int -test_get_attribute_name(void) +static void +test_get_attribute_name(const void H5_ATTR_UNUSED *params) { ssize_t name_buf_size; htri_t attr_exists; @@ -3945,7 +3912,7 @@ test_get_attribute_name(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4395,7 +4362,7 @@ test_get_attribute_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4412,7 +4379,7 @@ test_get_attribute_name(void) } H5E_END_TRY - return 1; + return; } /* @@ -4420,8 +4387,8 @@ test_get_attribute_name(void) * retrieved when H5Aget_name(_by_idx) is passed invalid * parameters. */ -static int -test_get_attribute_name_invalid_params(void) +static void +test_get_attribute_name_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t name_buf_size; htri_t attr_exists; @@ -4441,7 +4408,7 @@ test_get_attribute_name_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4754,7 +4721,7 @@ test_get_attribute_name_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4770,27 +4737,27 @@ test_get_attribute_name_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aget_storage_size. */ -static int -test_get_attribute_storage_size(void) +static void +test_get_attribute_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Aget_storage_size"); SKIPPED(); - return 0; + return; } /* * A test to check the functionality of H5Aget_info(_by_idx). */ -static int -test_get_attribute_info(void) +static void +test_get_attribute_info(const void H5_ATTR_UNUSED *params) { H5A_info_t attr_info; htri_t attr_exists; @@ -4810,7 +4777,7 @@ test_get_attribute_info(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5415,7 +5382,7 @@ test_get_attribute_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5430,15 +5397,15 @@ test_get_attribute_info(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Aget_info(_by_name/_by_idx) * doesn't succeed when passed invalid parameters. */ -static int -test_get_attribute_info_invalid_params(void) +static void +test_get_attribute_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5A_info_t attr_info; htri_t attr_exists; @@ -5458,7 +5425,7 @@ test_get_attribute_info_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5878,7 +5845,7 @@ test_get_attribute_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5892,15 +5859,15 @@ test_get_attribute_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be renamed * with H5Arename and H5Arename_by_name. */ -static int -test_rename_attribute(void) +static void +test_rename_attribute(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -5918,7 +5885,7 @@ test_rename_attribute(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6094,7 +6061,7 @@ test_rename_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6109,15 +6076,15 @@ test_rename_attribute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can't be renamed * when H5Arename(_by_name) is passed invalid parameters. */ -static int -test_rename_attribute_invalid_params(void) +static void +test_rename_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; herr_t err_ret = -1; @@ -6136,7 +6103,7 @@ test_rename_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6463,7 +6430,7 @@ test_rename_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6478,7 +6445,7 @@ test_rename_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -6488,8 +6455,8 @@ test_rename_attribute_invalid_params(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_group(void) +static void +test_attribute_iterate_group(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -6509,7 +6476,7 @@ test_attribute_iterate_group(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6855,7 +6822,7 @@ test_attribute_iterate_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6870,7 +6837,7 @@ test_attribute_iterate_group(void) } H5E_END_TRY - return 1; + return; } /* @@ -6880,8 +6847,8 @@ test_attribute_iterate_group(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_dataset(void) +static void +test_attribute_iterate_dataset(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -6905,7 +6872,7 @@ test_attribute_iterate_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7276,7 +7243,7 @@ test_attribute_iterate_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7294,7 +7261,7 @@ test_attribute_iterate_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -7304,8 +7271,8 @@ test_attribute_iterate_dataset(void) * decreasing order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_datatype(void) +static void +test_attribute_iterate_datatype(const void H5_ATTR_UNUSED *params) { size_t link_counter; size_t i; @@ -7327,7 +7294,7 @@ test_attribute_iterate_datatype(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7693,7 +7660,7 @@ test_attribute_iterate_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7709,7 +7676,7 @@ test_attribute_iterate_datatype(void) } H5E_END_TRY - return 1; + return; } /* @@ -7719,14 +7686,14 @@ test_attribute_iterate_datatype(void) * order of both attribute name and attribute * creation order. */ -static int -test_attribute_iterate_index_saving(void) +static void +test_attribute_iterate_index_saving(const void H5_ATTR_UNUSED *params) { TESTING("attribute iteration index saving capability"); SKIPPED(); - return 1; + return; } /* @@ -7734,8 +7701,8 @@ test_attribute_iterate_index_saving(void) * be iterated over when H5Aiterate(_by_name) is * passed invalid parameters. */ -static int -test_attribute_iterate_invalid_params(void) +static void +test_attribute_iterate_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -7754,7 +7721,7 @@ test_attribute_iterate_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or iterate aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8130,7 +8097,7 @@ test_attribute_iterate_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8147,7 +8114,7 @@ test_attribute_iterate_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -8155,8 +8122,8 @@ test_attribute_iterate_invalid_params(void) * on an object with no attributes attached to it is * not problematic. */ -static int -test_attribute_iterate_0_attributes(void) +static void +test_attribute_iterate_0_attributes(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -8173,7 +8140,7 @@ test_attribute_iterate_0_attributes(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8320,7 +8287,7 @@ test_attribute_iterate_0_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8334,7 +8301,7 @@ test_attribute_iterate_0_attributes(void) } H5E_END_TRY - return 1; + return; } /* A compound type for test_attribute_compound_subset */ @@ -8347,8 +8314,8 @@ typedef struct attribute_compound_io_t { * A test to ensure that data is read back correctly from a attribute after it has * been written, using subsets of compound datatypes */ -static int -test_attribute_compound_subset(void) +static void +test_attribute_compound_subset(const void H5_ATTR_UNUSED *params) { hsize_t dims[1] = {ATTRIBUTE_COMPOUND_IO_ATTR_DIMS}; size_t i; @@ -8373,7 +8340,7 @@ test_attribute_compound_subset(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8581,7 +8548,7 @@ test_attribute_compound_subset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8597,15 +8564,15 @@ test_attribute_compound_subset(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that attributes preserve data * correctness for strings with ASCII or UTF-8 char sets */ -static int -test_attribute_string_encodings(void) +static void +test_attribute_string_encodings(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -8630,7 +8597,7 @@ test_attribute_string_encodings(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8841,7 +8808,7 @@ test_attribute_string_encodings(void) free(read_buf); PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8861,15 +8828,15 @@ test_attribute_string_encodings(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that an attribute can be deleted * using H5Adelete(_by_idx). */ -static int -test_delete_attribute(void) +static void +test_delete_attribute(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -8888,7 +8855,7 @@ test_delete_attribute(void) SKIPPED(); printf(" API functions for basic file, group, or attribute aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10078,7 +10045,7 @@ test_delete_attribute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10093,7 +10060,7 @@ test_delete_attribute(void) } H5E_END_TRY - return 1; + return; } /* @@ -10101,8 +10068,8 @@ test_delete_attribute(void) * when H5Adelete(_by_name/_by_idx) is passed invalid * parameters. */ -static int -test_delete_attribute_invalid_params(void) +static void +test_delete_attribute_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -10121,7 +10088,7 @@ test_delete_attribute_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10499,7 +10466,7 @@ test_delete_attribute_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10513,14 +10480,14 @@ test_delete_attribute_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Aexists and H5Aexists_by_name. */ -static int -test_attribute_exists(void) +static void +test_attribute_exists(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -10538,7 +10505,7 @@ test_attribute_exists(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10639,7 +10606,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10653,15 +10620,15 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that H5Aexists(_by_name) will fail when * given invalid parameters. */ -static int -test_attribute_exists_invalid_params(void) +static void +test_attribute_exists_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t attr_exists; @@ -10680,7 +10647,7 @@ test_attribute_exists_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10916,7 +10883,7 @@ test_attribute_exists_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10930,15 +10897,15 @@ test_attribute_exists_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to make sure many attributes can be written * to the file */ -static int -test_attribute_many(void) +static void +test_attribute_many(const void H5_ATTR_UNUSED *params) { unsigned u; htri_t attr_exists; @@ -10958,7 +10925,7 @@ test_attribute_many(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11026,7 +10993,7 @@ test_attribute_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11040,15 +11007,15 @@ test_attribute_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to make sure an attribute can be opened for * a second time */ -static int -test_attribute_duplicate_id(void) +static void +test_attribute_duplicate_id(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -11066,7 +11033,7 @@ test_attribute_duplicate_id(void) SKIPPED(); printf( " API functions for basic file, group, or attribute aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11138,7 +11105,7 @@ test_attribute_duplicate_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11153,7 +11120,7 @@ test_attribute_duplicate_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -11162,8 +11129,8 @@ test_attribute_duplicate_id(void) * * XXX: Cover all of the cases and move to H5O tests. */ -static int -test_get_number_attributes(void) +static void +test_get_number_attributes(const void H5_ATTR_UNUSED *params) { H5O_info2_t obj_info; htri_t attr_exists; @@ -11182,7 +11149,7 @@ test_get_number_attributes(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or object aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11318,7 +11285,7 @@ test_get_number_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11332,7 +11299,7 @@ test_get_number_attributes(void) } H5E_END_TRY - return 1; + return; } /* @@ -11341,8 +11308,8 @@ test_get_number_attributes(void) * * XXX: May move to H5O tests. */ -static int -test_attr_shared_dtype(void) +static void +test_attr_shared_dtype(const void H5_ATTR_UNUSED *params) { H5O_info2_t obj_info; htri_t attr_exists; @@ -11364,7 +11331,7 @@ test_attr_shared_dtype(void) SKIPPED(); printf(" API functions for basic file, group, attribute, stored datatype, or object aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11479,7 +11446,7 @@ test_attr_shared_dtype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11492,7 +11459,7 @@ test_attr_shared_dtype(void) } H5E_END_TRY - return 1; + return; } static herr_t @@ -11581,26 +11548,90 @@ attr_iter_callback2(hid_t location_id, const char *attr_name, const H5A_info_t * UNUSED(ainfo); UNUSED(op_data); - return 0; + return H5_ITER_CONT; } -int -H5_api_attribute_test(void) +void +H5_api_attribute_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Attribute Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(attribute_tests); i++) { - nerrors += (*attribute_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_attribute_test_header", print_attribute_test_header, NULL, NULL, NULL, 0, + "Prints header for attribute tests"); + + AddTest("test_create_attribute_on_root", test_create_attribute_on_root, NULL, NULL, NULL, 0, + "attribute creation on the root group"); + AddTest("test_create_attribute_on_dataset", test_create_attribute_on_dataset, NULL, NULL, NULL, 0, + "attribute creation on a dataset"); + AddTest("test_create_attribute_on_datatype", test_create_attribute_on_datatype, NULL, NULL, NULL, 0, + "attribute creation on a committed datatype"); + AddTest("test_create_attribute_with_null_space", test_create_attribute_with_null_space, NULL, NULL, NULL, + 0, "attribute creation with a NULL dataspace"); + AddTest("test_create_attribute_with_scalar_space", test_create_attribute_with_scalar_space, NULL, NULL, + NULL, 0, "attribute creation with a SCALAR dataspace"); + AddTest("test_create_attribute_with_space_in_name", test_create_attribute_with_space_in_name, NULL, NULL, + NULL, 0, "attribute creation with a space in attribute's name"); + AddTest("test_create_attribute_invalid_params", test_create_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute creation with invalid parameters"); + AddTest("test_open_attribute", test_open_attribute, NULL, NULL, NULL, 0, "attribute opening"); + AddTest("test_open_attribute_invalid_params", test_open_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute opening with invalid parameters"); + AddTest("test_write_attribute", test_write_attribute, NULL, NULL, NULL, 0, "H5Awrite"); + AddTest("test_write_attribute_invalid_params", test_write_attribute_invalid_params, NULL, NULL, NULL, 0, + "H5Awrite with invalid parameters"); + AddTest("test_read_attribute", test_read_attribute, NULL, NULL, NULL, 0, "H5Aread"); + AddTest("test_read_attribute_invalid_params", test_read_attribute_invalid_params, NULL, NULL, NULL, 0, + "H5Aread with invalid parameters"); + AddTest("test_read_empty_attribute", test_read_empty_attribute, NULL, NULL, NULL, 0, + "reading an empty attribute"); + AddTest("test_close_attribute_invalid_id", test_close_attribute_invalid_id, NULL, NULL, NULL, 0, + "H5Aclose with an invalid attribute ID"); + AddTest("test_get_attribute_space_and_type", test_get_attribute_space_and_type, NULL, NULL, NULL, 0, + "retrieval of an attribute's dataspace and datatype"); + AddTest("test_get_attribute_space_and_type_invalid_params", + test_get_attribute_space_and_type_invalid_params, NULL, NULL, NULL, 0, + "H5Aget_type/H5Aget_space with invalid parameters"); + AddTest("test_attribute_property_lists", test_attribute_property_lists, NULL, NULL, NULL, 0, + "attribute property list operations"); + AddTest("test_get_attribute_name", test_get_attribute_name, NULL, NULL, NULL, 0, + "retrieval of an attribute's name"); + AddTest("test_get_attribute_name_invalid_params", test_get_attribute_name_invalid_params, NULL, NULL, + NULL, 0, "retrieval of an attribute's name with invalid parameters"); + AddTest("test_get_attribute_storage_size", test_get_attribute_storage_size, NULL, NULL, NULL, 0, + "H5Aget_storage_size"); + AddTest("test_get_attribute_info", test_get_attribute_info, NULL, NULL, NULL, 0, + "retrieval of attribute info"); + AddTest("test_get_attribute_info_invalid_params", test_get_attribute_info_invalid_params, NULL, NULL, + NULL, 0, "retrieval of attribute info with invalid parameters"); + AddTest("test_rename_attribute", test_rename_attribute, NULL, NULL, NULL, 0, "attribute renaming"); + AddTest("test_rename_attribute_invalid_params", test_rename_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute renaming with invalid parameters"); + AddTest("test_attribute_iterate_group", test_attribute_iterate_group, NULL, NULL, NULL, 0, + "attribute iteration on a group"); + AddTest("test_attribute_iterate_dataset", test_attribute_iterate_dataset, NULL, NULL, NULL, 0, + "attribute iteration on a dataset"); + AddTest("test_attribute_iterate_datatype", test_attribute_iterate_datatype, NULL, NULL, NULL, 0, + "attribute iteration on a committed datatype"); + AddTest("test_attribute_iterate_index_saving", test_attribute_iterate_index_saving, NULL, NULL, NULL, 0, + "attribute iteration index saving capability"); + AddTest("test_attribute_iterate_invalid_params", test_attribute_iterate_invalid_params, NULL, NULL, NULL, + 0, "attribute iteration with invalid parameters"); + AddTest("test_attribute_iterate_0_attributes", test_attribute_iterate_0_attributes, NULL, NULL, NULL, 0, + "attribute iteration on object with 0 attributes"); + AddTest("test_attribute_compound_subset", test_attribute_compound_subset, NULL, NULL, NULL, 0, + "verification of attribute data using H5Awrite then H5Aread with compound type subsets"); + AddTest("test_attribute_string_encodings", test_attribute_string_encodings, NULL, NULL, NULL, 0, + "string encoding read/write correctness on attributes"); + AddTest("test_delete_attribute", test_delete_attribute, NULL, NULL, NULL, 0, "attribute deletion"); + AddTest("test_delete_attribute_invalid_params", test_delete_attribute_invalid_params, NULL, NULL, NULL, 0, + "attribute deletion with invalid parameters"); + AddTest("test_attribute_exists", test_attribute_exists, NULL, NULL, NULL, 0, "attribute existence"); + AddTest("test_attribute_exists_invalid_params", test_attribute_exists_invalid_params, NULL, NULL, NULL, 0, + "attribute existence with invalid parameters"); + AddTest("test_attribute_duplicate_id", test_attribute_duplicate_id, NULL, NULL, NULL, 0, + "duplicated IDs for an attribute"); + AddTest("test_attribute_many", test_attribute_many, NULL, NULL, NULL, 0, "creating many attributes"); + AddTest("test_get_number_attributes", test_get_number_attributes, NULL, NULL, NULL, 0, + "retrieval of the number of attributes on an object"); + AddTest("test_attr_shared_dtype", test_attr_shared_dtype, NULL, NULL, NULL, 0, + "shared datatype for attributes"); } diff --git a/test/API/H5_api_attribute_test.h b/test/API/H5_api_attribute_test.h index 153d444e2fa..ed0943650b0 100644 --- a/test/API/H5_api_attribute_test.h +++ b/test/API/H5_api_attribute_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_attribute_test(void); +void H5_api_attribute_test_add(void); /************************************************** * * diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index e5ea8279ad5..c88288bfd01 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -16,171 +16,106 @@ * XXX: H5Dread_chunk/H5Dwrite_chunk, H5Dfill/scatter/gather */ -static int test_create_dataset_under_root(void); -static int test_create_dataset_under_existing_group(void); -static int test_create_dataset_invalid_params(void); -static int test_create_anonymous_dataset(void); -static int test_create_anonymous_dataset_invalid_params(void); -static int test_create_dataset_null_space(void); -static int test_create_dataset_scalar_space(void); -static int test_create_zero_dim_dset(void); -static int test_create_dataset_random_shapes(void); -static int test_create_dataset_predefined_types(void); -static int test_create_dataset_string_types(void); -static int test_create_dataset_compound_types(void); -static int test_create_dataset_enum_types(void); -static int test_create_dataset_array_types(void); -static int test_create_dataset_creation_properties(void); -static int test_create_many_dataset(void); -static int test_open_dataset(void); -static int test_open_dataset_invalid_params(void); -static int test_close_dataset_invalid_params(void); -static int test_get_dataset_space_and_type(void); -static int test_get_dataset_space_and_type_invalid_params(void); -static int test_get_dataset_space_status(void); -static int test_get_dataset_space_status_invalid_params(void); -static int test_dataset_property_lists(void); -static int test_get_dataset_storage_size(void); -static int test_get_dataset_storage_size_invalid_params(void); -static int test_get_dataset_chunk_storage_size(void); -static int test_get_dataset_chunk_storage_size_invalid_params(void); -static int test_get_dataset_offset(void); -static int test_get_dataset_offset_invalid_params(void); -static int test_read_dataset_small_all(void); -static int test_read_dataset_small_hyperslab(void); -static int test_read_dataset_small_point_selection(void); -static int test_read_multi_dataset_small_all(void); -static int test_read_multi_dataset_small_hyperslab(void); -static int test_read_multi_dataset_small_point_selection(void); -static int test_dataset_io_point_selections(void); -static int test_read_dataset_invalid_params(void); -static int test_write_dataset_small_all(void); -static int test_write_dataset_small_hyperslab(void); -static int test_write_dataset_small_point_selection(void); -static int test_write_dataset_data_verification(void); -static int test_write_multi_dataset_small_all(void); -static int test_write_multi_dataset_small_hyperslab(void); -static int test_write_multi_dataset_small_point_selection(void); -static int test_write_multi_dataset_data_verification(void); -static int test_write_dataset_invalid_params(void); -static int test_dataset_string_encodings(void); -static int test_dataset_builtin_type_conversion(void); -static int test_dataset_real_to_int_conversion(void); -static int test_dataset_compound_partial_io(void); -static int test_dataset_vlen_io(void); -static int test_dataset_set_extent_chunked_unlimited(void); -static int test_dataset_set_extent_chunked_fixed(void); -static int test_dataset_set_extent_data(void); -static int test_dataset_set_extent_double_handles(void); -static int test_dataset_set_extent_invalid_params(void); -static int test_flush_dataset(void); -static int test_flush_dataset_invalid_params(void); -static int test_refresh_dataset(void); -static int test_refresh_dataset_invalid_params(void); +static void print_dataset_test_header(const void *params); +static void test_create_dataset_under_root(const void *params); +static void test_create_dataset_under_existing_group(const void *params); +static void test_create_dataset_invalid_params(const void *params); +static void test_create_anonymous_dataset(const void *params); +static void test_create_anonymous_dataset_invalid_params(const void *params); +static void test_create_dataset_null_space(const void *params); +static void test_create_dataset_scalar_space(const void *params); +static void test_create_zero_dim_dset(const void *params); +static void test_create_dataset_random_shapes(const void *params); +static void test_create_dataset_predefined_types(const void *params); +static void test_create_dataset_string_types(const void *params); +static void test_create_dataset_compound_types(const void *params); +static void test_create_dataset_enum_types(const void *params); +static void test_create_dataset_array_types(const void *params); +static void test_create_dataset_creation_properties(const void *params); +static void test_create_many_dataset(const void *params); +static void test_open_dataset(const void *params); +static void test_open_dataset_invalid_params(const void *params); +static void test_close_dataset_invalid_params(const void *params); +static void test_get_dataset_space_and_type(const void *params); +static void test_get_dataset_space_and_type_invalid_params(const void *params); +static void test_get_dataset_space_status(const void *params); +static void test_get_dataset_space_status_invalid_params(const void *params); +static void test_dataset_property_lists(const void *params); +static void test_get_dataset_storage_size(const void *params); +static void test_get_dataset_storage_size_invalid_params(const void *params); +static void test_get_dataset_chunk_storage_size(const void *params); +static void test_get_dataset_chunk_storage_size_invalid_params(const void *params); +static void test_get_dataset_offset(const void *params); +static void test_get_dataset_offset_invalid_params(const void *params); +static void test_read_dataset_small_all(const void *params); +static void test_read_dataset_small_hyperslab(const void *params); +static void test_read_dataset_small_point_selection(const void *params); +static void test_read_multi_dataset_small_all(const void *params); +static void test_read_multi_dataset_small_hyperslab(const void *params); +static void test_read_multi_dataset_small_point_selection(const void *params); +static void test_dataset_io_point_selections(const void *params); +static void test_read_dataset_invalid_params(const void *params); +static void test_write_dataset_small_all(const void *params); +static void test_write_dataset_small_hyperslab(const void *params); +static void test_write_dataset_small_point_selection(const void *params); +static void test_write_dataset_data_verification(const void *params); +static void test_write_multi_dataset_small_all(const void *params); +static void test_write_multi_dataset_small_hyperslab(const void *params); +static void test_write_multi_dataset_small_point_selection(const void *params); +static void test_write_multi_dataset_data_verification(const void *params); +static void test_write_dataset_invalid_params(const void *params); +static void test_dataset_string_encodings(const void *params); +static void test_dataset_builtin_type_conversion(const void *params); +static void test_dataset_real_to_int_conversion(const void *params); +static void test_dataset_compound_partial_io(const void *params); +static void test_dataset_vlen_io(const void *params); +static void test_dataset_set_extent_chunked_unlimited(const void *params); +static void test_dataset_set_extent_chunked_fixed(const void *params); +static void test_dataset_set_extent_data(const void *params); +static void test_dataset_set_extent_double_handles(const void *params); +static void test_dataset_set_extent_invalid_params(const void *params); +static void test_flush_dataset(const void *params); +static void test_flush_dataset_invalid_params(const void *params); +static void test_refresh_dataset(const void *params); +static void test_refresh_dataset_invalid_params(const void *params); /* * Chunking tests */ -static int test_create_single_chunk_dataset(void); -static int test_write_single_chunk_dataset(void); -static int test_create_multi_chunk_dataset(void); -static int test_write_multi_chunk_dataset_same_shape_read(void); -static int test_write_multi_chunk_dataset_diff_shape_read(void); -static int test_overwrite_multi_chunk_dataset_same_shape_read(void); -static int test_overwrite_multi_chunk_dataset_diff_shape_read(void); -static int test_read_partial_chunk_all_selection(void); -static int test_read_partial_chunk_hyperslab_selection(void); -static int test_read_partial_chunk_point_selection(void); - -static int test_get_vlen_buf_size(void); +static void test_create_single_chunk_dataset(const void *params); +static void test_write_single_chunk_dataset(const void *params); +static void test_create_multi_chunk_dataset(const void *params); +static void test_write_multi_chunk_dataset_same_shape_read(const void *params); +static void test_write_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_same_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_read_partial_chunk_all_selection(const void *params); +static void test_read_partial_chunk_hyperslab_selection(const void *params); +static void test_read_partial_chunk_point_selection(const void *params); + +static void test_get_vlen_buf_size(const void *params); + +static size_t filter(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, + size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf); + +static void +print_dataset_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Dataset Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} -/* - * The array of dataset tests to be performed. - */ -static int (*dataset_tests[])(void) = { - test_create_dataset_under_root, - test_create_dataset_under_existing_group, - test_create_dataset_invalid_params, - test_create_anonymous_dataset, - test_create_anonymous_dataset_invalid_params, - test_create_dataset_null_space, - test_create_dataset_scalar_space, - test_create_zero_dim_dset, - test_create_dataset_random_shapes, - test_create_dataset_predefined_types, - test_create_dataset_string_types, - test_create_dataset_compound_types, - test_create_dataset_enum_types, - test_create_dataset_array_types, - test_create_dataset_creation_properties, - test_create_many_dataset, - test_open_dataset, - test_open_dataset_invalid_params, - test_close_dataset_invalid_params, - test_get_dataset_space_and_type, - test_get_dataset_space_and_type_invalid_params, - test_get_dataset_space_status, - test_get_dataset_space_status_invalid_params, - test_dataset_property_lists, - test_get_dataset_storage_size, - test_get_dataset_storage_size_invalid_params, - test_get_dataset_chunk_storage_size, - test_get_dataset_chunk_storage_size_invalid_params, - test_get_dataset_offset, - test_get_dataset_offset_invalid_params, - test_read_dataset_small_all, - test_read_dataset_small_hyperslab, - test_read_dataset_small_point_selection, - test_read_multi_dataset_small_all, - test_read_multi_dataset_small_hyperslab, - test_read_multi_dataset_small_point_selection, - test_dataset_io_point_selections, - test_read_dataset_invalid_params, - test_dataset_string_encodings, - test_write_dataset_small_all, - test_write_dataset_small_hyperslab, - test_write_dataset_small_point_selection, - test_write_dataset_data_verification, - test_write_multi_dataset_small_all, - test_write_multi_dataset_small_hyperslab, - test_write_multi_dataset_small_point_selection, - test_write_multi_dataset_data_verification, - test_write_dataset_invalid_params, - test_dataset_builtin_type_conversion, - test_dataset_real_to_int_conversion, - test_dataset_compound_partial_io, - test_dataset_vlen_io, - test_dataset_set_extent_chunked_unlimited, - test_dataset_set_extent_chunked_fixed, - test_dataset_set_extent_data, - test_dataset_set_extent_double_handles, - test_dataset_set_extent_invalid_params, - test_flush_dataset, - test_flush_dataset_invalid_params, - test_refresh_dataset, - test_refresh_dataset_invalid_params, - test_create_single_chunk_dataset, - test_write_single_chunk_dataset, - test_create_multi_chunk_dataset, - test_write_multi_chunk_dataset_same_shape_read, - test_write_multi_chunk_dataset_diff_shape_read, - test_overwrite_multi_chunk_dataset_same_shape_read, - test_overwrite_multi_chunk_dataset_diff_shape_read, - test_read_partial_chunk_all_selection, - test_read_partial_chunk_hyperslab_selection, - test_read_partial_chunk_point_selection, - test_get_vlen_buf_size, -}; - -size_t filter(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, - void H5_ATTR_UNUSED **buf); /* * A test to check that a dataset can be * created under the root group. */ -static int -test_create_dataset_under_root(void) +static void +test_create_dataset_under_root(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -193,7 +128,7 @@ test_create_dataset_under_root(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -227,7 +162,7 @@ test_create_dataset_under_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -239,15 +174,15 @@ test_create_dataset_under_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created * under a group that is not the root group. */ -static int -test_create_dataset_under_existing_group(void) +static void +test_create_dataset_under_existing_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -262,7 +197,7 @@ test_create_dataset_under_existing_group(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -313,7 +248,7 @@ test_create_dataset_under_existing_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -327,15 +262,15 @@ test_create_dataset_under_existing_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can't be created * when H5Dcreate is passed invalid parameters. */ -static int -test_create_dataset_invalid_params(void) +static void +test_create_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -350,7 +285,7 @@ test_create_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -570,7 +505,7 @@ test_create_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -584,14 +519,14 @@ test_create_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous dataset can be created. */ -static int -test_create_anonymous_dataset(void) +static void +test_create_anonymous_dataset(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -606,7 +541,7 @@ test_create_anonymous_dataset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -655,7 +590,7 @@ test_create_anonymous_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -669,7 +604,7 @@ test_create_anonymous_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -677,8 +612,8 @@ test_create_anonymous_dataset(void) * be created when H5Dcreate_anon is passed invalid * parameters. */ -static int -test_create_anonymous_dataset_invalid_params(void) +static void +test_create_anonymous_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -693,7 +628,7 @@ test_create_anonymous_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -851,7 +786,7 @@ test_create_anonymous_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -865,15 +800,15 @@ test_create_anonymous_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a NULL * dataspace is not problematic. */ -static int -test_create_dataset_null_space(void) +static void +test_create_dataset_null_space(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -888,7 +823,7 @@ test_create_dataset_null_space(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -948,7 +883,7 @@ test_create_dataset_null_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -962,15 +897,15 @@ test_create_dataset_null_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a scalar * dataspace is not problematic. */ -static int -test_create_dataset_scalar_space(void) +static void +test_create_dataset_scalar_space(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -985,7 +920,7 @@ test_create_dataset_scalar_space(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1045,7 +980,7 @@ test_create_dataset_scalar_space(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1059,15 +994,15 @@ test_create_dataset_scalar_space(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that creating a dataset with a dataspace * which contains a 0-sized dimension is not problematic. */ -static int -test_create_zero_dim_dset(void) +static void +test_create_zero_dim_dset(const void H5_ATTR_UNUSED *params) { hsize_t dims[ZERO_DIM_DSET_TEST_SPACE_RANK] = {0}; hid_t file_id = H5I_INVALID_HID; @@ -1084,7 +1019,7 @@ test_create_zero_dim_dset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1149,7 +1084,7 @@ test_create_zero_dim_dset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1162,15 +1097,15 @@ test_create_zero_dim_dset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created with * a variety of different dataspace shapes. */ -static int -test_create_dataset_random_shapes(void) +static void +test_create_dataset_random_shapes(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1185,7 +1120,7 @@ test_create_dataset_random_shapes(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1246,7 +1181,7 @@ test_create_dataset_random_shapes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1260,7 +1195,7 @@ test_create_dataset_random_shapes(void) } H5E_END_TRY - return 1; + return; } /* @@ -1268,8 +1203,8 @@ test_create_dataset_random_shapes(void) * each of the predefined integer and floating-point * datatypes. */ -static int -test_create_dataset_predefined_types(void) +static void +test_create_dataset_predefined_types(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1292,7 +1227,7 @@ test_create_dataset_predefined_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1354,7 +1289,7 @@ test_create_dataset_predefined_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1367,15 +1302,15 @@ test_create_dataset_predefined_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * string datatypes. */ -static int -test_create_dataset_string_types(void) +static void +test_create_dataset_string_types(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1390,7 +1325,7 @@ test_create_dataset_string_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1520,7 +1455,7 @@ test_create_dataset_string_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1536,15 +1471,15 @@ test_create_dataset_string_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * a variety of compound datatypes. */ -static int -test_create_dataset_compound_types(void) +static void +test_create_dataset_compound_types(const void H5_ATTR_UNUSED *params) { size_t i, j; hid_t file_id = H5I_INVALID_HID; @@ -1562,7 +1497,7 @@ test_create_dataset_compound_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* @@ -1690,7 +1625,7 @@ test_create_dataset_compound_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1706,15 +1641,15 @@ test_create_dataset_compound_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created with * enum datatypes. */ -static int -test_create_dataset_enum_types(void) +static void +test_create_dataset_enum_types(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -1732,7 +1667,7 @@ test_create_dataset_enum_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1832,7 +1767,7 @@ test_create_dataset_enum_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1848,15 +1783,15 @@ test_create_dataset_enum_types(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * array datatypes. */ -static int -test_create_dataset_array_types(void) +static void +test_create_dataset_array_types(const void H5_ATTR_UNUSED *params) { hsize_t array_dims1[DATASET_ARRAY_TYPE_TEST_RANK1]; hsize_t array_dims2[DATASET_ARRAY_TYPE_TEST_RANK2]; @@ -1879,7 +1814,7 @@ test_create_dataset_array_types(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2028,7 +1963,7 @@ test_create_dataset_array_types(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2050,10 +1985,10 @@ test_create_dataset_array_types(void) } H5E_END_TRY - return 1; + return; } -size_t +static size_t filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, const unsigned int H5_ATTR_UNUSED cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) @@ -2066,8 +2001,8 @@ filter(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts, * A test to check the functionality of the different * dataset creation properties. */ -static int -test_create_dataset_creation_properties(void) +static void +test_create_dataset_creation_properties(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; hsize_t chunk_dims[DATASET_CREATION_PROPERTIES_TEST_SHAPE_RANK]; @@ -2084,6 +2019,7 @@ test_create_dataset_creation_properties(void) int nfilters = 0; H5Z_filter_t retrieved_filter_id = H5I_INVALID_HID; size_t num_filter_params = DATASET_CREATION_PROPERTIES_TEST_UD_FILTER_NUM_PARAMS; + TESTING_MULTIPART("dataset creation properties"); /* Make sure the connector supports the API functions being tested */ @@ -2092,7 +2028,7 @@ test_create_dataset_creation_properties(void) SKIPPED(); printf(" API functions for basic file, group, or dataset " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3123,7 +3059,7 @@ test_create_dataset_creation_properties(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3144,15 +3080,15 @@ test_create_dataset_creation_properties(void) H5E_END_TRY - return 1; + return; } } /* * A test to create many small datasets (100,000) */ -static int -test_create_many_dataset(void) +static void +test_create_many_dataset(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -3169,7 +3105,7 @@ test_create_many_dataset(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3234,7 +3170,7 @@ test_create_many_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3247,29 +3183,29 @@ test_create_many_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that re-opening a dataset with * H5Dopen succeeds. */ -static int -test_open_dataset(void) +static void +test_open_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dopen"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dopen fails when it is * passed invalid parameters. */ -static int -test_open_dataset_invalid_params(void) +static void +test_open_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -3284,7 +3220,7 @@ test_open_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3422,7 +3358,7 @@ test_open_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3436,15 +3372,15 @@ test_open_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Dclose fails when it is * passed an invalid dataset ID. */ -static int -test_close_dataset_invalid_params(void) +static void +test_close_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -3455,7 +3391,7 @@ test_close_dataset_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3481,7 +3417,7 @@ test_close_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3490,7 +3426,7 @@ test_close_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -3498,8 +3434,8 @@ test_close_dataset_invalid_params(void) * and datatype can be retrieved with H5Dget_space and * H5Dget_type, respectively. */ -static int -test_get_dataset_space_and_type(void) +static void +test_get_dataset_space_and_type(const void H5_ATTR_UNUSED *params) { hsize_t dset_dims[DATASET_GET_SPACE_TYPE_TEST_SPACE_RANK]; size_t i; @@ -3519,7 +3455,7 @@ test_get_dataset_space_and_type(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3764,7 +3700,7 @@ test_get_dataset_space_and_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3780,7 +3716,7 @@ test_get_dataset_space_and_type(void) } H5E_END_TRY - return 1; + return; } /* @@ -3788,8 +3724,8 @@ test_get_dataset_space_and_type(void) * can't be retrieved when H5Dget_space and H5Dget_type are passed * invalid parameters, respectively. */ -static int -test_get_dataset_space_and_type_invalid_params(void) +static void +test_get_dataset_space_and_type_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -3807,7 +3743,7 @@ test_get_dataset_space_and_type_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3909,7 +3845,7 @@ test_get_dataset_space_and_type_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3925,20 +3861,20 @@ test_get_dataset_space_and_type_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Dget_space_status. */ -static int -test_get_dataset_space_status(void) +static void +test_get_dataset_space_status(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_space_status"); SKIPPED(); - return 0; + return; } /* @@ -3946,14 +3882,14 @@ test_get_dataset_space_status(void) * status can't be retrieved with H5Dget_space_status when * it is passed invalid parameters. */ -static int -test_get_dataset_space_status_invalid_params(void) +static void +test_get_dataset_space_status_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_space_status with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -3963,14 +3899,13 @@ test_get_dataset_space_status_invalid_params(void) * Also tests that a valid copy of a DAPL used for dataset * access can be retrieved with a call to H5Dget_access_plist. */ -static int -test_dataset_property_lists(void) +static void +test_dataset_property_lists(const void H5_ATTR_UNUSED *params) { const char *path_prefix = "/test_prefix"; hsize_t dims[DATASET_PROPERTY_LIST_TEST_SPACE_RANK]; hsize_t chunk_dims[DATASET_PROPERTY_LIST_TEST_SPACE_RANK]; size_t i; - herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t dset_id1 = H5I_INVALID_HID, dset_id2 = H5I_INVALID_HID, dset_id3 = H5I_INVALID_HID, @@ -3981,7 +3916,6 @@ test_dataset_property_lists(void) dset_dtype4 = H5I_INVALID_HID; hid_t space_id = H5I_INVALID_HID; char *tmp_prefix = NULL; - char vol_name[5]; TESTING_MULTIPART("dataset property list operations"); @@ -3991,7 +3925,7 @@ test_dataset_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4002,13 +3936,6 @@ test_dataset_property_lists(void) goto error; } - /** for DAOS VOL, this test is problematic since auto chunking can be selected, so skip for now */ - if (H5VLget_connector_name(file_id, vol_name, 5) < 0) { - H5_FAILED(); - printf(" couldn't get VOL connector name\n"); - goto error; - } - if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); @@ -4106,20 +4033,6 @@ test_dataset_property_lists(void) printf(" DCPL property values were incorrect\n"); PART_ERROR(H5Dget_create_plist); } - - H5E_BEGIN_TRY - { - err_ret = H5Pget_chunk(dcpl_id2, DATASET_PROPERTY_LIST_TEST_SPACE_RANK, tmp_chunk_dims); - } - H5E_END_TRY - - /* DAOS VOL can auto chunk, so don't fail */ - if (err_ret >= 0 && strcmp(vol_name, "daos") != 0) { - H5_FAILED(); - printf(" property list 2 shouldn't have had chunk dimensionality set (not a chunked " - "layout)\n"); - PART_ERROR(H5Dget_create_plist); - } } PASSED(); @@ -4308,20 +4221,6 @@ test_dataset_property_lists(void) printf(" DCPL property values were incorrect\n"); PART_ERROR(H5Dget_create_plist_reopened); } - - H5E_BEGIN_TRY - { - err_ret = H5Pget_chunk(dcpl_id2, DATASET_PROPERTY_LIST_TEST_SPACE_RANK, tmp_chunk_dims); - } - H5E_END_TRY - - /* DAOS VOL can auto chunk, so don't fail */ - if (err_ret >= 0 && strcmp(vol_name, "daos") != 0) { - H5_FAILED(); - printf(" property list 2 shouldn't have had chunk dimensionality set (not a chunked " - "layout)\n"); - PART_ERROR(H5Dget_create_plist_reopened); - } } PASSED(); @@ -4372,7 +4271,7 @@ test_dataset_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4398,20 +4297,20 @@ test_dataset_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Dget_storage_size. */ -static int -test_get_dataset_storage_size(void) +static void +test_get_dataset_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_storage_size"); SKIPPED(); - return 0; + return; } /* @@ -4419,27 +4318,27 @@ test_get_dataset_storage_size(void) * be retrieved when H5Dget_storage_size is passed * invalid parameters. */ -static int -test_get_dataset_storage_size_invalid_params(void) +static void +test_get_dataset_storage_size_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_chunk_storage_size. */ -static int -test_get_dataset_chunk_storage_size(void) +static void +test_get_dataset_chunk_storage_size(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_chunk_storage_size"); SKIPPED(); - return 0; + return; } /* @@ -4447,27 +4346,27 @@ test_get_dataset_chunk_storage_size(void) * a dataset can't be retrieved when H5Dget_chunk_storage_size * is passed invalid parameters. */ -static int -test_get_dataset_chunk_storage_size_invalid_params(void) +static void +test_get_dataset_chunk_storage_size_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_chunk_storage_size with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Dget_offset. */ -static int -test_get_dataset_offset(void) +static void +test_get_dataset_offset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_offset"); SKIPPED(); - return 0; + return; } /* @@ -4475,22 +4374,22 @@ test_get_dataset_offset(void) * retrieved when H5Dget_offset is passed invalid * parameters. */ -static int -test_get_dataset_offset_invalid_params(void) +static void +test_get_dataset_offset_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dget_offset with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using an H5S_ALL selection. */ -static int -test_read_dataset_small_all(void) +static void +test_read_dataset_small_all(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; size_t i, data_size; @@ -4507,7 +4406,7 @@ test_read_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4572,7 +4471,7 @@ test_read_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4587,15 +4486,15 @@ test_read_dataset_small_all(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using a hyperslab selection. */ -static int -test_read_dataset_small_hyperslab(void) +static void +test_read_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -4616,7 +4515,7 @@ test_read_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4698,7 +4597,7 @@ test_read_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4714,15 +4613,15 @@ test_read_dataset_small_hyperslab(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from a dataset using a point selection. */ -static int -test_read_dataset_small_point_selection(void) +static void +test_read_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -4743,7 +4642,7 @@ test_read_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -4827,7 +4726,7 @@ test_read_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4843,15 +4742,15 @@ test_read_dataset_small_point_selection(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small amount of data can be * read back from multiple datasets using H5S_ALL selections. */ -static int -test_read_multi_dataset_small_all(void) +static void +test_read_multi_dataset_small_all(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SMALL_READ_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -4871,7 +4770,7 @@ test_read_multi_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -4952,7 +4851,7 @@ test_read_multi_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4969,15 +4868,15 @@ test_read_multi_dataset_small_all(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small amount of data can be * read back from datasets using hyperslab selections. */ -static int -test_read_multi_dataset_small_hyperslab(void) +static void +test_read_multi_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_READ_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -5001,7 +4900,7 @@ test_read_multi_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -5102,7 +5001,7 @@ test_read_multi_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5122,15 +5021,15 @@ test_read_multi_dataset_small_hyperslab(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small amount of data can be * read back from datasets using point selections. */ -static int -test_read_multi_dataset_small_point_selection(void) +static void +test_read_multi_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_READ_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_READ_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -5152,7 +5051,7 @@ test_read_multi_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Prevent uninitialized memory usage on test failure */ @@ -5256,7 +5155,7 @@ test_read_multi_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5276,7 +5175,7 @@ test_read_multi_dataset_small_point_selection(void) } H5E_END_TRY; - return 1; + return; } /* @@ -5299,8 +5198,8 @@ test_read_multi_dataset_small_point_selection(void) ; \ } while ((J) < (I)); \ } -static int -test_dataset_io_point_selections(void) +static void +test_dataset_io_point_selections(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -5330,7 +5229,7 @@ test_dataset_io_point_selections(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } /* Create dataspaces and DCPL */ @@ -5757,7 +5656,7 @@ test_dataset_io_point_selections(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5773,15 +5672,15 @@ test_dataset_io_point_selections(void) } H5E_END_TRY - return 1; + return; } /* end test_dataset_io_point_selections() */ /* * A test to check that data can't be read from a * dataset when H5Dread is passed invalid parameters. */ -static int -test_read_dataset_invalid_params(void) +static void +test_read_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_READ_INVALID_PARAMS_TEST_DSET_SPACE_RANK] = {10, 5, 3}; herr_t err_ret = -1; @@ -5799,7 +5698,7 @@ test_read_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5992,7 +5891,7 @@ test_read_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6007,15 +5906,15 @@ test_read_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be * made to a dataset using an H5S_ALL selection. */ -static int -test_write_dataset_small_all(void) +static void +test_write_dataset_small_all(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -6033,7 +5932,7 @@ test_write_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6120,7 +6019,7 @@ test_write_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6135,15 +6034,15 @@ test_write_dataset_small_all(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be made * to a dataset using a hyperslab selection. */ -static int -test_write_dataset_small_hyperslab(void) +static void +test_write_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -6164,7 +6063,7 @@ test_write_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6250,7 +6149,7 @@ test_write_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6266,15 +6165,15 @@ test_write_dataset_small_hyperslab(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small write can be made * to a dataset using a point selection. */ -static int -test_write_dataset_small_point_selection(void) +static void +test_write_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -6295,7 +6194,7 @@ test_write_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6382,7 +6281,7 @@ test_write_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6398,15 +6297,15 @@ test_write_dataset_small_point_selection(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that data is read back correctly from * a dataset after it has been written. */ -static int -test_write_dataset_data_verification(void) +static void +test_write_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_VERIFY_WRITE_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -6434,7 +6333,7 @@ test_write_dataset_data_verification(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6893,7 +6792,7 @@ test_write_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6913,15 +6812,15 @@ test_write_dataset_data_verification(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a small multi write can be * made to a dataset using an H5S_ALL selection. */ -static int -test_write_multi_dataset_small_all(void) +static void +test_write_multi_dataset_small_all(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SMALL_WRITE_TEST_ALL_DSET_SPACE_RANK] = {10, 5, 3}; @@ -6948,7 +6847,7 @@ test_write_multi_dataset_small_all(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -7058,7 +6957,7 @@ test_write_multi_dataset_small_all(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7076,15 +6975,15 @@ test_write_multi_dataset_small_all(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small multi write can be made * to a dataset using a hyperslab selection. */ -static int -test_write_multi_dataset_small_hyperslab(void) +static void +test_write_multi_dataset_small_hyperslab(const void H5_ATTR_UNUSED *params) { hsize_t start[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; hsize_t stride[DATASET_SMALL_WRITE_TEST_HYPERSLAB_DSET_SPACE_RANK]; @@ -7108,7 +7007,7 @@ test_write_multi_dataset_small_hyperslab(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { @@ -7217,7 +7116,7 @@ test_write_multi_dataset_small_hyperslab(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7237,15 +7136,15 @@ test_write_multi_dataset_small_hyperslab(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a small multi write can be made * to a dataset using a point selection. */ -static int -test_write_multi_dataset_small_point_selection(void) +static void +test_write_multi_dataset_small_point_selection(const void H5_ATTR_UNUSED *params) { hsize_t points[DATASET_SMALL_WRITE_TEST_POINT_SELECTION_NUM_POINTS * DATASET_SMALL_WRITE_TEST_POINT_SELECTION_DSET_SPACE_RANK]; @@ -7268,7 +7167,7 @@ test_write_multi_dataset_small_point_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < DATASET_MULTI_COUNT; i++) { @@ -7380,7 +7279,7 @@ test_write_multi_dataset_small_point_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7400,15 +7299,15 @@ test_write_multi_dataset_small_point_selection(void) } H5E_END_TRY; - return 1; + return; } /* * A test to ensure that data is read back correctly from * multiple datasets after it has been written. */ -static int -test_write_multi_dataset_data_verification(void) +static void +test_write_multi_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints[DATASET_MULTI_COUNT]; hsize_t dims[DATASET_DATA_VERIFY_WRITE_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -7440,7 +7339,7 @@ test_write_multi_dataset_data_verification(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7979,7 +7878,7 @@ test_write_multi_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8003,15 +7902,15 @@ test_write_multi_dataset_data_verification(void) } H5E_END_TRY; - return 1; + return; } /* * A test to check that a dataset can't be written to * when H5Dwrite is passed invalid parameters. */ -static int -test_write_dataset_invalid_params(void) +static void +test_write_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_WRITE_INVALID_PARAMS_TEST_DSET_SPACE_RANK] = {10, 5, 3}; @@ -8030,7 +7929,7 @@ test_write_dataset_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8229,7 +8128,7 @@ test_write_dataset_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8244,15 +8143,15 @@ test_write_dataset_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that strings of any encoding * can be written to and read from a dataset */ -static int -test_dataset_string_encodings(void) +static void +test_dataset_string_encodings(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -8275,7 +8174,7 @@ test_dataset_string_encodings(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8471,7 +8370,7 @@ test_dataset_string_encodings(void) free(read_buf); PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8489,15 +8388,15 @@ test_dataset_string_encodings(void) } H5E_END_TRY; - return 1; + return; } /* * A test to ensure that data is read back correctly from a dataset after it has * been written, using type conversion with builtin types. */ -static int -test_dataset_builtin_type_conversion(void) +static void +test_dataset_builtin_type_conversion(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_BUILTIN_CONVERSION_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -8528,7 +8427,7 @@ test_dataset_builtin_type_conversion(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9007,7 +8906,7 @@ test_dataset_builtin_type_conversion(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9027,11 +8926,11 @@ test_dataset_builtin_type_conversion(void) } H5E_END_TRY - return 1; + return; } -static int -test_dataset_real_to_int_conversion(void) +static void +test_dataset_real_to_int_conversion(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_DATA_REAL_CONVERSION_TEST_DSET_SPACE_RANK] = {10, 10, 10}; @@ -9061,7 +8960,7 @@ test_dataset_real_to_int_conversion(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9549,7 +9448,7 @@ test_dataset_real_to_int_conversion(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9569,7 +9468,7 @@ test_dataset_real_to_int_conversion(void) } H5E_END_TRY; - return 1; + return; } /* @@ -9581,8 +9480,8 @@ typedef struct dataset_compount_partial_io_t { int b; } dataset_compount_partial_io_t; -static int -test_dataset_compound_partial_io(void) +static void +test_dataset_compound_partial_io(const void H5_ATTR_UNUSED *params) { hsize_t dims[1] = {DATASET_COMPOUND_PARTIAL_IO_DSET_DIMS}; size_t i; @@ -9606,7 +9505,7 @@ test_dataset_compound_partial_io(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9815,7 +9714,7 @@ test_dataset_compound_partial_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9831,13 +9730,13 @@ test_dataset_compound_partial_io(void) } H5E_END_TRY - return 1; + return; } /* A test to check that vlen sequences can be written and read back * with basic parent types and selections */ -static int -test_dataset_vlen_io(void) +static void +test_dataset_vlen_io(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -9868,13 +9767,9 @@ test_dataset_vlen_io(void) SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this " "connector\n"); - return 0; + return; } - /* Skipped for now due to segfault with the Cache VOL */ - SKIPPED(); - return 0; - TESTING_2("test setup"); if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10459,10 +10354,12 @@ test_dataset_vlen_io(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + PASSED(); - return 0; -error: + return; + +error: H5E_BEGIN_TRY { H5Dclose(dset_int); @@ -10492,7 +10389,7 @@ test_dataset_vlen_io(void) } H5E_END_TRY - return 1; + return; } /* @@ -10501,8 +10398,8 @@ test_dataset_vlen_io(void) * dimensions for the dataset, so the dimensionality of the * dataset may both shrink and grow. */ -static int -test_dataset_set_extent_chunked_unlimited(void) +static void +test_dataset_set_extent_chunked_unlimited(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_SPACE_RANK]; hsize_t max_dims[DATASET_SET_EXTENT_CHUNKED_UNLIMITED_TEST_SPACE_RANK]; @@ -10525,7 +10422,7 @@ test_dataset_set_extent_chunked_unlimited(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10710,7 +10607,7 @@ test_dataset_set_extent_chunked_unlimited(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10725,7 +10622,7 @@ test_dataset_set_extent_chunked_unlimited(void) } H5E_END_TRY - return 1; + return; } /* @@ -10734,8 +10631,8 @@ test_dataset_set_extent_chunked_unlimited(void) * dimensions for the dataset, so the dimensionality of the * dataset may only shrink. */ -static int -test_dataset_set_extent_chunked_fixed(void) +static void +test_dataset_set_extent_chunked_fixed(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_CHUNKED_FIXED_TEST_SPACE_RANK]; hsize_t dims2[DATASET_SET_EXTENT_CHUNKED_FIXED_TEST_SPACE_RANK]; @@ -10757,7 +10654,7 @@ test_dataset_set_extent_chunked_fixed(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -10988,7 +10885,7 @@ test_dataset_set_extent_chunked_fixed(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11005,15 +10902,15 @@ test_dataset_set_extent_chunked_fixed(void) } H5E_END_TRY - return 1; + return; } /* * A test to check the data is correct after expanding * and shrinking the dataset with H5Dset_extent */ -static int -test_dataset_set_extent_data(void) +static void +test_dataset_set_extent_data(const void H5_ATTR_UNUSED *params) { hsize_t dims_origin[DATASET_SET_EXTENT_DATA_TEST_SPACE_RANK] = {DATASET_SET_EXTENT_DATA_TEST_SPACE_DIM, DATASET_SET_EXTENT_DATA_TEST_SPACE_DIM}; @@ -11046,7 +10943,7 @@ test_dataset_set_extent_data(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11329,7 +11226,7 @@ test_dataset_set_extent_data(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11344,7 +11241,7 @@ test_dataset_set_extent_data(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_data */ /* @@ -11352,8 +11249,8 @@ test_dataset_set_extent_data(void) * used to extend the dataset, then the other handle should * return the new size when queried. */ -static int -test_dataset_set_extent_double_handles(void) +static void +test_dataset_set_extent_double_handles(const void H5_ATTR_UNUSED *params) { hsize_t dims_origin[DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_RANK] = { DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_DIM, DATASET_SET_EXTENT_DOUBLE_HANDLES_TEST_SPACE_DIM}; @@ -11380,7 +11277,7 @@ test_dataset_set_extent_double_handles(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11470,7 +11367,7 @@ test_dataset_set_extent_double_handles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11486,15 +11383,15 @@ test_dataset_set_extent_double_handles(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_double_handles */ /* * A test to check that a dataset's extent can't be * changed when H5Dset_extent is passed invalid parameters. */ -static int -test_dataset_set_extent_invalid_params(void) +static void +test_dataset_set_extent_invalid_params(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SET_EXTENT_INVALID_PARAMS_TEST_SPACE_RANK]; hsize_t chunk_dims[DATASET_SET_EXTENT_INVALID_PARAMS_TEST_SPACE_RANK]; @@ -11510,7 +11407,6 @@ test_dataset_set_extent_invalid_params(void) hid_t chunked_dcpl_id = H5I_INVALID_HID, compact_dcpl_id = H5I_INVALID_HID, contiguous_dcpl_id = H5I_INVALID_HID; hid_t fspace_id = H5I_INVALID_HID, compact_fspace_id = H5I_INVALID_HID; - char vol_name[5]; TESTING_MULTIPART("H5Dset_extent with invalid parameters"); @@ -11520,7 +11416,7 @@ test_dataset_set_extent_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, basic or more dataset aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11531,19 +11427,6 @@ test_dataset_set_extent_invalid_params(void) goto error; } - /** for DAOS VOL, this test is problematic since auto chunking can be selected, so skip for now */ - if (H5VLget_connector_name(file_id, vol_name, 5) < 0) { - H5_FAILED(); - printf(" couldn't get VOL connector name\n"); - goto error; - } - if (strcmp(vol_name, "daos") == 0) { - if (H5Fclose(file_id) < 0) - TEST_ERROR; - SKIPPED(); - return 0; - } - if ((container_group = H5Gopen2(file_id, DATASET_TEST_GROUP_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); printf(" couldn't open container group '%s'\n", DATASET_TEST_GROUP_NAME); @@ -11743,7 +11626,7 @@ test_dataset_set_extent_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11763,68 +11646,68 @@ test_dataset_set_extent_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* test_dataset_set_extent_invalid_params */ /* * A test for H5Dflush. */ -static int -test_flush_dataset(void) +static void +test_flush_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Dflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Dflush fails when it is * passed invalid parameters. */ -static int -test_flush_dataset_invalid_params(void) +static void +test_flush_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Dflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Drefresh. */ -static int -test_refresh_dataset(void) +static void +test_refresh_dataset(const void H5_ATTR_UNUSED *params) { TESTING("H5Drefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Drefresh fails when it is * passed invalid parameters. */ -static int -test_refresh_dataset_invalid_params(void) +static void +test_refresh_dataset_invalid_params(const void H5_ATTR_UNUSED *params) { - TESTING("H5Drefresh"); + TESTING("H5Drefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test to create a dataset composed of a single chunk. */ -static int -test_create_single_chunk_dataset(void) +static void +test_create_single_chunk_dataset(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_SINGLE_CHUNK_TEST_SPACE_RANK]; hsize_t retrieved_chunk_dims[DATASET_SINGLE_CHUNK_TEST_SPACE_RANK]; @@ -11844,7 +11727,7 @@ test_create_single_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11979,7 +11862,7 @@ test_create_single_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11994,15 +11877,15 @@ test_create_single_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a single-chunk dataset can be written * and read correctly. */ -static int -test_write_single_chunk_dataset(void) +static void +test_write_single_chunk_dataset(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t dims[DATASET_SINGLE_CHUNK_WRITE_TEST_DSET_SPACE_RANK]; @@ -12025,7 +11908,7 @@ test_write_single_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12197,7 +12080,7 @@ test_write_single_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12215,14 +12098,14 @@ test_write_single_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* * A test to create a dataset composed of multiple chunks. */ -static int -test_create_multi_chunk_dataset(void) +static void +test_create_multi_chunk_dataset(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_TEST_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_TEST_SPACE_RANK] = {10, 10}; @@ -12243,7 +12126,7 @@ test_create_multi_chunk_dataset(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12378,7 +12261,7 @@ test_create_multi_chunk_dataset(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12393,7 +12276,7 @@ test_create_multi_chunk_dataset(void) } H5E_END_TRY - return 1; + return; } /* @@ -12402,8 +12285,8 @@ test_create_multi_chunk_dataset(void) * chunks of the dataset, the file dataspace and memory dataspace * used are the same shape. */ -static int -test_write_multi_chunk_dataset_same_shape_read(void) +static void +test_write_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -12429,7 +12312,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -12703,7 +12586,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -12720,7 +12603,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -12729,8 +12612,8 @@ test_write_multi_chunk_dataset_same_shape_read(void) * chunks of the dataset, the file dataspace and memory dataspace * used are differently shaped. */ -static int -test_write_multi_chunk_dataset_diff_shape_read(void) +static void +test_write_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -12755,7 +12638,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13038,7 +12921,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13057,7 +12940,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13066,8 +12949,8 @@ test_write_multi_chunk_dataset_diff_shape_read(void) * When reading back the chunks of the dataset, the file * dataspace and memory dataspace used are the same shape. */ -static int -test_overwrite_multi_chunk_dataset_same_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -13093,7 +12976,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13375,7 +13258,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13392,7 +13275,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13401,8 +13284,8 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) * When reading back the chunks of the dataset, the file * dataspace and memory dataspace used are differently shaped. */ -static int -test_overwrite_multi_chunk_dataset_diff_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t dims[DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {100, 100}; hsize_t chunk_dims[DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK] = {10, 10}; @@ -13428,7 +13311,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13720,7 +13603,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13739,7 +13622,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -13749,8 +13632,8 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) */ #define FIXED_DIMSIZE 25 #define FIXED_CHUNK_DIMSIZE 10 -static int -test_read_partial_chunk_all_selection(void) +static void +test_read_partial_chunk_all_selection(const void H5_ATTR_UNUSED *params) { DATASET_PARTIAL_CHUNK_READ_ALL_SEL_TEST_DSET_CTYPE write_buf[FIXED_DIMSIZE][FIXED_DIMSIZE]; DATASET_PARTIAL_CHUNK_READ_ALL_SEL_TEST_DSET_CTYPE read_buf[FIXED_DIMSIZE][FIXED_DIMSIZE]; @@ -13773,7 +13656,7 @@ test_read_partial_chunk_all_selection(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -13908,7 +13791,7 @@ test_read_partial_chunk_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13922,7 +13805,7 @@ test_read_partial_chunk_all_selection(void) } H5E_END_TRY - return 1; + return; } #undef FIXED_DIMSIZE #undef FIXED_CHUNK_DIMSIZE @@ -13935,8 +13818,8 @@ test_read_partial_chunk_all_selection(void) #define FIXED_DIMSIZE 25 #define FIXED_CHUNK_DIMSIZE 10 #define FIXED_NCHUNKS 9 /* For convenience - make sure to adjust this as necessary */ -static int -test_read_partial_chunk_hyperslab_selection(void) +static void +test_read_partial_chunk_hyperslab_selection(const void H5_ATTR_UNUSED *params) { DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_CTYPE write_buf[FIXED_CHUNK_DIMSIZE][FIXED_CHUNK_DIMSIZE]; DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_CTYPE read_buf[FIXED_CHUNK_DIMSIZE][FIXED_CHUNK_DIMSIZE]; @@ -13960,7 +13843,7 @@ test_read_partial_chunk_hyperslab_selection(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or get property list aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -14063,6 +13946,7 @@ test_read_partial_chunk_hyperslab_selection(void) /* * Write and read each chunk in the dataset. */ + printf("\n"); for (i = 0; i < FIXED_NCHUNKS; i++) { hsize_t start[DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_SPACE_RANK]; hsize_t count[DATASET_PARTIAL_CHUNK_READ_HYPER_SEL_TEST_DSET_SPACE_RANK]; @@ -14199,7 +14083,7 @@ test_read_partial_chunk_hyperslab_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14214,7 +14098,7 @@ test_read_partial_chunk_hyperslab_selection(void) } H5E_END_TRY - return 1; + return; } #undef FIXED_DIMSIZE #undef FIXED_CHUNK_DIMSIZE @@ -14227,13 +14111,13 @@ test_read_partial_chunk_hyperslab_selection(void) */ /* #define FIXED_DIMSIZE 25 */ /* #define FIXED_CHUNK_DIMSIZE 10 */ -static int -test_read_partial_chunk_point_selection(void) +static void +test_read_partial_chunk_point_selection(const void H5_ATTR_UNUSED *params) { TESTING("reading a partial chunk using a point selection in file dataspace"); SKIPPED(); - return 1; + return; } /* #undef FIXED_DIMSIZE */ /* #undef FIXED_CHUNK_DIMSIZE */ @@ -14242,8 +14126,8 @@ test_read_partial_chunk_point_selection(void) * A test to verify that H5Dvlen_get_buf_size returns * correct size */ -static int -test_get_vlen_buf_size(void) +static void +test_get_vlen_buf_size(const void H5_ATTR_UNUSED *params) { hvl_t wdata[DATASET_GET_VLEN_BUF_SIZE_DSET_SPACE_DIM]; /* Information to write */ hid_t file_id = H5I_INVALID_HID; @@ -14265,7 +14149,7 @@ test_get_vlen_buf_size(void) SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this " "connector\n"); - return 0; + return; } /* Allocate and initialize VL data to write */ @@ -14354,7 +14238,7 @@ test_get_vlen_buf_size(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14370,26 +14254,158 @@ test_get_vlen_buf_size(void) } H5E_END_TRY - return 1; + return; } /* end test_get_vlen_buf_size() */ -int -H5_api_dataset_test(void) +void +H5_api_dataset_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Dataset Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(dataset_tests); i++) { - nerrors += (*dataset_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_dataset_test_header", print_dataset_test_header, NULL, NULL, NULL, 0, + "Prints header for dataset tests"); + + AddTest("test_create_dataset_under_root", test_create_dataset_under_root, NULL, NULL, NULL, 0, + "dataset creation under root group"); + AddTest("test_create_dataset_under_existing_group", test_create_dataset_under_existing_group, NULL, NULL, + NULL, 0, "dataset creation under an existing group"); + AddTest("test_create_dataset_invalid_params", test_create_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dcreate with invalid parameters"); + AddTest("test_create_anonymous_dataset", test_create_anonymous_dataset, NULL, NULL, NULL, 0, + "anonymous dataset creation"); + AddTest("test_create_anonymous_dataset_invalid_params", test_create_anonymous_dataset_invalid_params, + NULL, NULL, NULL, 0, "anonymous dataset creation with invalid parameters"); + AddTest("test_create_dataset_null_space", test_create_dataset_null_space, NULL, NULL, NULL, 0, + "dataset creation with a NULL dataspace"); + AddTest("test_create_dataset_scalar_space", test_create_dataset_scalar_space, NULL, NULL, NULL, 0, + "dataset creation with a SCALAR dataspace"); + AddTest("test_create_zero_dim_dset", test_create_zero_dim_dset, NULL, NULL, NULL, 0, + "creation of 0-sized dataset"); + AddTest("test_create_dataset_random_shapes", test_create_dataset_random_shapes, NULL, NULL, NULL, 0, + "dataset creation with random dimension sizes"); + AddTest("test_create_dataset_predefined_types", test_create_dataset_predefined_types, NULL, NULL, NULL, 0, + "dataset creation with predefined datatypes"); + AddTest("test_create_dataset_string_types", test_create_dataset_string_types, NULL, NULL, NULL, 0, + "dataset creation with string types"); + AddTest("test_create_dataset_compound_types", test_create_dataset_compound_types, NULL, NULL, NULL, 0, + "dataset creation with compound datatypes"); + AddTest("test_create_dataset_enum_types", test_create_dataset_enum_types, NULL, NULL, NULL, 0, + "dataset creation with enum types"); + AddTest("test_create_dataset_array_types", test_create_dataset_array_types, NULL, NULL, NULL, 0, + "dataset creation with array types"); + AddTest("test_create_dataset_creation_properties", test_create_dataset_creation_properties, NULL, NULL, + NULL, 0, "dataset creation properties"); + AddTest("test_create_many_dataset", test_create_many_dataset, NULL, NULL, NULL, 0, + "creating many datasets"); + AddTest("test_open_dataset", test_open_dataset, NULL, NULL, NULL, 0, "H5Dopen"); + AddTest("test_open_dataset_invalid_params", test_open_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dopen with invalid parameters"); + AddTest("test_close_dataset_invalid_params", test_close_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dclose with an invalid dataset ID"); + AddTest("test_get_dataset_space_and_type", test_get_dataset_space_and_type, NULL, NULL, NULL, 0, + "retrieval of a dataset's dataspace and datatype"); + AddTest("test_get_dataset_space_and_type_invalid_params", test_get_dataset_space_and_type_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_type/H5Dget_space with invalid parameters"); + AddTest("test_get_dataset_space_status", test_get_dataset_space_status, NULL, NULL, NULL, 0, + "H5Dget_space_status"); + AddTest("test_get_dataset_space_status_invalid_params", test_get_dataset_space_status_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_space_status with invalid parameters"); + AddTest("test_dataset_property_lists", test_dataset_property_lists, NULL, NULL, NULL, 0, + "dataset property list operations"); + AddTest("test_get_dataset_storage_size", test_get_dataset_storage_size, NULL, NULL, NULL, 0, + "H5Dget_storage_size"); + AddTest("test_get_dataset_storage_size_invalid_params", test_get_dataset_storage_size_invalid_params, + NULL, NULL, NULL, 0, "H5Dget_storage_size with invalid parameters"); + AddTest("test_get_dataset_chunk_storage_size", test_get_dataset_chunk_storage_size, NULL, NULL, NULL, 0, + "H5Dget_chunk_storage_size"); + AddTest("test_get_dataset_chunk_storage_size_invalid_params", + test_get_dataset_chunk_storage_size_invalid_params, NULL, NULL, NULL, 0, + "H5Dget_chunk_storage_size with invalid parameters"); + AddTest("test_get_dataset_offset", test_get_dataset_offset, NULL, NULL, NULL, 0, "H5Dget_offset"); + AddTest("test_get_dataset_offset_invalid_params", test_get_dataset_offset_invalid_params, NULL, NULL, + NULL, 0, "H5Dget_offset with invalid parameters"); + AddTest("test_read_dataset_small_all", test_read_dataset_small_all, NULL, NULL, NULL, 0, + "small read from dataset with H5S_ALL"); + AddTest("test_read_dataset_small_hyperslab", test_read_dataset_small_hyperslab, NULL, NULL, NULL, 0, + "small read from dataset with a hyperslab selection"); + AddTest("test_read_dataset_small_point_selection", test_read_dataset_small_point_selection, NULL, NULL, + NULL, 0, "small read from dataset with a point selection"); + AddTest("test_read_multi_dataset_small_all", test_read_multi_dataset_small_all, NULL, NULL, NULL, 0, + "small multi read from datasets with H5S_ALL"); + AddTest("test_read_multi_dataset_small_hyperslab", test_read_multi_dataset_small_hyperslab, NULL, NULL, + NULL, 0, "small multi read from datasets with a hyperslab selection"); + AddTest("test_read_multi_dataset_small_point_selection", test_read_multi_dataset_small_point_selection, + NULL, NULL, NULL, 0, "small multi read from datasets with point selections"); + AddTest("test_dataset_io_point_selections", test_dataset_io_point_selections, NULL, NULL, NULL, 0, + "point selection I/O with all selection in memory and points in file"); + AddTest("test_read_dataset_invalid_params", test_read_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dread with invalid parameters"); + AddTest("test_dataset_string_encodings", test_dataset_string_encodings, NULL, NULL, NULL, 0, + "string encoding read/write correctness on datasets"); + AddTest("test_write_dataset_small_all", test_write_dataset_small_all, NULL, NULL, NULL, 0, + "small write to dataset with H5S_ALL"); + AddTest("test_write_dataset_small_hyperslab", test_write_dataset_small_hyperslab, NULL, NULL, NULL, 0, + "small write to dataset with a hyperslab selection"); + AddTest("test_write_dataset_small_point_selection", test_write_dataset_small_point_selection, NULL, NULL, + NULL, 0, "small write to dataset with a point selection"); + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread"); + AddTest("test_write_multi_dataset_small_all", test_write_multi_dataset_small_all, NULL, NULL, NULL, 0, + "small multi write to datasets with H5S_ALL"); + AddTest("test_write_multi_dataset_small_hyperslab", test_write_multi_dataset_small_hyperslab, NULL, NULL, + NULL, 0, "small multi write to datasets with hyperslab selections"); + AddTest("test_write_multi_dataset_small_point_selection", test_write_multi_dataset_small_point_selection, + NULL, NULL, NULL, 0, "small multi write to datasets with point selections"); + AddTest("test_write_multi_dataset_data_verification", test_write_multi_dataset_data_verification, NULL, + NULL, NULL, 0, "verification of datasets' data using H5Dwrite_multi then H5Dread_multi"); + AddTest("test_write_dataset_invalid_params", test_write_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dwrite with invalid parameters"); + AddTest("test_dataset_builtin_type_conversion", test_dataset_builtin_type_conversion, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with type conversion of builtin types"); + AddTest("test_dataset_real_to_int_conversion", test_dataset_real_to_int_conversion, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with real <-> integer type conversion"); + AddTest( + "test_dataset_compound_partial_io", test_dataset_compound_partial_io, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread with partial element compound type I/O"); + AddTest( + "test_dataset_vlen_io", test_dataset_vlen_io, NULL, NULL, NULL, 0, + "verification of dataset data with H5Dwrite and then H5D read with variable length sequence data"); + AddTest("test_dataset_set_extent_chunked_unlimited", test_dataset_set_extent_chunked_unlimited, NULL, + NULL, NULL, 0, "H5Dset_extent on chunked dataset with unlimited dimensions"); + AddTest("test_dataset_set_extent_chunked_fixed", test_dataset_set_extent_chunked_fixed, NULL, NULL, NULL, + 0, "H5Dset_extent on chunked dataset with fixed dimensions"); + AddTest("test_dataset_set_extent_data", test_dataset_set_extent_data, NULL, NULL, NULL, 0, + "H5Dset_extent on data correctness"); + AddTest("test_dataset_set_extent_double_handles", test_dataset_set_extent_double_handles, NULL, NULL, + NULL, 0, "H5Dset_extent on double dataset handles"); + AddTest("test_dataset_set_extent_invalid_params", test_dataset_set_extent_invalid_params, NULL, NULL, + NULL, 0, "H5Dset_extent with invalid parameters"); + AddTest("test_flush_dataset", test_flush_dataset, NULL, NULL, NULL, 0, "H5Dflush"); + AddTest("test_flush_dataset_invalid_params", test_flush_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Dflush with invalid parameters"); + AddTest("test_refresh_dataset", test_refresh_dataset, NULL, NULL, NULL, 0, "H5Drefresh"); + AddTest("test_refresh_dataset_invalid_params", test_refresh_dataset_invalid_params, NULL, NULL, NULL, 0, + "H5Drefresh with invalid parameters"); + AddTest("test_create_single_chunk_dataset", test_create_single_chunk_dataset, NULL, NULL, NULL, 0, + "creation of dataset with single chunk"); + AddTest("test_write_single_chunk_dataset", test_write_single_chunk_dataset, NULL, NULL, NULL, 0, + "write to dataset with single chunk"); + AddTest("test_create_multi_chunk_dataset", test_create_multi_chunk_dataset, NULL, NULL, NULL, 0, + "creation of dataset with multiple chunks"); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_read_partial_chunk_all_selection", test_read_partial_chunk_all_selection, NULL, NULL, NULL, + 0, "reading a partial chunk using H5S_ALL for file dataspace"); + AddTest("test_read_partial_chunk_hyperslab_selection", test_read_partial_chunk_hyperslab_selection, NULL, + NULL, NULL, 0, "reading a partial chunk using a hyperslab selection in file dataspace"); + AddTest("test_read_partial_chunk_point_selection", test_read_partial_chunk_point_selection, NULL, NULL, + NULL, 0, "reading a partial chunk using a point selection in file dataspace"); + AddTest("test_get_vlen_buf_size", test_get_vlen_buf_size, NULL, NULL, NULL, 0, "H5Dvlen_get_buf_size"); } diff --git a/test/API/H5_api_dataset_test.h b/test/API/H5_api_dataset_test.h index cb87ae38bcb..2549b6ee540 100644 --- a/test/API/H5_api_dataset_test.h +++ b/test/API/H5_api_dataset_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_dataset_test(void); +void H5_api_dataset_test_add(void); /************************************************ * * diff --git a/test/API/H5_api_datatype_test.c b/test/API/H5_api_datatype_test.c index c788391d05c..968729df33e 100644 --- a/test/API/H5_api_datatype_test.c +++ b/test/API/H5_api_datatype_test.c @@ -17,68 +17,49 @@ */ #define PROBLEMATIC_TESTS -static int test_create_committed_datatype(void); -static int test_create_committed_datatype_invalid_params(void); -static int test_create_anonymous_committed_datatype(void); -static int test_create_anonymous_committed_datatype_invalid_params(void); +static void print_datatype_test_header(const void *params); +static void test_create_committed_datatype(const void *params); +static void test_create_committed_datatype_invalid_params(const void *params); +static void test_create_anonymous_committed_datatype(const void *params); +static void test_create_anonymous_committed_datatype_invalid_params(const void *params); #ifndef PROBLEMATIC_TESTS -static int test_create_committed_datatype_empty_types(void); +static void test_create_committed_datatype_empty_types(const void *params); #endif -static int test_recommit_committed_type(void); -static int test_open_committed_datatype(void); -static int test_open_committed_datatype_invalid_params(void); -static int test_reopen_committed_datatype_indirect(void); -static int test_close_committed_datatype_invalid_id(void); -static int test_datatype_property_lists(void); -static int test_create_dataset_with_committed_type(void); -static int test_create_attribute_with_committed_type(void); -static int test_delete_committed_type(void); -static int test_resurrect_datatype(void); -static int test_flush_committed_datatype(void); -static int test_flush_committed_datatype_invalid_params(void); -static int test_refresh_committed_datatype(void); -static int test_refresh_committed_datatype_invalid_params(void); +static void test_recommit_committed_type(const void *params); +static void test_open_committed_datatype(const void *params); +static void test_open_committed_datatype_invalid_params(const void *params); +static void test_reopen_committed_datatype_indirect(const void *params); +static void test_close_committed_datatype_invalid_id(const void *params); +static void test_datatype_property_lists(const void *params); +static void test_create_dataset_with_committed_type(const void *params); +static void test_create_attribute_with_committed_type(const void *params); +static void test_delete_committed_type(const void *params); +static void test_resurrect_datatype(const void *params); +static void test_flush_committed_datatype(const void *params); +static void test_flush_committed_datatype_invalid_params(const void *params); +static void test_refresh_committed_datatype(const void *params); +static void test_refresh_committed_datatype_invalid_params(const void *params); #ifndef PROBLEMATIC_TESTS -static int test_cant_commit_predefined(void); +static void test_cant_commit_predefined(const void *params); #endif -static int test_cant_modify_committed_type(void); +static void test_cant_modify_committed_type(const void *params); -/* - * The array of datatype tests to be performed. - */ -static int (*datatype_tests[])(void) = { - test_create_committed_datatype, - test_create_committed_datatype_invalid_params, - test_create_anonymous_committed_datatype, - test_create_anonymous_committed_datatype_invalid_params, -#ifndef PROBLEMATIC_TESTS - test_create_committed_datatype_empty_types, -#endif - test_recommit_committed_type, - test_open_committed_datatype, - test_open_committed_datatype_invalid_params, - test_reopen_committed_datatype_indirect, - test_close_committed_datatype_invalid_id, - test_datatype_property_lists, - test_create_dataset_with_committed_type, - test_create_attribute_with_committed_type, - test_delete_committed_type, - test_resurrect_datatype, - test_flush_committed_datatype, - test_flush_committed_datatype_invalid_params, - test_refresh_committed_datatype, - test_refresh_committed_datatype_invalid_params, -#ifndef PROBLEMATIC_TESTS - test_cant_commit_predefined, -#endif - test_cant_modify_committed_type, -}; +static void +print_datatype_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Datatype Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a committed datatype can be created. */ -static int -test_create_committed_datatype(void) +static void +test_create_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -92,7 +73,7 @@ test_create_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -138,7 +119,7 @@ test_create_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -150,15 +131,15 @@ test_create_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't be * created when H5Tcommit2 is passed invalid parameters. */ -static int -test_create_committed_datatype_invalid_params(void) +static void +test_create_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -173,7 +154,7 @@ test_create_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -360,7 +341,7 @@ test_create_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -372,15 +353,15 @@ test_create_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous committed datatype * can be created with H5Tcommit_anon. */ -static int -test_create_anonymous_committed_datatype(void) +static void +test_create_anonymous_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -394,7 +375,7 @@ test_create_anonymous_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -439,7 +420,7 @@ test_create_anonymous_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -451,15 +432,15 @@ test_create_anonymous_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't be * created when H5Tcommit_anon is passed invalid parameters. */ -static int -test_create_anonymous_committed_datatype_invalid_params(void) +static void +test_create_anonymous_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -474,7 +455,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -604,7 +585,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -616,7 +597,7 @@ test_create_anonymous_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -624,8 +605,8 @@ test_create_anonymous_committed_datatype_invalid_params(void) * compound and enum datatypes. */ #ifndef PROBLEMATIC_TESTS -static int -test_create_committed_datatype_empty_types(void) +static void +test_create_committed_datatype_empty_types(const void H5_ATTR_UNUSED *params) { herr_t err_ret = FAIL; hid_t file_id = H5I_INVALID_HID; @@ -640,7 +621,7 @@ test_create_committed_datatype_empty_types(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -791,15 +772,15 @@ test_create_committed_datatype_empty_types(void) } H5E_END_TRY - return 1; + return; } #endif /* * A test to check that a committed datatype can't be re-committed. */ -static int -test_recommit_committed_type(void) +static void +test_recommit_committed_type(const void H5_ATTR_UNUSED *params) { htri_t is_committed = false; herr_t err_ret; @@ -815,7 +796,7 @@ test_recommit_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -886,7 +867,7 @@ test_recommit_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -898,15 +879,15 @@ test_recommit_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype * can be opened using H5Topen2. */ -static int -test_open_committed_datatype(void) +static void +test_open_committed_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -920,7 +901,7 @@ test_open_committed_datatype(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -975,7 +956,7 @@ test_open_committed_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -987,15 +968,15 @@ test_open_committed_datatype(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can't * be opened when H5Topen2 is passed invalid parameters. */ -static int -test_open_committed_datatype_invalid_params(void) +static void +test_open_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1009,7 +990,7 @@ test_open_committed_datatype_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1143,7 +1124,7 @@ test_open_committed_datatype_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1155,15 +1136,15 @@ test_open_committed_datatype_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that open named datatypes can be reopened indirectly * through H5Dget_type without causing problems. */ -static int -test_reopen_committed_datatype_indirect(void) +static void +test_reopen_committed_datatype_indirect(const void H5_ATTR_UNUSED *params) { size_t dt_size = 0; hid_t file_id = H5I_INVALID_HID; @@ -1183,7 +1164,7 @@ test_reopen_committed_datatype_indirect(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1611,7 +1592,7 @@ test_reopen_committed_datatype_indirect(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1627,15 +1608,15 @@ test_reopen_committed_datatype_indirect(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Tclose fails when * it is passed an invalid datatype ID. */ -static int -test_close_committed_datatype_invalid_id(void) +static void +test_close_committed_datatype_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -1647,7 +1628,7 @@ test_close_committed_datatype_invalid_id(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_STORED_DATATYPES)) { SKIPPED(); printf(" API functions for basic file or stored datatype aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1673,7 +1654,7 @@ test_close_committed_datatype_invalid_id(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1682,7 +1663,7 @@ test_close_committed_datatype_invalid_id(void) } H5E_END_TRY - return 1; + return; } /* @@ -1690,8 +1671,8 @@ test_close_committed_datatype_invalid_id(void) * can be persisted and that a valid copy of that TCPL can * be retrieved later with a call to H5Tget_create_plist. */ -static int -test_datatype_property_lists(void) +static void +test_datatype_property_lists(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1706,7 +1687,7 @@ test_datatype_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, stored datatype, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1883,7 +1864,7 @@ test_datatype_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1898,15 +1879,15 @@ test_datatype_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a dataset can be created using * a committed datatype. */ -static int -test_create_dataset_with_committed_type(void) +static void +test_create_dataset_with_committed_type(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1923,7 +1904,7 @@ test_create_dataset_with_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2027,7 +2008,7 @@ test_create_dataset_with_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2041,15 +2022,15 @@ test_create_dataset_with_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an attribute can be created * using a committed datatype. */ -static int -test_create_attribute_with_committed_type(void) +static void +test_create_attribute_with_committed_type(const void H5_ATTR_UNUSED *params) { htri_t attr_exists; hid_t file_id = H5I_INVALID_HID; @@ -2067,7 +2048,7 @@ test_create_attribute_with_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or stored datatype aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2160,7 +2141,7 @@ test_create_attribute_with_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2174,15 +2155,15 @@ test_create_attribute_with_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can * be deleted. */ -static int -test_delete_committed_type(void) +static void +test_delete_committed_type(const void H5_ATTR_UNUSED *params) { htri_t type_exists; hid_t file_id = H5I_INVALID_HID; @@ -2198,7 +2179,7 @@ test_delete_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, attribute, or stored datatype aren't supported " "with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2274,7 +2255,7 @@ test_delete_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2286,15 +2267,15 @@ test_delete_committed_type(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a committed datatype can still be opened when * the link to the datatype is deleted and then a new one is created. */ -static int -test_resurrect_datatype(void) +static void +test_resurrect_datatype(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2310,7 +2291,7 @@ test_resurrect_datatype(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2415,7 +2396,7 @@ test_resurrect_datatype(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2427,47 +2408,47 @@ test_resurrect_datatype(void) } H5E_END_TRY - return 1; + return; } -static int -test_flush_committed_datatype(void) +static void +test_flush_committed_datatype(const void H5_ATTR_UNUSED *params) { TESTING("H5Tflush"); SKIPPED(); - return 0; + return; } -static int -test_flush_committed_datatype_invalid_params(void) +static void +test_flush_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Tflush with invalid parameters"); SKIPPED(); - return 0; + return; } -static int -test_refresh_committed_datatype(void) +static void +test_refresh_committed_datatype(const void H5_ATTR_UNUSED *params) { TESTING("H5Trefresh"); SKIPPED(); - return 0; + return; } -static int -test_refresh_committed_datatype_invalid_params(void) +static void +test_refresh_committed_datatype_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Trefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -2476,8 +2457,8 @@ test_refresh_committed_datatype_invalid_params(void) * copied datatype. */ #ifndef PROBLEMATIC_TESTS -static int -test_cant_commit_predefined(void) +static void +test_cant_commit_predefined(const void H5_ATTR_UNUSED *params) { herr_t err_ret; hid_t file_id = H5I_INVALID_HID; @@ -2492,7 +2473,7 @@ test_cant_commit_predefined(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2536,7 +2517,7 @@ test_cant_commit_predefined(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2547,15 +2528,15 @@ test_cant_commit_predefined(void) } H5E_END_TRY - return 1; + return; } #endif /* * A test to check that a datatype cannot be modified once it has been committed. */ -static int -test_cant_modify_committed_type(void) +static void +test_cant_modify_committed_type(const void H5_ATTR_UNUSED *params) { htri_t is_committed = false; herr_t err_ret; @@ -2572,7 +2553,7 @@ test_cant_modify_committed_type(void) SKIPPED(); printf(" API functions for basic file, group, or stored datatype aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2643,7 +2624,7 @@ test_cant_modify_committed_type(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2655,26 +2636,63 @@ test_cant_modify_committed_type(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_datatype_test(void) +void +H5_api_datatype_test_add(void) { - size_t i; - int nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_datatype_test_header", print_datatype_test_header, NULL, NULL, NULL, 0, + "Prints header for datatype tests"); + + AddTest("test_create_committed_datatype", test_create_committed_datatype, NULL, NULL, NULL, 0, + "creation of a committed datatype"); + AddTest("test_create_committed_datatype_invalid_params", test_create_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Tcommit2 with invalid parameters"); + AddTest("test_create_anonymous_committed_datatype", test_create_anonymous_committed_datatype, NULL, NULL, + NULL, 0, "creation of anonymous committed datatype"); + AddTest("test_create_anonymous_committed_datatype_invalid_params", + test_create_anonymous_committed_datatype_invalid_params, NULL, NULL, NULL, 0, + "H5Tcommit_anon with invalid parameters"); - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Datatype Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); +#ifndef PROBLEMATIC_TESTS + AddTest("test_create_committed_datatype_empty_types", test_create_committed_datatype_empty_types, NULL, + NULL, NULL, 0, "creation of committed datatype with empty types"); +#endif - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(datatype_tests); i++) { - nerrors += (*datatype_tests[i])() ? 1 : 0; - } + AddTest("test_recommit_committed_type", test_recommit_committed_type, NULL, NULL, NULL, 0, + "inability to re-commit a committed datatype"); + AddTest("test_open_committed_datatype", test_open_committed_datatype, NULL, NULL, NULL, 0, "H5Topen2"); + AddTest("test_open_committed_datatype_invalid_params", test_open_committed_datatype_invalid_params, NULL, + NULL, NULL, 0, "H5Topen2 with invalid parameters"); + AddTest("test_reopen_committed_datatype_indirect", test_reopen_committed_datatype_indirect, NULL, NULL, + NULL, 0, "reopening open committed datatypes using H5Dget_type"); + AddTest("test_close_committed_datatype_invalid_id", test_close_committed_datatype_invalid_id, NULL, NULL, + NULL, 0, "H5Tclose with an invalid committed datatype ID"); + AddTest("test_datatype_property_lists", test_datatype_property_lists, NULL, NULL, NULL, 0, + "datatype property list operations"); + AddTest("test_create_dataset_with_committed_type", test_create_dataset_with_committed_type, NULL, NULL, + NULL, 0, "dataset creation with a committed datatype"); + AddTest("test_create_attribute_with_committed_type", test_create_attribute_with_committed_type, NULL, + NULL, NULL, 0, "attribute creation with a committed datatype"); + AddTest("test_delete_committed_type", test_delete_committed_type, NULL, NULL, NULL, 0, + "committed datatype deletion"); + AddTest("test_resurrect_datatype", test_resurrect_datatype, NULL, NULL, NULL, 0, + "resurrecting datatype after deletion"); + AddTest("test_flush_committed_datatype", test_flush_committed_datatype, NULL, NULL, NULL, 0, "H5Tflush"); + AddTest("test_flush_committed_datatype_invalid_params", test_flush_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Tflush with invalid parameters"); + AddTest("test_refresh_committed_datatype", test_refresh_committed_datatype, NULL, NULL, NULL, 0, + "H5Trefresh"); + AddTest("test_refresh_committed_datatype_invalid_params", test_refresh_committed_datatype_invalid_params, + NULL, NULL, NULL, 0, "H5Trefresh with invalid parameters"); - printf("\n"); +#ifndef PROBLEMATIC_TESTS + AddTest("test_cant_commit_predefined", test_cant_commit_predefined, NULL, NULL, NULL, 0, + "inability to commit predefined types directly"); +#endif - return nerrors; + AddTest("test_cant_modify_committed_type", test_cant_modify_committed_type, NULL, NULL, NULL, 0, + "inability to modify a committed datatype"); } diff --git a/test/API/H5_api_datatype_test.h b/test/API/H5_api_datatype_test.h index e35de7904bd..0cb861692b7 100644 --- a/test/API/H5_api_datatype_test.h +++ b/test/API/H5_api_datatype_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_datatype_test(void); +void H5_api_datatype_test_add(void); /************************************************* * * diff --git a/test/API/H5_api_file_test.c b/test/API/H5_api_file_test.c index e7bb632f1ae..bdcb9e8f9a7 100644 --- a/test/API/H5_api_file_test.c +++ b/test/API/H5_api_file_test.c @@ -12,52 +12,41 @@ #include "H5_api_file_test.h" -static int test_create_file(void); -static int test_create_file_invalid_params(void); -static int test_create_file_excl(void); -static int test_open_file(void); -static int test_open_file_invalid_params(void); -static int test_open_nonexistent_file(void); -static int test_file_open_overlap(void); -static int test_file_permission(void); -static int test_reopen_file(void); -static int test_close_file_invalid_id(void); -static int test_flush_file(void); -static int test_file_is_accessible(void); -static int test_file_property_lists(void); -static int test_get_file_intent(void); -static int test_get_file_obj_count(void); -static int test_file_mounts(void); -static int test_get_file_name(void); +static void print_file_test_header(const void *params); +static void test_create_file(const void *params); +static void test_create_file_invalid_params(const void *params); +static void test_create_file_excl(const void *params); +static void test_open_file(const void *params); +static void test_open_file_invalid_params(const void *params); +static void test_open_nonexistent_file(const void *params); +static void test_file_open_overlap(const void *params); +static void test_file_permission(const void *params); +static void test_reopen_file(const void *params); +static void test_close_file_invalid_id(const void *params); +static void test_flush_file(const void *params); +static void test_file_is_accessible(const void *params); +static void test_file_property_lists(const void *params); +static void test_get_file_intent(const void *params); +static void test_get_file_obj_count(const void *params); +static void test_file_mounts(const void *params); +static void test_get_file_name(const void *params); -/* - * The array of file tests to be performed. - */ -static int (*file_tests[])(void) = { - test_create_file, - test_create_file_invalid_params, - test_create_file_excl, - test_open_file, - test_open_file_invalid_params, - test_open_nonexistent_file, - test_file_open_overlap, - test_file_permission, - test_reopen_file, - test_close_file_invalid_id, - test_flush_file, - test_file_is_accessible, - test_file_property_lists, - test_get_file_intent, - test_get_file_obj_count, - test_file_mounts, - test_get_file_name, -}; +static void +print_file_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API File Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * Tests that a file can be created. */ -static int -test_create_file(void) +static void +test_create_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -68,7 +57,7 @@ test_create_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_TEST_FILENAME, &prefixed_filename) < 0) { @@ -85,32 +74,36 @@ test_create_file(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * Tests that a file can't be created when H5Fcreate is passed * invalid parameters. */ -static int -test_create_file_invalid_params(void) +static void +test_create_file_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -121,7 +114,7 @@ test_create_file_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_INVALID_PARAMS_FILE_NAME, &prefixed_filename) < 0) { @@ -239,7 +232,7 @@ test_create_file_invalid_params(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY @@ -253,15 +246,15 @@ test_create_file_invalid_params(void) free(prefixed_filename); - return 1; + return; } /* * Tests that file creation will fail when a file is created * using the H5F_ACC_EXCL flag while the file already exists. */ -static int -test_create_file_excl(void) +static void +test_create_file_excl(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t file_id2 = H5I_INVALID_HID; @@ -273,7 +266,7 @@ test_create_file_excl(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_CREATE_EXCL_FILE_NAME, &prefixed_filename) < 0) { @@ -316,32 +309,36 @@ test_create_file_excl(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * Tests that a file can be opened. */ -static int -test_open_file(void) +static void +test_open_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; @@ -351,7 +348,7 @@ test_open_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -408,7 +405,7 @@ test_open_file(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -417,15 +414,15 @@ test_open_file(void) } H5E_END_TRY - return 1; + return; } /* * Tests that a file can't be opened when H5Fopen is given * invalid parameters. */ -static int -test_open_file_invalid_params(void) +static void +test_open_file_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; @@ -435,7 +432,7 @@ test_open_file_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -510,7 +507,7 @@ test_open_file_invalid_params(void) } END_MULTIPART; - return 0; + return; error: H5E_BEGIN_TRY @@ -519,14 +516,14 @@ test_open_file_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to ensure that opening a file which doesn't exist will fail. */ -static int -test_open_nonexistent_file(void) +static void +test_open_nonexistent_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; char *prefixed_filename = NULL; @@ -537,7 +534,7 @@ test_open_nonexistent_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, NONEXISTENT_FILENAME, &prefixed_filename) < 0) { @@ -546,7 +543,12 @@ test_open_nonexistent_file(void) goto error; } - /* XXX: Make sure to first delete the file so we know for sure it doesn't exist */ + /* Make sure to first delete the file so we know for sure it doesn't exist */ + H5E_BEGIN_TRY + { + H5Fdelete(prefixed_filename, H5P_DEFAULT); + } + H5E_END_TRY; H5E_BEGIN_TRY { @@ -565,7 +567,7 @@ test_open_nonexistent_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -576,15 +578,15 @@ test_open_nonexistent_file(void) free(prefixed_filename); - return 1; + return; } /* * Tests that a file can be opened read-only or read-write * and things are handled appropriately. */ -static int -test_file_permission(void) +static void +test_file_permission(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID; @@ -604,7 +606,7 @@ test_file_permission(void) SKIPPED(); printf(" API functions for basic file, group, dataset, attribute, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -790,13 +792,15 @@ test_file_permission(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -807,19 +811,21 @@ test_file_permission(void) H5Tclose(dtype_id); H5Gclose(group_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that a file can be re-opened with H5Freopen. */ -static int -test_reopen_file(void) +static void +test_reopen_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t file_id2 = H5I_INVALID_HID; @@ -830,7 +836,7 @@ test_reopen_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -852,7 +858,7 @@ test_reopen_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -862,14 +868,14 @@ test_reopen_file(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Fclose doesn't succeed for an * invalid file ID */ -static int -test_close_file_invalid_id(void) +static void +test_close_file_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; @@ -879,7 +885,7 @@ test_close_file_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -896,17 +902,17 @@ test_close_file_invalid_id(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* * A test to check that a file can be flushed using H5Fflush. */ -static int -test_flush_file(void) +static void +test_flush_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t dspace_id = H5I_INVALID_HID; @@ -923,7 +929,7 @@ test_flush_file(void) SKIPPED(); printf(" API functions for basic file, dataset, or file flush aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1001,13 +1007,15 @@ test_flush_file(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1015,19 +1023,21 @@ test_flush_file(void) H5Sclose(dspace_id); H5Dclose(dset_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test for H5Fis_accessible. */ -static int -test_file_is_accessible(void) +static void +test_file_is_accessible(const void H5_ATTR_UNUSED *params) { const char *const fake_filename = "nonexistent_file.h5"; char *prefixed_filename = NULL; @@ -1039,7 +1049,7 @@ test_file_is_accessible(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, fake_filename, &prefixed_filename) < 0) { @@ -1099,12 +1109,12 @@ test_file_is_accessible(void) free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: free(prefixed_filename); - return 1; + return; } /* @@ -1114,8 +1124,8 @@ test_file_is_accessible(void) * tests that a valid copy of a FAPL used for file access * can be retrieved with a call to H5Fget_access_plist. */ -static int -test_file_property_lists(void) +static void +test_file_property_lists(const void H5_ATTR_UNUSED *params) { hsize_t prop_val = 0; hid_t file_id1 = H5I_INVALID_HID; @@ -1135,7 +1145,7 @@ test_file_property_lists(void) SKIPPED(); printf(" API functions for basic or more file or get property list aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1385,6 +1395,10 @@ test_file_property_lists(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1393,7 +1407,7 @@ test_file_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1404,20 +1418,24 @@ test_file_property_lists(void) H5Pclose(fapl_id2); H5Fclose(file_id1); H5Fclose(file_id2); + if (GetTestCleanup()) { + H5Fdelete(prefixed_filename1, H5P_DEFAULT); + H5Fdelete(prefixed_filename2, H5P_DEFAULT); + } } H5E_END_TRY free(prefixed_filename1); free(prefixed_filename2); - return 1; + return; } /* * A test to check that the file intent flags can be retrieved. */ -static int -test_get_file_intent(void) +static void +test_get_file_intent(const void H5_ATTR_UNUSED *params) { unsigned file_intent; hid_t file_id = H5I_INVALID_HID; @@ -1429,7 +1447,7 @@ test_get_file_intent(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { SKIPPED(); printf(" API functions for basic or more file aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1553,29 +1571,34 @@ test_get_file_intent(void) } END_MULTIPART; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; + free(prefixed_filename); prefixed_filename = NULL; - return 0; + return; error: H5E_BEGIN_TRY { H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that the number of open objects and IDs of objects in a file * can be retrieved. */ -static int -test_get_file_obj_count(void) +static void +test_get_file_obj_count(const void H5_ATTR_UNUSED *params) { ssize_t obj_count; hid_t file_id = H5I_INVALID_HID; @@ -1600,7 +1623,7 @@ test_get_file_obj_count(void) printf( " API functions for basic or more file, basic dataset, group, stored datatypes, or attribute " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1886,6 +1909,10 @@ test_get_file_obj_count(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename1, H5P_DEFAULT) < 0) + TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename2, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename1); prefixed_filename1 = NULL; @@ -1894,7 +1921,7 @@ test_get_file_obj_count(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1906,21 +1933,25 @@ test_get_file_obj_count(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) { + H5Fdelete(prefixed_filename1, H5P_DEFAULT); + H5Fdelete(prefixed_filename2, H5P_DEFAULT); + } } H5E_END_TRY free(prefixed_filename1); free(prefixed_filename2); - return 1; + return; } /* * A test to check that opening files in an overlapping way * works correctly. */ -static int -test_file_open_overlap(void) +static void +test_file_open_overlap(const void H5_ATTR_UNUSED *params) { ssize_t obj_count; hid_t file_id = H5I_INVALID_HID; @@ -1938,7 +1969,7 @@ test_file_open_overlap(void) SKIPPED(); printf(" API functions for basic or more file, dataset, or group aren't supported with this " "connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, OVERLAPPING_FILENAME, &prefixed_filename) < 0) { @@ -2029,13 +2060,15 @@ test_file_open_overlap(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2045,20 +2078,22 @@ test_file_open_overlap(void) H5Dclose(dset_id); H5Fclose(file_id); H5Fclose(file_id2); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to check that file mounting and unmounting works * correctly. */ -static int -test_file_mounts(void) +static void +test_file_mounts(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t child_fid = H5I_INVALID_HID; @@ -2073,7 +2108,7 @@ test_file_mounts(void) SKIPPED(); printf(" API functions for basic file, file mount, or basic group aren't supported with this " "connector\n"); - return 0; + return; } if (prefix_filename(test_path_prefix, FILE_MOUNT_TEST_FILENAME, &prefixed_filename) < 0) { @@ -2120,13 +2155,15 @@ test_file_mounts(void) TEST_ERROR; if (H5Fclose(child_fid) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2134,19 +2171,21 @@ test_file_mounts(void) H5Gclose(group_id); H5Fclose(file_id); H5Fclose(child_fid); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; + return; } /* * A test to ensure that a file's name can be retrieved. */ -static int -test_get_file_name(void) +static void +test_get_file_name(const void H5_ATTR_UNUSED *params) { ssize_t file_name_buf_len = 0; hid_t file_id = H5I_INVALID_HID; @@ -2169,7 +2208,7 @@ test_get_file_name(void) printf( " API functions for basic or more file, basic dataset, group, stored datatypes, or attribute " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2463,13 +2502,15 @@ test_get_file_name(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(prefixed_filename, H5P_DEFAULT) < 0) + TEST_ERROR; free(prefixed_filename); prefixed_filename = NULL; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2482,58 +2523,47 @@ test_get_file_name(void) H5Aclose(attr_id); H5Gclose(group_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(prefixed_filename, H5P_DEFAULT); } H5E_END_TRY free(prefixed_filename); - return 1; -} - -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) -{ - remove_test_file(test_path_prefix, FILE_CREATE_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_CREATE_EXCL_FILE_NAME); - - /* The below file should not get created */ - /* remove_test_file(test_path_prefix, FILE_CREATE_INVALID_PARAMS_FILE_NAME); */ - - remove_test_file(test_path_prefix, OVERLAPPING_FILENAME); - remove_test_file(test_path_prefix, FILE_PERMISSION_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_FLUSH_TEST_FILENAME); - remove_test_file(test_path_prefix, FILE_PROPERTY_LIST_TEST_FNAME1); - remove_test_file(test_path_prefix, FILE_PROPERTY_LIST_TEST_FNAME2); - remove_test_file(test_path_prefix, FILE_INTENT_TEST_FILENAME); - remove_test_file(test_path_prefix, GET_OBJ_COUNT_TEST_FILENAME1); - remove_test_file(test_path_prefix, GET_OBJ_COUNT_TEST_FILENAME2); - remove_test_file(test_path_prefix, FILE_MOUNT_TEST_FILENAME); - remove_test_file(test_path_prefix, GET_FILE_NAME_TEST_FNAME); + return; } -int -H5_api_file_test(void) +void +H5_api_file_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API File Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(file_tests); i++) { - nerrors += (*file_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_file_test_header", print_file_test_header, NULL, NULL, NULL, 0, + "Prints header for file tests"); + + AddTest("test_create_file", test_create_file, NULL, NULL, NULL, 0, "H5Fcreate"); + AddTest("test_create_file_invalid_params", test_create_file_invalid_params, NULL, NULL, NULL, 0, + "H5Fcreate with invalid parameters"); + AddTest("test_create_file_excl", test_create_file_excl, NULL, NULL, NULL, 0, + "H5Fcreate with H5F_ACC_EXCL/H5F_ACC_TRUNC flag"); + AddTest("test_open_file", test_open_file, NULL, NULL, NULL, 0, "H5Fopen"); + AddTest("test_open_file_invalid_params", test_open_file_invalid_params, NULL, NULL, NULL, 0, + "H5Fopen with invalid parameters"); + AddTest("test_open_nonexistent_file", test_open_nonexistent_file, NULL, NULL, NULL, 0, + "for invalid opening of a non-existent file"); + AddTest("test_file_open_overlap", test_file_open_overlap, NULL, NULL, NULL, 0, "overlapping file opens"); + AddTest("test_file_permission", test_file_permission, NULL, NULL, NULL, 0, + "file permissions (invalid creation of objects in read-only file)"); + AddTest("test_reopen_file", test_reopen_file, NULL, NULL, NULL, 0, "re-open of a file with H5Freopen"); + AddTest("test_close_file_invalid_id", test_close_file_invalid_id, NULL, NULL, NULL, 0, + "H5Fclose with an invalid ID"); + AddTest("test_flush_file", test_flush_file, NULL, NULL, NULL, 0, "H5Fflush"); + AddTest("test_file_is_accessible", test_file_is_accessible, NULL, NULL, NULL, 0, "H5Fis_accessible"); + AddTest("test_file_property_lists", test_file_property_lists, NULL, NULL, NULL, 0, + "file property list operations"); + AddTest("test_get_file_intent", test_get_file_intent, NULL, NULL, NULL, 0, + "retrieval of file intent with H5Fget_intent"); + AddTest("test_get_file_obj_count", test_get_file_obj_count, NULL, NULL, NULL, 0, + "retrieval of open object number and IDs"); + AddTest("test_file_mounts", test_file_mounts, NULL, NULL, NULL, 0, "file mounting/unmounting"); + AddTest("test_get_file_name", test_get_file_name, NULL, NULL, NULL, 0, "retrieval of file name"); } diff --git a/test/API/H5_api_file_test.h b/test/API/H5_api_file_test.h index 782b27b4941..6fb27671bff 100644 --- a/test/API/H5_api_file_test.h +++ b/test/API/H5_api_file_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_file_test(void); +void H5_api_file_test_add(void); /********************************************* * * diff --git a/test/API/H5_api_group_test.c b/test/API/H5_api_group_test.c index fb7a149db04..ce784e0c04f 100644 --- a/test/API/H5_api_group_test.c +++ b/test/API/H5_api_group_test.c @@ -12,55 +12,43 @@ #include "H5_api_group_test.h" -static int test_create_group_under_root(void); -static int test_create_group_under_existing_group(void); -static int test_create_many_groups(void); -static int test_create_deep_groups(void); -static int test_create_intermediate_group(void); -static int test_create_group_invalid_params(void); -static int test_create_anonymous_group(void); -static int test_create_anonymous_group_invalid_params(void); -static int test_open_nonexistent_group(void); -static int test_open_group_invalid_params(void); -static int test_close_group_invalid_id(void); -static int test_group_property_lists(void); -static int test_get_group_info(void); -static int test_get_group_info_invalid_params(void); -static int test_flush_group(void); -static int test_flush_group_invalid_params(void); -static int test_refresh_group(void); -static int test_refresh_group_invalid_params(void); -static int create_group_recursive(hid_t parent_gid, unsigned counter); - -/* - * The array of group tests to be performed. - */ -static int (*group_tests[])(void) = { - test_create_group_under_root, - test_create_group_under_existing_group, - test_create_many_groups, - test_create_deep_groups, - test_create_intermediate_group, - test_create_group_invalid_params, - test_create_anonymous_group, - test_create_anonymous_group_invalid_params, - test_open_nonexistent_group, - test_open_group_invalid_params, - test_close_group_invalid_id, - test_group_property_lists, - test_get_group_info, - test_get_group_info_invalid_params, - test_flush_group, - test_flush_group_invalid_params, - test_refresh_group, - test_refresh_group_invalid_params, -}; +static void print_group_test_header(const void *params); +static void test_create_group_under_root(const void *params); +static void test_create_group_under_existing_group(const void *params); +static void test_create_many_groups(const void *params); +static void test_create_deep_groups(const void *params); +static void test_create_intermediate_group(const void *params); +static void test_create_group_invalid_params(const void *params); +static void test_create_anonymous_group(const void *params); +static void test_create_anonymous_group_invalid_params(const void *params); +static void test_open_nonexistent_group(const void *params); +static void test_open_group_invalid_params(const void *params); +static void test_close_group_invalid_id(const void *params); +static void test_group_property_lists(const void *params); +static void test_get_group_info(const void *params); +static void test_get_group_info_invalid_params(const void *params); +static void test_flush_group(const void *params); +static void test_flush_group_invalid_params(const void *params); +static void test_refresh_group(const void *params); +static void test_refresh_group_invalid_params(const void *params); +static int create_group_recursive(hid_t parent_gid, unsigned counter); + +static void +print_group_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Group Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a group can be created under the root group. */ -static int -test_create_group_under_root(void) +static void +test_create_group_under_root(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_gid = H5I_INVALID_HID; @@ -71,7 +59,7 @@ test_create_group_under_root(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -95,7 +83,7 @@ test_create_group_under_root(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -105,15 +93,15 @@ test_create_group_under_root(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can be created under an existing * group which is not the root group. */ -static int -test_create_group_under_existing_group(void) +static void +test_create_group_under_existing_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t parent_group_id = H5I_INVALID_HID, child_group_id = H5I_INVALID_HID, @@ -125,7 +113,7 @@ test_create_group_under_existing_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -170,7 +158,7 @@ test_create_group_under_existing_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -182,14 +170,14 @@ test_create_group_under_existing_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to create many (one million) groups */ -static int -test_create_many_groups(void) +static void +test_create_many_groups(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -203,7 +191,7 @@ test_create_many_groups(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -250,7 +238,7 @@ test_create_many_groups(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -262,14 +250,14 @@ test_create_many_groups(void) } H5E_END_TRY - return 1; + return; } /* * A test to create groups of the depth GROUP_DEPTH. */ -static int -test_create_deep_groups(void) +static void +test_create_deep_groups(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -281,7 +269,7 @@ test_create_deep_groups(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -317,7 +305,7 @@ test_create_deep_groups(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -328,7 +316,7 @@ test_create_deep_groups(void) } H5E_END_TRY - return 1; + return; } /* @@ -376,8 +364,8 @@ create_group_recursive(hid_t parent_gid, unsigned counter) /* * A test to create groups automatically using H5Pset_create_intermediate_group */ -static int -test_create_intermediate_group(void) +static void +test_create_intermediate_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -390,7 +378,7 @@ test_create_intermediate_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -506,7 +494,7 @@ test_create_intermediate_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -518,15 +506,15 @@ test_create_intermediate_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can't be created when H5Gcreate * is passed invalid parameters. */ -static int -test_create_group_invalid_params(void) +static void +test_create_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -537,7 +525,7 @@ test_create_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -683,7 +671,7 @@ test_create_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -693,15 +681,15 @@ test_create_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous group can be created with * H5Gcreate_anon. */ -static int -test_create_anonymous_group(void) +static void +test_create_anonymous_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, new_group_id = H5I_INVALID_HID; @@ -712,7 +700,7 @@ test_create_anonymous_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -742,7 +730,7 @@ test_create_anonymous_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -753,15 +741,15 @@ test_create_anonymous_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an anonymous group can't be created * when H5Gcreate_anon is passed invalid parameters. */ -static int -test_create_anonymous_group_invalid_params(void) +static void +test_create_anonymous_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, new_group_id = H5I_INVALID_HID; @@ -772,7 +760,7 @@ test_create_anonymous_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -867,7 +855,7 @@ test_create_anonymous_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -878,15 +866,15 @@ test_create_anonymous_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group which doesn't exist cannot * be opened. */ -static int -test_open_nonexistent_group(void) +static void +test_open_nonexistent_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -897,7 +885,7 @@ test_open_nonexistent_group(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -923,7 +911,7 @@ test_open_nonexistent_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -933,15 +921,15 @@ test_open_nonexistent_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group can't be opened when H5Gopen * is passed invalid parameters. */ -static int -test_open_group_invalid_params(void) +static void +test_open_group_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; @@ -952,7 +940,7 @@ test_open_group_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1052,7 +1040,7 @@ test_open_group_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1062,15 +1050,15 @@ test_open_group_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Gclose doesn't succeed for an * invalid group ID. */ -static int -test_close_group_invalid_id(void) +static void +test_close_group_invalid_id(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; @@ -1080,7 +1068,7 @@ test_close_group_invalid_id(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC)) { SKIPPED(); printf(" API functions for basic group aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -1097,10 +1085,10 @@ test_close_group_invalid_id(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* @@ -1108,8 +1096,8 @@ test_close_group_invalid_id(void) * be persisted and that a valid copy of that GCPL can be * retrieved later with a call to H5Gget_create_plist. */ -static int -test_group_property_lists(void) +static void +test_group_property_lists(const void H5_ATTR_UNUSED *params) { unsigned dummy_prop_val = GROUP_PROPERTY_LIST_TEST_DUMMY_VAL; hid_t file_id = H5I_INVALID_HID; @@ -1125,7 +1113,7 @@ test_group_property_lists(void) SKIPPED(); printf(" API functions for basic file, group, property list, or creation order aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1358,7 +1346,7 @@ test_group_property_lists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1372,14 +1360,14 @@ test_group_property_lists(void) } H5E_END_TRY - return 1; + return; } /* * A test for the functionality of H5Gget_info(_by_idx). */ -static int -test_get_group_info(void) +static void +test_get_group_info(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; unsigned i; @@ -1396,7 +1384,7 @@ test_get_group_info(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE)) { SKIPPED(); printf(" API functions for basic file or group aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1793,7 +1781,7 @@ test_get_group_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1806,15 +1794,15 @@ test_get_group_info(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a group's info can't be retrieved when * H5Gget_info(_by_name/_by_idx) is passed invalid parameters. */ -static int -test_get_group_info_invalid_params(void) +static void +test_get_group_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; herr_t err_ret = -1; @@ -1827,7 +1815,7 @@ test_get_group_info_invalid_params(void) SKIPPED(); printf(" API functions for basic file, or more group aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2154,7 +2142,7 @@ test_get_group_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2163,14 +2151,14 @@ test_get_group_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Gflush. */ -static int -test_flush_group(void) +static void +test_flush_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2184,7 +2172,7 @@ test_flush_group(void) SKIPPED(); printf(" API functions for basic file, group, or flush refresh aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2222,7 +2210,7 @@ test_flush_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2233,15 +2221,15 @@ test_flush_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Gflush fails when it * is passed invalid parameters. */ -static int -test_flush_group_invalid_params(void) +static void +test_flush_group_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -2251,7 +2239,7 @@ test_flush_group_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for group flush aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -2268,17 +2256,17 @@ test_flush_group_invalid_params(void) PASSED(); - return 0; + return; error: - return 1; + return; } /* * A test for H5Grefresh. */ -static int -test_refresh_group(void) +static void +test_refresh_group(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -2292,7 +2280,7 @@ test_refresh_group(void) SKIPPED(); printf(" API functions for basic file, group, or flush refresh aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2330,7 +2318,7 @@ test_refresh_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2341,15 +2329,15 @@ test_refresh_group(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Grefresh fails when it * is passed invalid parameters. */ -static int -test_refresh_group_invalid_params(void) +static void +test_refresh_group_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -2359,7 +2347,7 @@ test_refresh_group_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { SKIPPED(); printf(" API functions for group refresh aren't supported with this connector\n"); - return 0; + return; } H5E_BEGIN_TRY @@ -2376,29 +2364,49 @@ test_refresh_group_invalid_params(void) PASSED(); - return 0; + return; error: - return 1; + return; } -int -H5_api_group_test(void) +void +H5_api_group_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Group Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(group_tests); i++) { - nerrors += (*group_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_group_test_header", print_group_test_header, NULL, NULL, NULL, 0, + "Prints header for group tests"); + + AddTest("test_create_group_under_root", test_create_group_under_root, NULL, NULL, NULL, 0, + "creation of group under the root group"); + AddTest("test_create_group_under_existing_group", test_create_group_under_existing_group, NULL, NULL, + NULL, 0, "creation of group under existing group using a relative path"); + AddTest("test_create_many_groups", test_create_many_groups, NULL, NULL, NULL, 0, "H5Gcreate many groups"); + AddTest("test_create_deep_groups", test_create_deep_groups, NULL, NULL, NULL, 0, + "H5Gcreate groups of great depths"); + AddTest("test_create_intermediate_group", test_create_intermediate_group, NULL, NULL, NULL, 0, + "H5Gcreate group with intermediate group creation"); + AddTest("test_create_group_invalid_params", test_create_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gcreate with invalid parameters"); + AddTest("test_create_anonymous_group", test_create_anonymous_group, NULL, NULL, NULL, 0, + "creation of anonymous group"); + AddTest("test_create_anonymous_group_invalid_params", test_create_anonymous_group_invalid_params, NULL, + NULL, NULL, 0, "H5Gcreate_anon with invalid parameters"); + AddTest("test_open_nonexistent_group", test_open_nonexistent_group, NULL, NULL, NULL, 0, + "for invalid opening of a nonexistent group"); + AddTest("test_open_group_invalid_params", test_open_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gopen with invalid parameters"); + AddTest("test_close_group_invalid_id", test_close_group_invalid_id, NULL, NULL, NULL, 0, + "H5Gclose with an invalid group ID"); + AddTest("test_group_property_lists", test_group_property_lists, NULL, NULL, NULL, 0, + "group property list operations"); + AddTest("test_get_group_info", test_get_group_info, NULL, NULL, NULL, 0, "retrieval of group info"); + AddTest("test_get_group_info_invalid_params", test_get_group_info_invalid_params, NULL, NULL, NULL, 0, + "retrieval of group info with invalid parameters"); + AddTest("test_flush_group", test_flush_group, NULL, NULL, NULL, 0, "H5Gflush"); + AddTest("test_flush_group_invalid_params", test_flush_group_invalid_params, NULL, NULL, NULL, 0, + "H5Gflush with invalid parameters"); + AddTest("test_refresh_group", test_refresh_group, NULL, NULL, NULL, 0, "H5Grefresh"); + AddTest("test_refresh_group_invalid_params", test_refresh_group_invalid_params, NULL, NULL, NULL, 0, + "H5Grefresh with invalid parameters"); } diff --git a/test/API/H5_api_group_test.h b/test/API/H5_api_group_test.h index a60822daa75..6f1f5de2a5b 100644 --- a/test/API/H5_api_group_test.h +++ b/test/API/H5_api_group_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_group_test(void); +void H5_api_group_test_add(void); /********************************************** * * diff --git a/test/API/H5_api_link_test.c b/test/API/H5_api_link_test.c index fe00e1b82a4..25249976a53 100644 --- a/test/API/H5_api_link_test.c +++ b/test/API/H5_api_link_test.c @@ -16,62 +16,63 @@ * TODO: add link tests for short-circuit success in operator callback */ -static int test_create_hard_link(void); -static int test_create_hard_link_long_name(void); -static int test_create_hard_link_many(void); -static int test_create_hard_link_same_loc(void); -static int test_create_hard_link_invalid_params(void); -static int test_create_soft_link_existing_relative(void); -static int test_create_soft_link_existing_absolute(void); -static int test_create_soft_link_dangling_relative(void); -static int test_create_soft_link_dangling_absolute(void); -static int test_create_soft_link_long_name(void); -static int test_create_soft_link_many(void); -static int test_create_soft_link_invalid_params(void); -static int test_create_external_link(void); -static int test_create_external_link_dangling(void); -static int test_create_external_link_multi(void); -static int test_create_external_link_ping_pong(void); -static int test_create_external_link_invalid_params(void); -static int test_create_user_defined_link(void); -static int test_create_user_defined_link_invalid_params(void); -static int test_delete_link(void); -static int test_delete_link_reset_grp_max_crt_order(void); -static int test_delete_link_invalid_params(void); -static int test_copy_link(void); -static int test_copy_links_into_group_with_links(void); -static int test_copy_link_across_files(void); -static int test_copy_link_invalid_params(void); -static int test_move_link(void); -static int test_move_links_into_group_with_links(void); -static int test_move_link_across_files(void); -static int test_move_link_reset_grp_max_crt_order(void); -static int test_move_link_invalid_params(void); -static int test_get_link_val(void); -static int test_get_link_val_invalid_params(void); -static int test_get_link_info(void); -static int test_get_link_info_invalid_params(void); -static int test_get_link_name(void); -static int test_get_link_name_invalid_params(void); -static int test_link_iterate_hard_links(void); -static int test_link_iterate_soft_links(void); -static int test_link_iterate_external_links(void); -static int test_link_iterate_ud_links(void); -static int test_link_iterate_mixed_links(void); -static int test_link_iterate_invalid_params(void); -static int test_link_iterate_0_links(void); -static int test_link_visit_hard_links_no_cycles(void); -static int test_link_visit_soft_links_no_cycles(void); -static int test_link_visit_external_links_no_cycles(void); -static int test_link_visit_ud_links_no_cycles(void); -static int test_link_visit_mixed_links_no_cycles(void); -static int test_link_visit_hard_links_cycles(void); -static int test_link_visit_soft_links_cycles(void); -static int test_link_visit_external_links_cycles(void); -static int test_link_visit_ud_links_cycles(void); -static int test_link_visit_mixed_links_cycles(void); -static int test_link_visit_invalid_params(void); -static int test_link_visit_0_links(void); +static void print_link_test_header(const void *params); +static void test_create_hard_link(const void *params); +static void test_create_hard_link_long_name(const void *params); +static void test_create_hard_link_many(const void *params); +static void test_create_hard_link_same_loc(const void *params); +static void test_create_hard_link_invalid_params(const void *params); +static void test_create_soft_link_existing_relative(const void *params); +static void test_create_soft_link_existing_absolute(const void *params); +static void test_create_soft_link_dangling_relative(const void *params); +static void test_create_soft_link_dangling_absolute(const void *params); +static void test_create_soft_link_long_name(const void *params); +static void test_create_soft_link_many(const void *params); +static void test_create_soft_link_invalid_params(const void *params); +static void test_create_external_link(const void *params); +static void test_create_external_link_dangling(const void *params); +static void test_create_external_link_multi(const void *params); +static void test_create_external_link_ping_pong(const void *params); +static void test_create_external_link_invalid_params(const void *params); +static void test_create_user_defined_link(const void *params); +static void test_create_user_defined_link_invalid_params(const void *params); +static void test_delete_link(const void *params); +static void test_delete_link_reset_grp_max_crt_order(const void *params); +static void test_delete_link_invalid_params(const void *params); +static void test_copy_link(const void *params); +static void test_copy_links_into_group_with_links(const void *params); +static void test_copy_link_across_files(const void *params); +static void test_copy_link_invalid_params(const void *params); +static void test_move_link(const void *params); +static void test_move_links_into_group_with_links(const void *params); +static void test_move_link_across_files(const void *params); +static void test_move_link_reset_grp_max_crt_order(const void *params); +static void test_move_link_invalid_params(const void *params); +static void test_get_link_val(const void *params); +static void test_get_link_val_invalid_params(const void *params); +static void test_get_link_info(const void *params); +static void test_get_link_info_invalid_params(const void *params); +static void test_get_link_name(const void *params); +static void test_get_link_name_invalid_params(const void *params); +static void test_link_iterate_hard_links(const void *params); +static void test_link_iterate_soft_links(const void *params); +static void test_link_iterate_external_links(const void *params); +static void test_link_iterate_ud_links(const void *params); +static void test_link_iterate_mixed_links(const void *params); +static void test_link_iterate_invalid_params(const void *params); +static void test_link_iterate_0_links(const void *params); +static void test_link_visit_hard_links_no_cycles(const void *params); +static void test_link_visit_soft_links_no_cycles(const void *params); +static void test_link_visit_external_links_no_cycles(const void *params); +static void test_link_visit_ud_links_no_cycles(const void *params); +static void test_link_visit_mixed_links_no_cycles(const void *params); +static void test_link_visit_hard_links_cycles(const void *params); +static void test_link_visit_soft_links_cycles(const void *params); +static void test_link_visit_external_links_cycles(const void *params); +static void test_link_visit_ud_links_cycles(const void *params); +static void test_link_visit_mixed_links_cycles(const void *params); +static void test_link_visit_invalid_params(const void *params); +static void test_link_visit_0_links(const void *params); static herr_t link_iter_hard_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, void *op_data); @@ -106,74 +107,23 @@ static herr_t link_visit_invalid_params_cb(hid_t group_id, const char *name, con void *op_data); static herr_t link_visit_0_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, void *op_data); -/* - * The array of link tests to be performed. - */ -static int (*link_tests[])(void) = { - test_create_hard_link, - test_create_hard_link_long_name, - test_create_hard_link_many, - test_create_hard_link_same_loc, - test_create_hard_link_invalid_params, - test_create_soft_link_existing_relative, - test_create_soft_link_existing_absolute, - test_create_soft_link_dangling_relative, - test_create_soft_link_dangling_absolute, - test_create_soft_link_long_name, - test_create_soft_link_many, - test_create_soft_link_invalid_params, - test_create_external_link, - test_create_external_link_dangling, - test_create_external_link_multi, - test_create_external_link_ping_pong, - test_create_external_link_invalid_params, - test_create_user_defined_link, - test_create_user_defined_link_invalid_params, - test_delete_link, - test_delete_link_reset_grp_max_crt_order, - test_delete_link_invalid_params, - test_copy_link, - test_copy_links_into_group_with_links, - test_copy_link_across_files, - test_copy_link_invalid_params, - test_move_link, - test_move_links_into_group_with_links, - test_move_link_across_files, - test_move_link_reset_grp_max_crt_order, - test_move_link_invalid_params, - test_get_link_val, - test_get_link_val_invalid_params, - test_get_link_info, - test_get_link_info_invalid_params, - test_get_link_name, - test_get_link_name_invalid_params, - test_link_iterate_hard_links, - test_link_iterate_soft_links, - test_link_iterate_external_links, - test_link_iterate_ud_links, - test_link_iterate_mixed_links, - test_link_iterate_invalid_params, - test_link_iterate_0_links, - test_link_visit_hard_links_no_cycles, - test_link_visit_soft_links_no_cycles, - test_link_visit_external_links_no_cycles, - test_link_visit_ud_links_no_cycles, - test_link_visit_mixed_links_no_cycles, - test_link_visit_hard_links_cycles, - test_link_visit_soft_links_cycles, - test_link_visit_external_links_cycles, - test_link_visit_ud_links_cycles, - test_link_visit_mixed_links_cycles, - test_link_visit_invalid_params, - test_link_visit_0_links, -}; +static void +print_link_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Link Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that a hard link can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link(void) +static void +test_create_hard_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -187,7 +137,7 @@ test_create_hard_link(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -237,7 +187,7 @@ test_create_hard_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -248,15 +198,15 @@ test_create_hard_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a hard link with a long name can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link_long_name(void) +static void +test_create_hard_link_long_name(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -274,7 +224,7 @@ test_create_hard_link_long_name(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -302,10 +252,6 @@ test_create_hard_link_long_name(void) goto error; } - /** for DAOS VOL, max link name supported is 99 (Lexical key) */ - if (strcmp(vol_name, "daos") == 0) - name_len = 99; - /* Construct very long file name */ if ((objname = (char *)malloc((size_t)(name_len + 1))) == NULL) TEST_ERROR; @@ -346,7 +292,7 @@ test_create_hard_link_long_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -360,15 +306,15 @@ test_create_hard_link_long_name(void) if (objname) free(objname); - return 1; + return; } /* * A test to check that many hard links can be created * using H5Lcreate_hard. */ -static int -test_create_hard_link_many(void) +static void +test_create_hard_link_many(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -385,7 +331,7 @@ test_create_hard_link_many(void) SKIPPED(); printf( " API functions for basic file, group, or hard link aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -545,7 +491,7 @@ test_create_hard_link_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -557,15 +503,15 @@ test_create_hard_link_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that behavior is correct when using * the H5L_SAME_LOC macro for H5Lcreate_hard(). */ -static int -test_create_hard_link_same_loc(void) +static void +test_create_hard_link_same_loc(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -579,7 +525,7 @@ test_create_hard_link_same_loc(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -677,7 +623,7 @@ test_create_hard_link_same_loc(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -688,22 +634,22 @@ test_create_hard_link_same_loc(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a hard link can't be created when * H5Lcreate_hard is passed invalid parameters. */ -static int -test_create_hard_link_invalid_params(void) +static void +test_create_hard_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("hard link creation with invalid parameters"); @@ -713,7 +659,7 @@ test_create_hard_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -951,6 +897,12 @@ test_create_hard_link_invalid_params(void) PART_ERROR(H5Lcreate_hard_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcreate_hard_across_files); + } + PASSED(); } PART_END(H5Lcreate_hard_across_files); @@ -993,7 +945,7 @@ test_create_hard_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1002,18 +954,19 @@ test_create_hard_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* test_create_hard_link_invalid_params */ /* * A test to check that a soft link, which points to an * existing object with a relative path, can be created. */ -static int -test_create_soft_link_existing_relative(void) +static void +test_create_soft_link_existing_relative(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1028,7 +981,7 @@ test_create_soft_link_existing_relative(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1100,7 +1053,7 @@ test_create_soft_link_existing_relative(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1112,15 +1065,15 @@ test_create_soft_link_existing_relative(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link, which points to an * existing object using an absolute path, can be created. */ -static int -test_create_soft_link_existing_absolute(void) +static void +test_create_soft_link_existing_absolute(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1134,7 +1087,7 @@ test_create_soft_link_existing_absolute(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1195,7 +1148,7 @@ test_create_soft_link_existing_absolute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1207,7 +1160,7 @@ test_create_soft_link_existing_absolute(void) } H5E_END_TRY - return 1; + return; } /* @@ -1215,8 +1168,8 @@ test_create_soft_link_existing_absolute(void) * an object that doesn't exist by using a relative * path, can be created. */ -static int -test_create_soft_link_dangling_relative(void) +static void +test_create_soft_link_dangling_relative(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1231,7 +1184,7 @@ test_create_soft_link_dangling_relative(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1316,7 +1269,7 @@ test_create_soft_link_dangling_relative(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1328,7 +1281,7 @@ test_create_soft_link_dangling_relative(void) } H5E_END_TRY - return 1; + return; } /* @@ -1336,8 +1289,8 @@ test_create_soft_link_dangling_relative(void) * object that doesn't exist by using an absolute path, * can be created. */ -static int -test_create_soft_link_dangling_absolute(void) +static void +test_create_soft_link_dangling_absolute(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1352,7 +1305,7 @@ test_create_soft_link_dangling_absolute(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1438,7 +1391,7 @@ test_create_soft_link_dangling_absolute(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1450,15 +1403,15 @@ test_create_soft_link_dangling_absolute(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link with a long name can be created * using H5Lcreate_soft. */ -static int -test_create_soft_link_long_name(void) +static void +test_create_soft_link_long_name(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -1476,7 +1429,7 @@ test_create_soft_link_long_name(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1504,10 +1457,6 @@ test_create_soft_link_long_name(void) goto error; } - /** for DAOS VOL, max link name supported is 99 (Lexical key) */ - if (strcmp(vol_name, "daos") == 0) - name_len = 99; - /* Construct very long file name */ if ((objname = (char *)malloc((size_t)(name_len + 1))) == NULL) TEST_ERROR; @@ -1548,7 +1497,7 @@ test_create_soft_link_long_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1562,15 +1511,15 @@ test_create_soft_link_long_name(void) if (objname) free(objname); - return 1; + return; } /* * A test to check that many soft links can be created * using H5Lcreate_soft. */ -static int -test_create_soft_link_many(void) +static void +test_create_soft_link_many(const void H5_ATTR_UNUSED *params) { htri_t link_exists = FAIL; bool valid_name_matched = false; @@ -1588,7 +1537,7 @@ test_create_soft_link_many(void) SKIPPED(); printf(" API functions for basic file, group, link, or soft link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -1758,7 +1707,7 @@ test_create_soft_link_many(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1770,15 +1719,15 @@ test_create_soft_link_many(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft link can't be created * when H5Lcreate_soft is passed invalid parameters. */ -static int -test_create_soft_link_invalid_params(void) +static void +test_create_soft_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; @@ -1793,7 +1742,7 @@ test_create_soft_link_invalid_params(void) SKIPPED(); printf( " API functions for basic file, group, or soft link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1993,7 +1942,7 @@ test_create_soft_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2004,21 +1953,21 @@ test_create_soft_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link can be created * using H5Lcreate_external. */ -static int -test_create_external_link(void) +static void +test_create_external_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t root_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t root_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING("external link creation to existing object"); @@ -2028,7 +1977,7 @@ test_create_external_link(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2097,10 +2046,12 @@ test_create_external_link(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2109,10 +2060,11 @@ test_create_external_link(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -2120,14 +2072,14 @@ test_create_external_link(void) * object that doesn't exist by using an absolute path, can * be created. */ -static int -test_create_external_link_dangling(void) +static void +test_create_external_link_dangling(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t object_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t object_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING("dangling external link creation"); @@ -2137,7 +2089,7 @@ test_create_external_link_dangling(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } snprintf(ext_link_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2230,10 +2182,12 @@ test_create_external_link_dangling(void) TEST_ERROR; if (H5Fclose(ext_file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2243,26 +2197,27 @@ test_create_external_link_dangling(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(ext_file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link to an object * that crosses several files using H5Lcreate_external. */ -static int -test_create_external_link_multi(void) +static void +test_create_external_link_multi(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t group_id2 = H5I_INVALID_HID, group_id3 = H5I_INVALID_HID; - hid_t root_id = H5I_INVALID_HID; - char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename3[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t root_id = H5I_INVALID_HID; + char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename3[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; char objname[EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE]; TESTING_MULTIPART("external link creation to an object across several files"); @@ -2273,7 +2228,7 @@ test_create_external_link_multi(void) SKIPPED(); printf(" API functions for basic file, group, or external link aren't supported with this " "connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -2596,7 +2551,14 @@ test_create_external_link_multi(void) } END_MULTIPART; - return 0; + if (remove_test_file(NULL, ext_link_filename1) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename2) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename3) < 0) + TEST_ERROR; + + return; error: H5E_BEGIN_TRY @@ -2607,10 +2569,13 @@ test_create_external_link_multi(void) H5Gclose(group_id3); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename1); + remove_test_file(NULL, ext_link_filename2); + remove_test_file(NULL, ext_link_filename3); } H5E_END_TRY - return 1; + return; } /* @@ -2624,15 +2589,15 @@ test_create_external_link_multi(void) * file1:/link5 -> file2: /link6 * file2:/link6 -> file1: /final */ -static int -test_create_external_link_ping_pong(void) +static void +test_create_external_link_ping_pong(const void H5_ATTR_UNUSED *params) { - hid_t file_id = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t group_id2 = H5I_INVALID_HID; - bool valid_name_matched = false; - char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH]; - char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t file_id = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t group_id2 = H5I_INVALID_HID; + bool valid_name_matched = false; + char ext_link_filename1[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + char ext_link_filename2[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; char objname[EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE]; TESTING_MULTIPART("external link creation to an object in ping pong style"); @@ -2643,7 +2608,7 @@ test_create_external_link_ping_pong(void) SKIPPED(); printf(" API functions for basic file, group, or external link aren't supported with this " "connector\n"); - return 0; + return; } snprintf(ext_link_filename1, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix, @@ -2884,7 +2849,12 @@ test_create_external_link_ping_pong(void) } END_MULTIPART; - return 0; + if (remove_test_file(NULL, ext_link_filename1) < 0) + TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename2) < 0) + TEST_ERROR; + + return; error: H5E_BEGIN_TRY @@ -2892,24 +2862,26 @@ test_create_external_link_ping_pong(void) H5Gclose(group_id); H5Gclose(group_id2); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename1); + remove_test_file(NULL, ext_link_filename2); } H5E_END_TRY - return 1; + return; } /* * A test to check that an external link can't be created * when H5Lcreate_external is passed invalid parameters. */ -static int -test_create_external_link_invalid_params(void) +static void +test_create_external_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("H5Lcreate_external with invalid parameters"); @@ -2919,7 +2891,7 @@ test_create_external_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or external link aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3170,10 +3142,12 @@ test_create_external_link_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3181,17 +3155,18 @@ test_create_external_link_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a user-defined link can be created. */ -static int -test_create_user_defined_link(void) +static void +test_create_user_defined_link(const void H5_ATTR_UNUSED *params) { ssize_t udata_size; htri_t link_exists; @@ -3208,7 +3183,7 @@ test_create_user_defined_link(void) printf( " API functions for basic file, group, link, or user-defined link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -3262,7 +3237,7 @@ test_create_user_defined_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3273,15 +3248,15 @@ test_create_user_defined_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lcreate_ud fails when * it is given invalid parameters. */ -static int -test_create_user_defined_link_invalid_params(void) +static void +test_create_user_defined_link_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t udata_size; htri_t link_exists; @@ -3298,7 +3273,7 @@ test_create_user_defined_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or user-defined link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3510,7 +3485,7 @@ test_create_user_defined_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3521,23 +3496,23 @@ test_create_user_defined_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be deleted * using H5Ldelete and H5Ldelete_by_idx. */ -static int -test_delete_link(void) +static void +test_delete_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t nested_grp_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t nested_grp_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link deletion"); @@ -3549,7 +3524,7 @@ test_delete_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3885,6 +3860,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_external); + } + PASSED(); } PART_END(H5Ldelete_external); @@ -6091,6 +6072,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_crt_order_increasing); @@ -6379,6 +6366,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_crt_order_decreasing); @@ -6661,6 +6654,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_name_order_increasing); @@ -6943,6 +6942,12 @@ test_delete_link(void) PART_ERROR(H5Ldelete_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Ldelete_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Ldelete_by_idx_external_name_order_decreasing); @@ -7043,7 +7048,7 @@ test_delete_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7054,10 +7059,11 @@ test_delete_link(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -7065,8 +7071,8 @@ test_delete_link(void) * maximum link creation order value gets reset once * all the links have been deleted from the group. */ -static int -test_delete_link_reset_grp_max_crt_order(void) +static void +test_delete_link_reset_grp_max_crt_order(const void H5_ATTR_UNUSED *params) { H5G_info_t grp_info; size_t i; @@ -7085,7 +7091,7 @@ test_delete_link_reset_grp_max_crt_order(void) SKIPPED(); printf(" API functions for basic file, group, link, or creation order " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7300,7 +7306,7 @@ test_delete_link_reset_grp_max_crt_order(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7313,11 +7319,11 @@ test_delete_link_reset_grp_max_crt_order(void) } H5E_END_TRY - return 1; + return; } -static int -test_delete_link_invalid_params(void) +static void +test_delete_link_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t link_exists; herr_t err_ret = -1; @@ -7333,7 +7339,7 @@ test_delete_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, flag by index, or hard link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -7629,7 +7635,7 @@ test_delete_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7640,20 +7646,20 @@ test_delete_link_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be copied using H5Lcopy. */ -static int -test_copy_link(void) +static void +test_copy_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link copying"); @@ -7665,7 +7671,7 @@ test_copy_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -8481,6 +8487,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_no_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_no_check); + } + PASSED(); } PART_END(H5Lcopy_external_no_check); @@ -8692,6 +8704,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_check); + } + PASSED(); } PART_END(H5Lcopy_external_check); @@ -8835,6 +8853,12 @@ test_copy_link(void) PART_ERROR(H5Lcopy_external_same_loc); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_external_same_loc); + } + PASSED(); } PART_END(H5Lcopy_external_same_loc); @@ -8896,7 +8920,7 @@ test_copy_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8907,10 +8931,11 @@ test_copy_link(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -8922,14 +8947,14 @@ test_copy_link(void) * H5Lcopy might cause a group to have two links with the same * creation order values. */ -static int -test_copy_links_into_group_with_links(void) +static void +test_copy_links_into_group_with_links(const void H5_ATTR_UNUSED *params) { TESTING("H5Lcopy adjusting creation order values for copied links"); SKIPPED(); - return 1; + return; } /* @@ -8941,8 +8966,8 @@ test_copy_links_into_group_with_links(void) * copied links retain the properties of the original * links. */ -static int -test_copy_link_across_files(void) +static void +test_copy_link_across_files(const void H5_ATTR_UNUSED *params) { TESTING("link copying across files"); @@ -8950,23 +8975,23 @@ test_copy_link_across_files(void) SKIPPED(); - return 0; + return; } /* * A test to check that a link can't be copied * when H5Lcopy is passed invalid parameters. */ -static int -test_copy_link_invalid_params(void) +static void +test_copy_link_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("H5Lcopy with invalid parameters"); @@ -8977,7 +9002,7 @@ test_copy_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard links aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -9254,6 +9279,12 @@ test_copy_link_invalid_params(void) PART_ERROR(H5Lcopy_invalid_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lcopy_invalid_across_files); + } + PASSED(); } PART_END(H5Lcopy_invalid_across_files); @@ -9275,7 +9306,7 @@ test_copy_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -9286,24 +9317,25 @@ test_copy_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link can be moved with H5Lmove. */ -static int -test_move_link(void) +static void +test_move_link(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("link moving"); @@ -9315,7 +9347,7 @@ test_move_link(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, or external link aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -10289,6 +10321,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_no_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_no_check); + } + PASSED(); } PART_END(H5Lmove_external_no_check); @@ -10500,6 +10538,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_check); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_check); + } + PASSED(); } PART_END(H5Lmove_external_check); @@ -10639,6 +10683,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_same_loc); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_same_loc); + } + PASSED(); } PART_END(H5Lmove_external_same_loc); @@ -10741,6 +10791,12 @@ test_move_link(void) PART_ERROR(H5Lmove_external_rename); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_external_rename); + } + PASSED(); } PART_END(H5Lmove_external_rename); @@ -10813,7 +10869,7 @@ test_move_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -10824,10 +10880,11 @@ test_move_link(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(ext_file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -10839,8 +10896,8 @@ test_move_link(void) * H5Lmove might cause a group to have two links with the same * creation order values. */ -static int -test_move_links_into_group_with_links(void) +static void +test_move_links_into_group_with_links(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; size_t i; @@ -10859,7 +10916,7 @@ test_move_links_into_group_with_links(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or creation order aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11000,7 +11057,7 @@ test_move_links_into_group_with_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11014,7 +11071,7 @@ test_move_links_into_group_with_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -11025,8 +11082,8 @@ test_move_links_into_group_with_links(void) * TODO: Ideally, tests should be written to verify that the * moved links retain their original properties. */ -static int -test_move_link_across_files(void) +static void +test_move_link_across_files(const void H5_ATTR_UNUSED *params) { TESTING("link moving across files"); @@ -11034,7 +11091,7 @@ test_move_link_across_files(void) SKIPPED(); - return 0; + return; } /* @@ -11042,8 +11099,8 @@ test_move_link_across_files(void) * maximum link creation order value gets reset once * all the links have been moved out of the group. */ -static int -test_move_link_reset_grp_max_crt_order(void) +static void +test_move_link_reset_grp_max_crt_order(const void H5_ATTR_UNUSED *params) { H5G_info_t grp_info; size_t i; @@ -11062,7 +11119,7 @@ test_move_link_reset_grp_max_crt_order(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or creation order aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -11204,7 +11261,7 @@ test_move_link_reset_grp_max_crt_order(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11218,23 +11275,23 @@ test_move_link_reset_grp_max_crt_order(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lmove fails when it is given * invalid parameters. */ -static int -test_move_link_invalid_params(void) +static void +test_move_link_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t link_exists; herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t src_grp_id = H5I_INVALID_HID, dst_grp_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; - hid_t ext_file_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; + hid_t ext_file_id = H5I_INVALID_HID; TESTING_MULTIPART("H5Lmove with invalid parameters"); @@ -11244,7 +11301,7 @@ test_move_link_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11584,6 +11641,12 @@ test_move_link_invalid_params(void) PART_ERROR(H5Lmove_across_files); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lmove_across_files); + } + PASSED(); } PART_END(H5Lmove_across_files); @@ -11605,7 +11668,7 @@ test_move_link_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -11616,18 +11679,19 @@ test_move_link_invalid_params(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft or external link's value can * be retrieved by using H5Lget_val and H5Lget_val_by_idx. */ -static int -test_get_link_val(void) +static void +test_get_link_val(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; const char *ext_link_filepath; @@ -11638,9 +11702,9 @@ test_get_link_val(void) char link_val_buf[GET_LINK_VAL_TEST_LINK_VAL_BUF_SIZE]; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link value retrieval"); @@ -11651,7 +11715,7 @@ test_get_link_val(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or creation " "order aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -11869,6 +11933,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_external); + } + PASSED(); } PART_END(H5Lget_val_external); @@ -12901,6 +12971,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_crt_order_increasing); @@ -13151,6 +13227,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_crt_order_decreasing); @@ -13395,6 +13477,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_name_order_increasing); @@ -13639,6 +13727,12 @@ test_get_link_val(void) PART_ERROR(H5Lget_val_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_val_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_val_by_idx_external_name_order_decreasing); @@ -13731,7 +13825,7 @@ test_get_link_val(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -13742,18 +13836,19 @@ test_get_link_val(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a soft or external link's value can't be * retrieved when H5Lget_val(_by_idx) is passed invalid parameters. */ -static int -test_get_link_val_invalid_params(void) +static void +test_get_link_val_invalid_params(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; htri_t link_exists; @@ -13773,7 +13868,7 @@ test_get_link_val_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or creation " "order aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -14078,7 +14173,7 @@ test_get_link_val_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -14092,15 +14187,15 @@ test_get_link_val_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check the functionality of H5Lget_info2 and * H5Lget_info_by_idx2. */ -static int -test_get_link_info(void) +static void +test_get_link_info(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; const char *ext_objname = "/"; @@ -14108,9 +14203,9 @@ test_get_link_info(void) size_t link_val_size; hid_t file_id = H5I_INVALID_HID, ext_file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link info retrieval"); @@ -14122,7 +14217,7 @@ test_get_link_info(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -14401,6 +14496,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_external); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_external); + } + PASSED(); } PART_END(H5Lget_info_external); @@ -16071,6 +16172,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_crt_order_increasing); @@ -16275,6 +16382,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_crt_order_decreasing); @@ -16479,6 +16592,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_name_order_increasing); @@ -16683,6 +16802,12 @@ test_get_link_info(void) PART_ERROR(H5Lget_info_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_info_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_info_by_idx_external_name_order_decreasing); @@ -16775,7 +16900,7 @@ test_get_link_info(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -16786,18 +16911,19 @@ test_get_link_info(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's info can't be retrieved * when H5Lget_info(_by_idx)2 is passed invalid parameters. */ -static int -test_get_link_info_invalid_params(void) +static void +test_get_link_info_invalid_params(const void H5_ATTR_UNUSED *params) { H5L_info2_t link_info; herr_t err_ret = -1; @@ -16815,7 +16941,7 @@ test_get_link_info_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, or hard link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -17109,7 +17235,7 @@ test_get_link_info_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -17121,15 +17247,15 @@ test_get_link_info_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's name can be correctly * retrieved by using H5Lget_name_by_idx. */ -static int -test_get_link_name(void) +static void +test_get_link_name(const void H5_ATTR_UNUSED *params) { ssize_t link_name_buf_size = 0; htri_t link_exists; @@ -17138,7 +17264,7 @@ test_get_link_name(void) hid_t subgroup_id = H5I_INVALID_HID; hid_t gcpl_id = H5I_INVALID_HID; char link_name_buf[GET_LINK_NAME_TEST_BUF_SIZE]; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link name retrieval"); @@ -17150,7 +17276,7 @@ test_get_link_name(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -18688,6 +18814,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_crt_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_crt_order_increasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_crt_order_increasing); @@ -18877,6 +19009,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_crt_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_crt_order_decreasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_crt_order_decreasing); @@ -19060,6 +19198,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_name_order_increasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_name_order_increasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_name_order_increasing); @@ -19243,6 +19387,12 @@ test_get_link_name(void) PART_ERROR(H5Lget_name_by_idx_external_name_order_decreasing); } + if (remove_test_file(NULL, ext_link_filename) < 0) { + H5_FAILED(); + printf(" failed to delete external file '%s'\n", ext_link_filename); + PART_ERROR(H5Lget_name_by_idx_external_name_order_decreasing); + } + PASSED(); } PART_END(H5Lget_name_by_idx_external_name_order_decreasing); @@ -19343,7 +19493,7 @@ test_get_link_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -19354,18 +19504,19 @@ test_get_link_name(void) H5Gclose(container_group); H5Fclose(ext_file_id); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that a link's name can't be retrieved * when H5Lget_name_by_idx is passed invalid parameters. */ -static int -test_get_link_name_invalid_params(void) +static void +test_get_link_name_invalid_params(const void H5_ATTR_UNUSED *params) { ssize_t ret; htri_t link_exists; @@ -19385,7 +19536,7 @@ test_get_link_name_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, hard link, or external link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -19607,7 +19758,7 @@ test_get_link_name_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -19620,7 +19771,7 @@ test_get_link_name_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* @@ -19630,8 +19781,8 @@ test_get_link_name_invalid_params(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_hard_links(void) +static void +test_link_iterate_hard_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -19651,7 +19802,7 @@ test_link_iterate_hard_links(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, or iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -19986,7 +20137,7 @@ test_link_iterate_hard_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20001,7 +20152,7 @@ test_link_iterate_hard_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -20011,8 +20162,8 @@ test_link_iterate_hard_links(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_soft_links(void) +static void +test_link_iterate_soft_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -20029,7 +20180,7 @@ test_link_iterate_soft_links(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -20342,7 +20493,7 @@ test_link_iterate_soft_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20354,7 +20505,7 @@ test_link_iterate_soft_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -20364,15 +20515,15 @@ test_link_iterate_soft_links(void) * increasing and decreasing order of both link * name and link creation order. */ -static int -test_link_iterate_external_links(void) +static void +test_link_iterate_external_links(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration (only external links)"); @@ -20383,7 +20534,7 @@ test_link_iterate_external_links(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -20738,10 +20889,12 @@ test_link_iterate_external_links(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -20750,10 +20903,11 @@ test_link_iterate_external_links(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -20766,14 +20920,14 @@ test_link_iterate_external_links(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_iterate_ud_links(void) +static void +test_link_iterate_ud_links(const void H5_ATTR_UNUSED *params) { TESTING("link iteration (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -20790,8 +20944,8 @@ test_link_iterate_ud_links(void) * * TODO refactor link saving portion into its own test */ -static int -test_link_iterate_mixed_links(void) +static void +test_link_iterate_mixed_links(const void H5_ATTR_UNUSED *params) { hsize_t saved_idx; size_t i; @@ -20803,7 +20957,7 @@ test_link_iterate_mixed_links(void) hid_t dset_dtype = H5I_INVALID_HID; hid_t dset_dspace = H5I_INVALID_HID; int halted; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration (mixed link types)"); @@ -20814,7 +20968,7 @@ test_link_iterate_mixed_links(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21300,10 +21454,12 @@ test_link_iterate_mixed_links(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21315,29 +21471,30 @@ test_link_iterate_mixed_links(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Literate(_by_name)2 fails * when given invalid parameters. */ -static int -test_link_iterate_invalid_params(void) +static void +test_link_iterate_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; size_t i; htri_t link_exists; - hid_t file_id = H5I_INVALID_HID; - hid_t container_group = H5I_INVALID_HID; - hid_t group_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t dset_dspace = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t file_id = H5I_INVALID_HID; + hid_t container_group = H5I_INVALID_HID; + hid_t group_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t dset_dspace = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link iteration with invalid parameters"); @@ -21349,7 +21506,7 @@ test_link_iterate_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21711,10 +21868,12 @@ test_link_iterate_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21725,18 +21884,19 @@ test_link_iterate_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that link iteration performed on a * group with no links in it is not problematic. */ -static int -test_link_iterate_0_links(void) +static void +test_link_iterate_0_links(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -21750,7 +21910,7 @@ test_link_iterate_0_links(void) SKIPPED(); printf(" API functions for basic file, group, or iterate aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -21954,7 +22114,7 @@ test_link_iterate_0_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -21966,7 +22126,7 @@ test_link_iterate_0_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -21977,8 +22137,8 @@ test_link_iterate_0_links(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_hard_links_no_cycles(void) +static void +test_link_visit_hard_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -21998,7 +22158,7 @@ test_link_visit_hard_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or link iterate aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -22350,7 +22510,7 @@ test_link_visit_hard_links_no_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -22366,7 +22526,7 @@ test_link_visit_hard_links_no_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -22377,8 +22537,8 @@ test_link_visit_hard_links_no_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_soft_links_no_cycles(void) +static void +test_link_visit_soft_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -22396,7 +22556,7 @@ test_link_visit_soft_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -22733,7 +22893,7 @@ test_link_visit_soft_links_no_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -22746,7 +22906,7 @@ test_link_visit_soft_links_no_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -22757,16 +22917,16 @@ test_link_visit_soft_links_no_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_external_links_no_cycles(void) +static void +test_link_visit_external_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; - hid_t subgroup_id = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t subgroup_id = H5I_INVALID_HID; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting without cycles (only external links)"); @@ -22777,7 +22937,7 @@ test_link_visit_external_links_no_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -23125,10 +23285,12 @@ test_link_visit_external_links_no_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -23138,10 +23300,11 @@ test_link_visit_external_links_no_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -23155,14 +23318,14 @@ test_link_visit_external_links_no_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_ud_links_no_cycles(void) +static void +test_link_visit_ud_links_no_cycles(const void H5_ATTR_UNUSED *params) { TESTING("link visiting without cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -23180,19 +23343,19 @@ test_link_visit_ud_links_no_cycles(void) * * TODO refactor test to create a macroed number of subgroups */ -static int -test_link_visit_mixed_links_no_cycles(void) +static void +test_link_visit_mixed_links_no_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting without cycles (mixed link types)"); @@ -23206,7 +23369,7 @@ test_link_visit_mixed_links_no_cycles(void) printf( " API functions for basic file, group, link, hard link, soft link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -23635,10 +23798,12 @@ test_link_visit_mixed_links_no_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -23652,10 +23817,11 @@ test_link_visit_mixed_links_no_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -23665,8 +23831,8 @@ test_link_visit_mixed_links_no_cycles(void) * Iteration is done in increasing and decreasing * order of both link name and link creation order. */ -static int -test_link_visit_hard_links_cycles(void) +static void +test_link_visit_hard_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -23684,7 +23850,7 @@ test_link_visit_hard_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24015,7 +24181,7 @@ test_link_visit_hard_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24028,7 +24194,7 @@ test_link_visit_hard_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24038,8 +24204,8 @@ test_link_visit_hard_links_cycles(void) * Iteration is done in increasing and decreasing * order of both link name and link creation order. */ -static int -test_link_visit_soft_links_cycles(void) +static void +test_link_visit_soft_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -24057,7 +24223,7 @@ test_link_visit_soft_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24394,7 +24560,7 @@ test_link_visit_soft_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24407,7 +24573,7 @@ test_link_visit_soft_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24418,8 +24584,8 @@ test_link_visit_soft_links_cycles(void) * decreasing order of both link name and link * creation order. */ -static int -test_link_visit_external_links_cycles(void) +static void +test_link_visit_external_links_cycles(const void H5_ATTR_UNUSED *params) { size_t i; htri_t link_exists; @@ -24437,7 +24603,7 @@ test_link_visit_external_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -24779,7 +24945,7 @@ test_link_visit_external_links_cycles(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -24792,7 +24958,7 @@ test_link_visit_external_links_cycles(void) } H5E_END_TRY - return 1; + return; } /* @@ -24806,14 +24972,14 @@ test_link_visit_external_links_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_ud_links_cycles(void) +static void +test_link_visit_ud_links_cycles(const void H5_ATTR_UNUSED *params) { TESTING("link visiting with cycles (only user-defined links)"); SKIPPED(); - return 1; + return; } /* @@ -24826,16 +24992,16 @@ test_link_visit_ud_links_cycles(void) * TODO refactor test so that creation order tests * actually test the order that objects were created in. */ -static int -test_link_visit_mixed_links_cycles(void) +static void +test_link_visit_mixed_links_cycles(const void H5_ATTR_UNUSED *params) { htri_t link_exists; size_t i; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t gcpl_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t gcpl_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting with cycles (mixed link types)"); @@ -24847,7 +25013,7 @@ test_link_visit_mixed_links_cycles(void) SKIPPED(); printf(" API functions for basic file, group, link, hard link, soft link, external link, iterate, " "or user defined link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25239,10 +25405,12 @@ test_link_visit_mixed_links_cycles(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25253,28 +25421,29 @@ test_link_visit_mixed_links_cycles(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Lvisit(_by_name)2 fails when * it is given invalid parameters. */ -static int -test_link_visit_invalid_params(void) +static void +test_link_visit_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; htri_t link_exists; hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; hid_t subgroup1 = H5I_INVALID_HID, subgroup2 = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t dset_dtype = H5I_INVALID_HID; - hid_t fspace_id = H5I_INVALID_HID; - char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH]; + hid_t dset_id = H5I_INVALID_HID; + hid_t dset_dtype = H5I_INVALID_HID; + hid_t fspace_id = H5I_INVALID_HID; + char ext_link_filename[H5_API_TEST_FILENAME_MAX_LENGTH] = {0}; TESTING_MULTIPART("link visiting with invalid parameters"); @@ -25285,7 +25454,7 @@ test_link_visit_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, external link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25699,10 +25868,12 @@ test_link_visit_invalid_params(void) TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, ext_link_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25715,10 +25886,11 @@ test_link_visit_invalid_params(void) H5Gclose(group_id); H5Gclose(container_group); H5Fclose(file_id); + remove_test_file(NULL, ext_link_filename); } H5E_END_TRY - return 1; + return; } /* @@ -25726,8 +25898,8 @@ test_link_visit_invalid_params(void) * performed on a group with no links in it is * not problematic. */ -static int -test_link_visit_0_links(void) +static void +test_link_visit_0_links(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -25741,7 +25913,7 @@ test_link_visit_0_links(void) SKIPPED(); printf(" API functions for basic file, group, or link iterate aren't supported " "with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -25940,7 +26112,7 @@ test_link_visit_0_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -25952,7 +26124,7 @@ test_link_visit_0_links(void) } H5E_END_TRY - return 1; + return; } /* @@ -27264,36 +27436,116 @@ link_visit_0_links_cb(hid_t group_id, const char *name, const H5L_info2_t *info, return 0; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) +void +H5_api_link_test_add(void) { - remove_test_file(test_path_prefix, EXTERNAL_LINK_TEST_FILE_NAME); - remove_test_file(test_path_prefix, EXTERNAL_LINK_INVALID_PARAMS_TEST_FILE_NAME); -} - -int -H5_api_link_test(void) -{ - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Link Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(link_tests); i++) { - nerrors += (*link_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_link_test_header", print_link_test_header, NULL, NULL, NULL, 0, + "Prints header for link tests"); + + AddTest("test_create_hard_link", test_create_hard_link, NULL, NULL, NULL, 0, "hard link creation"); + AddTest("test_create_hard_link_long_name", test_create_hard_link_long_name, NULL, NULL, NULL, 0, + "hard link creation with a long name"); + AddTest("test_create_hard_link_many", test_create_hard_link_many, NULL, NULL, NULL, 0, + "hard link creation of many links"); + AddTest("test_create_hard_link_same_loc", test_create_hard_link_same_loc, NULL, NULL, NULL, 0, + "hard link creation with H5L_SAME_LOC"); + AddTest("test_create_hard_link_invalid_params", test_create_hard_link_invalid_params, NULL, NULL, NULL, 0, + "hard link creation with invalid parameters"); + AddTest("test_create_soft_link_existing_relative", test_create_soft_link_existing_relative, NULL, NULL, + NULL, 0, "soft link creation to existing object by relative path"); + AddTest("test_create_soft_link_existing_absolute", test_create_soft_link_existing_absolute, NULL, NULL, + NULL, 0, "soft link creation to existing object by absolute path"); + AddTest("test_create_soft_link_dangling_relative", test_create_soft_link_dangling_relative, NULL, NULL, + NULL, 0, "dangling soft link creation to object by relative path"); + AddTest("test_create_soft_link_dangling_absolute", test_create_soft_link_dangling_absolute, NULL, NULL, + NULL, 0, "dangling soft link creation to object by absolute path"); + AddTest("test_create_soft_link_long_name", test_create_soft_link_long_name, NULL, NULL, NULL, 0, + "soft link creation with a long name"); + AddTest("test_create_soft_link_many", test_create_soft_link_many, NULL, NULL, NULL, 0, + "soft link creation of many links"); + AddTest("test_create_soft_link_invalid_params", test_create_soft_link_invalid_params, NULL, NULL, NULL, 0, + "soft link creation with invalid parameters"); + AddTest("test_create_external_link", test_create_external_link, NULL, NULL, NULL, 0, + "external link creation to existing object"); + AddTest("test_create_external_link_dangling", test_create_external_link_dangling, NULL, NULL, NULL, 0, + "dangling external link creation"); + AddTest("test_create_external_link_multi", test_create_external_link_multi, NULL, NULL, NULL, 0, + "external link creation to an object across several files"); + AddTest("test_create_external_link_ping_pong", test_create_external_link_ping_pong, NULL, NULL, NULL, 0, + "external link creation to an object in ping pong style"); + AddTest("test_create_external_link_invalid_params", test_create_external_link_invalid_params, NULL, NULL, + NULL, 0, "H5Lcreate_external with invalid parameters"); + AddTest("test_create_user_defined_link", test_create_user_defined_link, NULL, NULL, NULL, 0, + "user-defined link creation"); + AddTest("test_create_user_defined_link_invalid_params", test_create_user_defined_link_invalid_params, + NULL, NULL, NULL, 0, "H5Lcreate_ud with invalid parameters"); + AddTest("test_delete_link", test_delete_link, NULL, NULL, NULL, 0, "link deletion"); + AddTest("test_delete_link_reset_grp_max_crt_order", test_delete_link_reset_grp_max_crt_order, NULL, NULL, + NULL, 0, "H5Ldelete of all links in group resets group's maximum link creation order value"); + AddTest("test_delete_link_invalid_params", test_delete_link_invalid_params, NULL, NULL, NULL, 0, + "H5Ldelete with invalid parameters"); + AddTest("test_copy_link", test_copy_link, NULL, NULL, NULL, 0, "link copying"); + AddTest("test_copy_links_into_group_with_links", test_copy_links_into_group_with_links, NULL, NULL, NULL, + 0, "H5Lcopy adjusting creation order values for copied links"); + AddTest("test_copy_link_across_files", test_copy_link_across_files, NULL, NULL, NULL, 0, + "link copying across files"); + AddTest("test_copy_link_invalid_params", test_copy_link_invalid_params, NULL, NULL, NULL, 0, + "H5Lcopy with invalid parameters"); + AddTest("test_move_link", test_move_link, NULL, NULL, NULL, 0, "link moving"); + AddTest("test_move_links_into_group_with_links", test_move_links_into_group_with_links, NULL, NULL, NULL, + 0, "H5Lmove adjusting creation order values for moved links"); + AddTest("test_move_link_across_files", test_move_link_across_files, NULL, NULL, NULL, 0, + "link moving across files"); + AddTest("test_move_link_reset_grp_max_crt_order", test_move_link_reset_grp_max_crt_order, NULL, NULL, + NULL, 0, "H5Lmove of all links out of group resets group's maximum link creation order value"); + AddTest("test_move_link_invalid_params", test_move_link_invalid_params, NULL, NULL, NULL, 0, + "H5Lmove with invalid parameters"); + AddTest("test_get_link_val", test_get_link_val, NULL, NULL, NULL, 0, "link value retrieval"); + AddTest("test_get_link_val_invalid_params", test_get_link_val_invalid_params, NULL, NULL, NULL, 0, + "link value retrieval with invalid parameters"); + AddTest("test_get_link_info", test_get_link_info, NULL, NULL, NULL, 0, "link info retrieval"); + AddTest("test_get_link_info_invalid_params", test_get_link_info_invalid_params, NULL, NULL, NULL, 0, + "link info retrieval with invalid parameters"); + AddTest("test_get_link_name", test_get_link_name, NULL, NULL, NULL, 0, "link name retrieval"); + AddTest("test_get_link_name_invalid_params", test_get_link_name_invalid_params, NULL, NULL, NULL, 0, + "link name retrieval with invalid parameters"); + AddTest("test_link_iterate_hard_links", test_link_iterate_hard_links, NULL, NULL, NULL, 0, + "link iteration (only hard links)"); + AddTest("test_link_iterate_soft_links", test_link_iterate_soft_links, NULL, NULL, NULL, 0, + "link iteration (only soft links)"); + AddTest("test_link_iterate_external_links", test_link_iterate_external_links, NULL, NULL, NULL, 0, + "link iteration (only external links)"); + AddTest("test_link_iterate_ud_links", test_link_iterate_ud_links, NULL, NULL, NULL, 0, + "link iteration (only user-defined links)"); + AddTest("test_link_iterate_mixed_links", test_link_iterate_mixed_links, NULL, NULL, NULL, 0, + "link iteration (mixed link types)"); + AddTest("test_link_iterate_invalid_params", test_link_iterate_invalid_params, NULL, NULL, NULL, 0, + "link iteration with invalid parameters"); + AddTest("test_link_iterate_0_links", test_link_iterate_0_links, NULL, NULL, NULL, 0, + "link iteration on group with 0 links"); + AddTest("test_link_visit_hard_links_no_cycles", test_link_visit_hard_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only hard links)"); + AddTest("test_link_visit_soft_links_no_cycles", test_link_visit_soft_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only soft links)"); + AddTest("test_link_visit_external_links_no_cycles", test_link_visit_external_links_no_cycles, NULL, NULL, + NULL, 0, "link visiting without cycles (only external links)"); + AddTest("test_link_visit_ud_links_no_cycles", test_link_visit_ud_links_no_cycles, NULL, NULL, NULL, 0, + "link visiting without cycles (only user-defined links)"); + AddTest("test_link_visit_mixed_links_no_cycles", test_link_visit_mixed_links_no_cycles, NULL, NULL, NULL, + 0, "link visiting without cycles (mixed link types)"); + AddTest("test_link_visit_hard_links_cycles", test_link_visit_hard_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only hard links)"); + AddTest("test_link_visit_soft_links_cycles", test_link_visit_soft_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only soft links)"); + AddTest("test_link_visit_external_links_cycles", test_link_visit_external_links_cycles, NULL, NULL, NULL, + 0, "link visiting with cycles (only external links)"); + AddTest("test_link_visit_ud_links_cycles", test_link_visit_ud_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (only user-defined links)"); + AddTest("test_link_visit_mixed_links_cycles", test_link_visit_mixed_links_cycles, NULL, NULL, NULL, 0, + "link visiting with cycles (mixed link types)"); + AddTest("test_link_visit_invalid_params", test_link_visit_invalid_params, NULL, NULL, NULL, 0, + "link visiting with invalid parameters"); + AddTest("test_link_visit_0_links", test_link_visit_0_links, NULL, NULL, NULL, 0, + "link visiting on group with subgroups containing 0 links"); } diff --git a/test/API/H5_api_link_test.h b/test/API/H5_api_link_test.h index d7d69154939..17b06e850dc 100644 --- a/test/API/H5_api_link_test.h +++ b/test/API/H5_api_link_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_link_test(void); +void H5_api_link_test_add(void); /********************************************* * * @@ -79,7 +79,6 @@ int H5_api_link_test(void); #define EXTERNAL_LINK_TEST_MULTI_NAME_BUF_SIZE 1024 #define EXTERNAL_LINK_TEST_FILE_NAME2 "ext_link_file_2.h5" #define EXTERNAL_LINK_TEST_FILE_NAME3 "ext_link_file_3.h5" -#define EXTERNAL_LINK_TEST_FILE_NAME4 "ext_link_file_4.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME1 "ext_link_file_ping_pong_1.h5" #define EXTERNAL_LINK_TEST_PING_PONG_NAME2 "ext_link_file_ping_pong_2.h5" diff --git a/test/API/H5_api_misc_test.c b/test/API/H5_api_misc_test.c index d747f882750..14611a001eb 100644 --- a/test/API/H5_api_misc_test.c +++ b/test/API/H5_api_misc_test.c @@ -12,24 +12,27 @@ #include "H5_api_misc_test.h" -static int test_open_link_without_leading_slash(void); -static int test_object_creation_by_absolute_path(void); -static int test_absolute_vs_relative_path(void); -static int test_dot_for_object_name(void); -static int test_symbols_in_compound_field_name(void); -static int test_double_init_term(void); +static void print_misc_test_header(const void *params); +static void test_open_link_without_leading_slash(const void *params); +static void test_object_creation_by_absolute_path(const void *params); +static void test_absolute_vs_relative_path(const void *params); +static void test_dot_for_object_name(const void *params); +static void test_symbols_in_compound_field_name(const void *params); +static void test_double_init_term(const void *params); + +static void +print_misc_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Miscellaneous Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} -/* - * The array of miscellaneous tests to be performed. - */ -static int (*misc_tests[])(void) = { - test_open_link_without_leading_slash, test_object_creation_by_absolute_path, - test_absolute_vs_relative_path, test_dot_for_object_name, - test_symbols_in_compound_field_name, test_double_init_term, -}; - -static int -test_open_link_without_leading_slash(void) +static void +test_open_link_without_leading_slash(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID; @@ -45,7 +48,7 @@ test_open_link_without_leading_slash(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -113,7 +116,7 @@ test_open_link_without_leading_slash(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -127,11 +130,11 @@ test_open_link_without_leading_slash(void) } H5E_END_TRY - return 1; + return; } -static int -test_object_creation_by_absolute_path(void) +static void +test_object_creation_by_absolute_path(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -150,7 +153,7 @@ test_object_creation_by_absolute_path(void) SKIPPED(); printf(" API functions for basic file, group, dataset, link, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -345,7 +348,7 @@ test_object_creation_by_absolute_path(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -361,12 +364,12 @@ test_object_creation_by_absolute_path(void) } H5E_END_TRY - return 1; + return; } /* XXX: Add testing for groups */ -static int -test_absolute_vs_relative_path(void) +static void +test_absolute_vs_relative_path(const void H5_ATTR_UNUSED *params) { htri_t link_exists; hid_t file_id = H5I_INVALID_HID; @@ -385,7 +388,7 @@ test_absolute_vs_relative_path(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or link aren't supported with this " "connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -680,7 +683,7 @@ test_absolute_vs_relative_path(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -704,14 +707,14 @@ test_absolute_vs_relative_path(void) } H5E_END_TRY - return 1; + return; } /* * A test to check creating/opening objects with the "." as the name */ -static int -test_dot_for_object_name(void) +static void +test_dot_for_object_name(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, subgroup_id = H5I_INVALID_HID; @@ -730,7 +733,7 @@ test_dot_for_object_name(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or stored datatype aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -855,7 +858,7 @@ test_dot_for_object_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -871,7 +874,7 @@ test_dot_for_object_name(void) } H5E_END_TRY - return 1; + return; } /* @@ -882,23 +885,23 @@ test_dot_for_object_name(void) * TODO: Not sure if this test can be done from public APIs * at the moment. */ -static int -test_double_init_term(void) +static void +test_double_init_term(const void H5_ATTR_UNUSED *params) { TESTING("double init/term correctness"); SKIPPED(); - return 0; + return; #if 0 error: - return 1; + return; #endif } -static int -test_symbols_in_compound_field_name(void) +static void +test_symbols_in_compound_field_name(const void H5_ATTR_UNUSED *params) { size_t i; size_t total_type_size; @@ -918,7 +921,7 @@ test_symbols_in_compound_field_name(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } for (i = 0; i < COMPOUND_WITH_SYMBOLS_IN_MEMBER_NAMES_TEST_NUM_SUBTYPES; i++) @@ -1017,7 +1020,7 @@ test_symbols_in_compound_field_name(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1033,26 +1036,26 @@ test_symbols_in_compound_field_name(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_misc_test(void) +void +H5_api_misc_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Miscellaneous Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(misc_tests); i++) { - nerrors += (*misc_tests[i])() ? 1 : 0; - } - - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_misc_test_header", print_misc_test_header, NULL, NULL, NULL, 0, + "Prints header for miscellaneous tests"); + + AddTest("test_open_link_without_leading_slash", test_open_link_without_leading_slash, NULL, NULL, NULL, 0, + "opening a link without a leading slash"); + AddTest("test_object_creation_by_absolute_path", test_object_creation_by_absolute_path, NULL, NULL, NULL, + 0, "object creation by absolute path"); + AddTest("test_absolute_vs_relative_path", test_absolute_vs_relative_path, NULL, NULL, NULL, 0, + "absolute vs. relative pathnames"); + AddTest("test_dot_for_object_name", test_dot_for_object_name, NULL, NULL, NULL, 0, + "creating objects with \".\" as the name"); + AddTest("test_symbols_in_compound_field_name", test_symbols_in_compound_field_name, NULL, NULL, NULL, 0, + "usage of '{', '}' and '\\\"' symbols in compound field name"); + AddTest("test_double_init_term", test_double_init_term, NULL, NULL, NULL, 0, + "double init/term correctness"); } diff --git a/test/API/H5_api_misc_test.h b/test/API/H5_api_misc_test.h index 13c82ed60ca..f9203e24556 100644 --- a/test/API/H5_api_misc_test.h +++ b/test/API/H5_api_misc_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_misc_test(void); +void H5_api_misc_test_add(void); /****************************************************** * * diff --git a/test/API/H5_api_object_test.c b/test/API/H5_api_object_test.c index 063ddf6a530..85714f2ed1f 100644 --- a/test/API/H5_api_object_test.c +++ b/test/API/H5_api_object_test.c @@ -12,36 +12,37 @@ #include "H5_api_object_test.h" -static int test_open_object(void); -static int test_open_object_invalid_params(void); -static int test_object_exists(void); -static int test_object_exists_invalid_params(void); -static int test_get_object_info(void); -static int test_get_object_info_invalid_params(void); -static int test_link_object(void); -static int test_link_object_invalid_params(void); -static int test_incr_decr_object_refcount(void); -static int test_incr_decr_object_refcount_invalid_params(void); -static int test_object_copy_basic(void); -static int test_object_copy_already_existing(void); -static int test_object_copy_shallow_group_copy(void); -static int test_object_copy_no_attributes(void); -static int test_object_copy_by_soft_link(void); -static int test_object_copy_group_with_soft_links(void); -static int test_object_copy_between_files(void); -static int test_object_copy_invalid_params(void); -static int test_object_comments(void); -static int test_object_comments_invalid_params(void); -static int test_object_visit(void); -static int test_object_visit_soft_link(void); -static int test_object_visit_invalid_params(void); -static int test_close_object(void); -static int test_close_object_invalid_params(void); -static int test_close_invalid_objects(void); -static int test_flush_object(void); -static int test_flush_object_invalid_params(void); -static int test_refresh_object(void); -static int test_refresh_object_invalid_params(void); +static void print_object_test_header(const void *params); +static void test_open_object(const void *params); +static void test_open_object_invalid_params(const void *params); +static void test_object_exists(const void *params); +static void test_object_exists_invalid_params(const void *params); +static void test_get_object_info(const void *params); +static void test_get_object_info_invalid_params(const void *params); +static void test_link_object(const void *params); +static void test_link_object_invalid_params(const void *params); +static void test_incr_decr_object_refcount(const void *params); +static void test_incr_decr_object_refcount_invalid_params(const void *params); +static void test_object_copy_basic(const void *params); +static void test_object_copy_already_existing(const void *params); +static void test_object_copy_shallow_group_copy(const void *params); +static void test_object_copy_no_attributes(const void *params); +static void test_object_copy_by_soft_link(const void *params); +static void test_object_copy_group_with_soft_links(const void *params); +static void test_object_copy_between_files(const void *params); +static void test_object_copy_invalid_params(const void *params); +static void test_object_comments(const void *params); +static void test_object_comments_invalid_params(const void *params); +static void test_object_visit(const void *params); +static void test_object_visit_soft_link(const void *params); +static void test_object_visit_invalid_params(const void *params); +static void test_close_object(const void *params); +static void test_close_object_invalid_params(const void *params); +static void test_close_invalid_objects(const void *params); +static void test_flush_object(const void *params); +static void test_flush_object_invalid_params(const void *params); +static void test_refresh_object(const void *params); +static void test_refresh_object_invalid_params(const void *params); static herr_t object_copy_attribute_iter_callback(hid_t location_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data); @@ -62,41 +63,16 @@ static herr_t object_visit_soft_link_callback(hid_t o_id, const char *name, cons static herr_t object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *object_info, void *op_data); -/* - * The array of object tests to be performed. - */ -static int (*object_tests[])(void) = { - test_open_object, - test_open_object_invalid_params, - test_object_exists, - test_object_exists_invalid_params, - test_get_object_info, - test_get_object_info_invalid_params, - test_link_object, - test_link_object_invalid_params, - test_incr_decr_object_refcount, - test_incr_decr_object_refcount_invalid_params, - test_object_copy_basic, - test_object_copy_already_existing, - test_object_copy_shallow_group_copy, - test_object_copy_no_attributes, - test_object_copy_by_soft_link, - test_object_copy_group_with_soft_links, - test_object_copy_between_files, - test_object_copy_invalid_params, - test_object_comments, - test_object_comments_invalid_params, - test_object_visit, - test_object_visit_soft_link, - test_object_visit_invalid_params, - test_close_object, - test_close_object_invalid_params, - test_close_invalid_objects, - test_flush_object, - test_flush_object_invalid_params, - test_refresh_object, - test_refresh_object_invalid_params, -}; +static void +print_object_test_header(const void H5_ATTR_UNUSED *params) +{ + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Object Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); +} /* * A test to check that various objects (group, dataset, datatype) @@ -108,8 +84,8 @@ static int (*object_tests[])(void) = { * * XXX: test opening through dangling and resolving soft links. */ -static int -test_open_object(void) +static void +test_open_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -130,7 +106,7 @@ test_open_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -398,7 +374,7 @@ test_open_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -414,7 +390,7 @@ test_open_object(void) } H5E_END_TRY - return 1; + return; } /* @@ -422,8 +398,8 @@ test_open_object(void) * can't be opened when H5Oopen, H5Oopen_by_idx and H5Oopen_by_addr * are passed invalid parameters. */ -static int -test_open_object_invalid_params(void) +static void +test_open_object_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -438,7 +414,7 @@ test_open_object_invalid_params(void) SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -773,7 +749,7 @@ test_open_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -786,14 +762,14 @@ test_open_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oexists_by_name. */ -static int -test_object_exists(void) +static void +test_object_exists(const void H5_ATTR_UNUSED *params) { htri_t object_exists; hid_t file_id = H5I_INVALID_HID; @@ -814,7 +790,7 @@ test_object_exists(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, stored datatype or soft link " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1035,7 +1011,7 @@ test_object_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1051,15 +1027,15 @@ test_object_exists(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Oexists_by_name fails * when it is passed invalid parameters. */ -static int -test_object_exists_invalid_params(void) +static void +test_object_exists_invalid_params(const void H5_ATTR_UNUSED *params) { htri_t object_exists; hid_t file_id = H5I_INVALID_HID; @@ -1073,7 +1049,7 @@ test_object_exists_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1199,7 +1175,7 @@ test_object_exists_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1211,20 +1187,20 @@ test_object_exists_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oget_info(_by_name/_by_idx). */ -static int -test_get_object_info(void) +static void +test_get_object_info(const void H5_ATTR_UNUSED *params) { TESTING("object info retrieval"); SKIPPED(); - return 0; + return; } /* @@ -1232,21 +1208,21 @@ test_get_object_info(void) * when H5Oget_info(_by_name/_by_idx) are passed invalid * parameters. */ -static int -test_get_object_info_invalid_params(void) +static void +test_get_object_info_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("object info retrieval with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Olink. */ -static int -test_link_object(void) +static void +test_link_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1265,7 +1241,7 @@ test_link_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1380,7 +1356,7 @@ test_link_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1396,7 +1372,7 @@ test_link_object(void) } H5E_END_TRY - return 1; + return; } /* @@ -1404,8 +1380,8 @@ test_link_object(void) * the file structure when H5Olink is passed invalid * parameters. */ -static int -test_link_object_invalid_params(void) +static void +test_link_object_invalid_params(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -1419,7 +1395,7 @@ test_link_object_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1584,7 +1560,7 @@ test_link_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1596,14 +1572,14 @@ test_link_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oincr_refcount/H5Odecr_refcount. */ -static int -test_incr_decr_object_refcount(void) +static void +test_incr_decr_object_refcount(const void H5_ATTR_UNUSED *params) { H5O_info2_t oinfo; /* Object info struct */ hid_t file_id = H5I_INVALID_HID; @@ -1623,7 +1599,7 @@ test_incr_decr_object_refcount(void) SKIPPED(); printf(" API functions for basic file, group, dataset, stored datatype, or object " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -1879,7 +1855,7 @@ test_incr_decr_object_refcount(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1894,15 +1870,15 @@ test_incr_decr_object_refcount(void) } H5E_END_TRY - return 1; + return; } /* test_incr_decr_object_refcount */ /* * A test to check that H5Oincr_refcount/H5Odecr_refcount * fail when passed invalid parameters. */ -static int -test_incr_decr_object_refcount_invalid_params(void) +static void +test_incr_decr_object_refcount_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t status; @@ -1912,7 +1888,7 @@ test_incr_decr_object_refcount_invalid_params(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE)) { SKIPPED(); printf(" API functions for more object aren't supported with this connector\n"); - return 0; + return; } BEGIN_MULTIPART @@ -1959,17 +1935,17 @@ test_incr_decr_object_refcount_invalid_params(void) } END_MULTIPART; - return 0; + return; error: - return 1; + return; } /* * Basic tests for H5Ocopy. */ -static int -test_object_copy_basic(void) +static void +test_object_copy_basic(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -2000,7 +1976,7 @@ test_object_copy_basic(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, iterate, or " "stored datatype aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2517,7 +2493,7 @@ test_object_copy_basic(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2538,15 +2514,15 @@ test_object_copy_basic(void) } H5E_END_TRY - return 1; + return; } /* * Tests to ensure that H5Ocopy fails when attempting to copy * an object to a destination where the object already exists. */ -static int -test_object_copy_already_existing(void) +static void +test_object_copy_already_existing(const void H5_ATTR_UNUSED *params) { herr_t err_ret; hid_t file_id = H5I_INVALID_HID; @@ -2568,7 +2544,7 @@ test_object_copy_already_existing(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, or stored datatype aren't " "supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -2720,7 +2696,7 @@ test_object_copy_already_existing(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2736,15 +2712,15 @@ test_object_copy_already_existing(void) } H5E_END_TRY - return 1; + return; } /* * A test to exercise the H5O_COPY_SHALLOW_HIERARCHY_FLAG flag * for H5Ocopy. */ -static int -test_object_copy_shallow_group_copy(void) +static void +test_object_copy_shallow_group_copy(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; htri_t object_link_exists; @@ -2765,7 +2741,7 @@ test_object_copy_shallow_group_copy(void) SKIPPED(); printf(" API functions for basic file, group, object, or link aren't supported with this " "connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -2949,7 +2925,7 @@ test_object_copy_shallow_group_copy(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2963,15 +2939,15 @@ test_object_copy_shallow_group_copy(void) } H5E_END_TRY - return 1; + return; } /* * Tests to exercise the H5O_COPY_WITHOUT_ATTR_FLAG flag * of H5Ocopy. */ -static int -test_object_copy_no_attributes(void) +static void +test_object_copy_no_attributes(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; htri_t object_link_exists; @@ -3002,7 +2978,7 @@ test_object_copy_no_attributes(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, or stored " "datatype aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3454,7 +3430,7 @@ test_object_copy_no_attributes(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3476,15 +3452,15 @@ test_object_copy_no_attributes(void) } H5E_END_TRY - return 1; + return; } /* * Tests to exercise the behavior of H5Ocopy when the source * object specified is a soft link or dangling soft link. */ -static int -test_object_copy_by_soft_link(void) +static void +test_object_copy_by_soft_link(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -3510,7 +3486,7 @@ test_object_copy_by_soft_link(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, iterate, or " "soft link aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -3793,7 +3769,7 @@ test_object_copy_by_soft_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3808,7 +3784,7 @@ test_object_copy_by_soft_link(void) } H5E_END_TRY - return 1; + return; } /* @@ -3816,8 +3792,8 @@ test_object_copy_by_soft_link(void) * H5Ocopy. Also tested is the H5O_COPY_EXPAND_SOFT_LINK_FLAG * flag. */ -static int -test_object_copy_group_with_soft_links(void) +static void +test_object_copy_group_with_soft_links(const void H5_ATTR_UNUSED *params) { H5G_info_t group_info; htri_t object_link_exists; @@ -3840,7 +3816,7 @@ test_object_copy_group_with_soft_links(void) printf(" API functions for basic file, group, object, link, iterate, or soft link aren't " "supported with " "this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4153,7 +4129,7 @@ test_object_copy_group_with_soft_links(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4167,15 +4143,15 @@ test_object_copy_group_with_soft_links(void) } H5E_END_TRY - return 1; + return; } /* * Tests for copying objects between two different files using * H5Ocopy. */ -static int -test_object_copy_between_files(void) +static void +test_object_copy_between_files(const void H5_ATTR_UNUSED *params) { H5O_info2_t object_info; H5G_info_t group_info; @@ -4209,7 +4185,7 @@ test_object_copy_between_files(void) SKIPPED(); printf(" API functions for basic file, group, object, link, dataset, attribute, stored " "datatype, or iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -4750,9 +4726,12 @@ test_object_copy_between_files(void) if (H5Fclose(file_id) < 0) TEST_ERROR; + if (remove_test_file(NULL, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME) < 0) + TEST_ERROR; + PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4772,18 +4751,19 @@ test_object_copy_between_files(void) H5Gclose(container_group); H5Fclose(file_id2); H5Fclose(file_id); + remove_test_file(NULL, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME); } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Ocopy fails when it * is passed invalid parameters. */ -static int -test_object_copy_invalid_params(void) +static void +test_object_copy_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -4797,7 +4777,7 @@ test_object_copy_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or object aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5000,7 +4980,7 @@ test_object_copy_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5012,34 +4992,34 @@ test_object_copy_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oset_comment(_by_name)/H5Oget_comment(_by_name). */ -static int -test_object_comments(void) +static void +test_object_comments(const void H5_ATTR_UNUSED *params) { TESTING("object comments"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Oset_comment(_by_name)/H5Oget_comment(_by_name) * fail when passed invalid parameters. */ -static int -test_object_comments_invalid_params(void) +static void +test_object_comments_invalid_params(const void H5_ATTR_UNUSED *params) { - TESTING("object comment "); + TESTING("object comments with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -5047,8 +5027,8 @@ test_object_comments_invalid_params(void) * * XXX: Should have test for checking nested object's names/paths. */ -static int -test_object_visit(void) +static void +test_object_visit(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -5078,7 +5058,7 @@ test_object_visit(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, attribute, stored datatype, or " "iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -5708,10 +5688,12 @@ test_object_visit(void) TEST_ERROR; if (H5Fclose(file_id2) < 0) TEST_ERROR; + if (remove_test_file(NULL, visit_filename) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5730,10 +5712,11 @@ test_object_visit(void) H5Gclose(container_group); H5Fclose(file_id); H5Fclose(file_id2); + remove_test_file(NULL, visit_filename); } H5E_END_TRY; - return 1; + return; } /* @@ -5745,8 +5728,8 @@ test_object_visit(void) * the links to ensure that the objects in the other group * do not get visited. */ -static int -test_object_visit_soft_link(void) +static void +test_object_visit_soft_link(const void H5_ATTR_UNUSED *params) { size_t i; hid_t file_id = H5I_INVALID_HID; @@ -5764,7 +5747,7 @@ test_object_visit_soft_link(void) SKIPPED(); printf(" API functions for basic file, group, object, soft link, or iterate " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6208,7 +6191,7 @@ test_object_visit_soft_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6223,15 +6206,15 @@ test_object_visit_soft_link(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Ovisit(_by_name) fails when * it is passed invalid parameters. */ -static int -test_object_visit_invalid_params(void) +static void +test_object_visit_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -6245,7 +6228,7 @@ test_object_visit_invalid_params(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_ITERATE)) { SKIPPED(); printf(" API functions for basic file, group, or iterate aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6529,7 +6512,7 @@ test_object_visit_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6541,14 +6524,14 @@ test_object_visit_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test for H5Oclose. */ -static int -test_close_object(void) +static void +test_close_object(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -6568,7 +6551,7 @@ test_close_object(void) SKIPPED(); printf(" API functions for basic file, group, object, dataset, attribute, or stored datatype " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6724,7 +6707,7 @@ test_close_object(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6740,15 +6723,15 @@ test_close_object(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that H5Oclose fails when it * is passed invalid parameters. */ -static int -test_close_object_invalid_params(void) +static void +test_close_object_invalid_params(const void H5_ATTR_UNUSED *params) { herr_t err_ret = -1; hid_t file_id = H5I_INVALID_HID; @@ -6759,7 +6742,7 @@ test_close_object_invalid_params(void) if (!(vol_cap_flags_g & (H5VL_CAP_FLAG_FILE_BASIC)) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_BASIC)) { SKIPPED(); printf(" API functions for basic file or object aren't supported with this connector\n"); - return 0; + return; } if ((file_id = H5Fopen(H5_api_test_filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { @@ -6785,7 +6768,7 @@ test_close_object_invalid_params(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6794,15 +6777,15 @@ test_close_object_invalid_params(void) } H5E_END_TRY - return 1; + return; } /* * A test to check that various objects (file, dataspace, property list, * and attribute) can't be closed with H5Oclose. */ -static int -test_close_invalid_objects(void) +static void +test_close_invalid_objects(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t container_group = H5I_INVALID_HID, group_id = H5I_INVALID_HID; @@ -6820,7 +6803,7 @@ test_close_invalid_objects(void) SKIPPED(); printf(" API functions for basic file, group, or object " "aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -6963,7 +6946,7 @@ test_close_invalid_objects(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6978,61 +6961,61 @@ test_close_invalid_objects(void) } H5E_END_TRY - return 1; + return; } /* test_close_invalid_objects */ /* * A test for H5Oflush. */ -static int -test_flush_object(void) +static void +test_flush_object(const void H5_ATTR_UNUSED *params) { TESTING("H5Oflush"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Oflush fails when * it is passed invalid parameters. */ -static int -test_flush_object_invalid_params(void) +static void +test_flush_object_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Oflush with invalid parameters"); SKIPPED(); - return 0; + return; } /* * A test for H5Orefresh. */ -static int -test_refresh_object(void) +static void +test_refresh_object(const void H5_ATTR_UNUSED *params) { TESTING("H5Orefresh"); SKIPPED(); - return 0; + return; } /* * A test to check that H5Orefresh fails when * it is passed invalid parameters. */ -static int -test_refresh_object_invalid_params(void) +static void +test_refresh_object_invalid_params(const void H5_ATTR_UNUSED *params) { TESTING("H5Orefresh with invalid parameters"); SKIPPED(); - return 0; + return; } /* @@ -7363,36 +7346,61 @@ object_visit_noop_callback(hid_t o_id, const char *name, const H5O_info2_t *obje return 0; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) -{ - remove_test_file(test_path_prefix, OBJECT_COPY_BETWEEN_FILES_TEST_FILE_NAME); - remove_test_file(test_path_prefix, OBJECT_VISIT_TEST_FILE_NAME); -} - -int -H5_api_object_test(void) +void +H5_api_object_test_add(void) { - size_t i; - int nerrors; - - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Object Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(object_tests); i++) { - nerrors += (*object_tests[i])() ? 1 : 0; - } - - printf("\n"); - - printf("Cleaning up testing files\n"); - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_object_test_header", print_object_test_header, NULL, NULL, NULL, 0, + "Prints header for object tests"); + + AddTest("test_open_object", test_open_object, NULL, NULL, NULL, 0, "object opening"); + AddTest("test_open_object_invalid_params", test_open_object_invalid_params, NULL, NULL, NULL, 0, + "object opening with invalid parameters"); + AddTest("test_object_exists", test_object_exists, NULL, NULL, NULL, 0, "object existence"); + AddTest("test_object_exists_invalid_params", test_object_exists_invalid_params, NULL, NULL, NULL, 0, + "object existence with invalid parameters"); + AddTest("test_get_object_info", test_get_object_info, NULL, NULL, NULL, 0, "object info retrieval"); + AddTest("test_get_object_info_invalid_params", test_get_object_info_invalid_params, NULL, NULL, NULL, 0, + "object info retrieval with invalid parameters"); + AddTest("test_link_object", test_link_object, NULL, NULL, NULL, 0, "object linking"); + AddTest("test_link_object_invalid_params", test_link_object_invalid_params, NULL, NULL, NULL, 0, + "object linking with invalid parameters"); + AddTest("test_incr_decr_object_refcount", test_incr_decr_object_refcount, NULL, NULL, NULL, 0, + "increment/decrement the reference count of object"); + AddTest("test_incr_decr_object_refcount_invalid_params", test_incr_decr_object_refcount_invalid_params, + NULL, NULL, NULL, 0, "object reference count incr./decr. with an invalid parameter"); + AddTest("test_object_copy_basic", test_object_copy_basic, NULL, NULL, NULL, 0, "basic object copying"); + AddTest("test_object_copy_already_existing", test_object_copy_already_existing, NULL, NULL, NULL, 0, + "object copying to location where objects already exist"); + AddTest("test_object_copy_shallow_group_copy", test_object_copy_shallow_group_copy, NULL, NULL, NULL, 0, + "object copying with H5O_COPY_SHALLOW_HIERARCHY_FLAG flag"); + AddTest("test_object_copy_no_attributes", test_object_copy_no_attributes, NULL, NULL, NULL, 0, + "object copying with H5O_COPY_WITHOUT_ATTR_FLAG flag"); + AddTest("test_object_copy_by_soft_link", test_object_copy_by_soft_link, NULL, NULL, NULL, 0, + "object copying through use of soft links"); + AddTest("test_object_copy_group_with_soft_links", test_object_copy_group_with_soft_links, NULL, NULL, + NULL, 0, "group copying when group contains soft links"); + AddTest("test_object_copy_between_files", test_object_copy_between_files, NULL, NULL, NULL, 0, + "object copying between files"); + AddTest("test_object_copy_invalid_params", test_object_copy_invalid_params, NULL, NULL, NULL, 0, + "object copying with invalid parameters"); + AddTest("test_object_comments", test_object_comments, NULL, NULL, NULL, 0, "object comments"); + AddTest("test_object_comments_invalid_params", test_object_comments_invalid_params, NULL, NULL, NULL, 0, + "object comments with invalid parameters"); + AddTest("test_object_visit", test_object_visit, NULL, NULL, NULL, 0, "object visiting"); + AddTest("test_object_visit_soft_link", test_object_visit_soft_link, NULL, NULL, NULL, 0, + "object visiting with soft links"); + AddTest("test_object_visit_invalid_params", test_object_visit_invalid_params, NULL, NULL, NULL, 0, + "object visiting with invalid parameters"); + AddTest("test_close_object", test_close_object, NULL, NULL, NULL, 0, "H5Oclose"); + AddTest("test_close_object_invalid_params", test_close_object_invalid_params, NULL, NULL, NULL, 0, + "H5Oclose with an invalid object ID"); + AddTest("test_close_invalid_objects", test_close_invalid_objects, NULL, NULL, NULL, 0, + "H5Oclose invalid objects"); + AddTest("test_flush_object", test_flush_object, NULL, NULL, NULL, 0, "H5Oflush"); + AddTest("test_flush_object_invalid_params", test_flush_object_invalid_params, NULL, NULL, NULL, 0, + "H5Oflush with invalid parameters"); + AddTest("test_refresh_object", test_refresh_object, NULL, NULL, NULL, 0, "H5Orefresh"); + AddTest("test_refresh_object_invalid_params", test_refresh_object_invalid_params, NULL, NULL, NULL, 0, + "H5Orefresh with invalid parameters"); } diff --git a/test/API/H5_api_object_test.h b/test/API/H5_api_object_test.h index 9231b91c2b9..ebefbbc0353 100644 --- a/test/API/H5_api_object_test.h +++ b/test/API/H5_api_object_test.h @@ -15,7 +15,7 @@ #include "H5_api_test.h" -int H5_api_object_test(void); +void H5_api_object_test_add(void); /*********************************************** * * diff --git a/test/API/H5_api_test.c b/test/API/H5_api_test.c index 22df50a0964..8b300c0fb0b 100644 --- a/test/API/H5_api_test.c +++ b/test/API/H5_api_test.c @@ -53,27 +53,27 @@ const char *test_path_prefix; #ifdef H5_API_TEST_HAVE_ASYNC #define H5_API_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test, 1) \ - X(H5_API_TEST_ASYNC, "async", H5_api_async_test, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_add, 1) \ + X(H5_API_TEST_ASYNC, "async", H5_api_async_test_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #else #define H5_API_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #endif @@ -84,7 +84,7 @@ enum H5_api_test_type { H5_API_TESTS }; static const char *const H5_api_test_name[] = {H5_API_TESTS}; #undef X #define X(a, b, c, d) c, -static int (*H5_api_test_func[])(void) = {H5_API_TESTS}; +static void (*H5_api_test_add_func[])(void) = {H5_API_TESTS}; #undef X #define X(a, b, c, d) d, static int H5_api_test_enabled[] = {H5_API_TESTS}; @@ -102,20 +102,49 @@ H5_api_test_name_to_type(const char *test_name) } static void -H5_api_test_run(void) +H5_api_test_add(void) { enum H5_api_test_type i; for (i = H5_API_TEST_FILE; i < H5_API_TEST_MAX; i++) if (H5_api_test_enabled[i]) - (void)H5_api_test_func[i](); + H5_api_test_add_func[i](); } -/******************************************************************************/ +static int +parse_command_line(int argc, char **argv) +{ + /* Simple argument checking, TODO can improve that later */ + if (argc > 1) { + enum H5_api_test_type i = H5_api_test_name_to_type(argv[argc - 1]); + if (i != H5_API_TEST_NULL) { + /* Run only specific API test */ + memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); + H5_api_test_enabled[i] = 1; + } + } + + return 0; +} + +static void +usage(FILE *stream) +{ + fprintf(stream, "file run only the file interface tests\n"); + fprintf(stream, "group run only the group interface tests\n"); + fprintf(stream, "dataset run only the dataset interface tests\n"); + fprintf(stream, "attribute run only the attribute interface tests\n"); + fprintf(stream, "datatype run only the datatype interface tests\n"); + fprintf(stream, "link run only the link interface tests\n"); + fprintf(stream, "object run only the object interface tests\n"); + fprintf(stream, "misc run only the miscellaneous tests\n"); + fprintf(stream, "async run only the async interface tests\n"); +} int main(int argc, char **argv) { + H5E_auto2_t default_err_func; const char *vol_connector_string; const char *vol_connector_name; unsigned seed; @@ -124,19 +153,47 @@ main(int argc, char **argv) hid_t registered_con_id = H5I_INVALID_HID; char *vol_connector_string_copy = NULL; char *vol_connector_info = NULL; + void *default_err_data = NULL; bool err_occurred = false; - /* Simple argument checking, TODO can improve that later */ - if (argc > 1) { - enum H5_api_test_type i = H5_api_test_name_to_type(argv[1]); - if (i != H5_API_TEST_NULL) { - /* Run only specific API test */ - memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); - H5_api_test_enabled[i] = 1; - } + H5open(); + + /* Store current error stack printing function since TestInit unsets it */ + H5Eget_auto2(H5E_DEFAULT, &default_err_func, &default_err_data); + + /* Initialize testing framework */ + if (TestInit(argv[0], usage, NULL, NULL, NULL, 0) < 0) { + fprintf(stderr, "Unable to initialize testing framework\n"); + err_occurred = true; + goto done; } - H5open(); + /* Reset error stack printing function */ + H5Eset_auto2(H5E_DEFAULT, default_err_func, default_err_data); + + /* Hide all output from testing framework and replace with our own */ + SetTestVerbosity(VERBO_NONE); + + /* Parse command line separately from the test framework since + * tests need to be added before TestParseCmdLine in order for + * the -help option to show them, but we need to know ahead of + * time which tests to add if only a specific interface's tests + * are going to be run. + */ + parse_command_line(argc, argv); + + /* Add tests */ + H5_api_test_add(); + + /* Display testing information */ + TestInfo(stdout); + + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "Unable to parse command-line arguments\n"); + err_occurred = true; + goto done; + } n_tests_run_g = 0; n_tests_passed_g = 0; @@ -183,7 +240,7 @@ main(int argc, char **argv) printf("Test parameters:\n"); printf(" - Test file name: '%s'\n", H5_api_test_filename); printf(" - Test seed: %u\n", seed); - printf("\n\n"); + printf("\n"); if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) { fprintf(stderr, "Unable to create FAPL\n"); @@ -267,18 +324,30 @@ main(int argc, char **argv) goto done; } - /* Run all the tests that are enabled */ - H5_api_test_run(); + /* Perform tests */ + if (PerformTests() < 0) { + fprintf(stderr, "Unable to run tests\n"); + err_occurred = true; + goto done; + } + + printf("\n"); + + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(stdout); - printf("Cleaning up testing files\n"); + printf("Deleting container file for tests\n\n"); - H5E_BEGIN_TRY - { - if (H5Fis_accessible(H5_api_test_filename, H5P_DEFAULT) > 0) { - H5Fdelete(H5_api_test_filename, fapl_id); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + if (H5Fis_accessible(H5_api_test_filename, H5P_DEFAULT) > 0) { + H5Fdelete(H5_api_test_filename, fapl_id); + } } + H5E_END_TRY } - H5E_END_TRY if (n_tests_run_g > 0) { printf("%zu/%zu (%.2f%%) API tests passed with VOL connector '%s'\n", n_tests_passed_g, n_tests_run_g, @@ -308,7 +377,20 @@ main(int argc, char **argv) err_occurred = true; } + if (GetTestNumErrs() > 0) + n_tests_failed_g += (size_t)GetTestNumErrs(); + + /* Release test infrastructure */ + if (TestShutdown() < 0) { + fprintf(stderr, "Unable to shut down testing framework\n"); + err_occurred = true; + } + H5close(); - exit(((err_occurred || n_tests_failed_g > 0) ? EXIT_FAILURE : EXIT_SUCCESS)); + /* Exit failure if errors encountered; else exit success. */ + if (err_occurred || n_tests_failed_g > 0) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); } diff --git a/test/API/H5_api_test.h b/test/API/H5_api_test.h index 9f11cdb35fb..50c87400126 100644 --- a/test/API/H5_api_test.h +++ b/test/API/H5_api_test.h @@ -17,6 +17,7 @@ #include #include "h5test.h" +#include "testframe.h" #include "H5_api_test_config.h" #include "H5_api_test_util.h" diff --git a/test/API/H5_api_test_util.c b/test/API/H5_api_test_util.c index 4fcf6fa756c..efb88c77100 100644 --- a/test/API/H5_api_test_util.c +++ b/test/API/H5_api_test_util.c @@ -703,6 +703,8 @@ create_test_container(char *filename, uint64_t vol_cap_flags) hid_t file_id = H5I_INVALID_HID; hid_t group_id = H5I_INVALID_HID; + printf("Creating container file for tests\n"); + if (!(vol_cap_flags & H5VL_CAP_FLAG_FILE_BASIC)) { printf(" VOL connector doesn't support file creation\n"); goto error; @@ -713,6 +715,8 @@ create_test_container(char *filename, uint64_t vol_cap_flags) goto error; } + printf(" created container file\n"); + if (vol_cap_flags & H5VL_CAP_FLAG_GROUP_BASIC) { /* Create container groups for each of the test interfaces * (group, attribute, dataset, etc.). @@ -831,6 +835,9 @@ remove_test_file(const char *prefix, const char *filename) char *prefixed_filename = NULL; herr_t ret_value = SUCCEED; + if (!GetTestCleanup()) + goto done; + if (prefix) { if (prefix_filename(prefix, filename, &prefixed_filename) < 0) { printf(" couldn't prefix filename\n"); diff --git a/test/event_set.c b/test/event_set.c index aa1a66fe695..3e667d90e4d 100644 --- a/test/event_set.c +++ b/test/event_set.c @@ -159,7 +159,7 @@ fake_wait_request_wait(void H5_ATTR_UNUSED *req, uint64_t H5_ATTR_UNUSED timeout *status = H5VL_REQUEST_STATUS_SUCCEED; return 0; -} /* end H5_daos_req_wait() */ +} /* end fake_wait_request_wait() */ herr_t fake_wait_request_free(void H5_ATTR_UNUSED *req) diff --git a/testpar/API/CMakeLists.txt b/testpar/API/CMakeLists.txt index c744366188a..db95d728b8e 100644 --- a/testpar/API/CMakeLists.txt +++ b/testpar/API/CMakeLists.txt @@ -394,11 +394,6 @@ if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) foreach (api_test_extra ${HDF5_API_PAR_TESTS_EXTRA}) if (TARGET ${api_test_extra}) - set_target_properties ( - ${api_test_extra} - PROPERTIES - OUTPUT_NAME "h5_api_test_parallel_${api_test_extra}" - ) install ( TARGETS ${api_test_extra} diff --git a/testpar/API/H5_api_async_test_parallel.c b/testpar/API/H5_api_async_test_parallel.c index cfa9230ffed..450b69f1464 100644 --- a/testpar/API/H5_api_async_test_parallel.c +++ b/testpar/API/H5_api_async_test_parallel.c @@ -12,42 +12,57 @@ #include "H5_api_async_test_parallel.h" -#ifdef H5ESpublic_H - -static int test_one_dataset_io(void); -static int test_multi_dataset_io(void); -static int test_multi_file_dataset_io(void); -static int test_multi_file_grp_dset_io(void); -static int test_set_extent(void); -static int test_attribute_exists(void); -static int test_attribute_io(void); -static int test_attribute_io_tconv(void); -static int test_attribute_io_compound(void); -static int test_group(void); -static int test_link(void); -static int test_ocopy_orefresh(void); -static int test_file_reopen(void); +static void print_async_test_header(const void *params); -/* - * The array of parallel async tests to be performed. - */ -static int (*par_async_tests[])(void) = { - test_one_dataset_io, - test_multi_dataset_io, - test_multi_file_dataset_io, - test_multi_file_grp_dset_io, - test_set_extent, - test_attribute_exists, - test_attribute_io, - test_attribute_io_tconv, - test_attribute_io_compound, - test_group, - test_link, - test_ocopy_orefresh, - test_file_reopen, -}; - -bool coll_metadata_read = true; +static void +print_async_test_header(const void *params) +{ + bool coll_md_read = true; + + if (params) + coll_md_read = *(const bool *)params; + + if (coll_md_read) { + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel Async Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + +#ifndef H5_API_TEST_HAVE_ASYNC + printf("SKIPPED due to no async support\n"); +#endif + } + } +#ifdef H5_API_TEST_HAVE_ASYNC + else if (MAINPROCESS) { + printf("\n"); + printf("****************************************************\n"); + printf("* *\n"); + printf("* Re-running tests with independent metadata reads *\n"); + printf("* *\n"); + printf("****************************************************\n\n"); + } +#endif +} + +#ifdef H5_API_TEST_HAVE_ASYNC + +static void test_async_one_dataset_io(const void *params); +static void test_async_multi_dataset_io(const void *params); +static void test_async_multi_file_dataset_io(const void *params); +static void test_async_multi_file_grp_dset_io(const void *params); +static void test_async_set_extent(const void *params); +static void test_async_attribute_exists(const void *params); +static void test_async_attribute_io(const void *params); +static void test_async_attribute_io_tconv(const void *params); +static void test_async_attribute_io_compound(const void *params); +static void test_async_group(const void *params); +static void test_async_link(const void *params); +static void test_async_ocopy_orefresh(const void *params); +static void test_async_file_reopen(const void *params); /* Highest "printf" file created (starting at 0) */ int max_printf_file = -1; @@ -57,8 +72,8 @@ int max_printf_file = -1; * of the dataset. */ #define ONE_DATASET_IO_TEST_SPACE_RANK 2 -static int -test_one_dataset_io(void) +static void +test_async_one_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[ONE_DATASET_IO_TEST_SPACE_RANK]; @@ -79,8 +94,11 @@ test_one_dataset_io(void) TESTING_MULTIPART("single dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -88,12 +106,10 @@ test_one_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -389,7 +405,7 @@ test_one_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -410,7 +426,7 @@ test_one_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef ONE_DATASET_IO_TEST_SPACE_RANK @@ -421,8 +437,8 @@ test_one_dataset_io(void) */ #define MULTI_DATASET_IO_TEST_SPACE_RANK 2 #define MULTI_DATASET_IO_TEST_NDSETS 5 -static int -test_multi_dataset_io(void) +static void +test_async_multi_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_DATASET_IO_TEST_SPACE_RANK]; @@ -444,8 +460,11 @@ test_multi_dataset_io(void) TESTING_MULTIPART("multi dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -453,12 +472,10 @@ test_multi_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -712,7 +729,7 @@ test_multi_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -734,7 +751,7 @@ test_multi_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_DATASET_IO_TEST_SPACE_RANK #undef MULTI_DATASET_IO_TEST_NDSETS @@ -745,8 +762,8 @@ test_multi_dataset_io(void) */ #define MULTI_FILE_DATASET_IO_TEST_SPACE_RANK 2 #define MULTI_FILE_DATASET_IO_TEST_NFILES 5 -static int -test_multi_file_dataset_io(void) +static void +test_async_multi_file_dataset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_DATASET_IO_TEST_SPACE_RANK]; @@ -770,8 +787,11 @@ test_multi_file_dataset_io(void) TESTING_MULTIPART("multi file dataset I/O"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); @@ -779,12 +799,10 @@ test_multi_file_dataset_io(void) " API functions for basic file, dataset, or flush aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1136,7 +1154,7 @@ test_multi_file_dataset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1159,7 +1177,7 @@ test_multi_file_dataset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_FILE_DATASET_IO_TEST_SPACE_RANK #undef MULTI_FILE_DATASET_IO_TEST_NFILES @@ -1170,8 +1188,8 @@ test_multi_file_dataset_io(void) */ #define MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK 2 #define MULTI_FILE_GRP_DSET_IO_TEST_NFILES 5 -static int -test_multi_file_grp_dset_io(void) +static void +test_async_multi_file_grp_dset_io(const void *params) { hsize_t *dims = NULL; hsize_t start[MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK]; @@ -1193,21 +1211,21 @@ test_multi_file_grp_dset_io(void) TESTING_MULTIPART("multi file dataset I/O with groups"); + TESTING_2("test setup"); + /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf( " API functions for basic file, group, or dataset aren't supported with this connector\n"); } - return 0; + return; } - TESTING_2("test setup"); - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1552,7 +1570,7 @@ test_multi_file_grp_dset_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1574,7 +1592,7 @@ test_multi_file_grp_dset_io(void) } H5E_END_TRY - return 1; + return; } #undef MULTI_FILE_GRP_DSET_IO_TEST_SPACE_RANK #undef MULTI_FILE_GRP_DSET_IO_TEST_NFILES @@ -1587,8 +1605,8 @@ test_multi_file_grp_dset_io(void) */ #define SET_EXTENT_TEST_SPACE_RANK 2 #define SET_EXTENT_TEST_NUM_EXTENDS 6 -static int -test_set_extent(void) +static void +test_async_set_extent(const void *params) { hsize_t *dims = NULL; hsize_t *maxdims = NULL; @@ -1615,7 +1633,8 @@ test_set_extent(void) TESTING("extending dataset"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { if (MAINPROCESS) { SKIPPED(); @@ -1623,10 +1642,10 @@ test_set_extent(void) "with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -1891,7 +1910,7 @@ test_set_extent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1918,7 +1937,7 @@ test_set_extent(void) } H5E_END_TRY - return 1; + return; } #undef SET_EXTENT_TEST_SPACE_RANK #undef SET_EXTENT_TEST_NUM_EXTENDS @@ -1929,8 +1948,8 @@ test_set_extent(void) * attribute on the dataset. */ #define ATTRIBUTE_EXISTS_TEST_SPACE_RANK 2 -static int -test_attribute_exists(void) +static void +test_async_attribute_exists(const void *params) { hsize_t *dims = NULL; bool op_failed = false; @@ -1948,7 +1967,8 @@ test_attribute_exists(void) TESTING("H5Aexists()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); @@ -1956,10 +1976,10 @@ test_attribute_exists(void) "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2054,7 +2074,7 @@ test_attribute_exists(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2071,7 +2091,7 @@ test_attribute_exists(void) } H5E_END_TRY - return 1; + return; } #undef ATTRIBUTE_EXISTS_TEST_SPACE_RANK @@ -2081,8 +2101,8 @@ test_attribute_exists(void) * verifies the data is correct. */ #define ATTRIBUTE_IO_TEST_SPACE_RANK 2 -static int -test_attribute_io(void) +static void +test_async_attribute_io(const void *params) { hsize_t *dims = NULL; bool op_failed = false; @@ -2101,7 +2121,8 @@ test_attribute_io(void) TESTING("attribute I/O"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); @@ -2109,10 +2130,10 @@ test_attribute_io(void) "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2259,7 +2280,7 @@ test_attribute_io(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2280,7 +2301,7 @@ test_attribute_io(void) } H5E_END_TRY - return 1; + return; } /* @@ -2289,8 +2310,8 @@ test_attribute_io(void) * attribute and verifies the data is correct. */ #define ATTRIBUTE_IO_TCONV_TEST_SPACE_RANK 2 -static int -test_attribute_io_tconv(void) +static void +test_async_attribute_io_tconv(const void *params) { hsize_t *dims = NULL; bool op_failed; @@ -2308,18 +2329,18 @@ test_attribute_io_tconv(void) TESTING("attribute I/O with type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, attribute, or flush aren't supported with this " "connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2454,7 +2475,7 @@ test_attribute_io_tconv(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2475,7 +2496,7 @@ test_attribute_io_tconv(void) } H5E_END_TRY - return 1; + return; } /* @@ -2489,8 +2510,8 @@ typedef struct tattr_cmpd_t { } tattr_cmpd_t; #define ATTRIBUTE_IO_COMPOUND_TEST_SPACE_RANK 2 -static int -test_attribute_io_compound(void) +static void +test_async_attribute_io_compound(const void *params) { hsize_t *dims = NULL; bool op_failed; @@ -2512,18 +2533,18 @@ test_attribute_io_compound(void) TESTING("attribute I/O with compound type conversion"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_ATTR_BASIC)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, dataset, dataset more, attribute, or flush aren't " "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create dataspace */ @@ -2861,7 +2882,7 @@ test_attribute_io_compound(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2887,14 +2908,14 @@ test_attribute_io_compound(void) } H5E_END_TRY - return 1; + return; } /* * Tests async group interfaces in parallel */ -static int -test_group(void) +static void +test_async_group(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -2912,18 +2933,19 @@ test_group(void) TESTING("group operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_MORE) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, group, group more or flush aren't " "supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create GCPL */ @@ -3048,7 +3070,7 @@ test_group(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3064,14 +3086,14 @@ test_group(void) } H5E_END_TRY - return 1; + return; } /* * Tests async link interfaces in parallel */ -static int -test_link(void) +static void +test_async_link(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3092,9 +3114,9 @@ test_link(void) TESTING("link operations"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_LINK_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_HARD_LINKS) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_SOFT_LINKS) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH) || !(vol_cap_flags_g & H5VL_CAP_FLAG_CREATION_ORDER)) { if (MAINPROCESS) { SKIPPED(); @@ -3102,10 +3124,10 @@ test_link(void) "aren't supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create GCPL */ @@ -3309,7 +3331,7 @@ test_link(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3324,15 +3346,15 @@ test_link(void) } H5E_END_TRY - return 1; + return; } /* * Tests H5Ocopy_async and H5Orefresh_async in parallel */ #define OCOPY_REFRESH_TEST_SPACE_RANK 2 -static int -test_ocopy_orefresh(void) +static void +test_async_ocopy_orefresh(const void *params) { hsize_t *dims = NULL; hid_t file_id = H5I_INVALID_HID; @@ -3342,24 +3364,27 @@ test_ocopy_orefresh(void) hid_t space_id = H5I_INVALID_HID; hid_t es_id = H5I_INVALID_HID; size_t num_in_progress; - bool op_failed = false; - bool is_native_vol = false; + bool coll_metadata_read = false; + bool op_failed = false; + bool is_native_vol = false; TESTING("H5Ocopy() and H5Orefresh()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || - !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_GROUP_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_OBJECT_MORE) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FLUSH_REFRESH)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file, group, dataset, object more, flush, or refresh " "aren't supported with this connector\n"); } - return 0; + return; } + coll_metadata_read = *(const bool *)params; + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) TEST_ERROR; @@ -3468,7 +3493,7 @@ test_ocopy_orefresh(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3485,15 +3510,15 @@ test_ocopy_orefresh(void) } H5E_END_TRY - return 1; + return; } #undef OCOPY_REFRESH_TEST_SPACE_RANK /* * Tests H5Freopen_async in parallel */ -static int -test_file_reopen(void) +static void +test_async_file_reopen(const void *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -3505,16 +3530,17 @@ test_file_reopen(void) TESTING("H5Freopen()"); /* Make sure the connector supports the API functions being tested */ - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { + if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC) || + !(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_MORE)) { if (MAINPROCESS) { SKIPPED(); printf(" API functions for basic file or file more aren't supported with this connector\n"); } - return 0; + return; } - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, coll_metadata_read)) < 0) + if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, *(const bool *)params)) < 0) TEST_ERROR; /* Create event stack */ @@ -3554,7 +3580,7 @@ test_file_reopen(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3567,107 +3593,126 @@ test_file_reopen(void) } H5E_END_TRY - return 1; + return; } /* * Cleanup temporary test files */ static void -cleanup_files(void) +test_async_file_cleanup(const void H5_ATTR_UNUSED *params) { char file_name[64]; int i; if (MAINPROCESS) { - H5Fdelete(PAR_ASYNC_API_TEST_FILE, H5P_DEFAULT); + remove_test_file(NULL, PAR_ASYNC_API_TEST_FILE); + for (i = 0; i <= max_printf_file; i++) { snprintf(file_name, sizeof(file_name), PAR_ASYNC_API_TEST_FILE_PRINTF, i); - H5Fdelete(file_name, H5P_DEFAULT); - } /* end for */ + remove_test_file(NULL, file_name); + } } } -int -H5_api_async_test_parallel(void) +void +H5_api_async_test_parallel_add(void) { - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - if (!(vol_cap_flags_g & H5VL_CAP_FLAG_ASYNC)) { - if (MAINPROCESS) { - SKIPPED(); - printf(" Async APIs aren't supported with this connector\n"); - } - - return 0; - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_async_tests); i++) { - nerrors += (*par_async_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - if (MAINPROCESS) { - printf("\n * Re-testing with independent metadata reads *\n"); - } - + bool coll_metadata_read = true; + + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header (coll)", print_async_test_header, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "Prints header for async tests"); + + /* Add tests using collective metadata reads */ + AddTest("test_async_one_dataset_io (coll)", test_async_one_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async single dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_dataset_io (coll)", test_async_multi_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_file_dataset_io (coll)", test_async_multi_file_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O (collective metadata reads)"); + AddTest("test_async_multi_file_grp_dset_io (coll)", test_async_multi_file_grp_dset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O with groups (collective metadata reads)"); + AddTest("test_async_set_extent (coll)", test_async_set_extent, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async extending dataset (collective metadata reads)"); + AddTest("test_async_attribute_exists (coll)", test_async_attribute_exists, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), "async H5Aexists() (collective metadata reads)"); + AddTest("test_async_attribute_io (coll)", test_async_attribute_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async attribute I/O (collective metadata reads)"); + AddTest("test_async_attribute_io_tconv (coll)", test_async_attribute_io_tconv, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with type conversion (collective metadata reads)"); + AddTest("test_async_attribute_io_compound (coll)", test_async_attribute_io_compound, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with compound type conversion (collective metadata reads)"); + AddTest("test_async_group (coll)", test_async_group, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async group operations (collective metadata reads)"); + AddTest("test_async_link (coll)", test_async_link, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async link operations (collective metadata reads)"); + AddTest("test_async_ocopy_orefresh (coll)", test_async_ocopy_orefresh, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Ocopy() and H5Orefresh() (collective metadata reads)"); + AddTest("test_async_file_reopen (coll)", test_async_file_reopen, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Freopen() (collective metadata reads)"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (coll)", test_async_file_cleanup, NULL, NULL, NULL, 0, + "cleanup async test files"); + + /* Re-run tests with independent metadata reads */ coll_metadata_read = false; - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_async_tests); i++) { - nerrors += (*par_async_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - return nerrors; + /* Add a fake test to print out that tests are being re-run with independent metadata reads */ + AddTest("print_async_test_header (ind)", print_async_test_header, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "Prints header for async tests"); + + /* Add tests using independent metadata reads */ + AddTest("test_async_one_dataset_io (ind)", test_async_one_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async single dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_dataset_io (ind)", test_async_multi_dataset_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async multi dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_file_dataset_io (ind)", test_async_multi_file_dataset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O (independent metadata reads)"); + AddTest("test_async_multi_file_grp_dset_io (ind)", test_async_multi_file_grp_dset_io, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async multi file dataset I/O with groups (independent metadata reads)"); + AddTest("test_async_set_extent (ind)", test_async_set_extent, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async extending dataset (independent metadata reads)"); + AddTest("test_async_attribute_exists (ind)", test_async_attribute_exists, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Aexists() (independent metadata reads)"); + AddTest("test_async_attribute_io (ind)", test_async_attribute_io, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async attribute I/O (independent metadata reads)"); + AddTest("test_async_attribute_io_tconv (ind)", test_async_attribute_io_tconv, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with type conversion (independent metadata reads)"); + AddTest("test_async_attribute_io_compound (ind)", test_async_attribute_io_compound, NULL, NULL, + &coll_metadata_read, sizeof(coll_metadata_read), + "async attribute I/O with compound type conversion (independent metadata reads)"); + AddTest("test_async_group (ind)", test_async_group, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async group operations (independent metadata reads)"); + AddTest("test_async_link (ind)", test_async_link, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async link operations (independent metadata reads)"); + AddTest("test_async_ocopy_orefresh (ind)", test_async_ocopy_orefresh, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Ocopy() and H5Orefresh() (independent metadata reads)"); + AddTest("test_async_file_reopen (ind)", test_async_file_reopen, NULL, NULL, &coll_metadata_read, + sizeof(coll_metadata_read), "async H5Freopen() (independent metadata reads)"); + + /* Add a fake test to cleanup test files due to current test interdependencies */ + AddTest("test_async_file_cleanup (ind)", test_async_file_cleanup, NULL, NULL, NULL, 0, + "cleanup async test files"); } -#else /* H5ESpublic_H */ +#else /* H5_API_TEST_HAVE_ASYNC */ -int -H5_api_async_test_parallel(void) +void +H5_api_async_test_parallel_add(void) { - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Async Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - printf("SKIPPED due to no async support in HDF5 library\n"); - - return 0; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_async_test_header", print_async_test_header, NULL, NULL, NULL, 0, + "Prints header for async tests"); } #endif diff --git a/testpar/API/H5_api_async_test_parallel.h b/testpar/API/H5_api_async_test_parallel.h index 02b910b5a8f..6f12a36b178 100644 --- a/testpar/API/H5_api_async_test_parallel.h +++ b/testpar/API/H5_api_async_test_parallel.h @@ -15,7 +15,7 @@ #include "H5_api_test_parallel.h" -int H5_api_async_test_parallel(void); +void H5_api_async_test_parallel_add(void); /******************************************************** * * diff --git a/testpar/API/H5_api_attribute_test_parallel.c b/testpar/API/H5_api_attribute_test_parallel.c index aaee7503ac8..c06ac918147 100644 --- a/testpar/API/H5_api_attribute_test_parallel.c +++ b/testpar/API/H5_api_attribute_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_attribute_test_parallel.h" -/* - * The array of parallel attribute tests to be performed. - */ -static int (*par_attribute_tests[])(void) = {NULL}; +static void print_attribute_test_header(const void *params); -int -H5_api_attribute_test_parallel(void) +static void +print_attribute_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Attribute Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_attribute_tests); i++) { - /* nerrors += (*par_attribute_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_attribute_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_attribute_test_header", print_attribute_test_header, NULL, NULL, NULL, 0, + "Prints header for attribute tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_attribute_test_parallel.h b/testpar/API/H5_api_attribute_test_parallel.h index 73ed9708cf4..7a2033dd90a 100644 --- a/testpar/API/H5_api_attribute_test_parallel.h +++ b/testpar/API/H5_api_attribute_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_attribute_test_parallel(void); +void H5_api_attribute_test_parallel_add(void); #endif /* H5_API_ATTRIBUTE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_dataset_test_parallel.c b/testpar/API/H5_api_dataset_test_parallel.c index 7dd9f7027ea..d4e208aaee9 100644 --- a/testpar/API/H5_api_dataset_test_parallel.c +++ b/testpar/API/H5_api_dataset_test_parallel.c @@ -16,64 +16,48 @@ */ #include "H5_api_dataset_test_parallel.h" -static int test_write_dataset_data_verification(void); -static int test_write_dataset_independent(void); -static int test_write_dataset_one_proc_0_selection(void); -static int test_write_dataset_one_proc_none_selection(void); -static int test_write_dataset_one_proc_all_selection(void); -static int test_write_dataset_hyper_file_all_mem(void); -static int test_write_dataset_all_file_hyper_mem(void); -static int test_write_dataset_point_file_all_mem(void); -static int test_write_dataset_all_file_point_mem(void); -static int test_write_dataset_hyper_file_point_mem(void); -static int test_write_dataset_point_file_hyper_mem(void); -static int test_read_dataset_one_proc_0_selection(void); -static int test_read_dataset_one_proc_none_selection(void); -static int test_read_dataset_one_proc_all_selection(void); -static int test_read_dataset_hyper_file_all_mem(void); -static int test_read_dataset_all_file_hyper_mem(void); -static int test_read_dataset_point_file_all_mem(void); -static int test_read_dataset_all_file_point_mem(void); -static int test_read_dataset_hyper_file_point_mem(void); -static int test_read_dataset_point_file_hyper_mem(void); +static void print_dataset_test_header(const void *params); +static void test_write_dataset_data_verification(const void *params); +static void test_write_dataset_independent(const void *params); +static void test_write_dataset_one_proc_0_selection(const void *params); +static void test_write_dataset_one_proc_none_selection(const void *params); +static void test_write_dataset_one_proc_all_selection(const void *params); +static void test_write_dataset_hyper_file_all_mem(const void *params); +static void test_write_dataset_all_file_hyper_mem(const void *params); +static void test_write_dataset_point_file_all_mem(const void *params); +static void test_write_dataset_all_file_point_mem(const void *params); +static void test_write_dataset_hyper_file_point_mem(const void *params); +static void test_write_dataset_point_file_hyper_mem(const void *params); +static void test_read_dataset_one_proc_0_selection(const void *params); +static void test_read_dataset_one_proc_none_selection(const void *params); +static void test_read_dataset_one_proc_all_selection(const void *params); +static void test_read_dataset_hyper_file_all_mem(const void *params); +static void test_read_dataset_all_file_hyper_mem(const void *params); +static void test_read_dataset_point_file_all_mem(const void *params); +static void test_read_dataset_all_file_point_mem(const void *params); +static void test_read_dataset_hyper_file_point_mem(const void *params); +static void test_read_dataset_point_file_hyper_mem(const void *params); /* * Chunking tests */ -static int test_write_multi_chunk_dataset_same_shape_read(void); -static int test_write_multi_chunk_dataset_diff_shape_read(void); -static int test_overwrite_multi_chunk_dataset_same_shape_read(void); -static int test_overwrite_multi_chunk_dataset_diff_shape_read(void); +static void test_write_multi_chunk_dataset_same_shape_read(const void *params); +static void test_write_multi_chunk_dataset_diff_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_same_shape_read(const void *params); +static void test_overwrite_multi_chunk_dataset_diff_shape_read(const void *params); -/* - * The array of parallel dataset tests to be performed. - */ -static int (*par_dataset_tests[])(void) = { - test_write_dataset_data_verification, - test_write_dataset_independent, - test_write_dataset_one_proc_0_selection, - test_write_dataset_one_proc_none_selection, - test_write_dataset_one_proc_all_selection, - test_write_dataset_hyper_file_all_mem, - test_write_dataset_all_file_hyper_mem, - test_write_dataset_point_file_all_mem, - test_write_dataset_all_file_point_mem, - test_write_dataset_hyper_file_point_mem, - test_write_dataset_point_file_hyper_mem, - test_read_dataset_one_proc_0_selection, - test_read_dataset_one_proc_none_selection, - test_read_dataset_one_proc_all_selection, - test_read_dataset_hyper_file_all_mem, - test_read_dataset_all_file_hyper_mem, - test_read_dataset_point_file_all_mem, - test_read_dataset_all_file_point_mem, - test_read_dataset_hyper_file_point_mem, - test_read_dataset_point_file_hyper_mem, - test_write_multi_chunk_dataset_same_shape_read, - test_write_multi_chunk_dataset_diff_shape_read, - test_overwrite_multi_chunk_dataset_same_shape_read, - test_overwrite_multi_chunk_dataset_diff_shape_read, -}; +static void +print_dataset_test_header(const void H5_ATTR_UNUSED *params) +{ + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel Dataset Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + } +} /* * A test to ensure that data is read back correctly from @@ -88,8 +72,8 @@ static int (*par_dataset_tests[])(void) = { #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME1 "dataset_write_data_verification_all" #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME2 "dataset_write_data_verification_hyperslab" #define DATASET_WRITE_DATA_VERIFY_TEST_DSET_NAME3 "dataset_write_data_verification_points" -static int -test_write_dataset_data_verification(void) +static void +test_write_dataset_data_verification(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -115,7 +99,7 @@ test_write_dataset_data_verification(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -866,7 +850,7 @@ test_write_dataset_data_verification(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -889,7 +873,7 @@ test_write_dataset_data_verification(void) } H5E_END_TRY - return 1; + return; } /* @@ -906,8 +890,8 @@ test_write_dataset_data_verification(void) #define DATASET_INDEPENDENT_WRITE_TEST_GROUP_NAME "independent_dataset_write_test" #define DATASET_INDEPENDENT_WRITE_TEST_DSET_NAME1 "dset1" #define DATASET_INDEPENDENT_WRITE_TEST_DSET_NAME2 "dset2" -static int -test_write_dataset_independent(void) +static void +test_write_dataset_independent(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -932,7 +916,7 @@ test_write_dataset_independent(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1211,7 +1195,7 @@ test_write_dataset_independent(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1233,7 +1217,7 @@ test_write_dataset_independent(void) } H5E_END_TRY - return 1; + return; } /* @@ -1245,8 +1229,8 @@ test_write_dataset_independent(void) #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_GROUP_NAME "one_rank_0_sel_write_test" #define DATASET_WRITE_ONE_PROC_0_SEL_TEST_DSET_NAME "one_rank_0_sel_dset" -static int -test_write_dataset_one_proc_0_selection(void) +static void +test_write_dataset_one_proc_0_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1271,7 +1255,7 @@ test_write_dataset_one_proc_0_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1509,7 +1493,7 @@ test_write_dataset_one_proc_0_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1530,7 +1514,7 @@ test_write_dataset_one_proc_0_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -1542,8 +1526,8 @@ test_write_dataset_one_proc_0_selection(void) #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_GROUP_NAME "one_rank_none_sel_write_test" #define DATASET_WRITE_ONE_PROC_NONE_SEL_TEST_DSET_NAME "one_rank_none_sel_dset" -static int -test_write_dataset_one_proc_none_selection(void) +static void +test_write_dataset_one_proc_none_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1568,7 +1552,7 @@ test_write_dataset_one_proc_none_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -1822,7 +1806,7 @@ test_write_dataset_one_proc_none_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -1843,7 +1827,7 @@ test_write_dataset_one_proc_none_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -1856,8 +1840,8 @@ test_write_dataset_one_proc_none_selection(void) #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_GROUP_NAME "one_rank_all_sel_write_test" #define DATASET_WRITE_ONE_PROC_ALL_SEL_TEST_DSET_NAME "one_rank_all_sel_dset" -static int -test_write_dataset_one_proc_all_selection(void) +static void +test_write_dataset_one_proc_all_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -1878,7 +1862,7 @@ test_write_dataset_one_proc_all_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2110,7 +2094,7 @@ test_write_dataset_one_proc_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2131,7 +2115,7 @@ test_write_dataset_one_proc_all_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -2148,8 +2132,8 @@ test_write_dataset_one_proc_all_selection(void) #define DATASET_WRITE_HYPER_FILE_ALL_MEM_TEST_GROUP_NAME "hyper_sel_file_all_sel_mem_write_test" #define DATASET_WRITE_HYPER_FILE_ALL_MEM_TEST_DSET_NAME "hyper_sel_file_all_sel_mem_dset" #endif -static int -test_write_dataset_hyper_file_all_mem(void) +static void +test_write_dataset_hyper_file_all_mem(const void H5_ATTR_UNUSED *params) { #ifdef BROKEN hssize_t space_npoints; @@ -2177,7 +2161,7 @@ test_write_dataset_hyper_file_all_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2387,7 +2371,7 @@ test_write_dataset_hyper_file_all_mem(void) SKIPPED(); #endif - return 0; + return; #ifdef BROKEN error: @@ -2409,7 +2393,7 @@ test_write_dataset_hyper_file_all_mem(void) } H5E_END_TRY - return 1; + return; #endif } @@ -2423,8 +2407,8 @@ test_write_dataset_hyper_file_all_mem(void) #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_GROUP_NAME "all_sel_file_hyper_sel_mem_write_test" #define DATASET_WRITE_ALL_FILE_HYPER_MEM_TEST_DSET_NAME "all_sel_file_hyper_sel_mem_dset" -static int -test_write_dataset_all_file_hyper_mem(void) +static void +test_write_dataset_all_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -2445,7 +2429,7 @@ test_write_dataset_all_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -2681,7 +2665,7 @@ test_write_dataset_all_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -2702,7 +2686,7 @@ test_write_dataset_all_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -2710,14 +2694,14 @@ test_write_dataset_all_file_hyper_mem(void) * a point selection in the file dataspace and an all selection * in the memory dataspace. */ -static int -test_write_dataset_point_file_all_mem(void) +static void +test_write_dataset_point_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("write to dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -2730,8 +2714,8 @@ test_write_dataset_point_file_all_mem(void) #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_GROUP_NAME "all_sel_file_point_sel_mem_write_test" #define DATASET_WRITE_ALL_FILE_POINT_MEM_TEST_DSET_NAME "all_sel_file_point_sel_mem_dset" -static int -test_write_dataset_all_file_point_mem(void) +static void +test_write_dataset_all_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *points = NULL; @@ -2753,7 +2737,7 @@ test_write_dataset_all_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3005,7 +2989,7 @@ test_write_dataset_all_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3028,7 +3012,7 @@ test_write_dataset_all_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3041,8 +3025,8 @@ test_write_dataset_all_file_point_mem(void) #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_GROUP_NAME "hyper_sel_file_point_sel_mem_write_test" #define DATASET_WRITE_HYPER_FILE_POINT_MEM_TEST_DSET_NAME "hyper_sel_file_point_sel_mem_dset" -static int -test_write_dataset_hyper_file_point_mem(void) +static void +test_write_dataset_hyper_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3068,7 +3052,7 @@ test_write_dataset_hyper_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3329,7 +3313,7 @@ test_write_dataset_hyper_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3352,7 +3336,7 @@ test_write_dataset_hyper_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3365,8 +3349,8 @@ test_write_dataset_hyper_file_point_mem(void) #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_GROUP_NAME "point_sel_file_hyper_sel_mem_write_test" #define DATASET_WRITE_POINT_FILE_HYPER_MEM_TEST_DSET_NAME "point_sel_file_hyper_sel_mem_dset" -static int -test_write_dataset_point_file_hyper_mem(void) +static void +test_write_dataset_point_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3388,7 +3372,7 @@ test_write_dataset_point_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -3647,7 +3631,7 @@ test_write_dataset_point_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -3670,7 +3654,7 @@ test_write_dataset_point_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -3682,8 +3666,8 @@ test_write_dataset_point_file_hyper_mem(void) #define DATASET_READ_ONE_PROC_0_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_0_SEL_TEST_GROUP_NAME "one_rank_0_sel_read_test" #define DATASET_READ_ONE_PROC_0_SEL_TEST_DSET_NAME "one_rank_0_sel_dset" -static int -test_read_dataset_one_proc_0_selection(void) +static void +test_read_dataset_one_proc_0_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -3708,7 +3692,7 @@ test_read_dataset_one_proc_0_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_0_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -3983,7 +3967,7 @@ test_read_dataset_one_proc_0_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4004,7 +3988,7 @@ test_read_dataset_one_proc_0_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4016,8 +4000,8 @@ test_read_dataset_one_proc_0_selection(void) #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_GROUP_NAME "one_rank_none_sel_read_test" #define DATASET_READ_ONE_PROC_NONE_SEL_TEST_DSET_NAME "one_rank_none_sel_dset" -static int -test_read_dataset_one_proc_none_selection(void) +static void +test_read_dataset_one_proc_none_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4042,7 +4026,7 @@ test_read_dataset_one_proc_none_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_NONE_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -4332,7 +4316,7 @@ test_read_dataset_one_proc_none_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4353,7 +4337,7 @@ test_read_dataset_one_proc_none_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4366,8 +4350,8 @@ test_read_dataset_one_proc_none_selection(void) #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_GROUP_NAME "one_rank_all_sel_read_test" #define DATASET_READ_ONE_PROC_ALL_SEL_TEST_DSET_NAME "one_rank_all_sel_dset" -static int -test_read_dataset_one_proc_all_selection(void) +static void +test_read_dataset_one_proc_all_selection(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4388,7 +4372,7 @@ test_read_dataset_one_proc_all_selection(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ONE_PROC_ALL_SEL_TEST_SPACE_RANK, &dims) < 0) @@ -4669,7 +4653,7 @@ test_read_dataset_one_proc_all_selection(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -4690,7 +4674,7 @@ test_read_dataset_one_proc_all_selection(void) } H5E_END_TRY - return 1; + return; } /* @@ -4698,14 +4682,14 @@ test_read_dataset_one_proc_all_selection(void) * a hyperslab selection in the file dataspace and an all * selection in the memory dataspace. */ -static int -test_read_dataset_hyper_file_all_mem(void) +static void +test_read_dataset_hyper_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("read from dataset with hyperslab sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -4718,8 +4702,8 @@ test_read_dataset_hyper_file_all_mem(void) #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_GROUP_NAME "all_sel_file_hyper_sel_mem_read_test" #define DATASET_READ_ALL_FILE_HYPER_MEM_TEST_DSET_NAME "all_sel_file_hyper_sel_mem_dset" -static int -test_read_dataset_all_file_hyper_mem(void) +static void +test_read_dataset_all_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -4740,7 +4724,7 @@ test_read_dataset_all_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ALL_FILE_HYPER_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5016,7 +5000,7 @@ test_read_dataset_all_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5037,7 +5021,7 @@ test_read_dataset_all_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5045,14 +5029,14 @@ test_read_dataset_all_file_hyper_mem(void) * a point selection in the file dataspace and an all selection * in the memory dataspace. */ -static int -test_read_dataset_point_file_all_mem(void) +static void +test_read_dataset_point_file_all_mem(const void H5_ATTR_UNUSED *params) { TESTING("read from dataset with point sel. for file space; all sel. for memory"); SKIPPED(); - return 0; + return; } /* @@ -5065,8 +5049,8 @@ test_read_dataset_point_file_all_mem(void) #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_GROUP_NAME "all_sel_file_point_sel_mem_read_test" #define DATASET_READ_ALL_FILE_POINT_MEM_TEST_DSET_NAME "all_sel_file_point_sel_mem_dset" -static int -test_read_dataset_all_file_point_mem(void) +static void +test_read_dataset_all_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *points = NULL; @@ -5088,7 +5072,7 @@ test_read_dataset_all_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_ALL_FILE_POINT_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5377,7 +5361,7 @@ test_read_dataset_all_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5400,7 +5384,7 @@ test_read_dataset_all_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5413,8 +5397,8 @@ test_read_dataset_all_file_point_mem(void) #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_GROUP_NAME "hyper_sel_file_point_sel_mem_read_test" #define DATASET_READ_HYPER_FILE_POINT_MEM_TEST_DSET_NAME "hyper_sel_file_point_sel_mem_dset" -static int -test_read_dataset_hyper_file_point_mem(void) +static void +test_read_dataset_hyper_file_point_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -5440,7 +5424,7 @@ test_read_dataset_hyper_file_point_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_HYPER_FILE_POINT_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -5735,7 +5719,7 @@ test_read_dataset_hyper_file_point_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -5758,7 +5742,7 @@ test_read_dataset_hyper_file_point_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -5771,8 +5755,8 @@ test_read_dataset_hyper_file_point_mem(void) #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_DTYPE_SIZE sizeof(int) #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_GROUP_NAME "point_sel_file_hyper_sel_mem_read_test" #define DATASET_READ_POINT_FILE_HYPER_MEM_TEST_DSET_NAME "point_sel_file_hyper_sel_mem_dset" -static int -test_read_dataset_point_file_hyper_mem(void) +static void +test_read_dataset_point_file_hyper_mem(const void H5_ATTR_UNUSED *params) { hssize_t space_npoints; hsize_t *dims = NULL; @@ -5794,7 +5778,7 @@ test_read_dataset_point_file_hyper_mem(void) !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_BASIC) || !(vol_cap_flags_g & H5VL_CAP_FLAG_DATASET_MORE)) { SKIPPED(); printf(" API functions for basic file, group, or dataset aren't supported with this connector\n"); - return 0; + return; } if (generate_random_parallel_dimensions(DATASET_READ_POINT_FILE_HYPER_MEM_TEST_SPACE_RANK, &dims) < 0) @@ -6092,7 +6076,7 @@ test_read_dataset_point_file_hyper_mem(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6115,7 +6099,7 @@ test_read_dataset_point_file_hyper_mem(void) } H5E_END_TRY - return 1; + return; } /* @@ -6134,8 +6118,8 @@ test_read_dataset_point_file_hyper_mem(void) #define DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_GROUP_NAME \ "multi_chunk_dataset_write_same_space_read_test" #define DATASET_MULTI_CHUNK_WRITE_SAME_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" -static int -test_write_multi_chunk_dataset_same_shape_read(void) +static void +test_write_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -6162,7 +6146,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == @@ -6553,7 +6537,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -6575,7 +6559,7 @@ test_write_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -6596,8 +6580,8 @@ test_write_multi_chunk_dataset_same_shape_read(void) #define DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_GROUP_NAME \ "multi_chunk_dataset_write_diff_space_read_test" #define DATASET_MULTI_CHUNK_WRITE_DIFF_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" -static int -test_write_multi_chunk_dataset_diff_shape_read(void) +static void +test_write_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -6625,7 +6609,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == @@ -7018,7 +7002,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7040,7 +7024,7 @@ test_write_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -7061,8 +7045,8 @@ test_write_multi_chunk_dataset_diff_shape_read(void) "multi_chunk_dataset_same_space_overwrite_test" #define DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" #define DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_NITERS 10 -static int -test_overwrite_multi_chunk_dataset_same_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_same_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -7090,7 +7074,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == (dims = malloc(DATASET_MULTI_CHUNK_OVERWRITE_SAME_SPACE_READ_TEST_DSET_SPACE_RANK * @@ -7541,7 +7525,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -7563,7 +7547,7 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) } H5E_END_TRY - return 1; + return; } /* @@ -7586,8 +7570,8 @@ test_overwrite_multi_chunk_dataset_same_shape_read(void) "multi_chunk_dataset_diff_space_overwrite_test" #define DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_NAME "multi_chunk_dataset" #define DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_NITERS 10 -static int -test_overwrite_multi_chunk_dataset_diff_shape_read(void) +static void +test_overwrite_multi_chunk_dataset_diff_shape_read(const void H5_ATTR_UNUSED *params) { hsize_t *dims = NULL; hsize_t *chunk_dims = NULL; @@ -7616,7 +7600,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) SKIPPED(); printf(" API functions for basic file, group, dataset, or getting property list aren't " "supported with this connector\n"); - return 0; + return; } if (NULL == (dims = malloc(DATASET_MULTI_CHUNK_OVERWRITE_DIFF_SPACE_READ_TEST_DSET_SPACE_RANK * @@ -8069,7 +8053,7 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -8091,34 +8075,64 @@ test_overwrite_multi_chunk_dataset_diff_shape_read(void) } H5E_END_TRY - return 1; + return; } -int -H5_api_dataset_test_parallel(void) +void +H5_api_dataset_test_parallel_add(void) { - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel Dataset Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_dataset_tests); i++) { - nerrors += (*par_dataset_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_dataset_test_header", print_dataset_test_header, NULL, NULL, NULL, 0, + "Prints header for dataset tests"); + + AddTest("test_write_dataset_data_verification", test_write_dataset_data_verification, NULL, NULL, NULL, 0, + "verification of dataset data using H5Dwrite then H5Dread"); + AddTest("test_write_dataset_independent", test_write_dataset_independent, NULL, NULL, NULL, 0, + "independent writing to different datasets by different ranks"); + AddTest("test_write_dataset_one_proc_0_selection", test_write_dataset_one_proc_0_selection, NULL, NULL, + NULL, 0, "write to dataset with one rank selecting 0 rows"); + AddTest("test_write_dataset_one_proc_none_selection", test_write_dataset_one_proc_none_selection, NULL, + NULL, NULL, 0, "write to dataset with one rank using 'none' selection"); + AddTest("test_write_dataset_one_proc_all_selection", test_write_dataset_one_proc_all_selection, NULL, + NULL, NULL, 0, "write to dataset with one rank using all selection; others none selection"); + AddTest("test_write_dataset_hyper_file_all_mem", test_write_dataset_hyper_file_all_mem, NULL, NULL, NULL, + 0, "write to dataset with hyperslab sel. for file space; all sel. for memory"); + AddTest("test_write_dataset_all_file_hyper_mem", test_write_dataset_all_file_hyper_mem, NULL, NULL, NULL, + 0, "write to dataset with all sel. for file space; hyperslab sel. for memory"); + AddTest("test_write_dataset_point_file_all_mem", test_write_dataset_point_file_all_mem, NULL, NULL, NULL, + 0, "write to dataset with point sel. for file space; all sel. for memory"); + AddTest("test_write_dataset_all_file_point_mem", test_write_dataset_all_file_point_mem, NULL, NULL, NULL, + 0, "write to dataset with all sel. for file space; point sel. for memory"); + AddTest("test_write_dataset_hyper_file_point_mem", test_write_dataset_hyper_file_point_mem, NULL, NULL, + NULL, 0, "write to dataset with hyperslab sel. for file space; point sel. for memory"); + AddTest("test_write_dataset_point_file_hyper_mem", test_write_dataset_point_file_hyper_mem, NULL, NULL, + NULL, 0, "write to dataset with point sel. for file space; hyperslab sel. for memory"); + AddTest("test_read_dataset_one_proc_0_selection", test_read_dataset_one_proc_0_selection, NULL, NULL, + NULL, 0, "read from dataset with one rank selecting 0 rows"); + AddTest("test_read_dataset_one_proc_none_selection", test_read_dataset_one_proc_none_selection, NULL, + NULL, NULL, 0, "read from dataset with one rank using 'none' selection"); + AddTest("test_read_dataset_one_proc_all_selection", test_read_dataset_one_proc_all_selection, NULL, NULL, + NULL, 0, "read from dataset with one rank using all selection; others none selection"); + AddTest("test_read_dataset_hyper_file_all_mem", test_read_dataset_hyper_file_all_mem, NULL, NULL, NULL, 0, + "read from dataset with hyperslab sel. for file space; all sel. for memory"); + AddTest("test_read_dataset_all_file_hyper_mem", test_read_dataset_all_file_hyper_mem, NULL, NULL, NULL, 0, + "read from dataset with all sel. for file space; hyperslab sel. for memory"); + AddTest("test_read_dataset_point_file_all_mem", test_read_dataset_point_file_all_mem, NULL, NULL, NULL, 0, + "read from dataset with point sel. for file space; all sel. for memory"); + AddTest("test_read_dataset_all_file_point_mem", test_read_dataset_all_file_point_mem, NULL, NULL, NULL, 0, + "read from dataset with all sel. for file space; point sel. for memory"); + AddTest("test_read_dataset_hyper_file_point_mem", test_read_dataset_hyper_file_point_mem, NULL, NULL, + NULL, 0, "read from dataset with hyperslab sel. for file space; point sel. for memory"); + AddTest("test_read_dataset_point_file_hyper_mem", test_read_dataset_point_file_hyper_mem, NULL, NULL, + NULL, 0, "read from dataset with point sel. for file space; hyperslab sel. for memory"); + AddTest("test_write_multi_chunk_dataset_same_shape_read", test_write_multi_chunk_dataset_same_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_write_multi_chunk_dataset_diff_shape_read", test_write_multi_chunk_dataset_diff_shape_read, + NULL, NULL, NULL, 0, "write to dataset with multiple chunks using differently shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_same_shape_read", + test_overwrite_multi_chunk_dataset_same_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using same shaped dataspaces"); + AddTest("test_overwrite_multi_chunk_dataset_diff_shape_read", + test_overwrite_multi_chunk_dataset_diff_shape_read, NULL, NULL, NULL, 0, + "several overwrites to dataset with multiple chunks using differently shaped dataspaces"); } diff --git a/testpar/API/H5_api_dataset_test_parallel.h b/testpar/API/H5_api_dataset_test_parallel.h index d1af1d430ec..17ab7fefeba 100644 --- a/testpar/API/H5_api_dataset_test_parallel.h +++ b/testpar/API/H5_api_dataset_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_dataset_test_parallel(void); +void H5_api_dataset_test_parallel_add(void); #endif /* H5_API_DATASET_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_datatype_test_parallel.c b/testpar/API/H5_api_datatype_test_parallel.c index a6234042258..6b5faf2d04e 100644 --- a/testpar/API/H5_api_datatype_test_parallel.c +++ b/testpar/API/H5_api_datatype_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_datatype_test_parallel.h" -/* - * The array of parallel datatype tests to be performed. - */ -static int (*par_datatype_tests[])(void) = {NULL}; +static void print_datatype_test_header(const void *params); -int -H5_api_datatype_test_parallel(void) +static void +print_datatype_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Datatype Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_datatype_tests); i++) { - /* nerrors += (*par_datatype_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_datatype_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_datatype_test_header", print_datatype_test_header, NULL, NULL, NULL, 0, + "Prints header for datatype tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_datatype_test_parallel.h b/testpar/API/H5_api_datatype_test_parallel.h index 9f169fdc8ed..4524debfc81 100644 --- a/testpar/API/H5_api_datatype_test_parallel.h +++ b/testpar/API/H5_api_datatype_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_datatype_test_parallel(void); +void H5_api_datatype_test_parallel_add(void); #endif /* H5_API_DATATYPE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_file_test_parallel.c b/testpar/API/H5_api_file_test_parallel.c index 70f37c00405..c86517c7347 100644 --- a/testpar/API/H5_api_file_test_parallel.c +++ b/testpar/API/H5_api_file_test_parallel.c @@ -12,25 +12,30 @@ #include "H5_api_file_test_parallel.h" -static int test_create_file(void); -static int test_open_file(void); -static int test_split_comm_file_access(void); +static void print_file_test_header(const void *params); +static void test_create_file(const void *params); +static void test_open_file(const void *params); +static void test_split_comm_file_access(const void *params); -/* - * The array of parallel file tests to be performed. - */ -static int (*par_file_tests[])(void) = { - test_create_file, - test_open_file, - test_split_comm_file_access, -}; +static void +print_file_test_header(const void H5_ATTR_UNUSED *params) +{ + if (MAINPROCESS) { + printf("\n"); + printf("**********************************************\n"); + printf("* *\n"); + printf("* API Parallel File Tests *\n"); + printf("* *\n"); + printf("**********************************************\n\n"); + } +} /* * A test to ensure that a file can be created in parallel. */ #define FILE_CREATE_TEST_FILENAME "test_file_parallel.h5" -static int -test_create_file(void) +static void +test_create_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -41,7 +46,7 @@ test_create_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) @@ -53,31 +58,35 @@ test_create_file(void) goto error; } - if (H5Pclose(fapl_id) < 0) - TEST_ERROR; if (H5Fclose(file_id) < 0) TEST_ERROR; + if (GetTestCleanup() && H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id) < 0) + TEST_ERROR; + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { - H5Pclose(fapl_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id); + H5Pclose(fapl_id); } H5E_END_TRY - return 1; + return; } /* * A test to ensure that a file can be opened in parallel. */ -static int -test_open_file(void) +static void +test_open_file(const void H5_ATTR_UNUSED *params) { hid_t file_id = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -88,7 +97,7 @@ test_open_file(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } TESTING_2("test setup"); @@ -159,7 +168,7 @@ test_open_file(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY @@ -169,7 +178,7 @@ test_open_file(void) } H5E_END_TRY - return 1; + return; } /* @@ -185,8 +194,8 @@ test_open_file(void) * sooner or later due to MPI_Barrier calls being mixed up. */ #define SPLIT_FILE_COMM_TEST_FILE_NAME "split_comm_file.h5" -static int -test_split_comm_file_access(void) +static void +test_split_comm_file_access(const void H5_ATTR_UNUSED *params) { MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; @@ -202,7 +211,7 @@ test_split_comm_file_access(void) if (!(vol_cap_flags_g & H5VL_CAP_FLAG_FILE_BASIC)) { SKIPPED(); printf(" API functions for basic file aren't supported with this connector\n"); - return 0; + return; } /* set up MPI parameters */ @@ -251,7 +260,7 @@ test_split_comm_file_access(void) } /* delete the test file */ - if (H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id) < 0) { + if (GetTestCleanup() && H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id) < 0) { H5_FAILED(); printf(" failed to delete file '%s'\n", SPLIT_FILE_COMM_TEST_FILE_NAME); err_occurred = 1; @@ -294,74 +303,30 @@ test_split_comm_file_access(void) PASSED(); - return 0; + return; error: H5E_BEGIN_TRY { - H5Pclose(fapl_id); H5Fclose(file_id); + if (GetTestCleanup()) + H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, fapl_id); + H5Pclose(fapl_id); } H5E_END_TRY - return 1; + return; } -/* - * Cleanup temporary test files - */ -static void -cleanup_files(void) +void +H5_api_file_test_parallel_add(void) { - hid_t fapl_id = H5I_INVALID_HID; - - if ((fapl_id = create_mpi_fapl(MPI_COMM_WORLD, MPI_INFO_NULL, true)) < 0) { - if (MAINPROCESS) - printf(" failed to create FAPL for deleting test files\n"); - return; - } - - H5Fdelete(FILE_CREATE_TEST_FILENAME, fapl_id); - - /* The below file is deleted as part of the test */ - /* H5Fdelete(SPLIT_FILE_COMM_TEST_FILE_NAME, H5P_DEFAULT); */ - - if (H5Pclose(fapl_id) < 0) { - if (MAINPROCESS) - printf(" failed to close FAPL used for deleting test files\n"); - return; - } -} - -int -H5_api_file_test_parallel(void) -{ - size_t i; - int nerrors; - - if (MAINPROCESS) { - printf("**********************************************\n"); - printf("* *\n"); - printf("* API Parallel File Tests *\n"); - printf("* *\n"); - printf("**********************************************\n\n"); - } - - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_file_tests); i++) { - nerrors += (*par_file_tests[i])() ? 1 : 0; - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) { - printf("\n"); - printf("Cleaning up testing files\n"); - } - - cleanup_files(); - - return nerrors; + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_file_test_header", print_file_test_header, NULL, NULL, NULL, 0, + "Prints header for file tests"); + + AddTest("test_create_file", test_create_file, NULL, NULL, NULL, 0, "H5Fcreate"); + AddTest("test_open_file", test_open_file, NULL, NULL, NULL, 0, "H5Fopen"); + AddTest("test_split_comm_file_access", test_split_comm_file_access, NULL, NULL, NULL, 0, + "file access with a split communicator"); } diff --git a/testpar/API/H5_api_file_test_parallel.h b/testpar/API/H5_api_file_test_parallel.h index d7bf5522dea..057df817f57 100644 --- a/testpar/API/H5_api_file_test_parallel.h +++ b/testpar/API/H5_api_file_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_file_test_parallel(void); +void H5_api_file_test_parallel_add(void); #endif /* H5_API_FILE_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_group_test_parallel.c b/testpar/API/H5_api_group_test_parallel.c index f3e81cc4db7..ffacc870ac0 100644 --- a/testpar/API/H5_api_group_test_parallel.c +++ b/testpar/API/H5_api_group_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_group_test_parallel.h" -/* - * The array of parallel group tests to be performed. - */ -static int (*par_group_tests[])(void) = {NULL}; +static void print_group_test_header(const void *params); -int -H5_api_group_test_parallel(void) +static void +print_group_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Group Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_group_tests); i++) { - /* nerrors += (*par_group_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_group_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_group_test_header", print_group_test_header, NULL, NULL, NULL, 0, + "Prints header for group tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_group_test_parallel.h b/testpar/API/H5_api_group_test_parallel.h index a3201d13500..74897c602a6 100644 --- a/testpar/API/H5_api_group_test_parallel.h +++ b/testpar/API/H5_api_group_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_group_test_parallel(void); +void H5_api_group_test_parallel_add(void); #endif /* H5_API_GROUP_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_link_test_parallel.c b/testpar/API/H5_api_link_test_parallel.c index 33dcb002108..8df1d74ba24 100644 --- a/testpar/API/H5_api_link_test_parallel.c +++ b/testpar/API/H5_api_link_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_link_test_parallel.h" -/* - * The array of parallel link tests to be performed. - */ -static int (*par_link_tests[])(void) = {NULL}; +static void print_link_test_header(const void *params); -int -H5_api_link_test_parallel(void) +static void +print_link_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Link Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_link_tests); i++) { - /* nerrors += (*par_link_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_link_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_link_test_header", print_link_test_header, NULL, NULL, NULL, 0, + "Prints header for link tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_link_test_parallel.h b/testpar/API/H5_api_link_test_parallel.h index 72aaef22aed..0b0666c0e66 100644 --- a/testpar/API/H5_api_link_test_parallel.h +++ b/testpar/API/H5_api_link_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_link_test_parallel(void); +void H5_api_link_test_parallel_add(void); #endif /* H5_API_LINK_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_misc_test_parallel.c b/testpar/API/H5_api_misc_test_parallel.c index b8a9147633d..37ce0374bba 100644 --- a/testpar/API/H5_api_misc_test_parallel.c +++ b/testpar/API/H5_api_misc_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_misc_test_parallel.h" -/* - * The array of parallel miscellaneous tests to be performed. - */ -static int (*par_misc_tests[])(void) = {NULL}; +static void print_misc_test_header(const void *params); -int -H5_api_misc_test_parallel(void) +static void +print_misc_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Miscellaneous Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_misc_tests); i++) { - /* nerrors += (*par_misc_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_misc_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_misc_test_header", print_misc_test_header, NULL, NULL, NULL, 0, + "Prints header for miscellaneous tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_misc_test_parallel.h b/testpar/API/H5_api_misc_test_parallel.h index abe5ec0a163..cf1a33dc5bb 100644 --- a/testpar/API/H5_api_misc_test_parallel.h +++ b/testpar/API/H5_api_misc_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_misc_test_parallel(void); +void H5_api_misc_test_parallel_add(void); #endif /* H5_API_MISC_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_object_test_parallel.c b/testpar/API/H5_api_object_test_parallel.c index b475dfdf768..e7b3804281a 100644 --- a/testpar/API/H5_api_object_test_parallel.c +++ b/testpar/API/H5_api_object_test_parallel.c @@ -12,36 +12,27 @@ #include "H5_api_object_test_parallel.h" -/* - * The array of parallel object tests to be performed. - */ -static int (*par_object_tests[])(void) = {NULL}; +static void print_object_test_header(const void *params); -int -H5_api_object_test_parallel(void) +static void +print_object_test_header(const void H5_ATTR_UNUSED *params) { - size_t i; - int nerrors; - if (MAINPROCESS) { + printf("\n"); printf("**********************************************\n"); printf("* *\n"); printf("* API Parallel Object Tests *\n"); printf("* *\n"); printf("**********************************************\n\n"); } +} - for (i = 0, nerrors = 0; i < ARRAY_LENGTH(par_object_tests); i++) { - /* nerrors += (*par_object_tests[i])() ? 1 : 0; */ - - if (MPI_SUCCESS != MPI_Barrier(MPI_COMM_WORLD)) { - if (MAINPROCESS) - printf(" MPI_Barrier() failed!\n"); - } - } - - if (MAINPROCESS) - printf("\n"); +void +H5_api_object_test_parallel_add(void) +{ + /* Add a fake test to print out a header to distinguish different test interfaces */ + AddTest("print_object_test_header", print_object_test_header, NULL, NULL, NULL, 0, + "Prints header for object tests"); - return nerrors; + /* No tests yet */ } diff --git a/testpar/API/H5_api_object_test_parallel.h b/testpar/API/H5_api_object_test_parallel.h index 8e8e81739d4..66a47fb2fe2 100644 --- a/testpar/API/H5_api_object_test_parallel.h +++ b/testpar/API/H5_api_object_test_parallel.h @@ -15,6 +15,6 @@ #include "H5_api_test_parallel.h" -int H5_api_object_test_parallel(void); +void H5_api_object_test_parallel_add(void); #endif /* H5_API_OBJECT_TEST_PARALLEL_H_ */ diff --git a/testpar/API/H5_api_test_parallel.c b/testpar/API/H5_api_test_parallel.c index 882cce2fdae..7a80c9b1bdd 100644 --- a/testpar/API/H5_api_test_parallel.c +++ b/testpar/API/H5_api_test_parallel.c @@ -46,27 +46,27 @@ int mpi_rank; #ifdef H5_API_TEST_HAVE_ASYNC #define H5_API_PARALLEL_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel, 1) \ - X(H5_API_TEST_ASYNC, "async", H5_api_async_test_parallel, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel_add, 1) \ + X(H5_API_TEST_ASYNC, "async", H5_api_async_test_parallel_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #else #define H5_API_PARALLEL_TESTS \ X(H5_API_TEST_NULL, "", NULL, 0) \ - X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel, 1) \ - X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel, 1) \ - X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel, 1) \ - X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel, 1) \ - X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel, 1) \ - X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel, 1) \ - X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel, 1) \ - X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel, 1) \ + X(H5_API_TEST_FILE, "file", H5_api_file_test_parallel_add, 1) \ + X(H5_API_TEST_GROUP, "group", H5_api_group_test_parallel_add, 1) \ + X(H5_API_TEST_DATASET, "dataset", H5_api_dataset_test_parallel_add, 1) \ + X(H5_API_TEST_DATATYPE, "datatype", H5_api_datatype_test_parallel_add, 1) \ + X(H5_API_TEST_ATTRIBUTE, "attribute", H5_api_attribute_test_parallel_add, 1) \ + X(H5_API_TEST_LINK, "link", H5_api_link_test_parallel_add, 1) \ + X(H5_API_TEST_OBJECT, "object", H5_api_object_test_parallel_add, 1) \ + X(H5_API_TEST_MISC, "misc", H5_api_misc_test_parallel_add, 1) \ X(H5_API_TEST_MAX, "", NULL, 0) #endif @@ -77,7 +77,7 @@ enum H5_api_test_type { H5_API_PARALLEL_TESTS }; static const char *const H5_api_test_name[] = {H5_API_PARALLEL_TESTS}; #undef X #define X(a, b, c, d) c, -static int (*H5_api_test_func[])(void) = {H5_API_PARALLEL_TESTS}; +static void (*H5_api_test_add_func[])(void) = {H5_API_PARALLEL_TESTS}; #undef X #define X(a, b, c, d) d, static int H5_api_test_enabled[] = {H5_API_PARALLEL_TESTS}; @@ -95,13 +95,13 @@ H5_api_test_name_to_type(const char *test_name) } static void -H5_api_test_run(void) +H5_api_test_add(void) { enum H5_api_test_type i; for (i = H5_API_TEST_FILE; i < H5_API_TEST_MAX; i++) if (H5_api_test_enabled[i]) - (void)H5_api_test_func[i](); + H5_api_test_add_func[i](); } hid_t @@ -169,9 +169,40 @@ generate_random_parallel_dimensions(int space_rank, hsize_t **dims_out) return -1; } +static int +parse_command_line(int argc, char **argv) +{ + /* Simple argument checking, TODO can improve that later */ + if (argc > 1) { + enum H5_api_test_type i = H5_api_test_name_to_type(argv[argc - 1]); + if (i != H5_API_TEST_NULL) { + /* Run only specific API test */ + memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); + H5_api_test_enabled[i] = 1; + } + } + + return 0; +} + +static void +usage(FILE *stream) +{ + fprintf(stream, "file run only the file interface tests\n"); + fprintf(stream, "group run only the group interface tests\n"); + fprintf(stream, "dataset run only the dataset interface tests\n"); + fprintf(stream, "attribute run only the attribute interface tests\n"); + fprintf(stream, "datatype run only the datatype interface tests\n"); + fprintf(stream, "link run only the link interface tests\n"); + fprintf(stream, "object run only the object interface tests\n"); + fprintf(stream, "misc run only the miscellaneous tests\n"); + fprintf(stream, "async run only the async interface tests\n"); +} + int main(int argc, char **argv) { + H5E_auto2_t default_err_func; const char *vol_connector_string; const char *vol_connector_name; unsigned seed; @@ -180,6 +211,7 @@ main(int argc, char **argv) hid_t registered_con_id = H5I_INVALID_HID; char *vol_connector_string_copy = NULL; char *vol_connector_info = NULL; + void *default_err_data = NULL; int required = MPI_THREAD_MULTIPLE; int provided; @@ -200,16 +232,6 @@ main(int argc, char **argv) printf("** INFO: couldn't initialize with MPI_THREAD_MULTIPLE threading support **\n"); } - /* Simple argument checking, TODO can improve that later */ - if (argc > 1) { - enum H5_api_test_type i = H5_api_test_name_to_type(argv[1]); - if (i != H5_API_TEST_NULL) { - /* Run only specific API test */ - memset(H5_api_test_enabled, 0, sizeof(H5_api_test_enabled)); - H5_api_test_enabled[i] = 1; - } - } - /* * Make sure that HDF5 is initialized on all MPI ranks before proceeding. * This is important for certain VOL connectors which may require a @@ -217,6 +239,43 @@ main(int argc, char **argv) */ H5open(); + /* Store current error stack printing function since TestInit unsets it */ + H5Eget_auto2(H5E_DEFAULT, &default_err_func, &default_err_data); + + /* Initialize testing framework */ + if (TestInit(argv[0], usage, NULL, NULL, NULL, mpi_rank) < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't initialize testing framework\n"); + goto error; + } + + /* Reset error stack printing function */ + H5Eset_auto2(H5E_DEFAULT, default_err_func, default_err_data); + + /* Hide all output from testing framework and replace with our own */ + SetTestVerbosity(VERBO_NONE); + + /* Parse command line separately from the test framework since + * tests need to be added before TestParseCmdLine in order for + * the -help option to show them, but we need to know ahead of + * time which tests to add if only a specific interface's tests + * are going to be run. + */ + parse_command_line(argc, argv); + + /* Add tests */ + H5_api_test_add(); + + /* Display testing information */ + TestInfo(stdout); + + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't parse command-line arguments\n"); + goto error; + } + n_tests_run_g = 0; n_tests_passed_g = 0; n_tests_failed_g = 0; @@ -285,7 +344,7 @@ main(int argc, char **argv) printf(" - Test file name: '%s'\n", H5_api_test_parallel_filename); printf(" - Number of MPI ranks: %d\n", mpi_size); printf(" - Test seed: %u\n", seed); - printf("\n\n"); + printf("\n"); } BEGIN_INDEPENDENT_OP(create_fapl) @@ -389,19 +448,35 @@ main(int argc, char **argv) } END_INDEPENDENT_OP(create_test_container); - /* Run all the tests that are enabled */ - H5_api_test_run(); + MPI_Barrier(MPI_COMM_WORLD); + + /* Perform tests */ + if (PerformTests() < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't run tests\n"); + goto error; + } if (MAINPROCESS) - printf("Cleaning up testing files\n"); - H5Fdelete(H5_api_test_parallel_filename, fapl_id); + printf("\n"); + + if (MAINPROCESS) { + /* Display test summary, if requested */ + if (GetTestSummary()) + TestSummary(stdout); + + printf("Deleting container file for tests\n\n"); + } + + if (GetTestCleanup()) + H5Fdelete(H5_api_test_parallel_filename, fapl_id); if (n_tests_run_g > 0) { if (MAINPROCESS) printf("The below statistics are minimum values due to the possibility of some ranks failing a " "test while others pass:\n"); - if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_passed_g, 1, MPI_UNSIGNED_LONG_LONG, MPI_MIN, + if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_passed_g, 1, H5_SIZE_T_AS_MPI_TYPE, MPI_MIN, MPI_COMM_WORLD)) { if (MAINPROCESS) printf(" failed to collect consensus about the minimum number of tests that passed -- " @@ -413,7 +488,7 @@ main(int argc, char **argv) n_tests_passed_g > 0 ? "At least " : "", n_tests_passed_g, n_tests_run_g, ((double)n_tests_passed_g / (double)n_tests_run_g * 100.0), vol_connector_name); - if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_failed_g, 1, MPI_UNSIGNED_LONG_LONG, MPI_MIN, + if (MPI_SUCCESS != MPI_Allreduce(MPI_IN_PLACE, &n_tests_failed_g, 1, H5_SIZE_T_AS_MPI_TYPE, MPI_MIN, MPI_COMM_WORLD)) { if (MAINPROCESS) printf(" failed to collect consensus about the minimum number of tests that failed -- " @@ -446,11 +521,28 @@ main(int argc, char **argv) fprintf(stderr, " failed to close MPI FAPL\n"); } + free(vol_connector_string_copy); + vol_connector_string_copy = NULL; + + if (GetTestNumErrs() > 0) + n_tests_failed_g += (size_t)GetTestNumErrs(); + + /* Release test infrastructure */ + if (TestShutdown() < 0) { + if (MAINPROCESS) + fprintf(stderr, "Couldn't shut down testing framework\n"); + goto error; + } + H5close(); MPI_Finalize(); - exit(EXIT_SUCCESS); + /* Exit failure if errors encountered; else exit success. */ + if (n_tests_failed_g > 0) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); error: free(vol_connector_string_copy);