diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2020-06-11 01:15:41 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2020-06-11 01:15:41 (GMT) |
commit | 3650841a0a307e512bcc9aa04332ce72a780fc69 (patch) | |
tree | 9f94c54394953b2ab594329cf284e0d900cc0b51 | |
parent | 1e6b6b4bc6e56cfd63268d1823e0ab4baca00234 (diff) | |
parent | 5c0bd670d6e9919c463fbc05de99e2ba55b0761e (diff) | |
download | hdf5-3650841a0a307e512bcc9aa04332ce72a780fc69.zip hdf5-3650841a0a307e512bcc9aa04332ce72a780fc69.tar.gz hdf5-3650841a0a307e512bcc9aa04332ce72a780fc69.tar.bz2 |
Merge pull request #2636 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:HDFFV-11000-update-testh5cc.sh.in-for-version to develop
* commit '5c0bd670d6e9919c463fbc05de99e2ba55b0761e':
Add tests for all version to H5_NO_DEPRECATED_SYMBOLS section and to section for current version, with and without default API version flags.
HDFFV-11000: update-testh5cc.sh.in to test sample versioned functions in HDF5 1.10, 1.12 and develop.
-rw-r--r-- | examples/testh5cc.sh.in | 130 |
1 files changed, 126 insertions, 4 deletions
diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 9f766dd..71e84ed 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -48,6 +48,10 @@ verbose=${HDF5_VERBOSE:-1} # 0: none; 1: default; 2: chatty; 3: everything test $verbose -gt 2 && set -x H5_NO_DEPRECATED_SYMBOLS=`grep '#define H5_NO_DEPRECATED_SYMBOLS ' ../src/H5pubconf.h` H5_USE_16_API_DEFAULT=`grep '#define H5_USE_16_API_DEFAULT ' ../src/H5pubconf.h` +H5_USE_18_API_DEFAULT=`grep '#define H5_USE_18_API_DEFAULT ' ../src/H5pubconf.h` +H5_USE_110_API_DEFAULT=`grep '#define H5_USE_110_API_DEFAULT ' ../src/H5pubconf.h` +H5_USE_112_API_DEFAULT=`grep '#define H5_USE_112_API_DEFAULT ' ../src/H5pubconf.h` +H5_USE_114_API_DEFAULT=`grep '#define H5_USE_114_API_DEFAULT ' ../src/H5pubconf.h` # setup my machine information. myos=`uname -s` @@ -61,6 +65,10 @@ v16main=${H5TOOL}_v16main.$suffix v16main_o=${H5TOOL}_v16main.o v18main=${H5TOOL}_v18main.$suffix v18main_o=${H5TOOL}_v18main.o +v110main=${H5TOOL}_v110main.$suffix +v110main_o=${H5TOOL}_v110main.o +v112main=${H5TOOL}_v112main.$suffix +v112main_o=${H5TOOL}_v112main.o appmain=${H5TOOL}_appmain.$suffix appmain_o=${H5TOOL}_appmain.o prog1=${H5TOOL}_prog1.$suffix @@ -74,7 +82,7 @@ applib=libapp${H5TOOL}.a # Don't use the wildcard form of *.h5 as it will wipe out even *.h5 generated # by otehr test programs. This will cause a racing condition error when # parallel make (e.g., gmake -j 4) is used. -temp_SRC="$hdf5main $v16main $v18main $appmain $prog1 $prog2" +temp_SRC="$hdf5main $v16main $v18main $v110main $v112main $appmain $prog1 $prog2" temp_OBJ=`echo $temp_SRC | sed -e "s/\.${suffix}/.o/g"` temp_FILES="a.out $applib" @@ -196,6 +204,82 @@ main (void) } EOF +# Generate HDF5 v1.10 Main Program: +# This makes unique V1.10 API calls. +cat > $v110main <<EOF +/* This is a V1.10 API calls example Program. */ +#include "hdf5.h" +#define H5FILE_NAME "tmp.h5" +int +main (void) +{ + hid_t file, group, group2, dset, dset2; /* file and group handles */ + + file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + group = H5Gcreate(file, "/Group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + group2 = H5Gcreate2(file, "/Group1.8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset = H5Dopen(group, "Dataset", H5P_DEFAULT); + dset2 = H5Dopen2(group2, "Dataset2", H5P_DEFAULT); + H5Dclose(dset); + H5Dclose(dset2); + H5Gclose(group2); + H5Gclose(group); + H5Fclose(file); + + printf("HDF5 C program created with V1.10 API ran successfully. " + "File %s generated.\n", H5FILE_NAME); + remove(H5FILE_NAME); + return 0; +} +EOF + +# Generate HDF5 v1.12 Main Program: +# This makes unique V1.12 API calls. +cat > $v112main <<EOF +/* This is a V1.12 API calls example Program. */ +#include "hdf5.h" +#define H5FILE_NAME "tmp.h5" +#define SPACE1_RANK 3 +int +main (void) +{ + hid_t sid; /* Dataspace ID */ + hid_t fapl = -1; /* File access property list ID */ + int rank; /* Logical rank of dataspace */ + hsize_t dims[] = {3, 3, 15}; + size_t sbuf_size=0; + herr_t ret; /* Generic return value */ + hsize_t start[] = {0, 0, 0}; + hsize_t stride[] = {2, 5, 3}; + hsize_t count[] = {2, 2, 2}; + hsize_t block[] = {1, 3, 1}; + + /* Create the file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + + /* Set low/high bounds in the fapl */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, + H5F_LIBVER_LATEST); + + /* Create the dataspace */ + sid = H5Screate_simple(SPACE1_RANK, dims, NULL); + + /* Set the hyperslab selection */ + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); + + /* Encode simple dataspace in a buffer with the fapl setting */ + ret = H5Sencode(sid, NULL, &sbuf_size, fapl); + + /* Encode simple dataspace in a buffer with the fapl setting */ + ret = H5Sencode2(sid, NULL, &sbuf_size, fapl); + + printf("HDF5 C program created with V1.12 API ran successfully. "); +/* "File %s generated.\n", H5FILE_NAME); + remove(H5FILE_NAME); */ + return 0; +} +EOF + # Parse option # None @@ -304,17 +388,30 @@ TOOLTEST -E $appmain $prog1 $prog2 # Group5: Version compatibility tests. echo "***"Version compatibility tests. -# Test these two cases now. More later. +# 20200610 Updated for versions 1.10 - 1.14. # If H5_NO_DEPRECATED_SYMBOLS; -# then only v18main works. +# then versions v18main, v110main, and v112main work. +# -DH5_USE_<N>_API_DEFAULT flags cannot be used with H5_NO_DEPRECATED_SYMBOLS; # else if H5_USE_16_API_DEFAULT; # then v16main works. # else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. +# as new versions with versioned functions are added, they will work with and +# should be added to H5_NO_DEPRECATED_SYMBOLS and to the else section, with and +# without the -DH5_USE_<N>_API_DEFAULT flag. A new H5_USE_<N>_API_DEFAULT section +# should also be added. # if [ -n "$H5_USE_16_API_DEFAULT" ]; then echo "H5_USE_16_API_DEFAULT is defined." +elif [ -n "$H5_USE_18_API_DEFAULT" ]; then + echo "H5_USE_18_API_DEFAULT is defined." +elif [ -n "$H5_USE_110_API_DEFAULT" ]; then + echo "H5_USE_110_API_DEFAULT is defined." +elif [ -n "$H5_USE_112_API_DEFAULT" ]; then + echo "H5_USE_112_API_DEFAULT is defined." +elif [ -n "$H5_USE_114_API_DEFAULT" ]; then + echo "H5_USE_114_API_DEFAULT is defined." else - echo "H5_USE_16_API_DEFAULT is not defined." + echo "No H5 API_DEFAULT is defined." fi if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then echo "H5_NO_DEPRECATED_SYMBOLS is defined." @@ -324,11 +421,36 @@ fi if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then echo "Skipping $v16main test" TOOLTEST $v18main + TOOLTEST $v18main + TOOLTEST $v110main + TOOLTEST $v112main elif [ -n "$H5_USE_16_API_DEFAULT" ]; then + echo "Testing HDF5 with 16_API_DEFAULT" TOOLTEST $v16main +elif [ -n "$H5_USE_18_API_DEFAULT" ]; then + echo "Testing HDF5 with 18_API_DEFAULT" + TOOLTEST -DH5_USE_16_API_DEFAULT $v16main + TOOLTEST $v18main +elif [ -n "$H5_USE_110_API_DEFAULT" ]; then + echo "Testing HDF5 with 110_API_DEFAULT" + TOOLTEST -DH5_USE_16_API_DEFAULT $v16main + TOOLTEST -DH5_USE_18_API_DEFAULT $v18main + TOOLTEST $v110main +elif [ -n "$H5_USE_112_API_DEFAULT" ]; then + echo "Testing HDF5 with 112_API_DEFAULT" + TOOLTEST -DH5_USE_16_API_DEFAULT $v16main + TOOLTEST -DH5_USE_18_API_DEFAULT $v18main + TOOLTEST -DH5_USE_110_API_DEFAULT $v110main + TOOLTEST $v112main else + echo "Testing HDF5 with 114_API_DEFAULT" TOOLTEST -DH5_USE_16_API_DEFAULT $v16main + TOOLTEST -DH5_USE_18_API_DEFAULT $v18main + TOOLTEST -DH5_USE_110_API_DEFAULT $v110main + TOOLTEST -DH5_USE_112_API_DEFAULT $v112main TOOLTEST $v18main + TOOLTEST $v110main + TOOLTEST $v112main fi ############################################################################## |