diff --git a/.github/workflows/hdfeos5.yml b/.github/workflows/hdfeos5.yml new file mode 100644 index 00000000000..4f4fb1adea1 --- /dev/null +++ b/.github/workflows/hdfeos5.yml @@ -0,0 +1,51 @@ +name: hdfeos5 1.14 + +# Triggers the workflow on push or pull request or on demand +on: + workflow_dispatch: + push: + pull_request: + branches: [ hdf5_1_14 ] + paths-ignore: + - '.github/CODEOWNERS' + - '.github/FUNDING.yml' + - 'doc/**' + - 'release_docs/**' + - 'ACKNOWLEDGEMENTS' + - 'COPYING**' + - '**.md' + +# Using concurrency to cancel any in-progress job or run +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + name: Build hdfeos5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.7 + + - name: Install Autotools Dependencies (Linux) + run: | + sudo apt update + sudo apt install automake autoconf libtool libtool-bin + - name: Install HDF5 + run: | + ./autogen.sh + ./configure --prefix=/usr/local --disable-tests --with-default-api-version=v16 + make + sudo make install + - name: Install HDF-EOS5 + run: | + wget -O HDF-EOS5.2.0.tar.gz "https://git.earthdata.nasa.gov/projects/DAS/repos/hdfeos5/raw/hdf-eos5-2.0-src.tar.gz?at=refs%2Fheads%2FHDFEOS5_2.0" + tar zxvf HDF-EOS5.2.0.tar.gz + cd hdf-eos5-2.0 + ./configure CC=/usr/local/bin/h5cc --prefix=/usr/local/ --enable-install-include + make + make check + sudo make install diff --git a/CMakeLists.txt b/CMakeLists.txt index cf9729d099e..96240b71806 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,7 @@ set (HDF5_LIB_BASE "hdf5") set (HDF5_LIB_CORE "") set (HDF5_TEST_LIB_CORE "_test") +set (HDF5_TEST_PAR_LIB_CORE "_testpar") set (HDF5_CPP_LIB_CORE "_cpp") set (HDF5_HL_LIB_CORE "_hl") set (HDF5_HL_CPP_LIB_CORE "_hl_cpp") @@ -174,6 +175,7 @@ set (HDF5_JAVA_JNI_LIB_CORE "_java") set (HDF5_LIB_CORENAME "${HDF5_LIB_BASE}") set (HDF5_TEST_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_TEST_LIB_CORE}") +set (HDF5_TEST_PAR_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_TEST_PAR_LIB_CORE}") set (HDF5_CPP_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_CPP_LIB_CORE}") set (HDF5_HL_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_HL_LIB_CORE}") set (HDF5_HL_CPP_LIB_CORENAME "${HDF5_LIB_BASE}${HDF5_HL_CPP_LIB_CORE}") @@ -194,6 +196,7 @@ set (HDF5_JAVA_TEST_LIB_CORENAME "jartest5") #----------------------------------------------------------------------------- set (HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_TEST_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") +set (HDF5_TEST_PAR_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_TEST_PAR_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_CPP_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_HL_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_HL_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") set (HDF5_HL_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_BASE}${HDF5_LIB_INFIX}${HDF5_HL_CPP_LIB_CORE}${HDF5_EXTERNAL_LIB_SUFFIX}") @@ -216,6 +219,7 @@ set (HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB #----------------------------------------------------------------------------- set (HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-static") set (HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-static") +set (HDF5_TEST_PAR_LIB_TARGET "${HDF5_TEST_PAR_LIB_CORENAME}-static") set (HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-static") set (HDF5_HL_LIB_TARGET "${HDF5_HL_LIB_CORENAME}-static") set (HDF5_HL_CPP_LIB_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-static") @@ -232,6 +236,7 @@ set (HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}") set (HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}") set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared") set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared") +set (HDF5_TEST_PAR_LIBSH_TARGET "${HDF5_TEST_PAR_LIB_CORENAME}-shared") set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared") set (HDF5_HL_LIBSH_TARGET "${HDF5_HL_LIB_CORENAME}-shared") set (HDF5_HL_CPP_LIBSH_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-shared") diff --git a/bin/genparser b/bin/genparser index 619dbfaa3ed..3e113739447 100755 --- a/bin/genparser +++ b/bin/genparser @@ -200,14 +200,14 @@ if [ "$verbose" = true ] ; then fi ${HDF5_FLEX} --nounistd -PH5LTyy -o ${path_to_hl_src}/H5LTanalyze.c ${path_to_hl_src}/H5LTanalyze.l -# fix H5LTparse.c and H5LTlparse.h to declare H5LTyyparse return type as an -# hid_t instead of int. Currently the generated function H5LTyyparse is -# generated with a return value of type int, which is a mapping to the +# Fix H5LTparse.c and H5LTparse.h to declare H5LTyyparse return type as an +# hid_t instead of int. Currently, the H5LTyyparse function is generated +# with a return value of type int, which is a mapping to the # flex yyparse function. The return value in the HL library should be # an hid_t. -# I propose to not use flex to generate this function, but for now I am -# adding a perl command to find and replace this function declaration in -# H5LTparse.c. +# Use Perl command to find and replace this function declaration +# in H5LTparse.c. This is a temporary solution until a method that does not +# use flex is implemented. perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.c perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.c perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.c diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 65dabbe11c2..625e97f0d72 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1451,7 +1451,7 @@ test_read_string(H5File &file) *------------------------------------------------------------------------- */ extern "C" void -test_dset() +test_dset(const void *params) { hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template @@ -1492,9 +1492,6 @@ test_dset() catch (Exception &E) { test_report(nerrors, H5std_string(" Dataset")); } - - // Clean up data file - cleanup_dsets(); } // test_dset /*------------------------------------------------------------------------- @@ -1506,8 +1503,10 @@ test_dset() *------------------------------------------------------------------------- */ extern "C" void -cleanup_dsets() +cleanup_dsets(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE_ACCPLIST.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE_ACCPLIST.c_str()); + } } // cleanup_dsets diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index fa6822ad172..6c8560d5c8d 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -22,6 +22,7 @@ #define H5cpputil_H #include "h5test.h" +#include "testframe.h" using namespace H5; using std::cerr; @@ -29,8 +30,8 @@ using std::endl; #define MESSAGE(V, A) \ do { \ - if (HDGetTestVerbosity() > (V)) \ - print_func A; \ + if (GetTestVerbosity() > (V)) \ + printf A; \ } while (0) #define SUBTEST(TEST) \ do { \ @@ -142,36 +143,36 @@ verify_val(Type1 x, Type2 value, float epsilon, const char *msg, int line, const #ifdef __cplusplus extern "C" { #endif -void test_array(); -void test_attr(); -void test_compound(); -void test_dsproplist(); -void test_file(); -void test_filters(); -void test_links(); -void test_h5s(); -void test_iterate(); -void test_object(); -void test_reference(); -void test_types(); -void test_vlstrings(); -void test_dset(); +void test_array(const void *params); +void test_attr(const void *params); +void test_compound(const void *params); +void test_dsproplist(const void *params); +void test_file(const void *params); +void test_filters(const void *params); +void test_links(const void *params); +void test_h5s(const void *params); +void test_iterate(const void *params); +void test_object(const void *params); +void test_reference(const void *params); +void test_types(const void *params); +void test_vlstrings(const void *params); +void test_dset(const void *params); /* Prototypes for the cleanup routines */ -void cleanup_array(); -void cleanup_attr(); -void cleanup_compound(); -void cleanup_dsproplist(); -void cleanup_dsets(); -void cleanup_file(); -void cleanup_filters(); -void cleanup_h5s(); -void cleanup_iterate(); -void cleanup_links(); -void cleanup_object(); -void cleanup_reference(); -void cleanup_types(); -void cleanup_vlstrings(); +void cleanup_array(void *params); +void cleanup_attr(void *params); +void cleanup_compound(void *params); +void cleanup_dsproplist(void *params); +void cleanup_dsets(void *params); +void cleanup_file(void *params); +void cleanup_filters(void *params); +void cleanup_h5s(void *params); +void cleanup_iterate(void *params); +void cleanup_links(void *params); +void cleanup_object(void *params); +void cleanup_reference(void *params); +void cleanup_types(void *params); +void cleanup_vlstrings(void *params); #ifdef __cplusplus } diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index 2d14264f006..3ee94d24f59 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -477,7 +477,7 @@ test_array_info() *------------------------------------------------------------------------- */ extern "C" void -test_array() +test_array(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Array Datatypes\n")); @@ -502,7 +502,9 @@ test_array() *------------------------------------------------------------------------- */ extern "C" void -cleanup_array() +cleanup_array(void *params) { - HDremove(FILENAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + } } // cleanup_array diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 5135e0c7fa7..07ab0a6d777 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1956,7 +1956,7 @@ test_attr_corder_create_basic(FileCreatPropList &fcpl, FileAccPropList &fapl) *------------------------------------------------------------------------- */ extern "C" void -test_attr() +test_attr(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Attributes\n")); @@ -2041,12 +2041,14 @@ test_attr() *------------------------------------------------------------------------- */ extern "C" void -cleanup_attr() +cleanup_attr(void *params) { - HDremove(FILE_BASIC.c_str()); - HDremove(FILE_COMPOUND.c_str()); - HDremove(FILE_SCALAR.c_str()); - HDremove(FILE_MULTI.c_str()); - HDremove(FILE_DTYPE.c_str()); - HDremove(FILE_CRTPROPS.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_BASIC.c_str()); + HDremove(FILE_COMPOUND.c_str()); + HDremove(FILE_SCALAR.c_str()); + HDremove(FILE_MULTI.c_str()); + HDremove(FILE_DTYPE.c_str()); + HDremove(FILE_CRTPROPS.c_str()); + } } diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 53939dd1eb8..dada2c075a8 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -729,7 +729,7 @@ test_compound_set_size() *------------------------------------------------------------------------- */ extern "C" void -test_compound() +test_compound(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Compound Data Type operations\n")); @@ -753,7 +753,9 @@ test_compound() *------------------------------------------------------------------------- */ extern "C" void -cleanup_compound() +cleanup_compound(void *params) { - HDremove(COMPFILE.c_str()); + if (GetTestCleanup()) { + HDremove(COMPFILE.c_str()); + } } // cleanup_file diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index bccc41a568f..90b558fdbbf 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -114,7 +114,7 @@ test_transfplist() *------------------------------------------------------------------------- */ extern "C" void -test_dsproplist() +test_dsproplist(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Generic Dataset Property Lists\n")); @@ -132,7 +132,9 @@ test_dsproplist() *------------------------------------------------------------------------- */ extern "C" void -cleanup_dsproplist() +cleanup_dsproplist(void *params) { - HDremove(FILENAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + } } diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index 518227dd26c..bbbe7b6a400 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -57,42 +57,42 @@ main(int argc, char *argv[]) // caused deliberately and expected. Exception::dontPrint(); /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + TestInit(argv[0], NULL, NULL, 0); // testing file creation and opening in tfile.cpp - AddTest("tfile", test_file, cleanup_file, "File I/O Operations", NULL); + AddTest("tfile", test_file, NULL, cleanup_file, NULL, 0, "File I/O Operations"); // testing dataset functionalities in dset.cpp - AddTest("dsets", test_dset, cleanup_dsets, "Dataset I/O Operations", NULL); + AddTest("dsets", test_dset, NULL, cleanup_dsets, NULL, 0, "Dataset I/O Operations"); // testing dataspace functionalities in th5s.cpp - AddTest("th5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); + AddTest("th5s", test_h5s, NULL, cleanup_h5s, NULL, 0, "Dataspaces"); // testing attribute functionalities in tattr.cpp - AddTest("tattr", test_attr, cleanup_attr, "Attributes", NULL); + AddTest("tattr", test_attr, NULL, cleanup_attr, NULL, 0, "Attributes"); // testing object functionalities in tobject.cpp - AddTest("tobject", test_object, cleanup_object, "Objects", NULL); + AddTest("tobject", test_object, NULL, cleanup_object, NULL, 0, "Objects"); // testing reference functionalities in trefer.cpp - AddTest("trefer", test_reference, cleanup_reference, "References", NULL); + AddTest("trefer", test_reference, NULL, cleanup_reference, NULL, 0, "References"); // testing variable-length strings in tvlstr.cpp - AddTest("tvlstr", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); - AddTest("ttypes", test_types, cleanup_types, "Generic Data Types", NULL); - AddTest("tarray", test_array, cleanup_array, "Array Datatypes", NULL); - AddTest("tcompound", test_compound, cleanup_compound, "Compound Data Types", NULL); - AddTest("tdspl", test_dsproplist, cleanup_dsproplist, "Dataset Property List", NULL); - AddTest("tfilter", test_filters, cleanup_filters, "Various Filters", NULL); - AddTest("tlinks", test_links, cleanup_links, "Various Links", NULL); + AddTest("tvlstr", test_vlstrings, NULL, cleanup_vlstrings, NULL, 0, "Variable-Length Strings"); + AddTest("ttypes", test_types, NULL, cleanup_types, NULL, 0, "Generic Data Types"); + AddTest("tarray", test_array, NULL, cleanup_array, NULL, 0, "Array Datatypes"); + AddTest("tcompound", test_compound, NULL, cleanup_compound, NULL, 0, "Compound Data Types"); + AddTest("tdspl", test_dsproplist, NULL, cleanup_dsproplist, NULL, 0, "Dataset Property List"); + AddTest("tfilter", test_filters, NULL, cleanup_filters, NULL, 0, "Various Filters"); + AddTest("tlinks", test_links, NULL, cleanup_links, NULL, 0, "Various Links"); /* Comment out tests that are not done yet. - BMR, Feb 2001 - AddTest("select", test_select, cleanup_select, "Selections", NULL); - AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); - AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); + AddTest("select", test_select, NULL, cleanup_select, NULL, 0, "Selections"); + AddTest("time", test_time, NULL, cleanup_time, NULL, 0, "Time Datatypes"); + AddTest("vltypes", test_vltypes, NULL, cleanup_vltypes, NULL, 0, "Variable-Length Datatypes"); */ - AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); + AddTest("iterate", test_iterate, NULL, cleanup_iterate, NULL, 0, "Group & Attribute Iteration"); /* - AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); - AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); + AddTest("genprop", test_genprop, NULL, cleanup_genprop, NULL, 0, "Generic Properties"); + AddTest("id", test_ids, NULL, NULL, NULL, 0, "User-Created Identifiers"); Comment out tests that are not done yet */ /* Tentative - BMR 2007/1/12 - AddTest("enum", test_enum, cleanup_enum, "Enum Data Types", NULL); + AddTest("enum", test_enum, NULL, cleanup_enum, NULL, 0, "Enum Data Types"); */ } catch (Exception &E) { @@ -100,7 +100,7 @@ main(int argc, char *argv[]) } /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); /* Parse command line arguments */ TestParseCmdLine(argc, argv); @@ -110,7 +110,7 @@ main(int argc, char *argv[]) /* Display test summary, if requested */ if (GetTestSummary()) - TestSummary(); + TestSummary(stdout); /* Clean up test files, if allowed */ if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 212a241a3d9..bd7d96422e8 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -968,7 +968,7 @@ test_file_info() *------------------------------------------------------------------------- */ extern "C" void -test_file() +test_file(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing File I/O Operations\n")); @@ -996,13 +996,15 @@ test_file() extern "C" #endif void - cleanup_file() + cleanup_file(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); - HDremove(FILE3.c_str()); - HDremove(FILE4.c_str()); - HDremove(FILE5.c_str()); - HDremove(FILE6.c_str()); - HDremove(FILE7.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); + HDremove(FILE3.c_str()); + HDremove(FILE4.c_str()); + HDremove(FILE5.c_str()); + HDremove(FILE6.c_str()); + HDremove(FILE7.c_str()); + } } // cleanup_file diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 26be0681c2d..d66a7b5894c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -227,7 +227,7 @@ test_szip_filter(H5File &file1) */ const H5std_string FILE1("tfilters.h5"); extern "C" void -test_filters() +test_filters(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Various Filters\n")); @@ -259,7 +259,9 @@ test_filters() *------------------------------------------------------------------------- */ extern "C" void -cleanup_filters() +cleanup_filters(void *params) { - HDremove(FILE1.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + } } diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 04bc3c0b188..34fb32d4cea 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -471,7 +471,7 @@ test_h5s_compound_scalar_read() *------------------------------------------------------------------------- */ extern "C" void -test_h5s() +test_h5s(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Dataspaces\n")); @@ -493,7 +493,9 @@ test_h5s() *------------------------------------------------------------------------- */ extern "C" void -cleanup_h5s() +cleanup_h5s(void *params) { - HDremove(DATAFILE.c_str()); + if (GetTestCleanup()) { + HDremove(DATAFILE.c_str()); + } } // cleanup_h5s diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index b9196d43976..958b1bda604 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -440,7 +440,7 @@ test_HDFFV_9920() *------------------------------------------------------------------------- */ extern "C" void -test_iterate() +test_iterate(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Iterate Feature\n")); @@ -464,8 +464,10 @@ test_iterate() *------------------------------------------------------------------------- */ extern "C" void -cleanup_iterate() +cleanup_iterate(void *params) { - HDremove(FILE_ITERATE.c_str()); - HDremove(FILE_NAME.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_ITERATE.c_str()); + HDremove(FILE_NAME.c_str()); + } } // cleanup_iterate diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 3ce8c6823d3..a6d68631fc4 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -709,7 +709,7 @@ test_visit(hid_t fapl_id, hbool_t new_format) *------------------------------------------------------------------------- */ extern "C" void -test_links() +test_links(const void *params) { hid_t fapl_id, fapl2_id; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ @@ -769,8 +769,10 @@ test_links() *------------------------------------------------------------------------- */ extern "C" void -cleanup_links() +cleanup_links(void *params) { - HDremove(FILENAME[0]); - HDremove(FILENAME[1]); + if (GetTestCleanup()) { + HDremove(FILENAME[0]); + HDremove(FILENAME[1]); + } } diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 0affed1f838..cec13323544 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -718,7 +718,7 @@ test_intermediate_groups() *------------------------------------------------------------------------- */ extern "C" void -test_object() +test_object(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Object Functions\n")); @@ -742,10 +742,12 @@ test_object() *------------------------------------------------------------------------- */ extern "C" void -cleanup_object() +cleanup_object(void *params) { - HDremove(FILE_OBJECTS.c_str()); - HDremove(FILE_OBJHDR.c_str()); - HDremove(FILE_OBJINFO.c_str()); - HDremove(FILE_INTERGRPS.c_str()); + if (GetTestCleanup()) { + HDremove(FILE_OBJECTS.c_str()); + HDremove(FILE_OBJHDR.c_str()); + HDremove(FILE_OBJINFO.c_str()); + HDremove(FILE_INTERGRPS.c_str()); + } } // cleanup_objects diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 31c50229a1e..627330f4660 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -827,7 +827,7 @@ test_reference_region_1D() *------------------------------------------------------------------------- */ extern "C" void -test_reference() +test_reference(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing References\n")); @@ -848,8 +848,10 @@ test_reference() *------------------------------------------------------------------------- */ extern "C" void -cleanup_reference() +cleanup_reference(void *params) { - HDremove(FILE1.c_str()); - HDremove(FILE2.c_str()); + if (GetTestCleanup()) { + HDremove(FILE1.c_str()); + HDremove(FILE2.c_str()); + } } diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 322b72f444e..c504635b6ca 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -1093,7 +1093,7 @@ test_operators() *------------------------------------------------------------------------- */ extern "C" void -test_types() +test_types(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Generic Data Types\n")); @@ -1120,8 +1120,10 @@ test_types() *------------------------------------------------------------------------- */ extern "C" void -cleanup_types() +cleanup_types(void *params) { - for (int i = 0; i < 6; i++) - HDremove(FILENAME[i]); + if (GetTestCleanup()) { + for (int i = 0; i < 6; i++) + HDremove(FILENAME[i]); + } } // cleanup_types diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 33710a3ba17..ba39620334a 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -934,7 +934,7 @@ test_vl_rewrite() *------------------------------------------------------------------------- */ extern "C" void -test_vlstrings() +test_vlstrings(const void *params) { // Output message about test being performed MESSAGE(5, ("Testing Variable-Length Strings")); @@ -967,8 +967,10 @@ test_vlstrings() *------------------------------------------------------------------------- */ extern "C" void -cleanup_vlstrings() +cleanup_vlstrings(void *params) { - HDremove(FILENAME.c_str()); - HDremove(FILENAME2.c_str()); + if (GetTestCleanup()) { + HDremove(FILENAME.c_str()); + HDremove(FILENAME2.c_str()); + } } diff --git a/config/commence.am b/config/commence.am index 1f0dc2edda9..85753db286b 100644 --- a/config/commence.am +++ b/config/commence.am @@ -31,6 +31,7 @@ RUNEXEC=$(RUNSERIAL) # Libraries to link to while building LIBHDF5=$(top_builddir)/src/libhdf5.la LIBH5TEST=$(top_builddir)/test/libh5test.la +LIBH5TESTPAR=$(top_builddir)/testpar/libh5testpar.la LIBH5F=$(top_builddir)/fortran/src/libhdf5_fortran.la LIBH5FTEST=$(top_builddir)/fortran/test/libh5test_fortran.la LIBH5CPP=$(top_builddir)/c++/src/libhdf5_cpp.la diff --git a/doc/threadsafety-warning.md b/doc/threadsafety-warning.md new file mode 100644 index 00000000000..49abcb00af9 --- /dev/null +++ b/doc/threadsafety-warning.md @@ -0,0 +1,16 @@ +## A Warning + +Any application that creates threads that use the HDF5 library must join those threads before either process exit or library close through H5close(). If all HDF5-using threads aren't joined, the threads may exhibit undefined behavior. + +## Discussion for Developers on Potential Improvements + +It would in principle be possible to make it safe to have threads continue using HDF5 resources after a call to H5close() by keeping a count of threads within the library. (There is probably no solution to an early process exit producing undefined behavior within threads.) This method would only be able to count (and presumably, only _need_ to count) threads that directly interact with the library. Because each thread would need to be counted exactly once, this would most likely be done by use of a thread-local key with e.g. a boolean value used to track whether the a global atomic thread counter has already counted this thread. Then, if H5close() is invoked while this thread counter is above one (because one thread must be doing the closing), the library would not close, and instead keep its resources valid to hopefully avoid bad behavior with the threads. + +The issues with this approach are as follows: + +1. The process of checking for the existence/value of the thread-local key is slow, or at least slow enough that it's probably not worth adding this to almost every single API call to prevent this particular edge case. +2. Even with this approach, bad behavior would still be possible if the application does something like expose HDF5 resources to threads indirectly via a global variable. +3. How to allow H5close() to fail is nonobvious. H5close() could be allowed to return an error indicating a failure to close, but the number of applications which could usefully respond to such an error by joining threads is small. If an application were able/willing to join its created threads, presumably it would have done so before calling H5close(). Alternatively, H5close() could succeed but silently leave the library open. This creates the potential for confusing, unexpected behavior when the user thinks they are closing and re-opening the library, e.g. if environment variables are modified between close and re-open, or if resources such as default property lists are modified. +4. Applications should join threads before closing libraries that those threads are using, so all of this work would constitute an above-and-beyond effort to maintain safe and defined behavior in the face of an unsafe application. + +Despite these issues, if a more performant method was found to perform threadcounting like this, it might still constitute a worthwhile change. \ No newline at end of file diff --git a/doxygen/dox/CollectiveCalls.dox b/doxygen/dox/CollectiveCalls.dox index 9f26896262b..9fb7229a3ca 100644 --- a/doxygen/dox/CollectiveCalls.dox +++ b/doxygen/dox/CollectiveCalls.dox @@ -20,7 +20,7 @@ * \section sec_collective_calls_func Always collective * The following functions must always be called collectively. - +
API @@ -647,7 +647,7 @@ * If, however, the target object will not be modified, * they may be called independently. * - +
API @@ -943,7 +943,7 @@ * for an object or link in all cases where the object or link is accessed * in a parallel program. - +
- diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index 3c044257a49..a34c0fcc7cd 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -330,8 +330,8 @@ if test "x$do_link" = "xyes"; then -lhdf5_fortran) new_libraries="$new_libraries ${libdir}/libhdf5_fortran.a" ;; - -lhdf5hl_fortran) - new_libraries="$new_libraries ${libdir}/libhdf5hl_fortran.a" + -lhdf5_hl_fortran) + new_libraries="$new_libraries ${libdir}/libhdf5_hl_fortran.a" ;; *) new_libraries="$new_libraries $lib" diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 7d44792fbc0..7b55cedeb3b 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1228,7 +1228,7 @@ find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if (strncmp(name, (char *)op_data, strlen((char *)op_data)) == 0) + if (strcmp(name, (char *)op_data) == 0) ret = 1; return ret; diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index f85ed81b7fb..0172cb45a22 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1341,10 +1341,11 @@ test_detachscales(void) static int test_char_attachscales(const char *fileext) { - hid_t fid = -1; - hid_t did = -1; - char dsname[32]; - char scalename[32]; + hid_t fid = -1; + hid_t did = -1; + char dsname[32]; + char scalename[32]; + herr_t ds_existed = 0; snprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac"); @@ -1357,6 +1358,14 @@ test_char_attachscales(const char *fileext) if (create_char_dataset(fid, "ac", 0) < 0) goto out; + /* test finding dataset dsname */ + if ((ds_existed = H5LTfind_dataset(fid, dsname)) < 0) + goto out; + if (ds_existed == 0) { + printf("Unexpected result: Dataset \"%s\" does exist\n", dsname); + goto out; + } + if ((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { snprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac"); if (test_attach_scale(fid, did, scalename, DIM0) < 0) diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 9bbad45d609..23508b79990 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -29,6 +29,9 @@ #define DSET6_NAME "dataset double" #define DSET7_NAME "dataset string" +/* Name of a non-existing dataset, do not create a dataset with this name */ +#define NODS_NAME "dataset" + #define DIM 6 #define ATTR_NAME_SUB "att" @@ -60,6 +63,7 @@ test_dsets(void) hsize_t dims[2] = {2, 3}; hid_t file_id; hid_t dataset_id; + herr_t ds_existed = 0; /* whether searched ds exists */ char data_char_in[DIM] = {1, 2, 3, 4, 5, 6}; char data_char_out[DIM]; short data_short_in[DIM] = {1, 2, 3, 4, 5, 6}; @@ -348,6 +352,23 @@ test_dsets(void) if (strcmp(data_string_in, data_string_out) != 0) goto out; + PASSED(); + + /*------------------------------------------------------------------------- + * H5LTfind_dataset test + *------------------------------------------------------------------------- + */ + + HL_TESTING2("H5LTfind_dataset"); + + /* Try to find a non-existing ds whose name matches existing datasets partially */ + if ((ds_existed = H5LTfind_dataset(file_id, NODS_NAME)) < 0) + goto out; + if (ds_existed > 0) { + printf("Dataset \"%s\" does not exist.\n", NODS_NAME); + goto out; + } + /*------------------------------------------------------------------------- * end tests *------------------------------------------------------------------------- @@ -1075,7 +1096,7 @@ test_integers(void) char *dt_str; size_t str_len; - HL_TESTING3("\n text for integer types"); + HL_TESTING3(" text for integer types"); if ((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL)) < 0) goto out; @@ -1881,6 +1902,7 @@ test_text_dtype(void) { HL_TESTING2("H5LTtext_to_dtype"); + printf("\n"); if (test_integers() < 0) goto out; diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 99a5dbef91d..d17fcf1412f 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -861,9 +861,11 @@ verify_attribute(hid_t fid, const char *table_name, const char *attr_name) /* Verify values read in */ for (ii = 0; ii < ATTR_DIM; ii++) - if (attr_data[ii] != read_data[ii]) - TestErrPrintf("%d: attribute data different: attr_data[%d]=%d, read_data[%d]=%d\n", __LINE__, ii, - attr_data[ii], ii, read_data[ii]); + if (attr_data[ii] != read_data[ii]) { + fprintf(stderr, "%d: attribute data different: attr_data[%d]=%d, read_data[%d]=%d\n", __LINE__, + ii, attr_data[ii], ii, read_data[ii]); + goto error; + } /* Close the attribute */ if (H5Aclose(attr_id) < 0) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 91331af9217..52d7f8b7136 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -98,7 +98,15 @@ New Features Documentation: -------------- - - + - Documented that leaving HDF5 threads running at termination is unsafe + + Added doc/threadsafety-warning.md as a warning that threads which use HDF5 + resources must be closed before either process exit or library close. + If HDF5 threads are alive during either of these operations, their resources + will not be cleaned up properly and undefined behavior is possible. + + This document also includes a discussion on potential ways to mitigate this issue. + Support for new platforms, languages and compilers diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 007912053e9..0b1010ba832 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -179,6 +179,12 @@ H5B__cache_deserialize(const void *_image, size_t len, void *_udata, bool H5_ATT if (bt->nchildren > shared->two_k) HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "number of children is greater than maximum"); + /* Check in case of level is corrupted, it is unreasonable for level to be + larger than the number of entries */ + if (bt->level > bt->nchildren) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, + "level cannot be greater than the number of children, possibly corrupted"); + /* Sibling pointers */ if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_addr(udata->f), p_end)) HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 0d1cd0f868a..78ed5273f52 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1761,7 +1761,6 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha }; unsigned setting_count = 3; herr_t ret_value = SUCCEED; - unsigned buffer_i = 0; unsigned setting_i = 0; int found_setting = 0; char *line_buffer = &(buffer[0]); diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 9c4c8cdbbda..5fabf5266a0 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -725,7 +725,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Make certain that data in accumulator is visible before new write */ if ((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0) /* Flush if dirty and reset accumulator */ - if (H5F__accum_reset(f_sh, true) < 0) + if (H5F__accum_reset(f_sh, true, false) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Write the data */ @@ -776,7 +776,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s } /* end if */ else { /* Access covers whole accumulator */ /* Reset accumulator, but don't flush */ - if (H5F__accum_reset(f_sh, false) < 0) + if (H5F__accum_reset(f_sh, false, false) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); } /* end else */ } /* end if */ @@ -1039,7 +1039,7 @@ H5F__accum_flush(H5F_shared_t *f_sh) *------------------------------------------------------------------------- */ herr_t -H5F__accum_reset(H5F_shared_t *f_sh, bool flush) +H5F__accum_reset(H5F_shared_t *f_sh, bool flush, bool force) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1050,8 +1050,11 @@ H5F__accum_reset(H5F_shared_t *f_sh, bool flush) /* Flush any dirty data in accumulator, if requested */ if (flush) - if (H5F__accum_flush(f_sh) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator"); + if (H5F__accum_flush(f_sh) < 0) { + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator"); + if (!force) + HGOTO_DONE(FAIL); + } /* Check if we need to reset the metadata accumulator information */ if (f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { diff --git a/src/H5Fint.c b/src/H5Fint.c index f653e0b71f0..3a9c65f1783 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1559,7 +1559,7 @@ H5F__dest(H5F_t *f, bool flush, bool free_on_failure) } /* end if */ /* Destroy other components of the file */ - if (H5F__accum_reset(f->shared, true) < 0) + if (H5F__accum_reset(f->shared, true, true) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); if (H5FO_dest(f) < 0) @@ -3893,7 +3893,7 @@ H5F__start_swmr_write(H5F_t *f) } /* end if */ /* Flush and reset the accumulator */ - if (H5F__accum_reset(f->shared, true) < 0) + if (H5F__accum_reset(f->shared, true, false) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Turn on SWMR write in shared file open flags */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 2cd8a53ba53..3d50b50fc51 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -422,7 +422,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); /* Flush and reset the accumulator */ - if (H5F__accum_reset(f->shared, true) < 0) + if (H5F__accum_reset(f->shared, true, false) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Flush file buffers to disk. */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index f60841ec55f..7acd243aa82 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -445,7 +445,7 @@ H5_DLL herr_t H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr const void *buf); H5_DLL herr_t H5F__accum_free(H5F_shared_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5F__accum_flush(H5F_shared_t *f_sh); -H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, bool flush); +H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, bool flush, bool force); /* Shared file list related routines */ H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6ee93441586..0ebe6c54a7a 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -2499,8 +2499,8 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * pipeline * \param[in] flags Bit vector specifying certain general properties of * the filter - * \param[in] cd_nelmts Number of elements in \p c_values - * \param[in] c_values Auxiliary data for the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values Auxiliary data for the filter * * \return \herr_t * @@ -2756,7 +2756,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * */ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, - const unsigned int c_values[]); + const unsigned int cd_values[]); /** * \ingroup OCPL * diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h index 535027325fe..81321f6d787 100644 --- a/src/H5VLmodule.h +++ b/src/H5VLmodule.h @@ -468,7 +468,7 @@ * } H5L_info2_t; * \endcode * - *

H5Literate() and H5Lvisit() → H5Literte2() and H5Lvisit2()

+ *

H5Literate() and H5Lvisit() → H5Literate2() and H5Lvisit2()

* The callback used in these API calls used the old #H5L_info_t struct, which used * addresses instead of tokens. These callbacks were versioned in the C library and * now take modified #H5L_iterate2_t callbacks which use the new token-based info diff --git a/test/Makefile.am b/test/Makefile.am index fdd83e5bdeb..02a69680096 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -157,7 +157,7 @@ endif libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c -# Use libhd5test.la to compile all of the tests +# Use libh5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) # List the source files for tests that have more than one diff --git a/test/accum.c b/test/accum.c index c0401ac3d10..482ebcfa4e3 100644 --- a/test/accum.c +++ b/test/accum.c @@ -61,7 +61,7 @@ void accum_printf(const H5F_t *f); #define accum_read(a, s, b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_free(f, a, s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) #define accum_flush(f) H5F__accum_flush(f->shared) -#define accum_reset(f) H5F__accum_reset(f->shared, true) +#define accum_reset(f) H5F__accum_reset(f->shared, true, false) /* ================= */ /* Main Test Routine */ diff --git a/test/btree2.c b/test/btree2.c index 382d442476f..c504824d512 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -9924,7 +9924,7 @@ main(void) /* Reset library */ h5_test_init(); fapl = h5_fileaccess(); - localTestExpress = TestExpress; + localTestExpress = h5_get_testexpress(); /* For the Direct I/O driver, skip intensive tests due to poor performance */ if (localTestExpress < 2 && !strcmp(driver_name, "direct")) diff --git a/test/cache.c b/test/cache.c index d0cbf3f938f..f637bc6cf1e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -32368,7 +32368,7 @@ main(void) H5open(); - express_test = GetTestExpress(); + express_test = h5_get_testexpress(); printf("=========================================\n"); printf("Internal cache tests\n"); diff --git a/test/cache_api.c b/test/cache_api.c index cf0df5d4647..3c550594c24 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -2223,7 +2223,7 @@ main(void) H5open(); - express_test = GetTestExpress(); + express_test = h5_get_testexpress(); printf("===================================\n"); printf("Cache API tests\n"); diff --git a/test/cache_image.c b/test/cache_image.c index d2499631878..2cc2cc7f9bb 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7762,7 +7762,7 @@ main(void) H5open(); - express_test = GetTestExpress(); + express_test = h5_get_testexpress(); printf("=========================================\n"); printf("Cache image tests\n"); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 9a86b8ab75d..ec4e917b50e 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -18,7 +18,7 @@ #define H5F_TESTING #include "H5Fpkg.h" -#include "testhdf5.h" +#include "h5test.h" #include "cache_common.h" #include "H5CXprivate.h" /* API Contexts */ diff --git a/test/chunk_info.c b/test/chunk_info.c index 4591b7242b4..fc3168e1b8f 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -38,7 +38,7 @@ #define H5D_TESTING /* to use H5D__ functions */ #include "H5Dpkg.h" -#include "testhdf5.h" +#include "h5test.h" #ifdef H5_HAVE_FILTER_DEFLATE #include "zlib.h" #endif diff --git a/test/dsets.c b/test/dsets.c index d33b7ae251d..484b29b3676 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -20,7 +20,7 @@ #define H5Z_FRIEND /*suppress error about including H5Zpkg */ -#include "testhdf5.h" +#include "h5test.h" #include "H5srcdir.h" #include "H5CXprivate.h" /* API Contexts */ @@ -990,14 +990,16 @@ test_compact_io(hid_t fapl) /* Verify the dataset's layout and fill message versions */ if (fp->shared->low_bound == H5F_LIBVER_EARLIEST) { - VERIFY(dsetp->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "layout_ver_bounds"); - VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "fill_ver_bounds"); + if (dsetp->shared->layout.version != H5O_LAYOUT_VERSION_DEFAULT) + TEST_ERROR; + if (dsetp->shared->dcpl_cache.fill.version != H5O_FILL_VERSION_2) + TEST_ERROR; } else { - VERIFY(dsetp->shared->layout.version, H5O_layout_ver_bounds[fp->shared->low_bound], - "layout_ver_bounds"); - VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[fp->shared->low_bound], - "fill_ver_bounds"); + if (dsetp->shared->layout.version != H5O_layout_ver_bounds[fp->shared->low_bound]) + TEST_ERROR; + if (dsetp->shared->dcpl_cache.fill.version != H5O_fill_ver_bounds[fp->shared->low_bound]) + TEST_ERROR; } /* Close the dataset and delete from the file */ @@ -14987,7 +14989,8 @@ test_versionbounds(void) if (vdset > 0) /* dataset created successfully */ { /* Virtual dataset is only available starting in V110 */ - VERIFY(high >= H5F_LIBVER_V110, true, "virtual dataset"); + if (high < H5F_LIBVER_V110) + TEST_ERROR; if (H5Dclose(vdset) < 0) TEST_ERROR; @@ -16169,8 +16172,7 @@ main(void) goto error; printf("All dataset tests passed.\n"); #ifdef H5_HAVE_FILTER_SZIP - if (GetTestCleanup()) - HDremove(NOENCODER_COPY_FILENAME); + HDremove(NOENCODER_COPY_FILENAME); #endif /* H5_HAVE_FILTER_SZIP */ h5_cleanup(FILENAME, fapl); diff --git a/test/dtypes.c b/test/dtypes.c index d740d2a6f0f..5065153832b 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -14,7 +14,7 @@ * Purpose: Tests the datatype interface (H5T) */ -#include "testhdf5.h" +#include "h5test.h" #include "H5srcdir.h" #include "H5Iprivate.h" /* For checking that datatype id's don't leak */ @@ -9528,8 +9528,8 @@ test_deprec(hid_t fapl) dim_mismatch = false; for (u = 0; u < rank; u++) if (rdims[u] != dims[u]) { - TestErrPrintf("Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, - (int)rdims[u], u, (int)dims[u]); + fprintf(stderr, "Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, + (int)rdims[u], u, (int)dims[u]); dim_mismatch = true; } /* end if */ if (dim_mismatch) @@ -9539,9 +9539,9 @@ test_deprec(hid_t fapl) dim_mismatch = false; for (u = 0; u < rank; u++) if (rperm[u] != -2) { - TestErrPrintf( - "Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, - rperm[u], u, perm[u]); + fprintf(stderr, + "Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", + u, rperm[u], u, perm[u]); dim_mismatch = true; } /* end if */ if (dim_mismatch) @@ -9946,14 +9946,19 @@ verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version) case H5T_ARRAY: { H5T_t *base_dtypep = NULL; /* Internal structure of a datatype */ - if (low == H5F_LIBVER_EARLIEST) - VERIFY(dtypep->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds"); - else - VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds"); + if (low == H5F_LIBVER_EARLIEST) { + if (dtypep->shared->version != H5O_DTYPE_VERSION_2) + TEST_ERROR; + } + else { + if (dtypep->shared->version != H5O_dtype_ver_bounds[low]) + TEST_ERROR; + } /* Get the base datatype of this array type */ base_dtype = H5Tget_super(dtype); - CHECK(base_dtype, FAIL, "H5Tget_super"); + if (base_dtype == H5I_INVALID_HID) + TEST_ERROR; /* Get the base type's internal structure for version */ base_dtypep = (H5T_t *)H5I_object(base_dtype); @@ -10014,19 +10019,25 @@ verify_version(hid_t dtype, H5F_libver_t low, unsigned *highest_version) } /* If this compound datatype contains a datatype of higher version, it will be promoted to that version, thus, verify with highest version */ - if (*highest_version > H5O_dtype_ver_bounds[low]) - VERIFY(dtypep->shared->version, *highest_version, "verify_version"); - else - VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version"); + if (*highest_version > H5O_dtype_ver_bounds[low]) { + if (dtypep->shared->version != *highest_version) + TEST_ERROR; + } + else { + if (dtypep->shared->version != H5O_dtype_ver_bounds[low]) + TEST_ERROR; + } break; } case H5T_ENUM: - VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[low], "verify_version"); + if (dtypep->shared->version != H5O_dtype_ver_bounds[low]) + TEST_ERROR; break; case H5T_VLEN: case H5T_FLOAT: case H5T_INTEGER: - VERIFY(dtypep->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "verify_version"); + if (dtypep->shared->version != H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST]) + TEST_ERROR; break; case H5T_NCLASSES: case H5T_NO_CLASS: diff --git a/test/earray.c b/test/earray.c index 754b4b9dc8c..3291be11f92 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2303,8 +2303,6 @@ main(void) /* Reset library */ h5_test_init(); fapl = h5_fileaccess(); - if (TestExpress > 0) - printf("***Express test mode %d. Some tests may be skipped\n", TestExpress); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 878fe86449b..7a289618eaa 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -14,7 +14,7 @@ * Serial tests for encoding/decoding plists */ -#include "testhdf5.h" +#include "h5test.h" #include "H5ACprivate.h" #include "H5Pprivate.h" @@ -191,9 +191,6 @@ main(void) "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string); puts(msg); - if (VERBOSE_MED) - printf("Encode/Decode DCPLs\n"); - /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index d2d68105986..e7403576a8e 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -26,9 +26,6 @@ static int test_plists(const char *filename_prefix); int main(void) { - if (VERBOSE_MED) - printf("Encode/Decode property list endianness\n"); - /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); if (test_plists("plist_files/def_dcpl_") < 0) diff --git a/test/farray.c b/test/farray.c index a895e1d2cba..c3dc10d570b 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1634,8 +1634,6 @@ main(void) /* Reset library */ h5_test_init(); fapl = h5_fileaccess(); - if (TestExpress > 0) - printf("***Express test mode %d. Some tests may be skipped\n", TestExpress); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); diff --git a/test/fheap.c b/test/fheap.c index 0bf8e5690a8..22a4e5bc811 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -15960,6 +15960,7 @@ main(void) const char *driver_name; /* Environment variable */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool api_ctx_pushed = false; /* Whether API context pushed */ + int test_express; /* Don't run this test using certain file drivers */ driver_name = h5_get_test_driver_name(); @@ -15982,9 +15983,10 @@ main(void) * Activate full testing when this feature is re-enabled * in the future for parallel build. */ - if (TestExpress > 0) - printf("***Express test mode %d. Some tests may be skipped\n", TestExpress); - else if (TestExpress == 0) { + test_express = h5_get_testexpress(); + if (test_express > 0) + printf("***Express test mode %d. Some tests may be skipped\n", test_express); + else if (test_express == 0) { #ifdef H5_HAVE_PARALLEL num_pb_fs = NUM_PB_FS - 2; #else @@ -16200,7 +16202,7 @@ main(void) /* If this test fails, uncomment the tests above, which build up to this * level of complexity gradually. -QAK */ - if (TestExpress > 1) + if (test_express > 1) printf( "***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); else @@ -16248,7 +16250,7 @@ main(void) nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam); - if (TestExpress > 1) + if (test_express > 1) printf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam); @@ -16298,7 +16300,7 @@ main(void) nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped( fapl, &small_cparam, &tparam); - if (TestExpress > 1) + if (test_express > 1) printf("***Express test mode on. Some tests skipped\n"); else { nerrors += @@ -16428,7 +16430,7 @@ main(void) } /* end block */ /* Random object insertion & deletion */ - if (TestExpress > 1) + if (test_express > 1) printf("***Express test mode on. Some tests skipped\n"); else { /* Random tests using "small" heap creation parameters */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index bab334f1c68..0e662209212 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -26,7 +26,7 @@ /* Includes */ /* ======== */ -#include "testhdf5.h" +#include "h5test.h" #include "H5FDpkg.h" /* File Drivers */ /* ======= */ diff --git a/test/h5test.c b/test/h5test.c index f4a371ff42f..a8da5874a7d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -112,11 +112,15 @@ const char *LIBVER_NAMES[] = {"earliest", /* H5F_LIBVER_EARLIEST = 0 */ static H5E_auto2_t err_func = NULL; /* Global variables for testing */ -size_t n_tests_run_g = 0; -size_t n_tests_passed_g = 0; -size_t n_tests_failed_g = 0; -size_t n_tests_skipped_g = 0; -uint64_t vol_cap_flags_g = H5VL_CAP_FLAG_NONE; +static int TestExpress_g = -1; /* Whether to expedite testing. -1 means not set yet. */ +size_t n_tests_run_g = 0; +size_t n_tests_passed_g = 0; +size_t n_tests_failed_g = 0; +size_t n_tests_skipped_g = 0; +uint64_t vol_cap_flags_g = H5VL_CAP_FLAG_NONE; + +/* Whether h5_cleanup should clean up temporary testing files */ +static bool do_test_file_cleanup_g = true; static herr_t h5_errors(hid_t estack, void *client_data); static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, @@ -213,7 +217,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) { int retval = 0; - if (GetTestCleanup()) { + if (do_test_file_cleanup_g) { /* Clean up files in base_name, and the FAPL */ h5_delete_all_test_files(base_name, fapl); H5Pclose(fapl); @@ -272,7 +276,7 @@ h5_test_init(void) H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* Retrieve the TestExpress mode */ - GetTestExpress(); + TestExpress_g = h5_get_testexpress(); } /* end h5_test_init() */ /*------------------------------------------------------------------------- @@ -458,12 +462,12 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu if (isppdriver) { #ifdef H5_HAVE_PARALLEL if (getenv_all(MPI_COMM_WORLD, 0, HDF5_NOCLEANUP)) - SetTestNoCleanup(); + do_test_file_cleanup_g = false; #endif /* H5_HAVE_PARALLEL */ } else { if (getenv(HDF5_NOCLEANUP)) - SetTestNoCleanup(); + do_test_file_cleanup_g = false; } /* Check what prefix to use for test files. Process HDF5_PARAPREFIX and @@ -1006,6 +1010,81 @@ h5_get_libver_fapl(hid_t fapl) return -1; } /* end h5_get_libver_fapl() */ +/* + * Returns the current TestExpress functionality setting. + * Valid values returned are as follows: + * + * 0: Exhaustive run + * Tests should take as long as necessary + * 1: Full run. Default value if H5_TEST_EXPRESS_LEVEL_DEFAULT + * and the HDF5TestExpress environment variable are not defined + * Tests should take no more than 30 minutes + * 2: Quick run + * Tests should take no more than 10 minutes + * 3: Smoke test. + * Default if the HDF5TestExpress environment variable is set to + * a value other than 0-3 + * Tests should take less than 1 minute + * + * If the value returned is > 1, then test programs should + * skip some tests so that they complete sooner. + */ +int +h5_get_testexpress(void) +{ + char *env_val; + int express_val = TestExpress_g; + + /* TestExpress_g is uninitialized if it has a negative value */ + if (express_val < 0) { + /* Default to level 1 if not overridden */ + express_val = 1; + + /* Check if a default test express level is defined (e.g., by build system) */ +#ifdef H5_TEST_EXPRESS_LEVEL_DEFAULT + express_val = H5_TEST_EXPRESS_LEVEL_DEFAULT; + if (express_val < 0) + express_val = 1; /* Reset to default */ + else if (express_val > 3) + express_val = 3; +#endif + } + + /* Check if the HDF5TestExpress environment variable is set to + * override the default level + */ + env_val = getenv("HDF5TestExpress"); + if (env_val) { + if (strcmp(env_val, "0") == 0) + express_val = 0; + else if (strcmp(env_val, "1") == 0) + express_val = 1; + else if (strcmp(env_val, "2") == 0) + express_val = 2; + else + express_val = 3; + } + + return express_val; +} + +/* + * Sets the level of express testing to the given value. Negative + * values are set to the default TestExpress setting (1). Values + * larger than the highest TestExpress setting (3) are set to the + * highest TestExpress setting. + */ +void +h5_set_testexpress(int new_val) +{ + if (new_val < 0) + new_val = 1; /* Reset to default */ + else if (new_val > 3) + new_val = 3; + + TestExpress_g = new_val; +} + /*------------------------------------------------------------------------- * Function: h5_no_hwconv * @@ -1395,24 +1474,6 @@ h5_get_file_size(const char *filename, hid_t fapl) } /* end get_file_size() */ H5_GCC_CLANG_DIAG_ON("format-nonliteral") -/* - * This routine is designed to provide equivalent functionality to 'printf' - * and allow easy replacement for environments which don't have stdin/stdout - * available. (i.e. Windows & the Mac) - */ -H5_ATTR_FORMAT(printf, 1, 2) -int -print_func(const char *format, ...) -{ - va_list arglist; - int ret_value; - - va_start(arglist, format); - ret_value = vprintf(format, arglist); - va_end(arglist); - return ret_value; -} - #ifdef H5_HAVE_FILTER_SZIP /*------------------------------------------------------------------------- diff --git a/test/h5test.h b/test/h5test.h index 1ec537c62e3..1b33664fbf0 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -24,77 +24,6 @@ #include "H5private.h" #include "H5Eprivate.h" -/* - * Predefined test verbosity levels. - * - * Convention: - * - * The higher the verbosity value, the more information printed. - * So, output for higher verbosity also include output of all lower - * verbosity. - * - * Value Description - * 0 None: No informational message. - * 1 "All tests passed" - * 2 Header of overall test - * 3 Default: header and results of individual test - * 4 - * 5 Low: Major category of tests. - * 6 - * 7 Medium: Minor category of tests such as functions called. - * 8 - * 9 High: Highest level. All information. - */ -#define VERBO_NONE 0 /* None */ -#define VERBO_DEF 3 /* Default */ -#define VERBO_LO 5 /* Low */ -#define VERBO_MED 7 /* Medium */ -#define VERBO_HI 9 /* High */ - -/* - * Verbose queries - * Only None needs an exact match. The rest are at least as much. - */ - -/* A macro version of HDGetTestVerbosity(). */ -/* Should be used internally by the libtest.a only. */ -#define HDGetTestVerbosity() (TestVerbosity) - -#define VERBOSE_NONE (HDGetTestVerbosity() == VERBO_NONE) -#define VERBOSE_DEF (HDGetTestVerbosity() >= VERBO_DEF) -#define VERBOSE_LO (HDGetTestVerbosity() >= VERBO_LO) -#define VERBOSE_MED (HDGetTestVerbosity() >= VERBO_MED) -#define VERBOSE_HI (HDGetTestVerbosity() >= VERBO_HI) - -/* - * The TestExpress mode for the testing framework - * - Values: - 0: Exhaustive run - Tests should take as long as necessary - 1: Full run. Default if H5_TEST_EXPRESS_LEVEL_DEFAULT - and HDF5TestExpress are not defined - Tests should take no more than 30 minutes - 2: Quick run - Tests should take no more than 10 minutes - 3: Smoke test. - Default if HDF5TestExpress is set to a value other than 0-3 - Tests should take less than 1 minute - - Design: - If the environment variable $HDF5TestExpress is defined, - or if a default testing level > 1 has been set via - H5_TEST_EXPRESS_LEVEL_DEFAULT, then test programs should - skip some tests so that they complete sooner. -*/ - -/* - * Test controls definitions. - */ -#define SKIPTEST 1 /* Skip this test */ -#define ONLYTEST 2 /* Do only this test */ -#define BEGINTEST 3 /* Skip all tests before this test */ - /* * This contains the filename prefix specified as command line option for * the parallel test files. @@ -248,9 +177,6 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ goto part_##part_name##_end; \ } while (0) -/* Number of seconds to wait before killing a test (requires alarm(2)) */ -#define H5_ALARM_SEC 1200 /* default is 20 minutes */ - /* Flags for h5_fileaccess_flags() */ #define H5_FILEACCESS_VFD 0x01 #define H5_FILEACCESS_LIBVER 0x02 @@ -302,7 +228,6 @@ H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_restore_err(void); H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); -H5TEST_DLL int print_func(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); @@ -339,33 +264,9 @@ H5TEST_DLL void h5_delete_all_test_files(const char *base_name[], hid_t fapl); * including resetting the library by closing it */ H5TEST_DLL void h5_test_init(void); -/* Routines for operating on the list of tests (for the "all in one" tests) */ -H5TEST_DLL void TestUsage(void); -H5TEST_DLL void AddTest(const char *TheName, void (*TheCall)(void), void (*Cleanup)(void), - const char *TheDescr, const void *Parameters); -H5TEST_DLL void TestInfo(const char *ProgName); -H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]); -H5TEST_DLL void PerformTests(void); -H5TEST_DLL void TestSummary(void); -H5TEST_DLL void TestCleanup(void); -H5TEST_DLL void TestShutdown(void); -H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), - int (*private_parser)(int ac, char *av[])); -H5TEST_DLL int GetTestVerbosity(void); -H5TEST_DLL int SetTestVerbosity(int newval); -H5TEST_DLL int GetTestSummary(void); -H5TEST_DLL int GetTestCleanup(void); -H5TEST_DLL int SetTestNoCleanup(void); -H5TEST_DLL int GetTestExpress(void); -H5TEST_DLL int SetTestExpress(int newval); -H5TEST_DLL void ParseTestVerbosity(char *argv); -H5TEST_DLL int GetTestNumErrs(void); -H5TEST_DLL void IncTestNumErrs(void); -H5TEST_DLL const void *GetTestParameters(void); -H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2); -H5TEST_DLL void SetTest(const char *testname, int action); -H5TEST_DLL void TestAlarmOn(void); -H5TEST_DLL void TestAlarmOff(void); +/* Functions that deal with expediting testing */ +H5TEST_DLL int h5_get_testexpress(void); +H5TEST_DLL void h5_set_testexpress(int new_val); #ifdef H5_HAVE_FILTER_SZIP H5TEST_DLL int h5_szip_can_encode(void); @@ -378,14 +279,11 @@ H5TEST_DLL char *getenv_all(MPI_Comm comm, int root, const char *name); #endif /* Extern global variables */ -H5TEST_DLLVAR int TestExpress; -H5TEST_DLLVAR int TestVerbosity; H5TEST_DLLVAR size_t n_tests_run_g; H5TEST_DLLVAR size_t n_tests_passed_g; H5TEST_DLLVAR size_t n_tests_failed_g; H5TEST_DLLVAR size_t n_tests_skipped_g; H5TEST_DLLVAR uint64_t vol_cap_flags_g; -H5TEST_DLLVAR int mpi_rank_framework_g; H5TEST_DLL void h5_send_message(const char *file, const char *arg1, const char *arg2); H5TEST_DLL herr_t h5_wait_message(const char *file); diff --git a/test/objcopy.c b/test/objcopy.c index 798ba0c8123..88a709ad5ee 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -14,7 +14,7 @@ * Purpose: Test H5Ocopy(). */ -#include "testhdf5.h" +#include "h5test.h" #include "H5srcdir.h" #include "H5Iprivate.h" @@ -10063,14 +10063,14 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, for (i = 0; i < DIM_SIZE_1; i++) { buf[i].p = malloc((i + 1) * sizeof(hvl_t)); if (buf[i].p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i); return 1; } /* end if */ buf[i].len = i + 1; for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) { tvl->p = malloc((j + 1) * sizeof(unsigned int)); if (tvl->p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); return 1; } /* end if */ tvl->len = j + 1; @@ -10260,14 +10260,14 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h for (i = 0; i < DIM_SIZE_1; i++) { buf[i].p = malloc((i + 1) * sizeof(hvl_t)); if (buf[i].p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i); TEST_ERROR; } /* end if */ buf[i].len = i + 1; for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) { tvl->p = malloc((j + 1) * sizeof(unsigned int)); if (tvl->p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); TEST_ERROR; } /* end if */ tvl->len = j + 1; @@ -10452,14 +10452,14 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, for (i = 0; i < DIM_SIZE_1; i++) { buf[i].p = malloc((i + 1) * sizeof(hvl_t)); if (buf[i].p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i); TEST_ERROR; } /* end if */ buf[i].len = i + 1; for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) { tvl->p = malloc((j + 1) * sizeof(unsigned int)); if (tvl->p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); TEST_ERROR; } /* end if */ tvl->len = j + 1; @@ -10693,14 +10693,14 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap for (i = 0; i < DIM_SIZE_1; i++) { buf[i].p = malloc((i + 1) * sizeof(hvl_t)); if (buf[i].p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u\n", i); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u\n", i); TEST_ERROR; } /* end if */ buf[i].len = i + 1; for (tvl = (hvl_t *)buf[i].p, j = 0; j < (i + 1); j++, tvl++) { tvl->p = malloc((j + 1) * sizeof(unsigned int)); if (tvl->p == NULL) { - TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); + fprintf(stderr, "Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); TEST_ERROR; } /* end if */ tvl->len = j + 1; @@ -17136,9 +17136,6 @@ main(void) if (h5_driver_is_default_vfd_compatible(fapl, &driver_is_default_compatible) < 0) TEST_ERROR; - if (TestExpress > 0) - printf("***Express test mode %d. Some tests may be skipped\n", TestExpress); - /* Copy the file access property list */ if ((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR; diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 55dc23b8ea3..0aed2a0d010 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -14,7 +14,7 @@ * Purpose: Test H5Ocopy() for references. */ -#include "testhdf5.h" +#include "h5test.h" #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING @@ -1823,9 +1823,6 @@ main(void) h5_test_init(); fapl = h5_fileaccess(); - if (TestExpress > 0) - printf("***Express test mode %d. Some tests may be skipped\n", TestExpress); - /* Copy the file access property list */ if ((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR; diff --git a/test/select_io_dset.c b/test/select_io_dset.c index c4a88caba3f..249693d453b 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -14,7 +14,7 @@ * Purpose: Tests selection IO for the dataset interface (H5D) */ -#include "testhdf5.h" +#include "h5test.h" #include "H5srcdir.h" const char *FILENAME[] = {"select_io", /* 0 */ diff --git a/test/stab.c b/test/stab.c index 89481be24a1..cc7abe56ce0 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1466,10 +1466,9 @@ main(void) puts("All symbol table tests passed."); /* Cleanup */ - if (GetTestCleanup()) { - HDremove(FILE_OLD_GROUPS_COPY); - HDremove(CORRUPT_STAB_TMP_FILE); - } + HDremove(FILE_OLD_GROUPS_COPY); + HDremove(CORRUPT_STAB_TMP_FILE); + h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/tarray.c b/test/tarray.c index 0f9e3e44faa..8f370cb4846 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2217,7 +2217,7 @@ test_compat(void) *------------------------------------------------------------------------- */ void -test_array(void) +test_array(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Array Datatypes\n")); @@ -2249,11 +2249,13 @@ test_array(void) *------------------------------------------------------------------------- */ void -cleanup_array(void) +cleanup_array(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } /* end cleanup_array() */ diff --git a/test/tattr.c b/test/tattr.c index e15ed5fb736..4831e1604b0 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -4009,7 +4009,16 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 2; snprintf(attrname, sizeof(attrname), "attr %02u", u); - attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); + + if (vol_is_native && low != H5F_LIBVER_LATEST) { + H5E_BEGIN_TRY + { + attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY + } + else + attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); if (low == H5F_LIBVER_LATEST) { CHECK(attr, FAIL, "H5Acreate2"); @@ -11928,7 +11937,7 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) ** ****************************************************************/ void -test_attr(void) +test_attr(const void H5_ATTR_UNUSED *params) { hid_t fapl = (H5I_INVALID_HID), fapl2 = (H5I_INVALID_HID); /* File access property lists */ hid_t fcpl = (H5I_INVALID_HID), fcpl2 = (H5I_INVALID_HID); /* File creation property lists */ @@ -12157,11 +12166,13 @@ test_attr(void) *------------------------------------------------------------------------- */ void -cleanup_attr(void) +cleanup_attr(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tchecksum.c b/test/tchecksum.c index 62db33c1fba..5ee7c0f6d6e 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -216,7 +216,7 @@ test_chksum_large(void) ** ****************************************************************/ void -test_checksum(void) +test_checksum(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing checksum algorithms\n")); @@ -240,7 +240,7 @@ test_checksum(void) *------------------------------------------------------------------------- */ void -cleanup_checksum(void) +cleanup_checksum(void H5_ATTR_UNUSED *params) { /* no file to clean */ } diff --git a/test/tconfig.c b/test/tconfig.c index 25e9ad50efe..4cc796dcb43 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -59,7 +59,7 @@ void test_exit_definitions(void); *------------------------------------------------------------------------- */ void -test_configure(void) +test_configure(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing configure definitions\n")); @@ -77,7 +77,7 @@ test_configure(void) *------------------------------------------------------------------------- */ void -cleanup_configure(void) +cleanup_configure(void H5_ATTR_UNUSED *params) { /* no file to clean */ } diff --git a/test/tcoords.c b/test/tcoords.c index 1a3a8b3658d..b223600a4d2 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -678,7 +678,7 @@ test_multiple_ends(hid_t file, bool is_chunked) ** ****************************************************************/ void -test_coords(void) +test_coords(const void H5_ATTR_UNUSED *params) { hid_t fid; bool is_chunk[2] = {true, false}; @@ -713,11 +713,13 @@ test_coords(void) *------------------------------------------------------------------------- */ void -cleanup_coords(void) +cleanup_coords(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/testframe.c b/test/testframe.c index 50daede8eea..dd5a7bb8dce 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -11,276 +11,358 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: Provides support functions for the testing framework. - * + * Purpose: Implements a basic testing framework for HDF5 tests to use. */ -#include "testhdf5.h" +#include "testframe.h" +#include "h5test.h" /* * Definitions for the testing structure. */ -#define MAXTESTNAME 16 -#define MAXTESTDESC 64 typedef struct TestStruct { - int NumErrors; - char Description[MAXTESTDESC]; - int SkipFlag; char Name[MAXTESTNAME]; - void (*Call)(void); - void (*Cleanup)(void); - const void *Parameters; + char Description[MAXTESTDESC]; + void (*TestFunc)(const void *); + void (*TestSetupFunc)(void *); + void (*TestCleanupFunc)(void *); + void *TestParameters; + int TestNumErrors; + int TestSkipFlag; } TestStruct; /* - * Variables used by testing framework. + * Global variables used by testing framework. */ -static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ -static int num_errs = 0; /* Total number of errors during testing */ -int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ -int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ -static TestStruct *Test = NULL; /* Array of tests */ -static unsigned TestAlloc = 0; /* Size of the Test array */ -static unsigned Index = 0; -static const void *Test_parameters = NULL; -static const char *TestProgName = NULL; -static void (*TestPrivateUsage)(void) = NULL; -static int (*TestPrivateParser)(int ac, char *av[]) = NULL; -int mpi_rank_framework_g = 0; + +static TestStruct *TestArray = NULL; /* Array of tests */ +static unsigned TestAlloc = 0; /* Size of the Test array */ +static unsigned TestCount = 0; /* Number of tests currently added to test array */ + +static const char *TestProgName = NULL; +static void (*TestPrivateUsage_g)(FILE *stream) = NULL; +static herr_t (*TestPrivateParser_g)(int argc, char *argv[]) = NULL; + +static int TestNumErrs_g = 0; /* Total number of errors that occurred for whole test program */ +static bool TestEnableErrorStack = true; /* Whether to show error stacks from the library */ + +static int TestMaxNumThreads_g = -1; /* Max number of threads that can be spawned */ + +static bool TestDoSummary_g = false; /* Show test summary. Default is no. */ +static bool TestDoCleanUp_g = true; /* Do cleanup or not. Default is yes. */ + +int TestFrameworkProcessID_g = 0; /* MPI process rank value for parallel tests */ +int TestVerbosity_g = VERBO_DEF; /* Default Verbosity is Low */ /* - * Setup a test function and add it to the list of tests. - * It must have no parameters and returns void. - * TheName--short test name. - * If the name starts with '-', do not run it by default. - * TheCall--the test routine. - * Cleanup--the cleanup routine for the test. - * TheDescr--Long description of the test. - * Parameters--pointer to extra parameters. Use NULL if none used. - * Since only the pointer is copied, the contents should not change. - * Return: Void - * exit EXIT_FAILURE if error is encountered. + * Add a new test to the list of tests to be executed */ -void -AddTest(const char *TheName, void (*TheCall)(void), void (*Cleanup)(void), const char *TheDescr, - const void *Parameters) +herr_t +AddTest(const char *TestName, void (*TestFunc)(const void *), void (*TestSetupFunc)(void *), + void (*TestCleanupFunc)(void *), const void *TestData, size_t TestDataSize, const char *TestDescr) { - /* Sanity checking */ - if (strlen(TheDescr) >= MAXTESTDESC) { - printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", TheDescr, MAXTESTDESC); - exit(EXIT_FAILURE); + void *new_test_data = NULL; + + if (*TestName == '\0') { + fprintf(stderr, "%s: empty string given for test name\n", __func__); + return FAIL; + } + if (strlen(TestName) >= MAXTESTNAME) { + fprintf(stderr, "%s: test name ('%s') too long, increase MAXTESTNAME(%d).\n", __func__, TestName, + MAXTESTNAME); + return FAIL; } - if (strlen(TheName) >= MAXTESTNAME) { - printf("Test name too long, increase MAXTESTNAME(%d).\n", MAXTESTNAME); - exit(EXIT_FAILURE); + if (strlen(TestDescr) >= MAXTESTDESC) { + fprintf(stderr, "%s: test description ('%s') too long, increase MAXTESTDESC(%d).\n", __func__, + TestDescr, MAXTESTDESC); + return FAIL; + } + if ((TestData && (0 == TestDataSize)) || (!TestData && (0 != TestDataSize))) { + fprintf(stderr, "%s: invalid test data size (%zu)\n", __func__, TestDataSize); + return FAIL; } - /* Check for increasing the Test array size */ - if (Index >= TestAlloc) { - TestStruct *newTest = Test; /* New array of tests */ - unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */ + /* Re-allocate test array if necessary */ + if (TestCount >= TestAlloc) { + TestStruct *newTest = TestArray; + unsigned newAlloc = MAX(1, TestAlloc * 2); - /* Reallocate array */ - if (NULL == (newTest = (TestStruct *)realloc(Test, newAlloc * sizeof(TestStruct)))) { - printf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, - newAlloc); - exit(EXIT_FAILURE); + if (NULL == (newTest = realloc(TestArray, newAlloc * sizeof(TestStruct)))) { + fprintf(stderr, + "%s: couldn't reallocate test array, TestCount = %u, TestAlloc = %u, newAlloc = %u\n", + __func__, TestCount, TestAlloc, newAlloc); + return FAIL; } - /* Update info */ - Test = newTest; + TestArray = newTest; TestAlloc = newAlloc; } - /* Set up test function */ - strcpy(Test[Index].Description, TheDescr); - if (*TheName != '-') { - strcpy(Test[Index].Name, TheName); - Test[Index].SkipFlag = 0; + /* If the test name begins with '-', skip the test by default */ + if (*TestName == '-') { + TestArray[TestCount].TestSkipFlag = 1; + TestName++; } - else { /* skip test by default */ - strcpy(Test[Index].Name, TheName + 1); - Test[Index].SkipFlag = 1; + else + TestArray[TestCount].TestSkipFlag = 0; + + strcpy(TestArray[TestCount].Name, TestName); + strcpy(TestArray[TestCount].Description, TestDescr); + + /* Make a copy of the additional test data given */ + if (TestData) { + if (NULL == (new_test_data = malloc(TestDataSize))) { + fprintf(stderr, "%s: couldn't allocate space for additional test data\n", __func__); + return FAIL; + } + + memcpy(new_test_data, TestData, TestDataSize); } - Test[Index].Call = TheCall; - Test[Index].Cleanup = Cleanup; - Test[Index].NumErrors = -1; - Test[Index].Parameters = Parameters; + TestArray[TestCount].TestParameters = new_test_data; - /* Increment test count */ - Index++; + TestArray[TestCount].TestFunc = TestFunc; + TestArray[TestCount].TestSetupFunc = TestSetupFunc; + TestArray[TestCount].TestCleanupFunc = TestCleanupFunc; + TestArray[TestCount].TestNumErrors = -1; + + TestCount++; + + return SUCCEED; } /* - * Initialize testing framework - * - * ProgName: Name of test program. - * private_usage: Optional routine provided by test program to print the - * private portion of usage page. Default to NULL which means none is - * provided. - * private_parser: Optional routine provided by test program to parse the - * private options. Default to NULL which means none is provided. - * + * Initialize the testing framework */ -void -TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) +herr_t +TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream), + herr_t (*TestPrivateParser)(int argc, char *argv[]), int TestProcessID) { - /* - * Turn off automatic error reporting since we do it ourselves. Besides, - * half the functions this test calls are private, so automatic error - * reporting wouldn't do much good since it's triggered at the API layer. - */ - if (enable_error_stack == 0) - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* Turn off automatic error reporting if requested */ + if (!TestEnableErrorStack) { + if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) { + fprintf(stderr, "%s: can't disable error stack\n", __func__); + return FAIL; + } + } - /* - * Record the program name and private routines if provided. - */ + /* Initialize value for TestExpress functionality */ + h5_get_testexpress(); + + /* Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if (NULL != TestPrivateUsage) + TestPrivateUsage_g = TestPrivateUsage; + if (NULL != TestPrivateParser) + TestPrivateParser_g = TestPrivateParser; + + TestFrameworkProcessID_g = TestProcessID; + + /* Set/reset global variables from h5test that may be used by + * tests integrated with the testing framework + */ + n_tests_run_g = 0; + n_tests_passed_g = 0; + n_tests_failed_g = 0; + n_tests_skipped_g = 0; + + return SUCCEED; } /* - * Print test usage. - * First print the common test options, then the extra options if provided. + * Print out test program usage help text */ void -TestUsage(void) +TestUsage(FILE *stream) { - unsigned i; - - if (mpi_rank_framework_g == 0) { - print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", TestProgName, - (TestPrivateUsage ? "" : "")); - print_func(" [-[e]x[clude] name]+ \n"); - print_func(" [-o[nly] name]+ \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test given\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("help print out this information\n"); - if (TestPrivateUsage) { - print_func("\nExtra options\n"); - TestPrivateUsage(); - } - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); + size_t max_test_name_len = 0; + + /* If running in parallel, only print output from a single MPI process */ + if (TestFrameworkProcessID_g != 0) + return; + + if (!stream) + stream = stdout; + + fprintf(stream, "Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", TestProgName, + (TestPrivateUsage_g ? "" : "")); + fprintf(stream, " [-[e]x[clude] name]+ \n"); + fprintf(stream, " [-o[nly] name]+ \n"); + fprintf(stream, " [-b[egin] name] \n"); + fprintf(stream, " [-[max]t[hreads]] \n"); + fprintf(stream, " [-s[ummary]] \n"); + fprintf(stream, " [-c[leanoff]] \n"); + fprintf(stream, " [-h[elp]] \n"); + fprintf(stream, "\n\n"); + fprintf(stream, "verbose controls the amount of information displayed\n"); + fprintf(stream, "exclude to exclude tests by name\n"); + fprintf(stream, "only to name tests which should be run\n"); + fprintf(stream, "begin start at the name of the test given\n"); + fprintf(stream, "maxthreads maximum number of threads to be used by multi-thread tests\n"); + fprintf(stream, "summary prints a summary of test results at the end\n"); + fprintf(stream, "cleanoff does not delete *.hdf files after execution of tests\n"); + fprintf(stream, "help print out this information\n"); + if (TestPrivateUsage_g) { + fprintf(stream, "\nExtra options\n"); + TestPrivateUsage_g(stream); + } + fprintf(stream, "\n\n"); - for (i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); + /* Collect some information for cleaner printing */ + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + size_t test_name_len = strlen(TestArray[Loop].Name); - print_func("\n\n"); + if (test_name_len > max_test_name_len) + max_test_name_len = test_name_len; } + + fprintf(stream, "This program currently tests the following: \n\n"); + fprintf(stream, "%*s %s\n", (int)max_test_name_len, "Name", " Description"); + fprintf(stream, "%*s %s\n", (int)max_test_name_len, "----", " -----------"); + + for (unsigned i = 0; i < TestCount; i++) + fprintf(stream, "%*s %s\n", (int)max_test_name_len, TestArray[i].Name, TestArray[i].Description); + + fprintf(stream, "\n\n"); } /* - * Print test info. + * Print out miscellaneous test program information */ void -TestInfo(const char *ProgName) +TestInfo(FILE *stream) { - if (mpi_rank_framework_g == 0) { - unsigned major, minor, release; + unsigned major, minor, release; - H5get_libversion(&major, &minor, &release); + /* If running in parallel, only print output from a single MPI process */ + if (TestFrameworkProcessID_g != 0) + return; - print_func("\nFor help use: %s -help\n", ProgName); - print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); - } + if (!stream) + stream = stdout; + + H5get_libversion(&major, &minor, &release); + + fprintf(stream, "\nFor help use: %s -help\n", TestProgName); + fprintf(stream, "Linked with hdf5 version %u.%u release %u\n", major, minor, release); } /* - * Parse command line information. - * argc, argv: the usual command line argument count and strings - * - * Return: Void - * exit EXIT_FAILURE if error is encountered. + * Parse command line information */ -void +herr_t TestParseCmdLine(int argc, char *argv[]) { - bool skipped_all = false; - int ret_code; + herr_t ret_value = SUCCEED; while ((void)argv++, --argc > 0) { if ((strcmp(*argv, "-verbose") == 0) || (strcmp(*argv, "-v") == 0)) { if (argc > 0) { --argc; ++argv; - ParseTestVerbosity(*argv); + + if (ParseTestVerbosity(*argv) < 0) { + ret_value = FAIL; + goto done; + } } else { - TestUsage(); - exit(EXIT_FAILURE); + ret_value = FAIL; + goto done; } } else if (((strcmp(*argv, "-exclude") == 0) || (strcmp(*argv, "-x") == 0))) { if (argc > 0) { --argc; ++argv; - SetTest(*argv, SKIPTEST); + + if (SetTest(*argv, SKIPTEST) < 0) { + ret_value = FAIL; + goto done; + } } else { - TestUsage(); - exit(EXIT_FAILURE); + ret_value = FAIL; + goto done; } } else if (((strcmp(*argv, "-begin") == 0) || (strcmp(*argv, "-b") == 0))) { if (argc > 0) { --argc; ++argv; - SetTest(*argv, BEGINTEST); + + if (SetTest(*argv, BEGINTEST) < 0) { + ret_value = FAIL; + goto done; + } } else { - TestUsage(); - exit(EXIT_FAILURE); + ret_value = FAIL; + goto done; } } else if (((strcmp(*argv, "-only") == 0) || (strcmp(*argv, "-o") == 0))) { if (argc > 0) { - unsigned Loop; - --argc; ++argv; - /* Skip all tests, then activate only one. */ - if (!skipped_all) { - for (Loop = 0; Loop < Index; Loop++) - Test[Loop].SkipFlag = 1; - skipped_all = true; - } /* end if */ - SetTest(*argv, ONLYTEST); + if (SetTest(*argv, ONLYTEST) < 0) { + ret_value = FAIL; + goto done; + } } else { - TestUsage(); - exit(EXIT_FAILURE); + ret_value = FAIL; + goto done; } } else if ((strcmp(*argv, "-summary") == 0) || (strcmp(*argv, "-s") == 0)) - Summary = 1; - else if (strcmp(*argv, "-enable-error-stack") == 0) - enable_error_stack = 1; + TestDoSummary_g = true; + else if (strcmp(*argv, "-disable-error-stack") == 0) { + TestEnableErrorStack = false; + } else if ((strcmp(*argv, "-help") == 0) || (strcmp(*argv, "-h") == 0)) { - TestUsage(); + TestUsage(stdout); exit(EXIT_SUCCESS); } else if ((strcmp(*argv, "-cleanoff") == 0) || (strcmp(*argv, "-c") == 0)) SetTestNoCleanup(); + else if ((strcmp(*argv, "-maxthreads") == 0) || (strcmp(*argv, "-t") == 0)) { + if (argc > 0) { + long max_threads; + + --argc; + ++argv; + + errno = 0; + max_threads = strtol(*argv, NULL, 10); + if (errno != 0) { + fprintf(stderr, + "error while parsing value (%s) specified for maximum number of threads\n", + *argv); + ret_value = FAIL; + goto done; + } + if (max_threads <= 0) { + fprintf(stderr, "invalid value (%ld) specified for maximum number of threads\n", + max_threads); + ret_value = FAIL; + goto done; + } + else if (max_threads > (long)INT_MAX) { + fprintf(stderr, "value (%ld) specified for maximum number of threads too large\n", + max_threads); + ret_value = FAIL; + goto done; + } + + SetTestMaxNumThreads((int)max_threads); + } + else { + ret_value = FAIL; + goto done; + } + } else { /* non-standard option. Break out. */ break; @@ -288,91 +370,145 @@ TestParseCmdLine(int argc, char *argv[]) } /* Call extra parsing function if provided. */ - if (NULL != TestPrivateParser) { - ret_code = TestPrivateParser(argc + 1, argv - 1); - if (ret_code != 0) - exit(EXIT_FAILURE); + if (NULL != TestPrivateParser_g) { + if (TestPrivateParser_g(argc + 1, argv - 1) < 0) { + ret_value = FAIL; + goto done; + } } + +done: + if (ret_value < 0) + TestUsage(stderr); + + return ret_value; } /* - * Perform Tests. + * Execute all tests that aren't being skipped */ void PerformTests(void) { - unsigned Loop; + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + int old_num_errs = TestNumErrs_g; - for (Loop = 0; Loop < Index; Loop++) - if (Test[Loop].SkipFlag) { - if (mpi_rank_framework_g == 0) - MESSAGE(2, ("Skipping -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); + if (TestArray[Loop].TestSkipFlag) { + if (TestFrameworkProcessID_g == 0) + MESSAGE(2, ("Skipping -- %s (%s) \n", TestArray[Loop].Description, TestArray[Loop].Name)); + continue; } - else { - if (mpi_rank_framework_g == 0) - MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); - if (mpi_rank_framework_g == 0) - MESSAGE(5, ("===============================================\n")); - Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - TestAlarmOn(); - Test[Loop].Call(); - TestAlarmOff(); - Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; - if (mpi_rank_framework_g == 0) { - MESSAGE(5, ("===============================================\n")); - MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); - } + + if (TestFrameworkProcessID_g == 0) { + MESSAGE(2, ("Testing -- %s (%s) \n", TestArray[Loop].Description, TestArray[Loop].Name)); + MESSAGE(5, ("===============================================\n")); } - Test_parameters = NULL; /* clear it. */ + TestAlarmOn(); + + if (TestArray[Loop].TestSetupFunc) + TestArray[Loop].TestSetupFunc(TestArray[Loop].TestParameters); + + TestArray[Loop].TestFunc(TestArray[Loop].TestParameters); + + if (TestArray[Loop].TestCleanupFunc) + TestArray[Loop].TestCleanupFunc(TestArray[Loop].TestParameters); + + TestAlarmOff(); + + TestArray[Loop].TestNumErrors = TestNumErrs_g - old_num_errs; + + if (TestFrameworkProcessID_g == 0) { + MESSAGE(5, ("===============================================\n")); + MESSAGE(5, ("There were %d errors detected.\n\n", TestArray[Loop].TestNumErrors)); + } + } - if (mpi_rank_framework_g == 0) { + if (TestFrameworkProcessID_g == 0) { MESSAGE(2, ("\n\n")); - if (num_errs) - print_func("!!! %d Error(s) were detected !!!\n\n", (int)num_errs); + if (TestNumErrs_g) + MESSAGE(VERBO_NONE, ("!!! %d Error(s) were detected !!!\n\n", TestNumErrs_g)); else - print_func("All tests were successful. \n\n"); + MESSAGE(VERBO_NONE, ("All tests were successful. \n\n")); } } /* - * Display test summary. + * Display a summary of running tests */ void -TestSummary(void) +TestSummary(FILE *stream) { - unsigned Loop; + size_t max_test_name_len = 0; + size_t max_test_desc_len = 0; + size_t test_name_header_len = 0; + size_t test_desc_header_len = 0; + + /* If running in parallel, only print output from a single MPI process */ + if (TestFrameworkProcessID_g != 0) + return; + + if (!stream) + stream = stdout; + + /* Collect some information for cleaner printing */ + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + size_t test_name_len = strlen(TestArray[Loop].Name); + size_t test_desc_len = strlen(TestArray[Loop].Description); + + if (test_name_len > max_test_name_len) + max_test_name_len = test_name_len; + if (test_desc_len > max_test_desc_len) + max_test_desc_len = test_desc_len; + } + + test_name_header_len = MAX(max_test_name_len, strlen("Name of Test")); + test_desc_header_len = MAX(max_test_desc_len, strlen("Description of Test")); - print_func("Summary of Test Results:\n"); - print_func("Name of Test Errors Description of Test\n"); - print_func("---------------- ------ --------------------------------------\n"); + /* Print header, adjusted to maximum test name and description lengths */ + fprintf(stream, "Summary of Test Results:\n"); + fprintf(stream, "%-*s Errors %-*s\n", (int)test_name_header_len, "Name of Test", + (int)test_desc_header_len, "Description of Test"); - for (Loop = 0; Loop < Index; Loop++) { - if (Test[Loop].NumErrors == -1) - print_func("%16s %6s %s\n", Test[Loop].Name, "N/A", Test[Loop].Description); + /* Print a separating line row for each column header, adjusted to maximum + * test name and description lengths + */ + for (size_t i = 0; i < test_name_header_len; i++) /* 'Name of Test' */ + putc('-', stream); + putc(' ', stream); + putc(' ', stream); + for (size_t i = 0; i < 6; i++) /* 'Errors' */ + putc('-', stream); + putc(' ', stream); + putc(' ', stream); + for (size_t i = 0; i < test_desc_header_len; i++) /* 'Description of Test' */ + putc('-', stream); + putc('\n', stream); + + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + if (TestArray[Loop].TestNumErrors == -1) + fprintf(stream, "%-*s %-6s %-*s\n", (int)test_name_header_len, TestArray[Loop].Name, "N/A", + (int)test_desc_header_len, TestArray[Loop].Description); else - print_func("%16s %6d %s\n", Test[Loop].Name, (int)Test[Loop].NumErrors, Test[Loop].Description); + fprintf(stream, "%-*s %-6d %-*s\n", (int)test_name_header_len, TestArray[Loop].Name, + TestArray[Loop].TestNumErrors, (int)test_desc_header_len, TestArray[Loop].Description); } - print_func("\n\n"); + fprintf(stream, "\n\n"); } /* - * Cleanup files from testing + * Perform test cleanup */ void TestCleanup(void) { - unsigned Loop; - - if (mpi_rank_framework_g == 0) + if (TestFrameworkProcessID_g == 0) MESSAGE(2, ("\nCleaning Up temp files...\n\n")); - /* call individual cleanup routines in each source module */ - for (Loop = 0; Loop < Index; Loop++) - if (!Test[Loop].SkipFlag && Test[Loop].Cleanup != NULL) - Test[Loop].Cleanup(); + for (unsigned Loop = 0; Loop < TestCount; Loop++) + if (!TestArray[Loop].TestSkipFlag && TestArray[Loop].TestCleanupFunc != NULL) + TestArray[Loop].TestCleanupFunc(TestArray[Loop].TestParameters); } /* @@ -381,8 +517,11 @@ TestCleanup(void) void TestShutdown(void) { - if (Test) - free(Test); + if (TestArray) + for (unsigned Loop = 0; Loop < TestCount; Loop++) + free(TestArray[Loop].TestParameters); + + free(TestArray); } /* @@ -391,140 +530,77 @@ TestShutdown(void) H5_ATTR_PURE int GetTestVerbosity(void) { - return (TestVerbosity); + return TestVerbosity_g; } /* - * Set the verbosity level for the testing framework. - * Return previous verbosity level. + * Set the verbosity level for the testing framework */ int SetTestVerbosity(int newval) { int oldval; - oldval = TestVerbosity; - TestVerbosity = newval; - return (oldval); + if (newval < 0) + newval = VERBO_NONE; + else if (newval > VERBO_HI) + newval = VERBO_HI; + + oldval = TestVerbosity_g; + TestVerbosity_g = newval; + + return oldval; } /* * Retrieve the TestExpress mode for the testing framework - Values: - 0: Exhaustive run - Tests should take as long as necessary - 1: Full run. Default if H5_TEST_EXPRESS_LEVEL_DEFAULT - and HDF5TestExpress are not defined - Tests should take no more than 30 minutes - 2: Quick run - Tests should take no more than 10 minutes - 3: Smoke test. - Default if HDF5TestExpress is set to a value other than 0-3 - Tests should take less than 1 minute - - Design: - If the environment variable $HDF5TestExpress is defined, - or if a default testing level > 1 has been set via - H5_TEST_EXPRESS_LEVEL_DEFAULT, then test programs should - skip some tests so that they - complete sooner. - - Terms: - A "test" is a single executable, even if it contains multiple - sub-tests. - The standard system for test times is a Linux machine running in - NFS space (to catch tests that involve a great deal of disk I/O). - - Implementation: - I think this can be easily implemented in the test library (libh5test.a) - so that all tests can just call it to check the status of $HDF5TestExpress. */ int GetTestExpress(void) { - char *env_val; - - /* set it here for now. Should be done in something like h5test_init(). */ - if (TestExpress == -1) { - int express_val = 1; - - /* Check if a default test express level is defined (e.g., by build system) */ -#ifdef H5_TEST_EXPRESS_LEVEL_DEFAULT - express_val = H5_TEST_EXPRESS_LEVEL_DEFAULT; -#endif - - /* Check if HDF5TestExpress is set to override the default level */ - env_val = getenv("HDF5TestExpress"); - if (env_val) { - if (strcmp(env_val, "0") == 0) - express_val = 0; - else if (strcmp(env_val, "1") == 0) - express_val = 1; - else if (strcmp(env_val, "2") == 0) - express_val = 2; - else - express_val = 3; - } - - SetTestExpress(express_val); - } - - return (TestExpress); + return h5_get_testexpress(); } /* * Set the TestExpress mode for the testing framework. - * Return previous TestExpress mode. - * Values: non-zero means TestExpress mode is on, 0 means off. */ -int +void SetTestExpress(int newval) { - int oldval; - - oldval = TestExpress; - TestExpress = newval; - return (oldval); + h5_set_testexpress(newval); } /* - * Retrieve Summary request value. - * 0 means no summary, 1 means yes. + * Retrieve test summary request value. */ -H5_ATTR_PURE int +H5_ATTR_PURE bool GetTestSummary(void) { - return (Summary); + return TestDoSummary_g; } /* - * Retrieve Cleanup request value. - * 0 means no Cleanup, 1 means yes. + * Retrieve test file cleanup status value */ -H5_ATTR_PURE int +H5_ATTR_PURE bool GetTestCleanup(void) { - return (CleanUp); + return TestDoCleanUp_g; } /* - * Set cleanup to no. - * Return previous cleanup value. + * Set test file cleanup status to "don't clean up temporary files" */ -int +void SetTestNoCleanup(void) { - int oldval; - - oldval = CleanUp; - CleanUp = 0; - return (oldval); + TestDoCleanUp_g = false; } /* * Parse an argument string for verbosity level and set it. */ -void +herr_t ParseTestVerbosity(char *argv) { if (*argv == 'l') @@ -533,8 +609,26 @@ ParseTestVerbosity(char *argv) SetTestVerbosity(VERBO_MED); else if (*argv == 'h') SetTestVerbosity(VERBO_HI); - else - SetTestVerbosity(atoi(argv)); + else { + long verb_level; + + errno = 0; + verb_level = strtol(argv, NULL, 10); + if (errno != 0) { + fprintf(stderr, "%s: error while parsing value (%s) specified for test verbosity\n", __func__, + argv); + return FAIL; + } + + if (verb_level < 0) + verb_level = VERBO_DEF; + else if (verb_level > VERBO_HI) + verb_level = VERBO_HI; + + SetTestVerbosity((int)verb_level); + } + + return SUCCEED; } /* @@ -543,7 +637,7 @@ ParseTestVerbosity(char *argv) H5_ATTR_PURE int GetTestNumErrs(void) { - return (num_errs); + return TestNumErrs_g; } /* @@ -552,16 +646,7 @@ GetTestNumErrs(void) void IncTestNumErrs(void) { - num_errs++; -} - -/* - * Retrieve the current Test Parameters pointer. - */ -H5_ATTR_PURE const void * -GetTestParameters(void) -{ - return (Test_parameters); + TestNumErrs_g++; } /* @@ -575,11 +660,11 @@ TestErrPrintf(const char *format, ...) int ret_value; /* Increment the error count */ - num_errs++; + IncTestNumErrs(); /* Print the requested information */ va_start(arglist, format); - ret_value = vprintf(format, arglist); + ret_value = vfprintf(stderr, format, arglist); va_end(arglist); /* Return the length of the string produced (like printf() does) */ @@ -587,51 +672,84 @@ TestErrPrintf(const char *format, ...) } /* - * Set (control) which test will be tested. - * SKIPTEST: skip this test - * ONLYTEST: do only this test - * BEGINTEST: skip all tests before this test - * + * Change testing behavior in relation to a specific test */ -void +herr_t SetTest(const char *testname, int action) { - unsigned Loop; + static bool skipped_all = false; switch (action) { case SKIPTEST: - for (Loop = 0; Loop < Index; Loop++) - if (strcmp(testname, Test[Loop].Name) == 0) { - Test[Loop].SkipFlag = 1; + for (unsigned Loop = 0; Loop < TestCount; Loop++) + if (strcmp(testname, TestArray[Loop].Name) == 0) { + TestArray[Loop].TestSkipFlag = 1; break; } break; case BEGINTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (strcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + if (strcmp(testname, TestArray[Loop].Name) != 0) + TestArray[Loop].TestSkipFlag = 1; else { /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; + TestArray[Loop].TestSkipFlag = 0; break; } } break; case ONLYTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (strcmp(testname, Test[Loop].Name) == 0) { + /* Skip all tests, then keep track that we did that. + * Some testing prefers the convenience of being + * able to specify multiple tests to "only" run + * rather than specifying (possibly many more) tests + * to exclude, but we only want to skip all the + * tests a single time to facilitate this. + */ + if (!skipped_all) { + for (unsigned Loop = 0; Loop < TestCount; Loop++) + TestArray[Loop].TestSkipFlag = 1; + skipped_all = true; + } + + for (unsigned Loop = 0; Loop < TestCount; Loop++) { + if (strcmp(testname, TestArray[Loop].Name) == 0) { /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; + TestArray[Loop].TestSkipFlag = 0; break; } } break; default: /* error */ - if (mpi_rank_framework_g == 0) - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); - break; + if (TestFrameworkProcessID_g == 0) + fprintf(stderr, "%s: invalid action %d specified\n", __func__, action); + return FAIL; } + + return SUCCEED; +} + +/* + * Returns the value set for the maximum number of threads that a test + * program can spawn in addition to the main thread. + */ +H5_ATTR_PURE int +GetTestMaxNumThreads(void) +{ + return TestMaxNumThreads_g; +} + +/* + * Set the value for the maximum number of threads that a test program + * can spawn in addition to the main thread. + */ +herr_t +SetTestMaxNumThreads(int max_num_threads) +{ + TestMaxNumThreads_g = max_num_threads; + + return SUCCEED; } /* Enable a test timer that will kill long-running tests, the time is configurable @@ -640,7 +758,7 @@ SetTest(const char *testname, int action) * Only useful on POSIX systems where alarm(2) is present. This does not include * MinGW builds, which will often incorrectly decide that alarm(2) exists. */ -void +herr_t TestAlarmOn(void) { #ifdef H5_HAVE_ALARM @@ -648,12 +766,25 @@ TestAlarmOn(void) unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */ /* Get the alarm value from the environment variable, if set */ - if (env_val != NULL) - alarm_sec = (unsigned)strtoul(env_val, (char **)NULL, 10); + if (env_val != NULL) { + errno = 0; + alarm_sec = strtoul(env_val, NULL, 10); + if (errno != 0) { + fprintf(stderr, "%s: error while parsing value (%s) specified for alarm timeout\n", __func__, + env_val); + return FAIL; + } + else if (alarm_sec > (unsigned long)UINT_MAX) { + fprintf(stderr, "%s: value (%lu) specified for alarm timeout too large\n", __func__, alarm_sec); + return FAIL; + } + } /* Set the number of seconds before alarm goes off */ alarm((unsigned)alarm_sec); #endif + + return SUCCEED; } /* Disable the test timer */ diff --git a/test/testframe.h b/test/testframe.h new file mode 100644 index 00000000000..d730c6e0958 --- /dev/null +++ b/test/testframe.h @@ -0,0 +1,803 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Header file for a basic HDF5 testing framework + */ + +#ifndef H5TESTFRAME_H +#define H5TESTFRAME_H + +/* + * Include generic testing header, which includes the public + * HDF5 header, first. Including a private header first can + * cause the library to #undef the H5OPEN macro and cause odd + * test failures due to global IDs not being initialized. + */ +#include "h5test.h" + +#include "H5private.h" + +/**********/ +/* Macros */ +/**********/ + +/** + * \def MAXTESTNAME + * The maximum length for the name given to a test, including the NUL terminator + */ +#define MAXTESTNAME 64 + +/** + * \def MAXTESTDESC + * The maximum length for the description given to a test, including the NUL terminator + */ +#define MAXTESTDESC 128 + +/** + * \def H5_ALARM_SEC + * Number of seconds to wait before killing a test (requires alarm(2)) + */ +#define H5_ALARM_SEC 1200 /* default is 20 minutes */ + +/* + * Test controls definitions. + */ +#define SKIPTEST 1 /* Skip this test */ +#define ONLYTEST 2 /* Do only this test */ +#define BEGINTEST 3 /* Skip all tests before this test */ + +/* + * Predefined test verbosity levels. + * + * Convention: + * + * The higher the verbosity value, the more information printed. + * So, output for higher verbosity also include output of all lower + * verbosity. + */ +//! +/* + * + * Value Description + * 0 None: No informational message. + * 1 "All tests passed" + * 2 Header of overall test + * 3 Default: header and results of individual test + * 4 + * 5 Low: Major category of tests. + * 6 + * 7 Medium: Minor category of tests such as functions called. + * 8 + * 9 High: Highest level. All information. + */ +//! +#define VERBO_NONE 0 /* None */ +#define VERBO_DEF 3 /* Default */ +#define VERBO_LO 5 /* Low */ +#define VERBO_MED 7 /* Medium */ +#define VERBO_HI 9 /* High */ + +/* + * Verbose queries + * Only None needs an exact match. The rest are at least as much. + */ +#define VERBOSE_NONE (TestVerbosity_g == VERBO_NONE) +#define VERBOSE_DEF (TestVerbosity_g >= VERBO_DEF) +#define VERBOSE_LO (TestVerbosity_g >= VERBO_LO) +#define VERBOSE_MED (TestVerbosity_g >= VERBO_MED) +#define VERBOSE_HI (TestVerbosity_g >= VERBO_HI) + +/* Used to document process through a test */ +#define MESSAGE(V, A) \ + do { \ + if (TestFrameworkProcessID_g == 0 && TestVerbosity_g > (V)) \ + printf A; \ + } while (0) + +/************/ +/* Typedefs */ +/************/ + +/*************/ +/* Variables */ +/*************/ + +H5TEST_DLLVAR int TestFrameworkProcessID_g; +H5TEST_DLLVAR int TestVerbosity_g; + +/**************/ +/* Prototypes */ +/**************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Initializes the testing framework + * + * \param[in] ProgName The chosen name for the test executable to + * be used + * \param[in] TestPrivateUsage Pointer to a function which prints out + * additional usage help text that is specific + * to the test program + * \param[in] TestPrivateParser Pointer to a function which parses + * command-line arguments which are specific to + * the test program + * \param[in] TestProcessID ID for the process calling TestInit(). Used + * to control printing of output in parallel + * test programs. + * + * \return \herr_t + * + * \details TestInit() initializes the testing framework by setting up all + * the internal state needed for running tests. TestInit() should be + * called before any other function from this testing framework is + * called, but after other optional library setup functions, such + * as H5open() or H5dont_atexit(). + * + * \p ProgName is used to give a different name to the test program + * than the actual name of the executable. `argv[0]` should be + * passed for \p ProgName if a different name is not desired. + * + * \p TestPrivateUsage is a pointer to a function that can be used + * to print out additional usage help text that is specific to the + * test program when necessary. The TestUsage() function calls this + * function to print out the additional help text after printing out + * a more general set of help test instructions. \p TestPrivateUsage + * may be NULL. + * + * \p TestPrivateParser is a pointer to a function that can be used + * to parse command-line arguments which are specific to the test + * program. The TestParseCmdLine() function defers to this function + * when it encounters a command-line argument that is not among the + * standard list of arguments it recognizes. \p TestPrivateParser + * may be NULL. + * + * \p TestProcessID is an integer value that is used to distinguish + * between processes when multiple are involved in running a test + * program. This is primarily useful for controlling testing + * framework output printed during execution of a parallel test + * program. For serial tests, the value 0 should always be passed. + * For parallel tests, the rank value of the MPI process, as obtained + * by calling MPI_Comm_rank(), should be passed. Test framework output + * is only printed from the process with ID 0. + * + * \see TestShutdown(), TestUsage(), TestParseCmdLine() + * + */ +H5TEST_DLL herr_t TestInit(const char *ProgName, void (*TestPrivateUsage)(FILE *stream), + int (*TestPrivateParser)(int argc, char *argv[]), int TestProcessID); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Shuts down the testing framework + * + * \return void + * + * \details TestShutdown() shuts down the testing framework by tearing down + * the internal state needed for running tests and freeing any + * associated memory. TestShutdown() should be called after any + * other function from this testing framework is called, and just + * before any optional library shutdown functions, such as H5close(). + * + * \see TestInit() + * + */ +H5TEST_DLL void TestShutdown(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Prints out test program usage help text + * + * \param[in] stream Pointer to output stream to direct output to + * + * \return void + * + * \details TestUsage() prints out the test program's usage help text to + * the given output stream specified in \p stream. This includes the + * general list of command-line arguments accepted by the test + * program, additional test program-specific usage help text printed + * out by the optional callback specified in TestInit() and a list + * of all the tests and their descriptions, as added by AddTest(). + * \p stream may be NULL, in which case stdout is used. + * + * Note: when a parallel test calls TestUsage(), the output, + * including additional output from the optional callback specified + * in TestInit(), is only printed from the MPI process with rank + * value 0. Any collective operations should currently be avoided in + * the optional callback if one is provided. + * + * \see AddTest(), TestInit() + * + */ +H5TEST_DLL void TestUsage(FILE *stream); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Prints out miscellaneous test program information + * + * \param[in] stream Pointer to output stream to direct output to + * + * \return void + * + * \details TestInfo() prints out miscellaneous information for the test + * program, such as the version of the HDF5 library that the program + * is linked against. \p stream may be NULL, in which case stdout is + * used. + * + * Note: when a parallel test calls TestInfo(), the output is + * only printed from the MPI process with rank value 0. + * + */ +H5TEST_DLL void TestInfo(FILE *stream); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Adds a test to the list of tests be executed + * + * \param[in] TestName The chosen name for the test to be executed + * \param[in] TestFunc The function to call when executing the test + * \param[in] TestSetupFunc The function to call before executing the + * test + * \param[in] TestCleanupFunc The function to call after executing the test + * \param[in] TestData A pointer to additional data that will be + * passed to the test function and its setup and + * cleanup callbacks when the test runs + * \param[in] TestDataSize Size of the additional test data pointed to + * by \p TestData + * \param[in] TestDescr A short description of the test + * + * \return \herr_t + * + * \details AddTest() adds a new test to the list of tests that will be + * executed when PerformTests() is called by a test program. + * + * \p TestName is a short name given to a test that can be used to + * control how a test is executed, including skipping that test if + * necessary. The name specified in \p TestName must be #MAXTESTNAME + * bytes or less, including the NUL terminator. The name specified + * in \p TestName must also not be an empty string. If \p TestName + * begins with the character '-', the test will be set to be + * skipped by default. + * + * \p TestFunc is a pointer to the function that will be called for + * the test. The function must return no value and accept a single + * const void * as an argument, which will point to any parameters + * to be passed to the test that are specified in \p TestData. + * + * \p TestSetupFunc is an optional pointer to a function that will + * be called before the main test function is called. This allows + * tests to perform any pre-test setup necessary. The function must + * return no value and accept a single void * as an argument, which + * will point to any parameters to be passed to the test that are + * specified in \p TestData. + * + * \p TestCleanupFunc is an optional pointer to a function that + * will be called after a test's main test function has finished + * executing. This allows tests to perform any post-test cleanup + * necessary. The function must return no value and accept a single + * void * as an argument, which will point to any parameters to be + * passed to the test that are specified in \p TestData. + * + * \p TestData is an optional pointer to test parameters that will + * be passed to the test's main test function when executed, as well + * as the test's optional setup and cleanup callbacks. If given, the + * testing framework will make a copy of the parameters according to + * the size specified in \p TestDataSize. If \p TestData is not NULL, + * \p TestDataSize must be a positive value. Otherwise, if + * \p TestData is NULL, \p TestDataSize must be 0. + * + * \p TestDataSize is the size of the test parameter data to be + * passed to the test's main function and setup and callback + * functions during execution. If \p TestData is not NULL, + * \p TestDataSize must be a positive value. Otherwise, if + * \p TestData is NULL, \p TestDataSize must be 0. + * + * \p TestDescr is an informational description given to a test + * which may be printed out by the testing framework in various + * places. The string passed in \p TestDescr must be #MAXTESTDESC + * bytes or less, including the NUL terminator. The string passed + * in \p TestDescr may be an empty string, but it is advised that + * test authors give a description to a test. + * + * \see PerformTests() + * + */ +H5TEST_DLL herr_t AddTest(const char *TestName, void (*TestFunc)(const void *), void (*TestSetupFunc)(void *), + void (*TestCleanupFunc)(void *), const void *TestData, size_t TestDataSize, + const char *TestDescr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Parses command-line arguments given to the test program + * + * \param[in] argc Command-line argument count; received from main() + * \param[in] argv Command-line argument array; received from main() + * + * \return \herr_t + * + * \details TestParseCmdLine() parses the command-line arguments given to the + * test program. If an optional argument parsing callback was + * specified in the call to TestInit(), TestParseCmdLine() will + * defer to that function for parsing command-line arguments that + * it doesn't recognize. Note: TestParseCmdLine() requires + * that all standard command-line arguments must appear before any + * non-standard arguments that would be parsed by an optional + * argument parsing callback function specified in TestInit(). + * + * Note: TestParseCmdLine() should not be called until all + * tests have been added by AddTest() since some of the command-line + * arguments that are parsed involve the ability to skip certain + * tests. + * + * \see TestInit() + * + */ +H5TEST_DLL herr_t TestParseCmdLine(int argc, char *argv[]); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Executes all tests added by AddTest() that aren't flagged to be + * skipped + * + * \return void + * + * \details PerformTests() runs all tests that aren't flagged to be skipped + * in the order added by calls to AddTest(). For each test, the + * test's setup callback function (if supplied) will be called + * first, followed by the test's primary function and then the + * test's cleanup callback function (if supplied). Before each test + * begins, a timer is enabled by a call to TestAlarmOn() to prevent + * the test from running longer than desired. A call to + * TestAlarmOff() disables this timer after each test has finished. + * + * \see AddTest(), TestAlarmOn() + * + */ +H5TEST_DLL void PerformTests(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Prints out a summary of the results of running tests + * + * \param[in] stream Pointer to output stream to direct output to + * + * \return void + * + * \details TestSummary() prints out a summary of testing results, including + * each test's name, description and the number of errors that + * occurred during the test's execution. If a test was skipped, the + * number of errors for that test will show as "N/A". \p stream may + * be NULL, in which case stdout is used. + * + * Note: when a parallel test calls TestSummary(), the output + * is only printed from the MPI process with rank value 0. + * + */ +H5TEST_DLL void TestSummary(FILE *stream); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Calls the 'cleanup' callback for each test added to the list of + * tests + * + * \return void + * + * \details TestCleanup() performs cleanup by calling the 'cleanup' callback + * for each test added to the lists of tests, as long as the test + * isn't flagged to be skipped. + * + * \see SetTestCleanup() + * + */ +H5TEST_DLL void TestCleanup(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the current test verbosity level setting + * + * \return The current test verbosity level setting + * + * \details GetTestVerbosity() returns the current setting for the level of + * test verbosity. These levels are as follows: + * + * \snippet this test_verbo_snip + * + * \see SetTestVerbosity() + * + */ +H5TEST_DLL int GetTestVerbosity(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Sets the current test verbosity level setting + * + * \return The previous test verbosity level setting + * + * \details SetTestVerbosity() sets a new value for the level of test + * verbosity and returns the previous value. These levels are as + * follows: + * + * \snippet this test_verbo_snip + * + * If \p newval is negative, the test verbosity level is set to the + * lowest value (VERBO_NONE). If \p newval is greater than the + * highest verbosity value, it is set to the highest verbosity value + * (VERBO_HI). + * + * \see GetTestVerbosity() + * + */ +H5TEST_DLL int SetTestVerbosity(int newval); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Parses a string for a test verbosity level setting, then sets the + * test verbosity level to that setting + * + * \return \herr_t + * + * \details ParseTestVerbosity() parses a string for a test verbosity level + * setting, then sets the test verbosity level to that setting. The + * string may be the character 'l' (for low verbosity), 'm' (for + * medium verbosity), 'h' (for high verbosity) or a number between + * 0-9, corresponding to the different predefined levels of test + * verbosity. If a negative number is specified, the test verbosity + * level is set to the default (VERBO_DEF). If a number greater + * than VERBO_HI is specified, the test verbosity level is set to + * VERBO_HI. If ParseTestVerbosity() can't parse the string, a + * negative value will be returned to indicate failure. + * + * \see GetTestVerbosity(), SetTestVerbosity() + * + */ +H5TEST_DLL herr_t ParseTestVerbosity(char *argv); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the current TestExpress setting for expedited testing + * + * \return The current TestExpress setting + * + * \details GetTestExpress() returns the current setting for the TestExpress + * variable which controls whether or not some testing should be + * expedited. The variable may be set to one of the following + * values: + * + * 0: Exhaustive run + * Tests should take as long as necessary + * 1: Full run. Default value if H5_TEST_EXPRESS_LEVEL_DEFAULT + * and the HDF5TestExpress environment variable are not defined + * Tests should take no more than 30 minutes + * 2: Quick run + * Tests should take no more than 10 minutes + * 3: Smoke test. + * Default if the HDF5TestExpress environment variable is set to + * a value other than 0-3 + * Tests should take less than 1 minute + * + * The macro H5_TEST_EXPRESS_LEVEL_DEFAULT may be defined to one + * of these values at library configuration time in order to + * override the default value set for TestExpress. The TestExpress + * value may also be overridden at run time by setting the + * HDF5TestExpress environment variable to one of these values. + * + * The limitation imposed by the TestExpress functionality applies + * to the total runtime of a test executable, even if it contains + * multiple sub-tests. + * + * The standard system for test times is a Linux machine running in + * NFS space (to catch tests that involve a great deal of disk I/O). + * + * \see SetTestExpress() + * + */ +H5TEST_DLL int GetTestExpress(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Sets the current TestExpress setting for expedited testing + * + * \return void + * + * \details SetTestExpress() sets a new value for the TestExpress variable + * which controls whether or not some testing should be expedited. + * + * If \p newval is negative, the TestExpress value is set to the + * default value (1). If \p newval is greater than the highest + * TestExpress value, it is set to the highest TestExpress value + * (3). + * + * \see GetTestExpress() + * + */ +H5TEST_DLL void SetTestExpress(int newval); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the current test summary setting + * + * \return The current test summary setting + * + * \details GetTestSummary() returns whether or not a test program should + * call TestSummary() to print out a summary of test results after + * tests have run. This summary includes each test's name, + * description and the number of errors that occurred during the + * test's execution. + * + * \see TestSummary() + * + */ +H5TEST_DLL bool GetTestSummary(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the current test file cleanup status setting + * + * \return The current test file cleanup status setting + * + * \details GetTestCleanup() returns whether or not a test should clean up + * any temporary files it has created when it is finished running. + * If true is returned, the test should clean up temporary files. + * Otherwise, it should leave them in place. + * + * \see SetTestNoCleanup() + * + */ +H5TEST_DLL bool GetTestCleanup(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Sets the test file cleanup status setting to "don't clean up + * temporary files" + * + * \return void + * + * \details SetTestNoCleanup() sets the temporary test file cleanup status + * to false, causing future calls to GetTestCleanup() to return + * false and inform tests that they should not clean up temporary + * test files they have created. + * + * \see GetTestCleanup() + * + */ +H5TEST_DLL void SetTestNoCleanup(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the number of errors recorded for the test program + * + * \return The recorded number of errors + * + * \details GetTestNumErrs() returns the total number of errors recorded + * during the execution of the test program. This number is + * primarily used to determine whether the test program should exit + * with a success or failure value. + * + * \see IncTestNumErrs() + * + */ +H5TEST_DLL int GetTestNumErrs(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Increments the number of errors recorded for the test program + * + * \return void + * + * \details IncTestNumErrs() increments the number of errors recorded + * for the test program. + * + * \see GetTestNumErrs() + * + */ +H5TEST_DLL void IncTestNumErrs(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Prints out error messages to stderr and increments the number of + * test program errors + * + * \return return value of vfprintf() + * + * \details TestErrPrintf() is a wrapper around vfprintf() that can be used + * to print out messages to stderr when a test failure occurs. + * TestErrPrintf() increments the number of errors recorded for the + * test program when called. + * + */ +H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Change test execution for a particular test + * + * \return \herr_t + * + * \details SetTest() is used to change how test execution occurs in relation + * to a particular test. \p testname is the name of the test, as + * specified by AddTest(), to change the behavior for. \p action + * should be one of the following macros: + * + * SKIPTEST - informs the testing framework to skip the test + * specified by \p testname + * ONLYTEST - informs the testing framework to only run the test + * specified by \p testname and skip all other tests + * BEGINTEST - informs the testing framework to start running tests + * at the test specified by \p testname and skip all + * tests before it (in the order added by calls to + * AddTest()) + * + * Other values for \p action will cause SetTest() to return + * a negative value for failure. + * + * Multiple tests can be set to the value ONLYTEST in order to run a + * subset of tests. This is intended as a convenient alternative to + * needing to skip many other tests by setting them to the value + * SKIPTEST. + * + * \see AddTest() + * + */ +H5TEST_DLL herr_t SetTest(const char *testname, int action); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Returns the maximum number of threads a test program is allowed to + * spawn in addition to the main thread + * + * \return The maximum number of allowed spawned threads + * + * \details GetTestMaxNumThreads() returns the value for the maximum number + * of threads a test program is allowed to spawn in addition to the + * main thread for the test program. This number is usually + * configured by a command-line argument passed to the test program + * and is intended for allowing tests to adjust their workload + * according to the resources of the testing environment. + * + * The default value is -1, which means that multi-threaded tests + * aren't limited in the number of threads they can spawn, but + * should still only use a reasonable amount of threads. The value + * 0 indicates that no additional threads should be spawned, which + * is primarily for testing purposes. The value returned by + * GetTestMaxNumThreads() is meaningless for non-multi-threaded + * tests. + * + * \see SetTestMaxNumThreads() + * + */ +H5TEST_DLL int GetTestMaxNumThreads(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Sets the maximum number of threads a test program is allowed to + * spawn in addition to the main thread + * + * \return \herr_t + * + * \details SetTestMaxNumThreads() sets the value for the maximum number of + * threads a test program is allowed to spawn in addition to the + * main thread for the test program. This number is usually + * configured by a command-line argument passed to the test program + * and is intended for allowing tests to adjust their workload + * according to the resources of the testing environment. + * + * If \p max_num_threads is a negative value, test programs will be + * allowed to spawn any number of threads, though it is advised + * that test programs try to limit this to a reasonable number. + * The value 0 indicates that no additional threads should be + * spawned, which is primarily for testing purposes. + * + * \see SetTestMaxNumThreads() + * + */ +H5TEST_DLL herr_t SetTestMaxNumThreads(int max_num_threads); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Enables a global test timer + * + * \return \herr_t + * + * \details TestAlarmOn() enables a global test timer through use of + * alarm(2). This timer is intended to stop long-running or hanging + * tests after a configurable amount of time. The default time + * allowed for a test program is 1200 seconds (20 minutes). The + * environment variable HDF5_ALARM_SECONDS may be set to a number of + * seconds in order to override this value. However, a test program + * may still be limited by the build system used to build the + * library. For example, HDF5's CMake code has a default limit of + * 1200 seconds for a test program. + * + * If support for alarm(2) is not available on the system, this + * function has no effect. + * + * \see TestAlarmOff() + * + */ +H5TEST_DLL herr_t TestAlarmOn(void); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TEST + * + * \brief Disables a global test timer + * + * \return void + * + * \details TestAlarmOff() disables a global test timer as enabled by + * TestAlarmOn(). + * + * If support for alarm(2) is not available on the system, this + * function has no effect. + * + * \see TestAlarmOn() + * + */ +H5TEST_DLL void TestAlarmOff(void); + +#ifdef __cplusplus +} +#endif + +#endif /* H5TESTFRAME_H */ diff --git a/test/testhdf5.c b/test/testhdf5.c index 660fee9e2cd..0df372858dc 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -18,11 +18,11 @@ General test wrapper for HDF5 base library test programs DESIGN - Each test function should be implemented as function having no - parameters and returning void (i.e. no return value). They should be put - into the list of AddTest() calls in main() below. Functions which depend - on other functionality should be placed below the AddTest() call for the - base functionality testing. + Each test function should be implemented as function having a single + const void * parameter and returning void (i.e. no return value). They + should be put into the list of AddTest() calls in main() below. Functions + which depend on other functionality should be placed below the AddTest() + call for the base functionality testing. Each test module should include testhdf5.h and define a unique set of names for test files they create. @@ -47,46 +47,54 @@ main(int argc, char *argv[]) H5Pclose(fapl_id); /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + if (TestInit(argv[0], NULL, NULL, 0) < 0) { + fprintf(stderr, "couldn't initialize testing framework\n"); + exit(EXIT_FAILURE); + } /* Tests are generally arranged from least to most complexity... */ - AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL); - AddTest("h5system", test_h5_system, cleanup_h5_system, "H5system routines", NULL); - AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL); - AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL); - AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL); - AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL); - AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL); - AddTest("objects", test_h5o, cleanup_h5o, "Generic Object Functions", NULL); - AddTest("h5s", test_h5s, cleanup_h5s, "Dataspaces", NULL); - AddTest("coords", test_coords, cleanup_coords, "Dataspace coordinates", NULL); - AddTest("sohm", test_sohm, cleanup_sohm, "Shared Object Header Messages", NULL); - AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL); - AddTest("select", test_select, cleanup_select, "Selections", NULL); - AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL); - AddTest("ref_deprec", test_reference_deprec, cleanup_reference_deprec, "Deprecated References", NULL); - AddTest("ref", test_reference, cleanup_reference, "References", NULL); - AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL); - AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL); - AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL); - AddTest("array", test_array, cleanup_array, "Array Datatypes", NULL); - AddTest("genprop", test_genprop, cleanup_genprop, "Generic Properties", NULL); - AddTest("unicode", test_unicode, cleanup_unicode, "UTF-8 Encoding", NULL); - AddTest("id", test_ids, NULL, "User-Created Identifiers", NULL); - AddTest("misc", test_misc, cleanup_misc, "Miscellaneous", NULL); + AddTest("config", test_configure, NULL, cleanup_configure, NULL, 0, "Configure definitions"); + AddTest("h5system", test_h5_system, NULL, cleanup_h5_system, NULL, 0, "H5system routines"); + AddTest("metadata", test_metadata, NULL, cleanup_metadata, NULL, 0, "Encoding/decoding metadata"); + AddTest("checksum", test_checksum, NULL, cleanup_checksum, NULL, 0, "Checksum algorithm"); + AddTest("skiplist", test_skiplist, NULL, NULL, NULL, 0, "Skip Lists"); + AddTest("refstr", test_refstr, NULL, NULL, NULL, 0, "Reference Counted Strings"); + AddTest("file", test_file, NULL, cleanup_file, NULL, 0, "Low-Level File I/O"); + AddTest("objects", test_h5o, NULL, cleanup_h5o, NULL, 0, "Generic Object Functions"); + AddTest("h5s", test_h5s, NULL, cleanup_h5s, NULL, 0, "Dataspaces"); + AddTest("coords", test_coords, NULL, cleanup_coords, NULL, 0, "Dataspace coordinates"); + AddTest("sohm", test_sohm, NULL, cleanup_sohm, NULL, 0, "Shared Object Header Messages"); + AddTest("attr", test_attr, NULL, cleanup_attr, NULL, 0, "Attributes"); + AddTest("select", test_select, NULL, cleanup_select, NULL, 0, "Selections"); + AddTest("time", test_time, NULL, cleanup_time, NULL, 0, "Time Datatypes"); + AddTest("ref_deprec", test_reference_deprec, NULL, cleanup_reference_deprec, NULL, 0, + "Deprecated References"); + AddTest("ref", test_reference, NULL, cleanup_reference, NULL, 0, "References"); + AddTest("vltypes", test_vltypes, NULL, cleanup_vltypes, NULL, 0, "Variable-Length Datatypes"); + AddTest("vlstrings", test_vlstrings, NULL, cleanup_vlstrings, NULL, 0, "Variable-Length Strings"); + AddTest("iterate", test_iterate, NULL, cleanup_iterate, NULL, 0, "Group & Attribute Iteration"); + AddTest("array", test_array, NULL, cleanup_array, NULL, 0, "Array Datatypes"); + AddTest("genprop", test_genprop, NULL, cleanup_genprop, NULL, 0, "Generic Properties"); + AddTest("unicode", test_unicode, NULL, cleanup_unicode, NULL, 0, "UTF-8 Encoding"); + AddTest("id", test_ids, NULL, NULL, NULL, 0, "User-Created Identifiers"); + AddTest("misc", test_misc, NULL, cleanup_misc, NULL, 0, "Miscellaneous"); /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); /* Parse command line arguments */ - TestParseCmdLine(argc, argv); + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + exit(EXIT_FAILURE); + } /* Perform requested testing */ PerformTests(); /* Display test summary, if requested */ if (GetTestSummary()) - TestSummary(); + TestSummary(stdout); /* Clean up test files, if allowed */ if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) diff --git a/test/testhdf5.h b/test/testhdf5.h index 75c94ee9b6b..f4f3136d8a4 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -17,17 +17,20 @@ #ifndef TESTHDF5_H #define TESTHDF5_H -/* Include generic testing header also */ +/* Include generic testing header */ #include "h5test.h" +/* Include testing framework functionality */ +#include "testframe.h" + /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ #define CHECK(ret, val, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, (long)(ret)); \ + printf(" Call to routine: %15s at line %4d " \ + "in %s returned %ld \n", \ + where, (int)__LINE__, __FILE__, (long)(ret)); \ } \ if ((ret) == (val)) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ @@ -40,8 +43,8 @@ #define CHECK_I(ret, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", (where), (int)__LINE__, \ - __FILE__, (long)(ret)); \ + printf(" Call to routine: %15s at line %4d in %s returned %ld\n", (where), (int)__LINE__, \ + __FILE__, (long)(ret)); \ } \ if ((ret) < 0) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", (where), (long)(ret), \ @@ -54,8 +57,8 @@ #define CHECK_PTR(ret, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ - __FILE__, ((const void *)ret)); \ + printf(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ + __FILE__, ((const void *)ret)); \ } \ if (!(ret)) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \ @@ -68,8 +71,8 @@ #define CHECK_PTR_NULL(ret, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ - __FILE__, ((const void *)ret)); \ + printf(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ + __FILE__, ((const void *)ret)); \ } \ if (ret) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \ @@ -82,8 +85,8 @@ #define CHECK_PTR_EQ(ret, val, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ - __FILE__, (const void *)(ret)); \ + printf(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ + __FILE__, (const void *)(ret)); \ } \ if (ret != val) { \ TestErrPrintf( \ @@ -98,9 +101,9 @@ do { \ long __x = (long)_x, __val = (long)_val; \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", \ - (where), (int)__LINE__, __FILE__, __x); \ + printf(" Call to routine: %15s at line %4d in %s had value " \ + "%ld \n", \ + (where), (int)__LINE__, __FILE__, __x); \ } \ if ((__x) != (__val)) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \ @@ -115,8 +118,8 @@ do { \ _type __x = (_type)_x, __val = (_type)_val; \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " _format " \n", (where), \ - (int)__LINE__, __FILE__, __x); \ + printf(" Call to routine: %15s at line %4d in %s had value " _format " \n", (where), \ + (int)__LINE__, __FILE__, __x); \ } \ if ((__x) != (__val)) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format \ @@ -131,9 +134,9 @@ #define VERIFY_STR(x, val, where) \ do { \ if (VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%s \n", \ - (where), (int)__LINE__, __FILE__, x); \ + printf(" Call to routine: %15s at line %4d in %s had value " \ + "%s \n", \ + (where), (int)__LINE__, __FILE__, x); \ } \ if (strcmp(x, val) != 0) { \ TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \ @@ -147,9 +150,9 @@ #define RESULT(ret, func) \ do { \ if (VERBOSE_MED) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", \ - func, (int)__LINE__, __FILE__, (long)(ret)); \ + printf(" Call to routine: %15s at line %4d in %s returned " \ + "%ld\n", \ + func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ if (VERBOSE_HI) \ H5Eprint2(H5E_DEFAULT, stdout); \ @@ -161,94 +164,70 @@ } \ } while (0) -/* Used to document process through a test */ -#if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST) -#define MESSAGE(V, A) \ - do { \ - int mpi_rank; \ - \ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ - if (mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ - print_func A; \ - } while (0) -#else /* H5_HAVE_PARALLEL */ -#define MESSAGE(V, A) \ - do { \ - if (HDGetTestVerbosity() > (V)) \ - print_func A; \ - } while (0) -#endif /* H5_HAVE_PARALLEL */ - /* Used to indicate an error that is complex to check for */ #define ERROR(where) \ do { \ if (VERBOSE_HI) \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "invalid result\n", \ - where, (int)__LINE__, __FILE__); \ + printf(" Call to routine: %15s at line %4d in %s returned " \ + "invalid result\n", \ + where, (int)__LINE__, __FILE__); \ TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", where, (int)__LINE__, __FILE__); \ } while (0) -/* definitions for command strings */ -#define VERBOSITY_STR "Verbosity" -#define SKIP_STR "Skip" -#define TEST_STR "Test" -#define CLEAN_STR "Cleanup" - #ifdef __cplusplus extern "C" { #endif /* Prototypes for the test routines */ -void test_metadata(void); -void test_checksum(void); -void test_refstr(void); -void test_file(void); -void test_h5o(void); -void test_h5t(void); -void test_h5s(void); -void test_coords(void); -void test_h5d(void); -void test_attr(void); -void test_select(void); -void test_time(void); -void test_reference(void); -void test_reference_deprec(void); -void test_vltypes(void); -void test_vlstrings(void); -void test_iterate(void); -void test_array(void); -void test_genprop(void); -void test_configure(void); -void test_h5_system(void); -void test_misc(void); -void test_ids(void); -void test_skiplist(void); -void test_sohm(void); -void test_unicode(void); +void test_metadata(const void *params); +void test_checksum(const void *params); +void test_refstr(const void *params); +void test_file(const void *params); +void test_h5o(const void *params); +void test_h5t(const void *params); +void test_h5s(const void *params); +void test_coords(const void *params); +void test_h5d(const void *params); +void test_attr(const void *params); +void test_select(const void *params); +void test_time(const void *params); +void test_reference(const void *params); +void test_reference_deprec(const void *params); +void test_vltypes(const void *params); +void test_vlstrings(const void *params); +void test_iterate(const void *params); +void test_array(const void *params); +void test_genprop(const void *params); +void test_configure(const void *params); +void test_h5_system(const void *params); +void test_misc(const void *params); +void test_ids(const void *params); +void test_skiplist(const void *params); +void test_sohm(const void *params); +void test_unicode(const void *params); /* Prototypes for the cleanup routines */ -void cleanup_metadata(void); -void cleanup_checksum(void); -void cleanup_file(void); -void cleanup_h5o(void); -void cleanup_h5s(void); -void cleanup_coords(void); -void cleanup_attr(void); -void cleanup_select(void); -void cleanup_time(void); -void cleanup_reference(void); -void cleanup_reference_deprec(void); -void cleanup_vltypes(void); -void cleanup_vlstrings(void); -void cleanup_iterate(void); -void cleanup_array(void); -void cleanup_genprop(void); -void cleanup_configure(void); -void cleanup_h5_system(void); -void cleanup_sohm(void); -void cleanup_misc(void); -void cleanup_unicode(void); +void cleanup_metadata(void *params); +void cleanup_checksum(void *params); +void cleanup_file(void *params); +void cleanup_h5o(void *params); +void cleanup_h5s(void *params); +void cleanup_coords(void *params); +void cleanup_attr(void *params); +void cleanup_select(void *params); +void cleanup_time(void *params); +void cleanup_reference(void *params); +void cleanup_reference_deprec(void *params); +void cleanup_vltypes(void *params); +void cleanup_vlstrings(void *params); +void cleanup_iterate(void *params); +void cleanup_array(void *params); +void cleanup_genprop(void *params); +void cleanup_configure(void *params); +void cleanup_h5_system(void *params); +void cleanup_sohm(void *params); +void cleanup_misc(void *params); +void cleanup_unicode(void *params); #ifdef __cplusplus } diff --git a/test/tfile.c b/test/tfile.c index 721b8d2b656..cd3f2936a19 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4885,7 +4885,11 @@ test_sects_freespace(const char *driver_name, bool new_format) CHECK(nall, FAIL, "H5Fget_free_sections"); /* Should return failure when nsects is 0 with a nonnull sect_info */ - nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, all_sect_info); + H5E_BEGIN_TRY + { + nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, all_sect_info); + } + H5E_END_TRY VERIFY(nsects, FAIL, "H5Fget_free_sections"); /* Retrieve and verify free space info for all the sections */ @@ -5108,7 +5112,11 @@ test_filespace_compatible(void) CHECK(fid, FAIL, "H5Fopen"); /* The dataset should not be there */ - did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT); + H5E_BEGIN_TRY + { + did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(did, FAIL, "H5Dopen"); /* There should not be any free space in the file */ @@ -8388,7 +8396,7 @@ test_deprec(const char *driver_name) ** ****************************************************************/ void -test_file(void) +test_file(const void H5_ATTR_UNUSED *params) { const char *driver_name; /* File Driver value from environment */ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ @@ -8488,20 +8496,22 @@ test_file(void) *------------------------------------------------------------------------- */ void -cleanup_file(void) +cleanup_file(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(SFILE1, H5P_DEFAULT); - H5Fdelete(FILE1, H5P_DEFAULT); - H5Fdelete(FILE2, H5P_DEFAULT); - H5Fdelete(FILE3, H5P_DEFAULT); - H5Fdelete(FILE4, H5P_DEFAULT); - H5Fdelete(FILE5, H5P_DEFAULT); - H5Fdelete(FILE6, H5P_DEFAULT); - H5Fdelete(FILE7, H5P_DEFAULT); - H5Fdelete(FILE8, H5P_DEFAULT); - H5Fdelete(DST_FILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(SFILE1, H5P_DEFAULT); + H5Fdelete(FILE1, H5P_DEFAULT); + H5Fdelete(FILE2, H5P_DEFAULT); + H5Fdelete(FILE3, H5P_DEFAULT); + H5Fdelete(FILE4, H5P_DEFAULT); + H5Fdelete(FILE5, H5P_DEFAULT); + H5Fdelete(FILE6, H5P_DEFAULT); + H5Fdelete(FILE7, H5P_DEFAULT); + H5Fdelete(FILE8, H5P_DEFAULT); + H5Fdelete(DST_FILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tgenprop.c b/test/tgenprop.c index 4f4f60e79ab..b4267b66a87 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -2145,7 +2145,7 @@ test_genprop_deprec_list(void) ** ****************************************************************/ void -test_genprop(void) +test_genprop(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Generic Properties\n")); @@ -2188,11 +2188,13 @@ test_genprop(void) *------------------------------------------------------------------------- */ void -cleanup_genprop(void) +cleanup_genprop(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/th5_system.c b/test/th5_system.c index eb6787f9fb8..f55642b8941 100644 --- a/test/th5_system.c +++ b/test/th5_system.c @@ -551,7 +551,7 @@ test_h5_strndup(void) } void -test_h5_system(void) +test_h5_system(const void H5_ATTR_UNUSED *params) { MESSAGE(5, ("Testing H5system routines\n")); @@ -563,7 +563,7 @@ test_h5_system(void) } void -cleanup_h5_system(void) +cleanup_h5_system(void H5_ATTR_UNUSED *params) { /* Nothing to cleanup yet */ } diff --git a/test/th5o.c b/test/th5o.c index 815b5648e4d..f4eddfc4f5c 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1887,7 +1887,7 @@ test_h5o_getinfo_visit(void) ** ****************************************************************/ void -test_h5o(void) +test_h5o(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); @@ -1920,14 +1920,16 @@ test_h5o(void) *------------------------------------------------------------------------- */ void -cleanup_h5o(void) +cleanup_h5o(void H5_ATTR_UNUSED *params) { - char filename[1024]; - - H5E_BEGIN_TRY - { - h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); - H5Fdelete(filename, H5P_DEFAULT); + if (GetTestCleanup()) { + char filename[1024]; + + H5E_BEGIN_TRY + { + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/th5s.c b/test/th5s.c index 4c46c400116..e3505f2d0fa 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -212,7 +212,11 @@ test_h5s_basic(void) fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); if (fid1 >= 0) { - dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + H5E_BEGIN_TRY + { + dset1 = H5Dopen2(fid1, "dset", H5P_DEFAULT); + } + H5E_END_TRY; VERIFY(dset1, FAIL, "H5Dopen2"); ret = H5Fclose(fid1); CHECK_I(ret, "H5Fclose"); @@ -3476,7 +3480,7 @@ test_versionbounds(void) ** ****************************************************************/ void -test_h5s(void) +test_h5s(const void H5_ATTR_UNUSED *params) { H5F_libver_t low, high; /* Low and high bounds */ @@ -3534,15 +3538,17 @@ test_h5s(void) *------------------------------------------------------------------------- */ void -cleanup_h5s(void) +cleanup_h5s(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); - H5Fdelete(NULLFILE, H5P_DEFAULT); - H5Fdelete(BASICFILE, H5P_DEFAULT); - H5Fdelete(ZEROFILE, H5P_DEFAULT); - H5Fdelete(VERBFNAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(NULLFILE, H5P_DEFAULT); + H5Fdelete(BASICFILE, H5P_DEFAULT); + H5Fdelete(ZEROFILE, H5P_DEFAULT); + H5Fdelete(VERBFNAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tid.c b/test/tid.c index 0a2f658e4c2..4b9e4d0d351 100644 --- a/test/tid.c +++ b/test/tid.c @@ -1495,7 +1495,7 @@ test_appropriate_ids(void) } void -test_ids(void) +test_ids(const void H5_ATTR_UNUSED *params) { /* Set the random # seed */ HDsrandom((unsigned)time(NULL)); diff --git a/test/titerate.c b/test/titerate.c index 3c0b82e68f2..6128508d1b1 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -322,7 +322,12 @@ test_iter_group(hid_t fapl, bool new_format) i = 0; idx = 0; memset(info.name, 0, NAMELEN); - while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) { + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } + H5E_END_TRY + while (ret > 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 2, "H5Literate2"); @@ -341,7 +346,13 @@ test_iter_group(hid_t fapl, bool new_format) TestErrPrintf( "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); - } /* end while */ + + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } + H5E_END_TRY + } VERIFY(ret, -1, "H5Literate2"); if (i != (NDATASETS + 2)) @@ -354,7 +365,12 @@ test_iter_group(hid_t fapl, bool new_format) i = 0; idx = 0; memset(info.name, 0, NAMELEN); - while ((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) { + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } + H5E_END_TRY + while (ret >= 0) { /* Verify return value from iterator gets propagated correctly */ VERIFY(ret, 1, "H5Literate2"); @@ -373,6 +389,12 @@ test_iter_group(hid_t fapl, bool new_format) TestErrPrintf( "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); + + H5E_BEGIN_TRY + { + ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info); + } + H5E_END_TRY } /* end while */ VERIFY(ret, -1, "H5Literate2"); @@ -1221,7 +1243,7 @@ test_links_deprec(hid_t fapl) ** ****************************************************************/ void -test_iterate(void) +test_iterate(const void H5_ATTR_UNUSED *params) { hid_t fapl, fapl2; /* File access property lists */ unsigned new_format; /* Whether to use the new format or not */ @@ -1274,11 +1296,13 @@ test_iterate(void) *------------------------------------------------------------------------- */ void -cleanup_iterate(void) +cleanup_iterate(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tmeta.c b/test/tmeta.c index 68f77c83dae..3c0523db55f 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -53,7 +53,7 @@ static uint8_t encode_buffer[sizeof(compar_buffer)]; ** ****************************************************************/ void -test_metadata(void) +test_metadata(const void H5_ATTR_UNUSED *params) { int16_t ei16 = TEST_INT16_VALUE; /* variables to hold the values to encode */ uint16_t eu16 = TEST_UINT16_VALUE; @@ -121,7 +121,7 @@ test_metadata(void) *------------------------------------------------------------------------- */ void -cleanup_metadata(void) +cleanup_metadata(void H5_ATTR_UNUSED *params) { /* no file to clean */ } diff --git a/test/tmisc.c b/test/tmisc.c index 63bf5d8edcb..9c4c3764dc9 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1196,11 +1196,19 @@ test_misc7(void) CHECK(tid, FAIL, "H5Tcreate"); /* Attempt to commit an empty compound datatype */ - ret = H5Tcommit2(fid, MISC7_TYPENAME1, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Tcommit2(fid, MISC7_TYPENAME1, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Tcommit2"); /* Attempt to use empty compound datatype to create dataset */ - did = H5Dcreate2(fid, MISC7_DSETNAME1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, MISC7_DSETNAME1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Dcreate2"); /* Add a field to the compound datatype */ @@ -1228,11 +1236,19 @@ test_misc7(void) CHECK(tid, FAIL, "H5Tenum_create"); /* Attempt to commit an empty enum datatype */ - ret = H5Tcommit2(fid, MISC7_TYPENAME2, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + ret = H5Tcommit2(fid, MISC7_TYPENAME2, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Tcommit2"); /* Attempt to use empty enum datatype to create dataset */ - did = H5Dcreate2(fid, MISC7_DSETNAME2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + did = H5Dcreate2(fid, MISC7_DSETNAME2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(did, FAIL, "H5Dcreate2"); /* Add a member to the enum datatype */ @@ -3821,7 +3837,11 @@ test_misc20(void) CHECK(dcpl, FAIL, "H5Pcreate"); /* Try to use chunked storage for this dataset */ - ret = H5Pset_chunk(dcpl, rank, big_dims); + H5E_BEGIN_TRY + { + ret = H5Pset_chunk(dcpl, rank, big_dims); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Pset_chunk"); /* Verify that the storage for the dataset is the correct size and hasn't @@ -7105,7 +7125,7 @@ test_misc41(void) ** ****************************************************************/ void -test_misc(void) +test_misc(const void H5_ATTR_UNUSED *params) { bool default_driver = h5_using_default_driver(NULL); @@ -7188,52 +7208,54 @@ test_misc(void) *------------------------------------------------------------------------- */ void -cleanup_misc(void) +cleanup_misc(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(MISC1_FILE, H5P_DEFAULT); - H5Fdelete(MISC2_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC2_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC3_FILE, H5P_DEFAULT); - H5Fdelete(MISC4_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC4_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC5_FILE, H5P_DEFAULT); - H5Fdelete(MISC6_FILE, H5P_DEFAULT); - H5Fdelete(MISC7_FILE, H5P_DEFAULT); - H5Fdelete(MISC8_FILE, H5P_DEFAULT); - H5Fdelete(MISC9_FILE, H5P_DEFAULT); - H5Fdelete(MISC10_FILE_NEW, H5P_DEFAULT); - H5Fdelete(MISC11_FILE, H5P_DEFAULT); - H5Fdelete(MISC12_FILE, H5P_DEFAULT); - H5Fdelete(MISC13_FILE_1, H5P_DEFAULT); - H5Fdelete(MISC13_FILE_2, H5P_DEFAULT); - H5Fdelete(MISC14_FILE, H5P_DEFAULT); - H5Fdelete(MISC15_FILE, H5P_DEFAULT); - H5Fdelete(MISC16_FILE, H5P_DEFAULT); - H5Fdelete(MISC17_FILE, H5P_DEFAULT); - H5Fdelete(MISC18_FILE, H5P_DEFAULT); - H5Fdelete(MISC19_FILE, H5P_DEFAULT); - H5Fdelete(MISC20_FILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(MISC1_FILE, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC2_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC3_FILE, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC4_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC5_FILE, H5P_DEFAULT); + H5Fdelete(MISC6_FILE, H5P_DEFAULT); + H5Fdelete(MISC7_FILE, H5P_DEFAULT); + H5Fdelete(MISC8_FILE, H5P_DEFAULT); + H5Fdelete(MISC9_FILE, H5P_DEFAULT); + H5Fdelete(MISC10_FILE_NEW, H5P_DEFAULT); + H5Fdelete(MISC11_FILE, H5P_DEFAULT); + H5Fdelete(MISC12_FILE, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_1, H5P_DEFAULT); + H5Fdelete(MISC13_FILE_2, H5P_DEFAULT); + H5Fdelete(MISC14_FILE, H5P_DEFAULT); + H5Fdelete(MISC15_FILE, H5P_DEFAULT); + H5Fdelete(MISC16_FILE, H5P_DEFAULT); + H5Fdelete(MISC17_FILE, H5P_DEFAULT); + H5Fdelete(MISC18_FILE, H5P_DEFAULT); + H5Fdelete(MISC19_FILE, H5P_DEFAULT); + H5Fdelete(MISC20_FILE, H5P_DEFAULT); #ifdef H5_HAVE_FILTER_SZIP - H5Fdelete(MISC21_FILE, H5P_DEFAULT); - H5Fdelete(MISC22_FILE, H5P_DEFAULT); + H5Fdelete(MISC21_FILE, H5P_DEFAULT); + H5Fdelete(MISC22_FILE, H5P_DEFAULT); #endif /* H5_HAVE_FILTER_SZIP */ - H5Fdelete(MISC23_FILE, H5P_DEFAULT); - H5Fdelete(MISC24_FILE, H5P_DEFAULT); - H5Fdelete(MISC25A_FILE, H5P_DEFAULT); - H5Fdelete(MISC25C_FILE, H5P_DEFAULT); - H5Fdelete(MISC26_FILE, H5P_DEFAULT); - H5Fdelete(MISC28_FILE, H5P_DEFAULT); - H5Fdelete(MISC29_COPY_FILE, H5P_DEFAULT); - H5Fdelete(MISC30_FILE, H5P_DEFAULT); + H5Fdelete(MISC23_FILE, H5P_DEFAULT); + H5Fdelete(MISC24_FILE, H5P_DEFAULT); + H5Fdelete(MISC25A_FILE, H5P_DEFAULT); + H5Fdelete(MISC25C_FILE, H5P_DEFAULT); + H5Fdelete(MISC26_FILE, H5P_DEFAULT); + H5Fdelete(MISC28_FILE, H5P_DEFAULT); + H5Fdelete(MISC29_COPY_FILE, H5P_DEFAULT); + H5Fdelete(MISC30_FILE, H5P_DEFAULT); #ifndef H5_NO_DEPRECATED_SYMBOLS - H5Fdelete(MISC31_FILE, H5P_DEFAULT); + H5Fdelete(MISC31_FILE, H5P_DEFAULT); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - H5Fdelete(MISC38C_FILE, H5P_DEFAULT); - H5Fdelete(MISC39_FILE, H5P_DEFAULT); - H5Fdelete(MISC40_FILE, H5P_DEFAULT); - H5Fdelete(MISC41_FILE, H5P_DEFAULT); + H5Fdelete(MISC38C_FILE, H5P_DEFAULT); + H5Fdelete(MISC39_FILE, H5P_DEFAULT); + H5Fdelete(MISC40_FILE, H5P_DEFAULT); + H5Fdelete(MISC41_FILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } /* end cleanup_misc() */ diff --git a/test/trefer.c b/test/trefer.c index b1e4a3854b4..e2a09c0a21e 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -2254,7 +2254,11 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dread"); /* Open deleted dataset object */ - dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT); + H5E_BEGIN_TRY + { + dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT); + } + H5E_END_TRY VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object"); /* Close Dataset */ @@ -3830,7 +3834,7 @@ test_reference_perf(void) ** ****************************************************************/ void -test_reference(void) +test_reference(const void H5_ATTR_UNUSED *params) { H5F_libver_t low, high; /* Low and high bounds */ const char *driver_name; /* File Driver value from environment */ @@ -3884,22 +3888,24 @@ test_reference(void) *------------------------------------------------------------------------- */ void -cleanup_reference(void) +cleanup_reference(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILE_REF_PARAM, H5P_DEFAULT); - H5Fdelete(FILE_REF_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_VL_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_CMPND_OBJ, H5P_DEFAULT); - H5Fdelete(FILE_REF_REG, H5P_DEFAULT); - H5Fdelete(FILE_REF_REG_1D, H5P_DEFAULT); - H5Fdelete(FILE_REF_OBJ_DEL, H5P_DEFAULT); - H5Fdelete(FILE_REF_GRP, H5P_DEFAULT); - H5Fdelete(FILE_REF_ATTR, H5P_DEFAULT); - H5Fdelete(FILE_REF_EXT1, H5P_DEFAULT); - H5Fdelete(FILE_REF_EXT2, H5P_DEFAULT); - H5Fdelete(FILE_REF_COMPAT, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILE_REF_PARAM, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_VL_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_CMPND_OBJ, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG, H5P_DEFAULT); + H5Fdelete(FILE_REF_REG_1D, H5P_DEFAULT); + H5Fdelete(FILE_REF_OBJ_DEL, H5P_DEFAULT); + H5Fdelete(FILE_REF_GRP, H5P_DEFAULT); + H5Fdelete(FILE_REF_ATTR, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT1, H5P_DEFAULT); + H5Fdelete(FILE_REF_EXT2, H5P_DEFAULT); + H5Fdelete(FILE_REF_COMPAT, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index bbcf630fbc3..3035cbb2045 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -166,53 +166,134 @@ test_reference_params(void) CHECK(ret, FAIL, "H5Dcreate2"); /* Test parameters to H5Rcreate */ - ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate ref"); - ret = H5Rcreate(&wbuf[0], (hid_t)H5I_INVALID_HID, "/Group1/Dataset1", H5R_OBJECT, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], (hid_t)H5I_INVALID_HID, "/Group1/Dataset1", H5R_OBJECT, + (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate loc_id"); - ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate name"); - ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate null name"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate type"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)H5I_INVALID_HID); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)H5I_INVALID_HID); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate region space"); - ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0); + H5E_BEGIN_TRY + { + ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rcreate space"); /* Test parameters to H5Rdereference */ - dset2 = H5Rdereference2((hid_t)H5I_INVALID_HID, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2((hid_t)H5I_INVALID_HID, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2 loc_id"); - dset2 = H5Rdereference2(dataset, (hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0]); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, (hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0]); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id"); - dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2 ref"); - dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2 type"); /* Test parameters to H5Rget_obj_type2 */ - ret = H5Rget_obj_type2((hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0], NULL); + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type2((hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0], NULL); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id"); - ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL); + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rget_obj_type2 ref"); - ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL); + H5E_BEGIN_TRY + { + ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL); + } + H5E_END_TRY VERIFY(ret, FAIL, "H5Rget_obj_type2 type"); /* Test parameters to H5Rget_name */ - name_size = H5Rget_name((hid_t)H5I_INVALID_HID, H5R_DATASET_REGION, &rbuf[0], NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_name((hid_t)H5I_INVALID_HID, H5R_DATASET_REGION, &rbuf[0], NULL, 0); + } + H5E_END_TRY VERIFY(name_size, FAIL, "H5Rget_name loc_id"); - name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0); + } + H5E_END_TRY VERIFY(name_size, FAIL, "H5Rget_name ref"); - name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0); + H5E_BEGIN_TRY + { + name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0); + } + H5E_END_TRY VERIFY(name_size, FAIL, "H5Rget_name type"); /* Test parameters to H5Rget_region */ - ret_id = H5Rget_region((hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0]); + H5E_BEGIN_TRY + { + ret_id = H5Rget_region((hid_t)H5I_INVALID_HID, H5R_OBJECT, &rbuf[0]); + } + H5E_END_TRY VERIFY(ret_id, FAIL, "H5Rget_region loc_id"); - ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL); + H5E_BEGIN_TRY + { + ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL); + } + H5E_END_TRY VERIFY(ret_id, FAIL, "H5Rget_region ref"); - ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + H5E_BEGIN_TRY + { + ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]); + } + H5E_END_TRY VERIFY(ret_id, FAIL, "H5Rget_region type"); /* Close disk dataspace */ @@ -773,7 +854,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) /* Try to read an unaddressed dataset */ memset(&undef_reg, 0, sizeof(undef_reg)); - dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef"); /* Try to open objects */ @@ -1314,7 +1399,11 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dopen2"); /* Open undefined reference */ - dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &addr); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &addr); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2"); /* Read selection from disk */ @@ -1323,12 +1412,20 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dread"); /* Open deleted dataset object */ - dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2"); /* Open nonsense reference */ memset(&oref, 0, sizeof(hobj_ref_t)); - dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref); + H5E_BEGIN_TRY + { + dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref); + } + H5E_END_TRY VERIFY(dset2, FAIL, "H5Rdereference2"); /* Close Dataset */ @@ -1771,10 +1868,18 @@ test_reference_compat(void) CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1"); VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1"); - obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[2]); + H5E_BEGIN_TRY + { + obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[2]); + } + H5E_END_TRY VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1"); - obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]); + H5E_BEGIN_TRY + { + obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]); + } + H5E_END_TRY VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1"); /* Make sure the referenced objects can be opened */ @@ -1812,7 +1917,7 @@ test_reference_compat(void) ** ****************************************************************/ void -test_reference_deprec(void) +test_reference_deprec(const void H5_ATTR_UNUSED *params) { H5F_libver_t low, high; /* Low and high bounds */ bool vol_is_native; @@ -1862,9 +1967,11 @@ test_reference_deprec(void) *------------------------------------------------------------------------- */ void -cleanup_reference_deprec(void) +cleanup_reference_deprec(void H5_ATTR_UNUSED *params) { - HDremove(FILE1); - HDremove(FILE2); - HDremove(FILE3); + if (GetTestCleanup()) { + HDremove(FILE1); + HDremove(FILE2); + HDremove(FILE3); + } } diff --git a/test/trefstr.c b/test/trefstr.c index cd7ddcb44e3..3cd49c33e98 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -512,7 +512,7 @@ test_refstr_finalize(void) ** ****************************************************************/ void -test_refstr(void) +test_refstr(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Reference Counted Strings\n")); diff --git a/test/tselect.c b/test/tselect.c index b545eec0324..9658af99f5a 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -16065,7 +16065,7 @@ test_h5s_set_extent_none(void) ** ****************************************************************/ void -test_select(void) +test_select(const void H5_ATTR_UNUSED *params) { hid_t plist_id; /* Property list for reading random hyperslabs */ hid_t fapl; /* Property list accessing the file */ @@ -16277,11 +16277,13 @@ test_select(void) *------------------------------------------------------------------------- */ void -cleanup_select(void) +cleanup_select(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tskiplist.c b/test/tskiplist.c index 4c76321047f..6ac23fc715b 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -1557,7 +1557,7 @@ test_skiplist_term(void) ** ****************************************************************/ void -test_skiplist(void) +test_skiplist(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Skip Lists\n")); diff --git a/test/tsohm.c b/test/tsohm.c index cc639a6a2b2..82581c2fd77 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -615,7 +615,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, bool test_file_clo /* Closing and re-opening the file takes a long time on systems without * local disks. Don't close and reopen if express testing is enabled. */ - if (TestExpress > 1) + if (h5_get_testexpress() > 1) test_file_closing = false; /* Initialize wdata */ @@ -1553,7 +1553,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size /* Closing and re-opening the file takes a long time on systems without * local disks. Don't close and reopen if express testing is enabled. */ - if (TestExpress > 1) + if (h5_get_testexpress() > 1) test_file_closing = 0; /* Create a file and get its size */ @@ -3708,7 +3708,7 @@ test_sohm_external_dtype(void) ** ****************************************************************/ void -test_sohm(void) +test_sohm(const void H5_ATTR_UNUSED *params) { const char *driver_name; bool vol_is_native; @@ -3767,9 +3767,11 @@ test_sohm(void) *------------------------------------------------------------------------- */ void -cleanup_sohm(void) +cleanup_sohm(void H5_ATTR_UNUSED *params) { - HDremove(FILENAME); - HDremove(FILENAME_SRC); - HDremove(FILENAME_DST); + if (GetTestCleanup()) { + HDremove(FILENAME); + HDremove(FILENAME_SRC); + HDremove(FILENAME_DST); + } } /* cleanup_sohm */ diff --git a/test/ttime.c b/test/ttime.c index 08e9f967ab7..3d9ab879565 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -198,7 +198,7 @@ test_time_io(void) ** ****************************************************************/ void -test_time(void) +test_time(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Time Datatypes\n")); @@ -220,11 +220,13 @@ test_time(void) *------------------------------------------------------------------------- */ void -cleanup_time(void) +cleanup_time(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/ttsafe.c b/test/ttsafe.c index 6fe14fcc390..793b9c00bba 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -51,7 +51,7 @@ num_digits(int num) /* Test the H5is_library_threadsafe() function */ void -tts_is_threadsafe(void) +tts_is_threadsafe(const void H5_ATTR_UNUSED *params) { bool is_ts; bool should_be; @@ -97,19 +97,22 @@ main(int argc, char *argv[]) { /* Initialize testing framework */ - TestInit(argv[0], NULL, NULL); + if (TestInit(argv[0], NULL, NULL, 0) < 0) { + fprintf(stderr, "couldn't initialize testing framework\n"); + return -1; + } /* Tests are generally arranged from least to most complexity... */ - AddTest("is_threadsafe", tts_is_threadsafe, NULL, "library threadsafe status", NULL); -#ifdef H5_HAVE_THREADSAFE - AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); - AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); + AddTest("is_threadsafe", tts_is_threadsafe, NULL, NULL, NULL, 0, "library threadsafe status"); +#ifdef H5_HAVE_THREADS + AddTest("dcreate", tts_dcreate, NULL, cleanup_dcreate, NULL, 0, "multi-dataset creation"); + AddTest("error", tts_error, NULL, cleanup_error, NULL, 0, "per-thread error stacks"); #ifdef H5_HAVE_PTHREAD_H /* Thread cancellability only supported with pthreads ... */ - AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL); + AddTest("cancel", tts_cancel, NULL, cleanup_cancel, NULL, 0, "thread cancellation safety test"); #endif /* H5_HAVE_PTHREAD_H */ - AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); - AddTest("attr_vlen", tts_attr_vlen, cleanup_attr_vlen, "multi-file-attribute-vlen read", NULL); + AddTest("acreate", tts_acreate, NULL, cleanup_acreate, NULL, 0, "multi-attribute creation"); + AddTest("attr_vlen", tts_attr_vlen, NULL, cleanup_attr_vlen, NULL, 0, "multi-file-attribute-vlen read"); #else /* H5_HAVE_THREADSAFE */ @@ -118,17 +121,21 @@ main(int argc, char *argv[]) #endif /* H5_HAVE_THREADSAFE */ /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); /* Parse command line arguments */ - TestParseCmdLine(argc, argv); + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + return -1; + } /* Perform requested testing */ PerformTests(); /* Display test summary, if requested */ if (GetTestSummary()) - TestSummary(); + TestSummary(stdout); /* Clean up test files, if allowed */ if (GetTestCleanup() && !getenv(HDF5_NOCLEANUP)) diff --git a/test/ttsafe.h b/test/ttsafe.h index ce92c0173de..4fec1c86436 100644 --- a/test/ttsafe.h +++ b/test/ttsafe.h @@ -27,20 +27,20 @@ extern char *gen_name(int); /* Prototypes for the test routines */ -void tts_is_threadsafe(void); +void tts_is_threadsafe(const void *); #ifdef H5_HAVE_THREADSAFE -void tts_dcreate(void); -void tts_error(void); -void tts_cancel(void); -void tts_acreate(void); -void tts_attr_vlen(void); +void tts_dcreate(const void *); +void tts_error(const void *); +void tts_cancel(const void *); +void tts_acreate(const void *); +void tts_attr_vlen(const void *); /* Prototypes for the cleanup routines */ -void cleanup_dcreate(void); -void cleanup_error(void); -void cleanup_cancel(void); -void cleanup_acreate(void); -void cleanup_attr_vlen(void); +void cleanup_dcreate(void *); +void cleanup_error(void *); +void cleanup_cancel(void *); +void cleanup_acreate(void *); +void cleanup_attr_vlen(void *); #endif /* H5_HAVE_THREADSAFE */ #endif /* TTSAFE_H */ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 84e5c6ba9de..4e311e32ff3 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -45,7 +45,7 @@ typedef struct acreate_data_struct { } ttsafe_name_data_t; void -tts_acreate(void) +tts_acreate(const void H5_ATTR_UNUSED *params) { /* Thread declarations */ H5TS_thread_t threads[NUM_THREADS]; @@ -165,9 +165,11 @@ tts_acreate_thread(void *client_data) } /* end tts_acreate_thread() */ void -cleanup_acreate(void) +cleanup_acreate(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c index bfc2067e19c..ac4aa393492 100644 --- a/test/ttsafe_attr_vlen.c +++ b/test/ttsafe_attr_vlen.c @@ -51,7 +51,7 @@ void *tts_attr_vlen_thread(void *); void -tts_attr_vlen(void) +tts_attr_vlen(const void H5_ATTR_UNUSED *params) { H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */ hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -167,9 +167,11 @@ tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data) } /* end tts_attr_vlen_thread() */ void -cleanup_attr_vlen(void) +cleanup_attr_vlen(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 755df305edc..1809be4205d 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -52,7 +52,7 @@ pthread_mutex_t mutex; pthread_cond_t cond; void -tts_cancel(void) +tts_cancel(const void H5_ATTR_UNUSED *params) { pthread_attr_t attribute; hid_t dataset; @@ -241,9 +241,11 @@ tts_cancel_barrier(void) } /* end tts_cancel_barrier() */ void -cleanup_cancel(void) +cleanup_cancel(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_WIN_THREADS*/ diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index 42c3f6c1276..fb02484f978 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -54,7 +54,7 @@ thread_info thread_out[NUM_THREAD]; ********************************************************************** */ void -tts_dcreate(void) +tts_dcreate(const void H5_ATTR_UNUSED *params) { /* thread definitions */ H5TS_thread_t threads[NUM_THREAD]; @@ -162,8 +162,10 @@ tts_dcreate_creator(void *_thread_data) } /* end tts_dcreate_creator() */ void -cleanup_dcreate(void) +cleanup_dcreate(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 560a7e1b2f7..57493891571 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -56,7 +56,7 @@ static herr_t walk_error_callback(unsigned, const H5E_error2_t *, void *); static void *tts_error_thread(void *); void -tts_error(void) +tts_error(const void H5_ATTR_UNUSED *params) { hid_t def_fapl = H5I_INVALID_HID; hid_t vol_id = H5I_INVALID_HID; @@ -257,9 +257,11 @@ walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void H5_ATTR_UNUSE } void -cleanup_error(void) +cleanup_error(void H5_ATTR_UNUSED *params) { - HDunlink(FILENAME); + if (GetTestCleanup()) { + HDunlink(FILENAME); + } } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/tunicode.c b/test/tunicode.c index d3baf801692..70587e3d6ff 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -802,7 +802,7 @@ dump_string(const char *string) * that string. */ void -test_unicode(void) +test_unicode(const void H5_ATTR_UNUSED *params) { char test_string[MAX_STRING_LENGTH]; unsigned int cur_pos = 0; /* Current position in test_string */ @@ -864,11 +864,13 @@ test_unicode(void) * Delete the file this test created. */ void -cleanup_unicode(void) +cleanup_unicode(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tvlstr.c b/test/tvlstr.c index 9f41a0570b3..51004de8d08 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -968,7 +968,7 @@ test_write_same_element(void) ** ****************************************************************/ void -test_vlstrings(void) +test_vlstrings(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Variable-Length Strings\n")); @@ -1000,13 +1000,15 @@ test_vlstrings(void) *------------------------------------------------------------------------- */ void -cleanup_vlstrings(void) +cleanup_vlstrings(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(DATAFILE, H5P_DEFAULT); - H5Fdelete(DATAFILE2, H5P_DEFAULT); - H5Fdelete(DATAFILE3, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(DATAFILE, H5P_DEFAULT); + H5Fdelete(DATAFILE2, H5P_DEFAULT); + H5Fdelete(DATAFILE3, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/test/tvltypes.c b/test/tvltypes.c index 1ca7de3bd83..ac3e13fdc53 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -3233,7 +3233,7 @@ test_vltypes_fill_value(void) ** ****************************************************************/ void -test_vltypes(void) +test_vltypes(const void H5_ATTR_UNUSED *params) { /* Output message about test being performed */ MESSAGE(5, ("Testing Variable-Length Datatypes\n")); @@ -3266,11 +3266,13 @@ test_vltypes(void) *------------------------------------------------------------------------- */ void -cleanup_vltypes(void) +cleanup_vltypes(void H5_ATTR_UNUSED *params) { - H5E_BEGIN_TRY - { - H5Fdelete(FILENAME, H5P_DEFAULT); + if (GetTestCleanup()) { + H5E_BEGIN_TRY + { + H5Fdelete(FILENAME, H5P_DEFAULT); + } + H5E_END_TRY } - H5E_END_TRY } diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 106f79eba1e..35b862e1414 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -1,6 +1,17 @@ cmake_minimum_required (VERSION 3.18) project (HDF5_TEST_PAR C) +################################################################################# +# Define Parallel Test Library Sources +################################################################################# +set (TEST_PAR_LIB_SOURCES + ${HDF5_TEST_PAR_SOURCE_DIR}/testpar.c +) + +set (TEST_PAR_LIB_HEADERS + ${HDF5_TEST_PAR_SOURCE_DIR}/testpar.h +) + #----------------------------------------------------------------------------- # Define Tests #----------------------------------------------------------------------------- @@ -30,6 +41,101 @@ set (HDF5_TESTPAR_COMPILE_DEFS_PRIVATE "$<$:H5_HAVE_TEST_API>" ) +################################################################################# +# Setup build for parallel test library +################################################################################# +if (BUILD_STATIC_LIBS) + add_library (${HDF5_TEST_PAR_LIB_TARGET} STATIC ${TEST_PAR_LIB_SOURCES} ${TEST_PAR_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_PAR_LIB_TARGET} + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_PAR_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_options(${HDF5_TEST_PAR_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_PAR_LIB_TARGET} + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "${HDF5_TEST_COMPILE_DEFS_PRIVATE}" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_PAR_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TEST_PAR_LIB_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} + PRIVATE "$<$,$>:ws2_32.lib>" + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_PAR_LIB_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_TEST_PAR_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TEST_PAR_LIB_TARGET} PROPERTIES FOLDER libraries/test/par) + + if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) + INSTALL_TARGET_PDB (${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} libraries) + + install ( + TARGETS ${HDF5_TEST_PAR_LIB_TARGET} + EXPORT ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + INCLUDES DESTINATION include + ) + endif () +endif () + +if (BUILD_SHARED_LIBS) + add_library (${HDF5_TEST_PAR_LIBSH_TARGET} SHARED ${TEST_PAR_LIB_SOURCES} ${TEST_PAR_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_PAR_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_TEST_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_PAR_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_options(${HDF5_TEST_PAR_LIBSH_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + target_compile_definitions(${HDF5_TEST_PAR_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + "H5_TEST_EXPRESS_LEVEL_DEFAULT=${H5_TEST_EXPRESS_LEVEL_DEFAULT}" + "${HDF5_TEST_COMPILE_DEFS_PRIVATE}" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_PAR_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_TEST_PAR_LIBSH_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} + PRIVATE "$<$,$>:ws2_32.lib>" + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_PAR_LIBSH_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_TEST_PAR_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_TEST_PAR_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/par) + + if (HDF5_EXPORTED_TARGETS AND HDF5_TEST_API_INSTALL) + INSTALL_TARGET_PDB (${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + + install ( + TARGETS ${HDF5_TEST_PAR_LIBSH_TARGET} + EXPORT ${HDF5_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + INCLUDES DESTINATION include + ) + endif () +endif () + +#----------------------------------------------------------------------------- +# Add Target to clang-format +#----------------------------------------------------------------------------- +if (HDF5_ENABLE_FORMATTERS) + if (BUILD_STATIC_LIBS) + clang_format (HDF5_TEST_PAR_SRC_FORMAT ${HDF5_TEST_PAR_LIB_TARGET}) + else () + clang_format (HDF5_TEST_PAR_SRC_FORMAT ${HDF5_TEST_PAR_LIBSH_TARGET}) + endif () +endif () + +################################################################################# +# Tests +################################################################################# + #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) target_compile_options(testphdf5 PRIVATE "${HDF5_CMAKE_C_FLAGS}") @@ -40,12 +146,12 @@ target_include_directories (testphdf5 if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testphdf5 STATIC) target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" ) else () TARGET_C_PROPERTIES (testphdf5 SHARED) target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" ) endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) @@ -67,13 +173,15 @@ macro (ADD_H5P_EXE file) if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_PAR_LIB_TARGET} ${HDF5_LIB_TARGET} + "$<$:MPI::MPI_C>" "$<$,$>:ws2_32.lib>" ) else () TARGET_C_PROPERTIES (${file} SHARED) target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:MPI::MPI_C>" + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_PAR_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + "$<$:MPI::MPI_C>" "$<$,$>:ws2_32.lib>" ) endif () diff --git a/testpar/Makefile.am b/testpar/Makefile.am index 4a8cb826f49..27002fa3de3 100644 --- a/testpar/Makefile.am +++ b/testpar/Makefile.am @@ -42,12 +42,17 @@ endif # t_pflush1 and t_pflush2 are used by testpflush.sh check_PROGRAMS = $(TEST_PROG_PARA) t_pflush1 t_pflush2 +# The libh5testpar library provides common support code for the tests. +noinst_LTLIBRARIES=libh5testpar.la + +libh5testpar_la_SOURCES=testpar.c + testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \ t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \ t_prop.c t_coll_md.c t_oflush.c -# The tests all depend on the hdf5 library and the test library -LDADD = $(LIBH5TEST) $(LIBHDF5) +# The tests all depend on the hdf5 library and the test libraries +LDADD = $(LIBH5TEST) libh5testpar.la $(LIBHDF5) # Temporary files # MPItest.h5 is from t_mpi diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 8674e35369e..fca14d72a70 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -27,7 +27,10 @@ #include #include "hdf5.h" -#include "testphdf5.h" +#include "testpar.h" + +/* Include testing framework functionality */ +#include "testframe.h" #include "mpi.h" @@ -54,10 +57,21 @@ #define BIG_Z_FACTOR 2048 #endif +#define DATASETNAME1 "Data1" +#define DATASETNAME2 "Data2" +#define DATASETNAME3 "Data3" +#define DATASETNAME4 "Data4" +#define DATASETNAME7 "Data7" +#define DATASETNAME8 "Data8" +#define DATASETNAME9 "Data9" + #ifndef PATH_MAX #define PATH_MAX 512 #endif /* !PATH_MAX */ +/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; + /* global variables */ int dim0; int dim1; @@ -81,6 +95,11 @@ char *filenames[NFILENAME]; hid_t fapl; /* file access property list */ MPI_Comm test_comm = MPI_COMM_WORLD; +/* Structure for passing test parameters around */ +typedef struct test_params_t { + char *filename; +} test_params_t; + // static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ // static const char *TestProgName = NULL; // static void (*TestPrivateUsage)(void) = NULL; @@ -94,20 +113,20 @@ MPI_Comm test_comm = MPI_COMM_WORLD; * Show command usage */ static void -usage(void) +usage(FILE *stream) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", BIG_X_FACTOR, - BIG_Y_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + fprintf(stream, " [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + fprintf(stream, "\t-m" + "\tset number of datasets for the multiple dataset test\n"); + fprintf(stream, "\t-n" + "\tset number of groups for the multiple group test\n"); + fprintf(stream, "\t-f \tfilename prefix\n"); + fprintf(stream, "\t-2\t\tuse Split-file together with MPIO\n"); + fprintf(stream, "\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", BIG_X_FACTOR, + BIG_Y_FACTOR); + fprintf(stream, "\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + fprintf(stream, "\n"); } /* @@ -239,59 +258,6 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(test_comm, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /* * Setup the dimensions of the hyperslab. * Two modes--by rows or by columns. @@ -383,54 +349,6 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t s } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - // HDcompile_assert(MAX_RANK == 3); - HDcompile_assert(MAX_RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * MAX_RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " - "datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Fill the dataset with trivial data for testing. * Assume dimension rank is 2 and data is stored contiguous. @@ -479,7 +397,7 @@ dataset_print(hsize_t start[], hsize_t block[], DATATYPE *dataset) /* * Print the content of the dataset. */ -int +static int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { @@ -700,8 +618,8 @@ MpioTest2G(MPI_Comm comm) * dataset. */ -void -dataset_writeInd(void) +static void +dataset_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -727,7 +645,7 @@ dataset_writeInd(void) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -845,8 +763,8 @@ dataset_writeInd(void) } /* Example of using the parallel HDF5 library to read a dataset */ -void -dataset_readInd(void) +static void +dataset_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -867,7 +785,7 @@ dataset_readInd(void) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -967,8 +885,8 @@ dataset_readInd(void) * each process controls a hyperslab within.] */ -void -dataset_writeAll(void) +static void +dataset_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1000,7 +918,7 @@ dataset_writeAll(void) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -1348,6 +1266,22 @@ dataset_writeAll(void) /* Dataset5: point selection in File - Hyperslab selection in Memory*/ /* create a file dataspace independently */ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += MAX_RANK; + } + } + file_dataspace = H5Dget_space(dataset5); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1384,6 +1318,22 @@ dataset_writeAll(void) start[0] = (hsize_t)dim0 / (hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += MAX_RANK; + } + } + file_dataspace = H5Dget_space(dataset6); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1392,6 +1342,22 @@ dataset_writeAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += MAX_RANK; + } + } + mem_dataspace = H5Dget_space(dataset6); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1421,6 +1387,22 @@ dataset_writeAll(void) start[0] = (hsize_t)dim0 / (hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += MAX_RANK; + } + } + file_dataspace = H5Dget_space(dataset7); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1489,8 +1471,8 @@ dataset_writeAll(void) * each process controls a hyperslab within.] */ -void -dataset_readAll(void) +static void +dataset_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1516,7 +1498,7 @@ dataset_readAll(void) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1740,6 +1722,22 @@ dataset_readAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += MAX_RANK; + } + } + mem_dataspace = H5Dget_space(dataset5); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1778,6 +1776,22 @@ dataset_readAll(void) start[0] = (hsize_t)dim0 / (hsize_t)mpi_size * (hsize_t)mpi_rank; start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += MAX_RANK; + } + } + file_dataspace = H5Dget_space(dataset6); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1786,6 +1800,22 @@ dataset_readAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += MAX_RANK; + } + } + mem_dataspace = H5Dget_space(dataset6); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1892,324 +1922,96 @@ dataset_readAll(void) } /* - * Part 2--Independent read/write for extendible datasets. - */ - -/* - * Example of using the parallel HDF5 library to create two extendible - * datasets in one HDF5 file with independent parallel MPIO access support. - * The Datasets are of sizes (number-of-mpi-processes x dim0) x dim1. - * Each process controls only a slab of size dim0 x dim1 within each - * dataset. + * Example of using the parallel HDF5 library to create an extendable dataset + * and perform I/O on it in a way that verifies that the chunk cache is + * bypassed for parallel I/O. */ -void -extend_writeInd(void) +static void +extend_writeInd2(const void *params) { - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - hsize_t max_dims[MAX_RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[MAX_RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK]; /* for hyperslab setting */ - hsize_t stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; + hid_t fid; /* HDF5 file ID */ + hid_t fapl_id; /* File access templates */ + hid_t fs; /* File dataspace ID */ + hid_t ms; /* Memory dataspace ID */ + hid_t dataset; /* Dataset ID */ + hsize_t orig_size = 10; /* Original dataset dim size */ + hsize_t new_size = 20; /* Extended dataset dim size */ + hsize_t one = 1; + hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ + hsize_t chunk_size = 16384; /* chunk size */ + hid_t dcpl; /* dataset create prop. list */ + int written[10], /* Data to write */ + retrieved[10]; /* Data read in */ + int mpi_size, mpi_rank; /* MPI settings */ + int i; /* Local index variable */ + herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); + printf("Extend independent write test #2 on file %s\n", filename); /* set up MPI parameters */ MPI_Comm_size(test_comm, &mpi_size); MPI_Comm_rank(test_comm, &mpi_rank); - /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = (hsize_t)chunkdim0; - chunk_dims[1] = (hsize_t)chunkdim1; - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - /* ------------------- * START AN HDF5 FILE * -------------------*/ /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* Reduce the number of metadata cache slots, so that there are cache - * collisions during the raw data I/O on the chunked dataset. This stresses - * the metadata cache and tests for cache bugs. -QAK - */ - { - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); - VRFY((ret >= 0), "H5Pget_cache succeeded"); - mdc_nelmts = 4; - ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); - VRFY((ret >= 0), "H5Pset_cache succeeded"); - } + fapl_id = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); + VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); + ret = H5Pclose(fapl_id); + VRFY((ret >= 0), "H5Pclose succeeded"); /* -------------------------------------------------------------- * Define the dimensions of the overall datasets and create them. * ------------------------------------------------------------- */ /* set up dataset storage chunk sizes and creation property list */ - if (VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); - dataset_pl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_chunk(dataset_pl, MAX_RANK, chunk_dims); + dcpl = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl >= 0), "H5Pcreate succeeded"); + ret = H5Pset_chunk(dcpl, 1, &chunk_size); VRFY((ret >= 0), "H5Pset_chunk succeeded"); /* setup dimensionality object */ - /* start out with no rows, extend it later. */ - dims[0] = dims[1] = 0; - sid = H5Screate_simple(MAX_RANK, dims, max_dims); - VRFY((sid >= 0), "H5Screate_simple succeeded"); + fs = H5Screate_simple(1, &orig_size, &max_size); + VRFY((fs >= 0), "H5Screate_simple succeeded"); /* create an extendible dataset collectively */ - dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); - - /* create another extendible dataset collectively */ - dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); + dataset = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, fs, H5P_DEFAULT, dcpl, H5P_DEFAULT); + VRFY((dataset >= 0), "H5Dcreat2e succeeded"); /* release resource */ - H5Sclose(sid); - H5Pclose(dataset_pl); + ret = H5Pclose(dcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); /* ------------------------- - * Test writing to dataset1 + * Test writing to dataset * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); + /* create a memory dataspace independently */ + ms = H5Screate_simple(1, &orig_size, &max_size); + VRFY((ms >= 0), "H5Screate_simple succeeded"); /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); + for (i = 0; i < (int)orig_size; i++) + written[i] = i; + MESG("data array initialized"); if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); + MESG("writing at offset zero: "); + for (i = 0; i < (int)orig_size; i++) + printf("%s%d", i ? ", " : "", written[i]); + printf("\n"); } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Extend its current dim sizes before writing */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - H5Sclose(file_dataspace); - H5Sclose(mem_dataspace); - - /* ------------------------- - * Test writing to dataset2 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret < 0), "H5Dwrite failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Extend dataset2 and try again. Should succeed. */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset2, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - ret = H5Sclose(file_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Sclose(mem_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), "H5Dclose1 succeeded"); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), "H5Dclose2 succeeded"); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); -} - -/* - * Example of using the parallel HDF5 library to create an extendable dataset - * and perform I/O on it in a way that verifies that the chunk cache is - * bypassed for parallel I/O. - */ - -void -extend_writeInd2(void) -{ - const char *filename; - hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access templates */ - hid_t fs; /* File dataspace ID */ - hid_t ms; /* Memory dataspace ID */ - hid_t dataset; /* Dataset ID */ - hsize_t orig_size = 10; /* Original dataset dim size */ - hsize_t new_size = 20; /* Extended dataset dim size */ - hsize_t one = 1; - hsize_t max_size = H5S_UNLIMITED; /* dataset maximum dim size */ - hsize_t chunk_size = 16384; /* chunk size */ - hid_t dcpl; /* dataset create prop. list */ - int written[10], /* Data to write */ - retrieved[10]; /* Data read in */ - int mpi_size, mpi_rank; /* MPI settings */ - int i; /* Local index variable */ - herr_t ret; /* Generic return value */ - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent write test #2 on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* ------------------- - * START AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - fapl_id = create_faccess_plist(test_comm, MPI_INFO_NULL, facc_type); - VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); - - /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Release file-access template */ - ret = H5Pclose(fapl_id); - VRFY((ret >= 0), "H5Pclose succeeded"); - - /* -------------------------------------------------------------- - * Define the dimensions of the overall datasets and create them. - * ------------------------------------------------------------- */ - - /* set up dataset storage chunk sizes and creation property list */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_chunk(dcpl, 1, &chunk_size); - VRFY((ret >= 0), "H5Pset_chunk succeeded"); - - /* setup dimensionality object */ - fs = H5Screate_simple(1, &orig_size, &max_size); - VRFY((fs >= 0), "H5Screate_simple succeeded"); - - /* create an extendible dataset collectively */ - dataset = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, fs, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreat2e succeeded"); - - /* release resource */ - ret = H5Pclose(dcpl); - VRFY((ret >= 0), "H5Pclose succeeded"); - - /* ------------------------- - * Test writing to dataset - * -------------------------*/ - /* create a memory dataspace independently */ - ms = H5Screate_simple(1, &orig_size, &max_size); - VRFY((ms >= 0), "H5Screate_simple succeeded"); - - /* put some trivial data in the data_array */ - for (i = 0; i < (int)orig_size; i++) - written[i] = i; - MESG("data array initialized"); - if (VERBOSE_MED) { - MESG("writing at offset zero: "); - for (i = 0; i < (int)orig_size; i++) - printf("%s%d", i ? ", " : "", written[i]); - printf("\n"); - } - ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written); - VRFY((ret >= 0), "H5Dwrite succeeded"); + ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written); + VRFY((ret >= 0), "H5Dwrite succeeded"); /* ------------------------- * Read initial data from dataset. @@ -2274,622 +2076,13 @@ extend_writeInd2(void) printf("\n"); } - /* Close dataset collectively */ - ret = H5Dclose(dataset); - VRFY((ret >= 0), "H5Dclose succeeded"); - - /* Close the file collectively */ - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); -} - -/* Example of using the parallel HDF5 library to read an extendible dataset */ -void -extend_readInd(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ - const char *filename; - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK], stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); - - /* ------------------- - * OPEN AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* open the file collectively */ - fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); - VRFY((fid >= 0), ""); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* open the dataset1 collectively */ - dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset1 >= 0), ""); - - /* open another dataset collectively */ - dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset2 >= 0), ""); - - /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); - VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); - dims[0]++; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret < 0), "H5Dset_extent failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Read dataset1 using BYROW pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* read data independently */ - ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset1 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - - /* Read dataset2 using BYCOL pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* read data independently */ - ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset2 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), ""); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), ""); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); - if (data_array2) - free(data_array2); - if (data_origin1) - free(data_origin1); -} - -/* - * Part 3--Collective read/write for extendible datasets. - */ - -/* - * Example of using the parallel HDF5 library to create two extendible - * datasets in one HDF5 file with collective parallel MPIO access support. - * The Datasets are of sizes (number-of-mpi-processes x dim0) x dim1. - * Each process controls only a slab of size dim0 x dim1 within each - * dataset. - */ - -void -extend_writeAll(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - hsize_t max_dims[MAX_RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - hsize_t chunk_dims[MAX_RANK]; /* chunk sizes */ - hid_t dataset_pl; /* dataset create prop. list */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK]; /* for hyperslab setting */ - hsize_t stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent write test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* setup chunk-size. Make sure sizes are > 0 */ - chunk_dims[0] = (hsize_t)chunkdim0; - chunk_dims[1] = (hsize_t)chunkdim1; - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - - /* ------------------- - * START AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* Reduce the number of metadata cache slots, so that there are cache - * collisions during the raw data I/O on the chunked dataset. This stresses - * the metadata cache and tests for cache bugs. -QAK - */ - { - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - ret = H5Pget_cache(acc_tpl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); - VRFY((ret >= 0), "H5Pget_cache succeeded"); - mdc_nelmts = 4; - ret = H5Pset_cache(acc_tpl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); - VRFY((ret >= 0), "H5Pset_cache succeeded"); - } - - /* create the file collectively */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, acc_tpl); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* -------------------------------------------------------------- - * Define the dimensions of the overall datasets and create them. - * ------------------------------------------------------------- */ - - /* set up dataset storage chunk sizes and creation property list */ - if (VERBOSE_MED) - printf("chunks[]=%lu,%lu\n", (unsigned long)chunk_dims[0], (unsigned long)chunk_dims[1]); - dataset_pl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dataset_pl >= 0), "H5Pcreate succeeded"); - ret = H5Pset_chunk(dataset_pl, MAX_RANK, chunk_dims); - VRFY((ret >= 0), "H5Pset_chunk succeeded"); - - /* setup dimensionality object */ - /* start out with no rows, extend it later. */ - dims[0] = dims[1] = 0; - sid = H5Screate_simple(MAX_RANK, dims, max_dims); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - - /* create an extendible dataset collectively */ - dataset1 = H5Dcreate2(fid, DATASETNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset1 >= 0), "H5Dcreate2 succeeded"); - - /* create another extendible dataset collectively */ - dataset2 = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dataset_pl, H5P_DEFAULT); - VRFY((dataset2 >= 0), "H5Dcreate2 succeeded"); - - /* release resource */ - H5Sclose(sid); - H5Pclose(dataset_pl); - - /* ------------------------- - * Test writing to dataset1 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* Extend its current dim sizes before writing */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* write data collectively */ - ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - H5Sclose(file_dataspace); - H5Sclose(mem_dataspace); - H5Pclose(xfer_plist); - - /* ------------------------- - * Test writing to dataset2 - * -------------------------*/ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* put some trivial data in the data_array */ - dataset_fill(start, block, data_array1); - MESG("data_array initialized"); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* Try write to dataset2 beyond its current dim sizes. Should fail. */ - /* Temporary turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently. Should fail. */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret < 0), "H5Dwrite failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Extend dataset2 and try again. Should succeed. */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - ret = H5Dset_extent(dataset2, dims); - VRFY((ret >= 0), "H5Dset_extent succeeded"); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* write data independently */ - ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dwrite succeeded"); - - /* release resource */ - ret = H5Sclose(file_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Sclose(mem_dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Pclose(xfer_plist); - VRFY((ret >= 0), "H5Pclose succeeded"); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), "H5Dclose1 succeeded"); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), "H5Dclose2 succeeded"); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); -} - -/* Example of using the parallel HDF5 library to read an extendible dataset */ -void -extend_readAll(void) -{ - hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ - const char *filename; - hsize_t dims[MAX_RANK]; /* dataset dim sizes */ - DATATYPE *data_array1 = NULL; /* data buffer */ - DATATYPE *data_array2 = NULL; /* data buffer */ - DATATYPE *data_origin1 = NULL; /* expected data buffer */ - - hsize_t start[MAX_RANK]; /* for hyperslab setting */ - hsize_t count[MAX_RANK], stride[MAX_RANK]; /* for hyperslab setting */ - hsize_t block[MAX_RANK]; /* for hyperslab setting */ - - herr_t ret; /* Generic return value */ - int mpi_size, mpi_rank; - - MPI_Comm comm = test_comm; - MPI_Info info = MPI_INFO_NULL; - - filename = GetTestParameters(); - if (VERBOSE_MED) - printf("Extend independent read test on file %s\n", filename); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - /* allocate memory for data buffer */ - data_array1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); - data_array2 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_array2 != NULL), "data_array2 malloc succeeded"); - data_origin1 = (DATATYPE *)malloc((size_t)dim0 * (size_t)dim1 * sizeof(DATATYPE)); - VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); - - /* ------------------- - * OPEN AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* open the file collectively */ - fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); - VRFY((fid >= 0), ""); - - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* open the dataset1 collectively */ - dataset1 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset1 >= 0), ""); - - /* open another dataset collectively */ - dataset2 = H5Dopen2(fid, DATASETNAME1, H5P_DEFAULT); - VRFY((dataset2 >= 0), ""); - - /* Try extend dataset1 which is open RDONLY. Should fail. */ - /* first turn off auto error reporting */ - H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); - ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL); - VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded"); - dims[0]++; - ret = H5Dset_extent(dataset1, dims); - VRFY((ret < 0), "H5Dset_extent failed as expected"); - - /* restore auto error reporting */ - H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data); - H5Sclose(file_dataspace); - - /* Read dataset1 using BYROW pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset1); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* read data collectively */ - ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset1 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - H5Pclose(xfer_plist); - - /* Read dataset2 using BYCOL pattern */ - /* set up dimensions of the slab this process accesses */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - /* create a file dataspace independently */ - file_dataspace = H5Dget_space(dataset2); - VRFY((file_dataspace >= 0), ""); - ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), ""); - - /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(MAX_RANK, block, NULL); - VRFY((mem_dataspace >= 0), ""); - - /* fill dataset with test data */ - dataset_fill(start, block, data_origin1); - if (VERBOSE_MED) { - MESG("data_array created"); - dataset_print(start, block, data_array1); - } - - /* set up the collective transfer properties list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist >= 0), "H5Pcreate xfer succeeded"); - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if (dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret >= 0), "set independent IO collectively succeeded"); - } - - /* read data collectively */ - ret = H5Dread(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); - VRFY((ret >= 0), "H5Dread succeeded"); - - /* verify the read data with original expected data */ - ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); - VRFY((ret == 0), "dataset2 read verified correct"); - if (ret) - nerrors++; - - H5Sclose(mem_dataspace); - H5Sclose(file_dataspace); - H5Pclose(xfer_plist); - - /* close dataset collectively */ - ret = H5Dclose(dataset1); - VRFY((ret >= 0), ""); - ret = H5Dclose(dataset2); - VRFY((ret >= 0), ""); - - /* close the file collectively */ - H5Fclose(fid); - - /* release data buffers */ - if (data_array1) - free(data_array1); - if (data_array2) - free(data_array2); - if (data_origin1) - free(data_origin1); + /* Close dataset collectively */ + ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); + + /* Close the file collectively */ + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); } /* @@ -2897,8 +2090,8 @@ extend_readAll(void) * dataset in an HDF5 file with collective parallel access support. */ #ifdef H5_HAVE_FILTER_DEFLATE -void -compress_readAll(void) +static void +compress_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2919,7 +2112,7 @@ compress_readAll(void) int mpi_size, mpi_rank; herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Collective chunked dataset read test on file %s\n", filename); @@ -3082,8 +2275,8 @@ compress_readAll(void) * dataset with the exception that one processor selects no element. */ -void -none_selection_chunk(void) +static void +none_selection_chunk(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -3111,7 +2304,7 @@ none_selection_chunk(void) MPI_Comm comm = test_comm; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const test_params_t *)params)->filename; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -3281,992 +2474,13 @@ none_selection_chunk(void) free(data_array); } -/* Function: test_actual_io_mode - * - * Purpose: tests one specific case of collective I/O and checks that the - * actual_chunk_opt_mode property and the actual_io_mode - * properties in the DXPL have the correct values. - * - * Input: selection_mode: changes the way processes select data from the space, as well - * as some dxpl flags to get collective I/O to break in different ways. - * - * The relevant I/O function and expected response for each mode: - * TEST_ACTUAL_IO_MULTI_CHUNK_IND: - * H5D_mpi_chunk_collective_io, each process reports independent I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_COL: - * H5D_mpi_chunk_collective_io, each process reports collective I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_MIX: - * H5D_mpi_chunk_collective_io, each process reports mixed I/O - * - * TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: - * H5D_mpi_chunk_collective_io, processes disagree. The root reports - * collective, the rest report independent I/O - * - * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_IND. - * Set directly go to multi-chunk-io without num threshold calc. - * TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: - * Same test TEST_ACTUAL_IO_MULTI_CHUNK_COL. - * Set directly go to multi-chunk-io without num threshold calc. - * - * TEST_ACTUAL_IO_LINK_CHUNK: - * H5D_link_chunk_collective_io, processes report linked chunk I/O - * - * TEST_ACTUAL_IO_CONTIGUOUS: - * H5D__contig_collective_write or H5D__contig_collective_read - * each process reports contiguous collective I/O - * - * TEST_ACTUAL_IO_NO_COLLECTIVE: - * Simple independent I/O. This tests that the defaults are properly set. - * - * TEST_ACTUAL_IO_RESET: - * Performs collective and then independent I/O with the same dxpl to - * make sure the property is correctly reset to the default on each use. - * Specifically, this test runs TEST_ACTUAL_IO_MULTI_CHUNK_NO_OPT_MIX_DISAGREE - * (The most complex case that works on all builds) and then performs - * an independent read and write with the same dxpls. - * - * Note: DIRECT_MULTI_CHUNK_MIX and DIRECT_MULTI_CHUNK_MIX_DISAGREE - * is not needed as they are covered by DIRECT_CHUNK_MIX and - * MULTI_CHUNK_MIX_DISAGREE cases. _DIRECT_ cases are only for testing - * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO instead of num-threshold. - */ -static void -test_actual_io_mode(int selection_mode) -{ - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - H5D_mpio_actual_io_mode_t actual_io_mode_write = H5D_MPIO_NO_COLLECTIVE; - H5D_mpio_actual_io_mode_t actual_io_mode_read = H5D_MPIO_NO_COLLECTIVE; - H5D_mpio_actual_io_mode_t actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - const char *filename; - const char *test_name; - bool direct_multi_chunk_io; - bool multi_chunk_io; - bool is_chunked; - bool is_collective; - int mpi_size = -1; - int mpi_rank = -1; - int length; - int *buffer; - int i; - MPI_Comm mpi_comm = MPI_COMM_NULL; - MPI_Info mpi_info = MPI_INFO_NULL; - hid_t fid = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dataset = H5I_INVALID_HID; - hid_t data_type = H5T_NATIVE_INT; - hid_t fapl_id = H5I_INVALID_HID; - hid_t mem_space = H5I_INVALID_HID; - hid_t file_space = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl_write = H5I_INVALID_HID; - hid_t dxpl_read = H5I_INVALID_HID; - hsize_t dims[MAX_RANK]; - hsize_t chunk_dims[MAX_RANK]; - hsize_t start[MAX_RANK]; - hsize_t stride[MAX_RANK]; - hsize_t count[MAX_RANK]; - hsize_t block[MAX_RANK]; - char message[256]; - herr_t ret; - - /* Set up some flags to make some future if statements slightly more readable */ - direct_multi_chunk_io = (selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND || - selection_mode == TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - - /* Note: RESET performs the same tests as MULTI_CHUNK_MIX_DISAGREE and then - * tests independent I/O - */ - multi_chunk_io = - (selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_IND || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_COL || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX || - selection_mode == TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE || selection_mode == TEST_ACTUAL_IO_RESET); - - is_chunked = - (selection_mode != TEST_ACTUAL_IO_CONTIGUOUS && selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE); - - is_collective = selection_mode != TEST_ACTUAL_IO_NO_COLLECTIVE; - - /* Set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - MPI_Barrier(test_comm); - - assert(mpi_size >= 1); - - mpi_comm = test_comm; - mpi_info = MPI_INFO_NULL; - - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* Setup the file access template */ - fapl_id = create_faccess_plist(mpi_comm, mpi_info, facc_type); - VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); - - /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Create the basic Space */ - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - sid = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - - /* Create the dataset creation plist */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl >= 0), "dataset creation plist created successfully"); - - /* If we are not testing contiguous datasets */ - if (is_chunked) { - /* Set up chunk information. */ - chunk_dims[0] = dims[0] / (hsize_t)mpi_size; - chunk_dims[1] = dims[1]; - ret = H5Pset_chunk(dcpl, 2, chunk_dims); - VRFY((ret >= 0), "chunk creation property list succeeded"); - } - - /* Create the dataset */ - dataset = H5Dcreate2(fid, "actual_io", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - - /* Create the file dataspace */ - file_space = H5Dget_space(dataset); - VRFY((file_space >= 0), "H5Dget_space succeeded"); - - /* Choose a selection method based on the type of I/O we want to occur, - * and also set up some selection-dependeent test info. */ - switch (selection_mode) { - - /* Independent I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_IND: - case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND: - /* Since the dataset is chunked by row and each process selects a row, - * each process writes to a different chunk. This forces all I/O to be - * independent. - */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Multi Chunk - Independent"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - break; - - /* Collective I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_COL: - case TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL: - /* The dataset is chunked by rows, so each process takes a column which - * spans all chunks. Since the processes write non-overlapping regular - * selections to each chunk, the operation is purely collective. - */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - - test_name = "Multi Chunk - Collective"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - if (mpi_size > 1) - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - else - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - break; - - /* Mixed I/O with optimization */ - case TEST_ACTUAL_IO_MULTI_CHUNK_MIX: - /* A chunk will be assigned collective I/O only if it is selected by each - * process. To get mixed I/O, have the root select all chunks and each - * subsequent process select the first and nth chunk. The first chunk, - * accessed by all, will be assigned collective I/O while each other chunk - * will be accessed only by the root and the nth process and will be - * assigned independent I/O. Each process will access one chunk collectively - * and at least one chunk independently, reporting mixed I/O. - */ - - if (mpi_rank == 0) { - /* Select the first column */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - } - else { - /* Select the first and the nth chunk in the nth column */ - block[0] = (hsize_t)(dim0 / mpi_size); - block[1] = (hsize_t)(dim1 / mpi_size); - count[0] = 2; - count[1] = 1; - stride[0] = (hsize_t)mpi_rank * block[0]; - stride[1] = 1; - start[0] = 0; - start[1] = (hsize_t)mpi_rank * block[1]; - } - - test_name = "Multi Chunk - Mixed"; - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; - break; - - /* RESET tests that the properties are properly reset to defaults each time I/O is - * performed. To achieve this, we have RESET perform collective I/O (which would change - * the values from the defaults) followed by independent I/O (which should report the - * default values). RESET doesn't need to have a unique selection, so we reuse - * MULTI_CHUMK_MIX_DISAGREE, which was chosen because it is a complex case that works - * on all builds. The independent section of RESET can be found at the end of this function. - */ - case TEST_ACTUAL_IO_RESET: - - /* Mixed I/O with optimization and internal disagreement */ - case TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE: - /* A chunk will be assigned collective I/O only if it is selected by each - * process. To get mixed I/O with disagreement, assign process n to the - * first chunk and the nth chunk. The first chunk, selected by all, is - * assgigned collective I/O, while each other process gets independent I/O. - * Since the root process with only access the first chunk, it will report - * collective I/O. The subsequent processes will access the first chunk - * collectively, and their other chunk independently, reporting mixed I/O. - */ - - if (mpi_rank == 0) { - /* Select the first chunk in the first column */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); - block[0] = block[0] / (hsize_t)mpi_size; - } - else { - /* Select the first and the nth chunk in the nth column */ - block[0] = (hsize_t)(dim0 / mpi_size); - block[1] = (hsize_t)(dim1 / mpi_size); - count[0] = 2; - count[1] = 1; - stride[0] = (hsize_t)mpi_rank * block[0]; - stride[1] = 1; - start[0] = 0; - start[1] = (hsize_t)mpi_rank * block[1]; - } - - /* If the testname was not already set by the RESET case */ - if (selection_mode == TEST_ACTUAL_IO_RESET) - test_name = "RESET"; - else - test_name = "Multi Chunk - Mixed (Disagreement)"; - - actual_chunk_opt_mode_expected = H5D_MPIO_MULTI_CHUNK; - if (mpi_size > 1) { - if (mpi_rank == 0) - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - else - actual_io_mode_expected = H5D_MPIO_CHUNK_MIXED; - } - else - actual_io_mode_expected = H5D_MPIO_CHUNK_INDEPENDENT; - - break; - - /* Linked Chunk I/O */ - case TEST_ACTUAL_IO_LINK_CHUNK: - /* Nothing special; link chunk I/O is forced in the dxpl settings. */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Link Chunk"; - actual_chunk_opt_mode_expected = H5D_MPIO_LINK_CHUNK; - actual_io_mode_expected = H5D_MPIO_CHUNK_COLLECTIVE; - break; - - /* Contiguous Dataset */ - case TEST_ACTUAL_IO_CONTIGUOUS: - /* A non overlapping, regular selection in a contiguous dataset leads to - * collective I/O */ - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Contiguous"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_CONTIGUOUS_COLLECTIVE; - break; - - case TEST_ACTUAL_IO_NO_COLLECTIVE: - slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); - - test_name = "Independent"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - break; - - default: - test_name = "Undefined Selection Mode"; - actual_chunk_opt_mode_expected = H5D_MPIO_NO_CHUNK_OPTIMIZATION; - actual_io_mode_expected = H5D_MPIO_NO_COLLECTIVE; - break; - } - - ret = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* Create a memory dataspace mirroring the dataset and select the same hyperslab - * as in the file space. - */ - mem_space = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((mem_space >= 0), "mem_space created"); - - ret = H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, stride, count, block); - VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); - - /* Get the number of elements in the selection */ - length = dim0 * dim1; - - /* Allocate and initialize the buffer */ - buffer = (int *)malloc(sizeof(int) * (size_t)length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); - for (i = 0; i < length; i++) - buffer[i] = i; - - /* Set up the dxpl for the write */ - dxpl_write = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - - /* Set collective I/O properties in the dxpl. */ - if (is_collective) { - /* Request collective I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Set the threshold number of processes per chunk to twice mpi_size. - * This will prevent the threshold from ever being met, thus forcing - * multi chunk io instead of link chunk io. - * This is via default. - */ - if (multi_chunk_io) { - /* force multi-chunk-io by threshold */ - ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl_write, (unsigned)mpi_size * 2); - VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded"); - - /* set this to manipulate testing scenario about allocating processes - * to chunks */ - ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl_write, (unsigned)99); - VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded"); - } - - /* Set directly go to multi-chunk-io without threshold calc. */ - if (direct_multi_chunk_io) { - /* set for multi chunk io by property*/ - ret = H5Pset_dxpl_mpio_chunk_opt(dxpl_write, H5FD_MPIO_CHUNK_MULTI_IO); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - } - - /* Make a copy of the dxpl to test the read operation */ - dxpl_read = H5Pcopy(dxpl_write); - VRFY((dxpl_read >= 0), "H5Pcopy succeeded"); - - /* Write */ - ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Retrieve Actual io values */ - ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - /* Read */ - ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - - /* Retrieve Actual io values */ - ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - /* Check write vs read */ - VRFY((actual_io_mode_read == actual_io_mode_write), - "reading and writing are the same for actual_io_mode"); - VRFY((actual_chunk_opt_mode_read == actual_chunk_opt_mode_write), - "reading and writing are the same for actual_chunk_opt_mode"); - - /* Test values */ - if (actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t)-1 && - actual_io_mode_expected != (H5D_mpio_actual_io_mode_t)-1) { - snprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n", - test_name); - VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); - snprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name); - VRFY((actual_io_mode_write == actual_io_mode_expected), message); - } - else { - fprintf(stderr, "%s %d -> (%d,%d)\n", test_name, mpi_rank, actual_chunk_opt_mode_write, - actual_io_mode_write); - } - - /* To test that the property is successfully reset to the default, we perform some - * independent I/O after the collective I/O - */ - if (selection_mode == TEST_ACTUAL_IO_RESET) { - if (mpi_rank == 0) { - /* Switch to independent io */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - ret = H5Pset_dxpl_mpio(dxpl_read, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - - /* Write */ - ret = H5Dwrite(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_write, buffer); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Check Properties */ - ret = H5Pget_mpio_actual_io_mode(dxpl_write, &actual_io_mode_write); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_write, &actual_chunk_opt_mode_write); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - VRFY(actual_chunk_opt_mode_write == H5D_MPIO_NO_CHUNK_OPTIMIZATION, - "actual_chunk_opt_mode has correct value for reset write (independent)"); - VRFY(actual_io_mode_write == H5D_MPIO_NO_COLLECTIVE, - "actual_io_mode has correct value for reset write (independent)"); - - /* Read */ - ret = H5Dread(dataset, data_type, H5S_ALL, H5S_ALL, dxpl_read, buffer); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Check Properties */ - ret = H5Pget_mpio_actual_io_mode(dxpl_read, &actual_io_mode_read); - VRFY((ret >= 0), "retrieving actual io mode succeeded"); - ret = H5Pget_mpio_actual_chunk_opt_mode(dxpl_read, &actual_chunk_opt_mode_read); - VRFY((ret >= 0), "retrieving actual chunk opt mode succeeded"); - - VRFY(actual_chunk_opt_mode_read == H5D_MPIO_NO_CHUNK_OPTIMIZATION, - "actual_chunk_opt_mode has correct value for reset read (independent)"); - VRFY(actual_io_mode_read == H5D_MPIO_NO_COLLECTIVE, - "actual_io_mode has correct value for reset read (independent)"); - } - } - - /* Release some resources */ - ret = H5Sclose(sid); - ret = H5Pclose(fapl_id); - ret = H5Pclose(dcpl); - ret = H5Pclose(dxpl_write); - ret = H5Pclose(dxpl_read); - ret = H5Dclose(dataset); - ret = H5Sclose(mem_space); - ret = H5Sclose(file_space); - ret = H5Fclose(fid); - free(buffer); - return; -} - -/* Function: actual_io_mode_tests - * - * Purpose: Tests all possible cases of the actual_io_mode property. - */ -void -actual_io_mode_tests(void) -{ - int mpi_size = -1; - int mpi_rank = -1; - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_size(test_comm, &mpi_rank); - - test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); - - /* - * Test multi-chunk-io via proc_num threshold - */ - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); - - /* The Multi Chunk Mixed test requires at least three processes. */ - if (mpi_size > 2) - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); - else - fprintf(stdout, "Multi Chunk Mixed test requires 3 processes minimum\n"); - - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); - - /* - * Test multi-chunk-io via setting direct property - */ - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - - test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); - test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); - - test_actual_io_mode(TEST_ACTUAL_IO_RESET); - return; -} - -/* - * Function: test_no_collective_cause_mode - * - * Purpose: - * tests cases for broken collective I/O and checks that the - * H5Pget_mpio_no_collective_cause properties in the DXPL have the correct values. - * - * Input: - * selection_mode: various mode to cause broken collective I/O - * Note: Originally, each TEST case is supposed to be used alone. - * After some discussion, this is updated to take multiple TEST cases - * with '|'. However there is no error check for any of combined - * test cases, so a tester is responsible to understand and feed - * proper combination of TESTs if needed. - * - * - * TEST_COLLECTIVE: - * Test for regular collective I/O without cause of breaking. - * Just to test normal behavior. - * - * TEST_SET_INDEPENDENT: - * Test for Independent I/O as the cause of breaking collective I/O. - * - * TEST_DATATYPE_CONVERSION: - * Test for Data Type Conversion as the cause of breaking collective I/O. - * - * TEST_DATA_TRANSFORMS: - * Test for Data Transform feature as the cause of breaking collective I/O. - * - * TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES: - * Test for NULL dataspace as the cause of breaking collective I/O. - * - * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT: - * Test for Compact layout as the cause of breaking collective I/O. - * - * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL: - * Test for Externl-File storage as the cause of breaking collective I/O. - */ -#define FILE_EXTERNAL "nocolcause_extern.data" -static void -test_no_collective_cause_mode(int selection_mode) -{ - uint32_t no_collective_cause_local_write = 0; - uint32_t no_collective_cause_local_read = 0; - uint32_t no_collective_cause_local_expected = 0; - uint32_t no_collective_cause_global_write = 0; - uint32_t no_collective_cause_global_read = 0; - uint32_t no_collective_cause_global_expected = 0; - // hsize_t coord[NELM][MAX_RANK]; - - uint32_t no_selection_io_cause_write = 0; - uint32_t no_selection_io_cause_read = 0; - uint32_t no_selection_io_cause_expected = 0; - - const char *filename; - const char *test_name; - bool is_chunked = 1; - bool is_independent = 0; - int mpi_size = -1; - int mpi_rank = -1; - int length; - int *buffer; - int i; - MPI_Comm mpi_comm; - MPI_Info mpi_info; - hid_t fid = H5I_INVALID_HID; - hid_t sid = H5I_INVALID_HID; - hid_t dataset = H5I_INVALID_HID; - hid_t data_type = H5T_NATIVE_INT; - hid_t fapl_id = H5I_INVALID_HID; - hid_t dcpl = H5I_INVALID_HID; - hid_t dxpl_write = H5I_INVALID_HID; - hid_t dxpl_read = H5I_INVALID_HID; - hsize_t dims[MAX_RANK]; - hid_t mem_space = H5I_INVALID_HID; - hid_t file_space = H5I_INVALID_HID; - hsize_t chunk_dims[MAX_RANK]; - herr_t ret; - /* set to global value as default */ - int l_facc_type = facc_type; - char message[256]; - - /* Set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - MPI_Barrier(test_comm); - - assert(mpi_size >= 1); - - mpi_comm = test_comm; - mpi_info = MPI_INFO_NULL; - - /* Create the dataset creation plist */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl >= 0), "dataset creation plist created successfully"); - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT) { - ret = H5Pset_layout(dcpl, H5D_COMPACT); - VRFY((ret >= 0), "set COMPACT layout succeeded"); - is_chunked = 0; - } - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - ret = H5Pset_external(dcpl, FILE_EXTERNAL, 0, H5F_UNLIMITED); - VRFY((ret >= 0), "set EXTERNAL file layout succeeded"); - is_chunked = 0; - } - - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES) { - sid = H5Screate(H5S_NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - is_chunked = 0; - } - else { - /* Create the basic Space */ - /* if this is a compact dataset, create a small dataspace that does not exceed 64K */ - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT) { - dims[0] = BIG_X_FACTOR * 6; - dims[1] = BIG_Y_FACTOR * 6; - } - else { - dims[0] = (hsize_t)dim0; - dims[1] = (hsize_t)dim1; - } - sid = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((sid >= 0), "H5Screate_simple succeeded"); - } - - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* Setup the file access template */ - fapl_id = create_faccess_plist(mpi_comm, mpi_info, l_facc_type); - VRFY((fapl_id >= 0), "create_faccess_plist() succeeded"); - - /* Create the file */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* If we are not testing contiguous datasets */ - if (is_chunked) { - /* Set up chunk information. */ - chunk_dims[0] = dims[0] / (hsize_t)mpi_size; - chunk_dims[1] = dims[1]; - ret = H5Pset_chunk(dcpl, 2, chunk_dims); - VRFY((ret >= 0), "chunk creation property list succeeded"); - } - - /* Create the dataset */ - dataset = H5Dcreate2(fid, "nocolcause", data_type, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset >= 0), "H5Dcreate2() dataset succeeded"); - - /* Set up the dxpl for the write */ - dxpl_write = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_write >= 0), "H5Pcreate(H5P_DATASET_XFER) succeeded"); - - /* - * Set expected causes and some tweaks based on the type of test - */ - if (selection_mode & TEST_DATATYPE_CONVERSION) { - test_name = "Broken Collective I/O - Datatype Conversion"; - - /* set different sign to trigger type conversion */ - data_type = H5T_NATIVE_UINT; - - /* Disable selection I/O since datatype conversion is supported in collective with selection I/O */ - ret = H5Pset_selection_io(dxpl_write, H5D_SELECTION_IO_MODE_OFF); - VRFY((ret >= 0), "H5Pset_selection_io succeeded"); - - no_collective_cause_local_expected |= H5D_MPIO_DATATYPE_CONVERSION | H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected |= H5D_MPIO_DATATYPE_CONVERSION | H5D_MPIO_NO_SELECTION_IO; - no_selection_io_cause_expected |= H5D_SEL_IO_DISABLE_BY_API; - } - - if (selection_mode & TEST_DATA_TRANSFORMS) { - test_name = "Broken Collective I/O - DATA Transforms"; - - /* Set transform */ - ret = H5Pset_data_transform(dxpl_write, "x+1"); - VRFY((ret >= 0), "H5Pset_data_transform succeeded"); - - /* Disable selection I/O since data transforms are supported in collective with selection I/O */ - ret = H5Pset_selection_io(dxpl_write, H5D_SELECTION_IO_MODE_OFF); - VRFY((ret >= 0), "H5Pset_selection_io succeeded"); - - no_collective_cause_local_expected |= H5D_MPIO_DATA_TRANSFORMS | H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected |= H5D_MPIO_DATA_TRANSFORMS | H5D_MPIO_NO_SELECTION_IO; - no_selection_io_cause_expected |= H5D_SEL_IO_DISABLE_BY_API; - } - - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES) { - test_name = "Broken Collective I/O - No Simple or Scalar DataSpace"; - no_collective_cause_local_expected |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; - no_collective_cause_global_expected |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - } - - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT || - selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - test_name = "Broken Collective I/O - No CONTI or CHUNKED Dataset"; - no_collective_cause_local_expected |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - no_collective_cause_global_expected |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - } - - if (selection_mode & TEST_COLLECTIVE) { - test_name = "Broken Collective I/O - Not Broken"; - no_collective_cause_local_expected = H5D_MPIO_COLLECTIVE; - no_collective_cause_global_expected = H5D_MPIO_COLLECTIVE; - } - - if (selection_mode & TEST_SET_INDEPENDENT) { - test_name = "Broken Collective I/O - Independent"; - no_collective_cause_local_expected = H5D_MPIO_SET_INDEPENDENT; - no_collective_cause_global_expected = H5D_MPIO_SET_INDEPENDENT; - no_collective_cause_local_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - no_collective_cause_global_expected &= ~(unsigned)H5D_MPIO_NO_SELECTION_IO; - /* switch to independent io */ - is_independent = 1; - } - - /* use all spaces for certain tests */ - if (selection_mode & TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES || - selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { - file_space = H5S_ALL; - mem_space = H5S_ALL; - } - else { - /* Get the file dataspace */ - file_space = H5Dget_space(dataset); - VRFY((file_space >= 0), "H5Dget_space succeeded"); - - /* Create the memory dataspace */ - mem_space = H5Screate_simple(MAX_RANK, dims, NULL); - VRFY((mem_space >= 0), "mem_space created"); - } - - /* Get the number of elements in the selection */ - H5_CHECKED_ASSIGN(length, int, dims[0] * dims[1], hsize_t); - - /* Allocate and initialize the buffer */ - buffer = (int *)malloc(sizeof(int) * (size_t)length); - VRFY((buffer != NULL), "malloc of buffer succeeded"); - for (i = 0; i < length; i++) - buffer[i] = i; - - if (is_independent) { - /* Set Independent I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_INDEPENDENT); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - else { - /* Set Collective I/O */ - ret = H5Pset_dxpl_mpio(dxpl_write, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - } - - /*--------------------- - * Test Write access - *---------------------*/ - - /* Write */ - ret = H5Dwrite(dataset, data_type, mem_space, file_space, dxpl_write, buffer); - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dwrite() dataset multichunk write succeeded"); - - /* Get the cause of broken collective I/O */ - ret = H5Pget_mpio_no_collective_cause(dxpl_write, &no_collective_cause_local_write, - &no_collective_cause_global_write); - VRFY((ret >= 0), "retrieving no collective cause succeeded"); - - ret = H5Pget_no_selection_io_cause(dxpl_write, &no_selection_io_cause_write); - VRFY((ret >= 0), "retrieving no selection io cause succeeded"); - - if (no_collective_cause_local_write & H5D_MPIO_NO_SELECTION_IO) { - VRFY((no_selection_io_cause_write == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for write is as expected"); - } - - if (no_collective_cause_global_write & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_write == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for write is as expected"); - } - - /*--------------------- - * Test Read access - *---------------------*/ - - /* Make a copy of the dxpl to test the read operation */ - dxpl_read = H5Pcopy(dxpl_write); - VRFY((dxpl_read >= 0), "H5Pcopy succeeded"); - - /* Read */ - ret = H5Dread(dataset, data_type, mem_space, file_space, dxpl_read, buffer); - - if (ret < 0) - H5Eprint2(H5E_DEFAULT, stdout); - VRFY((ret >= 0), "H5Dread() dataset multichunk read succeeded"); - - /* Get the cause of broken collective I/O */ - ret = H5Pget_mpio_no_collective_cause(dxpl_read, &no_collective_cause_local_read, - &no_collective_cause_global_read); - VRFY((ret >= 0), "retrieving no collective cause succeeded"); - - ret = H5Pget_no_selection_io_cause(dxpl_read, &no_selection_io_cause_read); - VRFY((ret >= 0), "retrieving no selection io cause succeeded"); - - if (no_collective_cause_local_read & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_read == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for read is as expected"); - } - - if (no_collective_cause_global_read & H5D_MPIO_NO_SELECTION_IO) { - - VRFY((no_selection_io_cause_read == no_selection_io_cause_expected), - "H5D_MPIO_NO_SELECTION_IO for read is as expected"); - } - - /* Check write vs read */ - VRFY((no_collective_cause_local_read == no_collective_cause_local_write), - "reading and writing are the same for local cause of Broken Collective I/O"); - VRFY((no_collective_cause_global_read == no_collective_cause_global_write), - "reading and writing are the same for global cause of Broken Collective I/O"); - - /* Test values */ - memset(message, 0, sizeof(message)); - snprintf(message, sizeof(message), "Local cause of Broken Collective I/O has the correct value for %s.\n", - test_name); - VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message); - memset(message, 0, sizeof(message)); - snprintf(message, sizeof(message), - "Global cause of Broken Collective I/O has the correct value for %s.\n", test_name); - VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message); - - /* Release some resources */ - if (sid) - H5Sclose(sid); - if (fapl_id) - H5Pclose(fapl_id); - if (dcpl) - H5Pclose(dcpl); - if (dxpl_write) - H5Pclose(dxpl_write); - if (dxpl_read) - H5Pclose(dxpl_read); - if (dataset) - H5Dclose(dataset); - if (mem_space) - H5Sclose(mem_space); - if (file_space) - H5Sclose(file_space); - if (fid) - H5Fclose(fid); - free(buffer); - - /* clean up external file */ - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) - HDremove(FILE_EXTERNAL); - - return; -} - -/* Function: no_collective_cause_tests - * - * Purpose: Tests cases for broken collective IO. - */ -void -no_collective_cause_tests(void) -{ - /* - * Test individual cause - */ - test_no_collective_cause_mode(TEST_COLLECTIVE); - test_no_collective_cause_mode(TEST_SET_INDEPENDENT); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); - - /* - * Test combined causes - */ - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | - TEST_DATA_TRANSFORMS); - - return; -} - -/* Function: dense_attr_test - * - * Purpose: Test cases for writing dense attributes in parallel - */ -void -test_dense_attr(void) -{ - int mpi_size, mpi_rank; - hid_t fpid, fid; - hid_t gid, gpid; - hid_t atFileSpace, atid; - hsize_t atDims[1] = {10000}; - herr_t status; - const char *filename; - - /* get filename */ - filename = (const char *)GetTestParameters(); - assert(filename != NULL); - - /* set up MPI parameters */ - MPI_Comm_size(test_comm, &mpi_size); - MPI_Comm_rank(test_comm, &mpi_rank); - - fpid = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fpid > 0), "H5Pcreate succeeded"); - status = H5Pset_libver_bounds(fpid, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - VRFY((status >= 0), "H5Pset_libver_bounds succeeded"); - status = H5Pset_fapl_mpio(fpid, test_comm, MPI_INFO_NULL); - VRFY((status >= 0), "H5Pset_fapl_mpio succeeded"); - fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fpid); - VRFY((fid > 0), "H5Fcreate succeeded"); - status = H5Pclose(fpid); - VRFY((status >= 0), "H5Pclose succeeded"); - - gpid = H5Pcreate(H5P_GROUP_CREATE); - VRFY((gpid > 0), "H5Pcreate succeeded"); - status = H5Pset_attr_phase_change(gpid, 0, 0); - VRFY((status >= 0), "H5Pset_attr_phase_change succeeded"); - gid = H5Gcreate2(fid, "foo", H5P_DEFAULT, gpid, H5P_DEFAULT); - VRFY((gid > 0), "H5Gcreate2 succeeded"); - status = H5Pclose(gpid); - VRFY((status >= 0), "H5Pclose succeeded"); - - atFileSpace = H5Screate_simple(1, atDims, NULL); - VRFY((atFileSpace > 0), "H5Screate_simple succeeded"); - atid = H5Acreate2(gid, "bar", H5T_STD_U64LE, atFileSpace, H5P_DEFAULT, H5P_DEFAULT); - VRFY((atid > 0), "H5Acreate succeeded"); - status = H5Sclose(atFileSpace); - VRFY((status >= 0), "H5Sclose succeeded"); - - status = H5Aclose(atid); - VRFY((status >= 0), "H5Aclose succeeded"); - - status = H5Gclose(gid); - VRFY((status >= 0), "H5Gclose succeeded"); - status = H5Fclose(fid); - VRFY((status >= 0), "H5Fclose succeeded"); - - return; -} - int main(int argc, char **argv) { - int express_test; - int mpi_size, mpi_rank; /* mpi variables */ - hsize_t oldsize, newsize = 1048576; + test_params_t test_params; + int express_test; + int mpi_size, mpi_rank; /* mpi variables */ + hsize_t oldsize, newsize = 1048576; #ifndef H5_HAVE_WIN32_API /* Un-buffer the stdout and stderr */ @@ -4278,8 +2492,6 @@ main(int argc, char **argv) MPI_Comm_size(test_comm, &mpi_size); MPI_Comm_rank(test_comm, &mpi_rank); - mpi_rank_framework_g = mpi_rank; - memset(filenames, 0, sizeof(filenames)); dim0 = BIG_X_FACTOR; @@ -4324,29 +2536,45 @@ main(int argc, char **argv) /* Initialize testing framework */ if (mpi_rank < 2) { - TestInit(argv[0], usage, parse_options); + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { + fprintf(stderr, "couldn't initialize testing framework\n"); + MPI_Abort(MPI_COMM_WORLD, -1); + } - /* Parse command line arguments */ - TestParseCmdLine(argc, argv); + test_params.filename = PARATESTFILE; - AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, NULL, &test_params, sizeof(test_params), + "dataset independent write"); - AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); + AddTest("idsetr", dataset_readInd, NULL, NULL, &test_params, sizeof(test_params), + "dataset independent read"); - AddTest("cdsetw", dataset_writeAll, NULL, "dataset collective write", PARATESTFILE); + AddTest("cdsetw", dataset_writeAll, NULL, NULL, &test_params, sizeof(test_params), + "dataset collective write"); - AddTest("cdsetr", dataset_readAll, NULL, "dataset collective read", PARATESTFILE); + AddTest("cdsetr", dataset_readAll, NULL, NULL, &test_params, sizeof(test_params), + "dataset collective read"); - AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE); + AddTest("eidsetw2", extend_writeInd2, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset independent write #2"); - AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); + AddTest("selnone", none_selection_chunk, NULL, NULL, &test_params, sizeof(test_params), + "chunked dataset with none-selection"); #ifdef H5_HAVE_FILTER_DEFLATE - AddTest("cmpdsetr", compress_readAll, NULL, "compressed dataset collective read", PARATESTFILE); + AddTest("cmpdsetr", compress_readAll, NULL, NULL, &test_params, sizeof(test_params), + "compressed dataset collective read"); #endif /* H5_HAVE_FILTER_DEFLATE */ /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); + + /* Parse command line arguments */ + if (TestParseCmdLine(argc, argv) < 0) { + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + MPI_Abort(MPI_COMM_WORLD, -1); + } /* setup file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 068e3aa0f50..fe38dadb403 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -11,14 +11,16 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf5.h" -#include "testphdf5.h" +#include "testpar.h" #include "H5Dprivate.h" /* For Chunk tests */ +/* Include testing framework functionality */ +#include "testframe.h" + /* FILENAME and filenames must have the same number of names */ const char *FILENAME[3] = {"bigio_test.h5", "single_rank_independent_io.h5", NULL}; /* Constants definitions */ -#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ /* Define some handy debugging shorthands, routines, ... */ /* debugging tools */ @@ -28,22 +30,27 @@ const char *FILENAME[3] = {"bigio_test.h5", "single_rank_independent_io.h5", NUL /* Constants definitions */ #define RANK 2 -#define IN_ORDER 1 -#define OUT_OF_ORDER 2 +#define DATASET1 "DSET1" +#define DATASET2 "DSET2" +#define DATASET3 "DSET3" +#define DATASET4 "DSET4" +#define DXFER_BIGCOUNT (1 << 29) + +#define SPACE_DIM1 24 +#define SPACE_DIM2 4 +#define BYROW_CONT 1 +#define BYROW_DISCONT 2 +#define BYROW_SELECTNONE 3 +#define BYROW_SELECTUNBALANCE 4 +#define BYROW_SELECTINCHUNK 5 -#define DATASET1 "DSET1" -#define DATASET2 "DSET2" -#define DATASET3 "DSET3" -#define DATASET4 "DSET4" -#define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/ -#define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */ -#define DXFER_BIGCOUNT (1 << 29) +#define DSET_COLLECTIVE_CHUNK_NAME "coll_chunk_name" #define HYPER 1 #define POINT 2 #define ALL 3 -/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; typedef hsize_t B_DATATYPE; int facc_type = FACC_MPIO; /*Test file access type */ @@ -108,54 +115,6 @@ fill_datasets(hsize_t start[], hsize_t block[], B_DATATYPE *dataset) } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - HDcompile_assert(RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "count[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "stride[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "block[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " - "total datapoints=%" PRIuHSIZE "\n", - start[0], start[1], count[0], count[1], stride[0], stride[1], block[0], block[1], - block[0] * block[1] * count[0] * count[1]); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Print the content of the dataset. */ @@ -1186,59 +1145,6 @@ single_rank_independent_io(void) MPI_Barrier(MPI_COMM_WORLD); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY_G((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY_G((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY_G((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY_G((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY_G((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY_G((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /*------------------------------------------------------------------------- * Function: coll_chunk1 * @@ -1269,7 +1175,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) * ------------------------------------------------------------------------ */ -void +static void coll_chunk1(void) { const char *filename = FILENAME[0]; @@ -1317,7 +1223,7 @@ coll_chunk1(void) * * ------------------------------------------------------------------------ */ -void +static void coll_chunk2(void) { const char *filename = FILENAME[0]; @@ -1366,7 +1272,7 @@ coll_chunk2(void) * ------------------------------------------------------------------------ */ -void +static void coll_chunk3(void) { const char *filename = FILENAME[0]; @@ -1922,7 +1828,12 @@ main(int argc, char **argv) printf("Failed to turn off atexit processing. Continue.\n"); /* set alarm. */ - TestAlarmOn(); + if (TestAlarmOn() < 0) { + if (MAIN_PROCESS) + fprintf(stderr, "couldn't enable test timer\n"); + MPI_Finalize(); + return -1; + } acc_plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 0f845ef9b39..1d0d414e657 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -779,7 +779,7 @@ init_data(void) * Function: do_express_test() * * Purpose: Do an MPI_Allreduce to obtain the maximum value returned - * by GetTestExpress() across all processes. Return this + * by h5_get_testexpress() across all processes. Return this * value. * * Envirmoment variables can be different across different @@ -787,7 +787,7 @@ init_data(void) * on whether to do an express test. * * Return: Success: Maximum of the values returned by - * GetTestExpress() across all processes. + * h5_get_testexpress() across all processes. * * Failure: -1 * @@ -799,7 +799,7 @@ do_express_test(void) int max_express_test; int result; - express_test = GetTestExpress(); + express_test = h5_get_testexpress(); result = MPI_Allreduce((void *)&express_test, (void *)&max_express_test, 1, MPI_INT, MPI_MAX, world_mpi_comm); diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 5de615038b2..88c070968fd 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -15,7 +15,7 @@ * feature implemented in H5C.c */ -#include "testphdf5.h" +#include "testpar.h" #include "cache_common.h" #include "genall5.h" diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index 1d5978306a8..202551ff9c8 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -456,7 +456,7 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in * it, read to verify all data are as written. */ void -test_chunk_alloc(void) +test_chunk_alloc(const void *params) { const char *filename; hid_t file_id, dataset; @@ -480,7 +480,7 @@ test_chunk_alloc(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend Chunked allocation test on file %s\n", filename); @@ -542,7 +542,7 @@ test_chunk_alloc(void) * fashion. */ void -test_chunk_alloc_incr_ser_to_par(void) +test_chunk_alloc_incr_ser_to_par(const void *params) { H5D_space_status_t space_status; const char *filename; @@ -567,7 +567,7 @@ test_chunk_alloc_incr_ser_to_par(void) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (MAINPROCESS && VERBOSE_MED) printf("Chunked dataset incremental file space allocation serial to parallel test on file %s\n", filename); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index fa3459d252f..eeaced0a067 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -64,9 +64,9 @@ static void coll_chunktest(const char *filename, int chunk_factor, int select_fa */ void -coll_chunk1(void) +coll_chunk1(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -126,9 +126,9 @@ coll_chunk1(void) * ------------------------------------------------------------------------ */ void -coll_chunk2(void) +coll_chunk2(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -189,9 +189,9 @@ coll_chunk2(void) */ void -coll_chunk3(void) +coll_chunk3(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_size; int mpi_rank; @@ -254,9 +254,9 @@ coll_chunk3(void) */ void -coll_chunk4(void) +coll_chunk4(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -317,9 +317,9 @@ coll_chunk4(void) */ void -coll_chunk5(void) +coll_chunk5(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -382,9 +382,9 @@ coll_chunk5(void) */ void -coll_chunk6(void) +coll_chunk6(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -445,9 +445,9 @@ coll_chunk6(void) */ void -coll_chunk7(void) +coll_chunk7(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -508,9 +508,9 @@ coll_chunk7(void) */ void -coll_chunk8(void) +coll_chunk8(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -571,9 +571,9 @@ coll_chunk8(void) */ void -coll_chunk9(void) +coll_chunk9(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -634,9 +634,9 @@ coll_chunk9(void) */ void -coll_chunk10(void) +coll_chunk10(const void *params) { - const char *filename = GetTestParameters(); + const char *filename = ((const H5Ptest_param_t *)params)->name; int mpi_rank; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -739,6 +739,22 @@ coll_chunktest(const char *filename, int chunk_factor, int select_factor, int ap VRFY((coords != NULL), "coords malloc succeeded"); point_set(start, count, stride, block, num_points, coords, mode); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += RANK; + } + } + file_dataspace = H5Screate_simple(2, dims, NULL); VRFY((file_dataspace >= 0), "file dataspace created succeeded"); diff --git a/testpar/t_coll_md.c b/testpar/t_coll_md.c index 043ecf81208..f87e357dc1a 100644 --- a/testpar/t_coll_md.c +++ b/testpar/t_coll_md.c @@ -63,7 +63,7 @@ * arbitrary number (0 was chosen). */ void -test_partial_no_selection_coll_md_read(void) +test_partial_no_selection_coll_md_read(const void *params) { const char *filename; hsize_t *dataset_dims = NULL; @@ -102,7 +102,7 @@ test_partial_no_selection_coll_md_read(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -262,7 +262,7 @@ test_partial_no_selection_coll_md_read(void) * */ void -test_multi_chunk_io_addrmap_issue(void) +test_multi_chunk_io_addrmap_issue(const void *params) { const char *filename; hsize_t start[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS]; @@ -297,7 +297,7 @@ test_multi_chunk_io_addrmap_issue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -390,7 +390,7 @@ test_multi_chunk_io_addrmap_issue(void) *2096 but expected 320000 major: Internal error (too specific to document in detail) minor: MPI Error String */ void -test_link_chunk_io_sort_chunk_issue(void) +test_link_chunk_io_sort_chunk_issue(const void *params) { const char *filename; hsize_t dataset_dims[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS]; @@ -427,7 +427,7 @@ test_link_chunk_io_sort_chunk_issue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -554,7 +554,7 @@ test_link_chunk_io_sort_chunk_issue(void) * heap data is not correctly mapped as raw data. */ void -test_collective_global_heap_write(void) +test_collective_global_heap_write(const void *params) { const char *filename; hsize_t attr_dims[COLL_GHEAP_WRITE_ATTR_DIMS]; @@ -583,7 +583,7 @@ test_collective_global_heap_write(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); @@ -634,7 +634,7 @@ test_collective_global_heap_write(void) * collective metadata writes are NOT requested. */ void -test_coll_io_ind_md_write(void) +test_coll_io_ind_md_write(const void *params) { const char *filename; long long *data = NULL; @@ -654,7 +654,7 @@ test_coll_io_ind_md_write(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl_id >= 0), "create_faccess_plist succeeded"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index bf4fcfda1a7..cf4ada8139d 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -122,53 +122,6 @@ slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t s } } -/* - * Setup the coordinates for point selection. - */ -void -point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order) -{ - hsize_t i, j, k = 0, m, n, s1, s2; - - HDcompile_assert(RANK == 2); - - if (OUT_OF_ORDER == order) - k = (num_points * RANK) - 1; - else if (IN_ORDER == order) - k = 0; - - s1 = start[0]; - s2 = start[1]; - - for (i = 0; i < count[0]; i++) - for (j = 0; j < count[1]; j++) - for (m = 0; m < block[0]; m++) - for (n = 0; n < block[1]; n++) - if (OUT_OF_ORDER == order) { - coords[k--] = s2 + (stride[1] * j) + n; - coords[k--] = s1 + (stride[0] * i) + m; - } - else if (IN_ORDER == order) { - coords[k++] = s1 + stride[0] * i + m; - coords[k++] = s2 + stride[1] * j + n; - } - - if (VERBOSE_MED) { - printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " - "datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); - k = 0; - for (i = 0; i < num_points; i++) { - printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); - k += 2; - } - } -} - /* * Fill the dataset with trivial data for testing. * Assume dimension rank is 2 and data is stored contiguous. @@ -271,7 +224,7 @@ dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[] */ void -dataset_writeInd(void) +dataset_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -293,7 +246,7 @@ dataset_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -423,7 +376,7 @@ dataset_writeInd(void) /* Example of using the parallel HDF5 library to read a dataset */ void -dataset_readInd(void) +dataset_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -444,7 +397,7 @@ dataset_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -558,7 +511,7 @@ dataset_readInd(void) */ void -dataset_writeAll(void) +dataset_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -587,7 +540,7 @@ dataset_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -948,6 +901,22 @@ dataset_writeAll(void) /* Dataset5: point selection in File - Hyperslab selection in Memory*/ /* create a file dataspace independently */ point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += RANK; + } + } + file_dataspace = H5Dget_space(dataset5); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -984,6 +953,22 @@ dataset_writeAll(void) start[0] = (hsize_t)(dim0 / mpi_size * mpi_rank); start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += RANK; + } + } + file_dataspace = H5Dget_space(dataset6); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -992,6 +977,22 @@ dataset_writeAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += RANK; + } + } + mem_dataspace = H5Dget_space(dataset6); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1021,6 +1022,22 @@ dataset_writeAll(void) start[0] = (hsize_t)(dim0 / mpi_size * mpi_rank); start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t k = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t i = 0; i < num_points; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += RANK; + } + } + file_dataspace = H5Dget_space(dataset7); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1090,7 +1107,7 @@ dataset_writeAll(void) */ void -dataset_readAll(void) +dataset_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1116,7 +1133,7 @@ dataset_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1353,6 +1370,22 @@ dataset_readAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += RANK; + } + } + mem_dataspace = H5Dget_space(dataset5); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1391,6 +1424,22 @@ dataset_readAll(void) start[0] = (hsize_t)(dim0 / mpi_size * mpi_rank); start[1] = 0; point_set(start, count, stride, block, num_points, coords, IN_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += RANK; + } + } + file_dataspace = H5Dget_space(dataset6); VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1399,6 +1448,22 @@ dataset_readAll(void) start[0] = 0; start[1] = 0; point_set(start, count, stride, block, num_points, coords, OUT_OF_ORDER); + if (VERBOSE_MED) { + hsize_t idx = 0; + + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " + "datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], + (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], + (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + + for (size_t point = 0; point < num_points; point++) { + printf("(%d, %d)\n", (int)coords[idx], (int)coords[idx + 1]); + idx += RANK; + } + } + mem_dataspace = H5Dget_space(dataset6); VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); @@ -1517,7 +1582,7 @@ dataset_readAll(void) */ void -extend_writeInd(void) +extend_writeInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1543,7 +1608,7 @@ extend_writeInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1751,7 +1816,7 @@ extend_writeInd(void) */ void -extend_writeInd2(void) +extend_writeInd2(const void *params) { const char *filename; hid_t fid; /* HDF5 file ID */ @@ -1771,7 +1836,7 @@ extend_writeInd2(void) int i; /* Local index variable */ herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test #2 on file %s\n", filename); @@ -1924,7 +1989,7 @@ extend_writeInd2(void) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readInd(void) +extend_readInd(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1947,7 +2012,7 @@ extend_readInd(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -2114,7 +2179,7 @@ extend_readInd(void) */ void -extend_writeAll(void) +extend_writeAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2141,7 +2206,7 @@ extend_writeAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -2367,7 +2432,7 @@ extend_writeAll(void) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readAll(void) +extend_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2391,7 +2456,7 @@ extend_readAll(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -2573,7 +2638,7 @@ extend_readAll(void) */ #ifdef H5_HAVE_FILTER_DEFLATE void -compress_readAll(void) +compress_readAll(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2594,7 +2659,7 @@ compress_readAll(void) int mpi_size, mpi_rank; herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Collective chunked dataset read test on file %s\n", filename); @@ -2769,7 +2834,7 @@ compress_readAll(void) */ void -none_selection_chunk(void) +none_selection_chunk(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -2797,7 +2862,7 @@ none_selection_chunk(void) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -3031,7 +3096,7 @@ none_selection_chunk(void) * path way to multi-chunk-io by H5FD_MPIO_CHUNK_MULTI_IO instead of num-threshold. */ static void -test_actual_io_mode(int selection_mode) +test_actual_io_mode(const void *params, int selection_mode) { H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_write = H5D_MPIO_NO_CHUNK_OPTIMIZATION; H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode_read = H5D_MPIO_NO_CHUNK_OPTIMIZATION; @@ -3111,7 +3176,7 @@ test_actual_io_mode(int selection_mode) mpi_comm = MPI_COMM_WORLD; mpi_info = MPI_INFO_NULL; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* Setup the file access template */ @@ -3484,7 +3549,7 @@ test_actual_io_mode(int selection_mode) * */ void -actual_io_mode_tests(void) +actual_io_mode_tests(const void *params) { H5D_selection_io_mode_t selection_io_mode; hid_t dxpl_id = H5I_INVALID_HID; @@ -3507,32 +3572,32 @@ actual_io_mode_tests(void) VRFY((ret >= 0), "H5Pclose succeeded"); if (selection_io_mode == H5D_SELECTION_IO_MODE_OFF) { - test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE); + test_actual_io_mode(params, TEST_ACTUAL_IO_NO_COLLECTIVE); /* * Test multi-chunk-io via proc_num threshold */ - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_COL); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_IND); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_COL); /* The Multi Chunk Mixed test requires at least three processes. */ if (mpi_size > 2) - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_MIX); else fprintf(stdout, "Multi Chunk Mixed test requires 3 processes minimum\n"); - test_actual_io_mode(TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); + test_actual_io_mode(params, TEST_ACTUAL_IO_MULTI_CHUNK_MIX_DISAGREE); /* * Test multi-chunk-io via setting direct property */ - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); - test_actual_io_mode(TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); + test_actual_io_mode(params, TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_IND); + test_actual_io_mode(params, TEST_ACTUAL_IO_DIRECT_MULTI_CHUNK_COL); - test_actual_io_mode(TEST_ACTUAL_IO_LINK_CHUNK); - test_actual_io_mode(TEST_ACTUAL_IO_CONTIGUOUS); + test_actual_io_mode(params, TEST_ACTUAL_IO_LINK_CHUNK); + test_actual_io_mode(params, TEST_ACTUAL_IO_CONTIGUOUS); - test_actual_io_mode(TEST_ACTUAL_IO_RESET); + test_actual_io_mode(params, TEST_ACTUAL_IO_RESET); } return; @@ -3579,7 +3644,7 @@ actual_io_mode_tests(void) */ #define FILE_EXTERNAL "nocolcause_extern.data" static void -test_no_collective_cause_mode(int selection_mode) +test_no_collective_cause_mode(const void *params, int selection_mode) { uint32_t no_collective_cause_local_write = 0; uint32_t no_collective_cause_local_read = 0; @@ -3682,7 +3747,7 @@ test_no_collective_cause_mode(int selection_mode) VRFY((sid >= 0), "H5Screate_simple succeeded"); } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* Setup the file access template */ @@ -3920,7 +3985,7 @@ test_no_collective_cause_mode(int selection_mode) /* clean up external file */ if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) - H5Fdelete(FILE_EXTERNAL, fapl); + HDremove(FILE_EXTERNAL); if (fapl) H5Pclose(fapl); @@ -3934,26 +3999,27 @@ test_no_collective_cause_mode(int selection_mode) * */ void -no_collective_cause_tests(void) +no_collective_cause_tests(const void *params) { /* * Test individual cause */ - test_no_collective_cause_mode(TEST_COLLECTIVE); - test_no_collective_cause_mode(TEST_SET_INDEPENDENT); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); + test_no_collective_cause_mode(params, TEST_COLLECTIVE); + test_no_collective_cause_mode(params, TEST_SET_INDEPENDENT); + test_no_collective_cause_mode(params, TEST_DATATYPE_CONVERSION); + test_no_collective_cause_mode(params, TEST_DATA_TRANSFORMS); + test_no_collective_cause_mode(params, TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); /* * Test combined causes */ - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); - test_no_collective_cause_mode(TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode(TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION | - TEST_DATA_TRANSFORMS); + test_no_collective_cause_mode(params, + TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | TEST_DATATYPE_CONVERSION); + test_no_collective_cause_mode(params, TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); + test_no_collective_cause_mode(params, TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL | + TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); return; } @@ -3970,7 +4036,7 @@ no_collective_cause_tests(void) */ void -dataset_atomicity(void) +dataset_atomicity(const void *params) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -3997,7 +4063,7 @@ dataset_atomicity(void) dim0 = 64; dim1 = 32; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (facc_type != FACC_MPIO) { printf("Atomicity tests will not work without the MPIO VFD\n"); return; @@ -4318,7 +4384,7 @@ dataset_atomicity(void) * */ void -test_dense_attr(void) +test_dense_attr(const void *params) { int mpi_size, mpi_rank; hid_t fpid, fid; @@ -4346,7 +4412,7 @@ test_dense_attr(void) } /* get filename */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); fpid = H5Pcreate(H5P_FILE_ACCESS); diff --git a/testpar/t_file.c b/testpar/t_file.c index acfb45d30a8..1fd4b41e82f 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -57,7 +57,7 @@ static int open_file(const char *filename, hid_t fapl, int metadata_write_strate * sooner or later due to barrier mixed up. */ void -test_split_comm_access(void) +test_split_comm_access(const void *params) { MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; @@ -68,7 +68,7 @@ test_split_comm_access(void) herr_t ret; /* generic return value */ const char *filename; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); @@ -134,7 +134,7 @@ test_split_comm_access(void) } void -test_page_buffer_access(void) +test_page_buffer_access(const void *params) { const char *filename; hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -152,7 +152,7 @@ test_page_buffer_access(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Until page buffering is supported in parallel in some form (even if * just for a single MPI process), this test just will just check to @@ -790,7 +790,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t * multiple opens of the same file. */ void -test_file_properties(void) +test_file_properties(const void *params) { hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ @@ -823,7 +823,7 @@ test_file_properties(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; mpi_ret = MPI_Info_create(&info); VRFY((mpi_ret >= 0), "MPI_Info_create succeeded"); @@ -995,7 +995,7 @@ test_file_properties(void) } /* end test_file_properties() */ void -test_delete(void) +test_delete(const void *params) { hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ @@ -1005,7 +1005,7 @@ test_delete(void) htri_t is_accessible = FAIL; /* Whether a file is accessible */ herr_t ret; /* Generic return value */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1075,7 +1075,7 @@ test_delete(void) * due to an invalid library version bounds setting */ void -test_invalid_libver_bounds_file_close_assert(void) +test_invalid_libver_bounds_file_close_assert(const void *params) { const char *filename = NULL; MPI_Comm comm = MPI_COMM_WORLD; @@ -1085,7 +1085,7 @@ test_invalid_libver_bounds_file_close_assert(void) hid_t fapl_id = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1125,7 +1125,7 @@ test_invalid_libver_bounds_file_close_assert(void) * called by multiple ranks. */ void -test_evict_on_close_parallel_unsupp(void) +test_evict_on_close_parallel_unsupp(const void *params) { const char *filename = NULL; MPI_Comm comm = MPI_COMM_WORLD; @@ -1134,7 +1134,7 @@ test_evict_on_close_parallel_unsupp(void) hid_t fapl_id = H5I_INVALID_HID; herr_t ret; - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1185,7 +1185,7 @@ test_evict_on_close_parallel_unsupp(void) * This is a test program from the user. */ void -test_fapl_preserve_hints(void) +test_fapl_preserve_hints(const void *params) { const char *filename; const char *key = "hdf_info_fapl"; @@ -1203,7 +1203,7 @@ test_fapl_preserve_hints(void) int mpi_ret; /* MPI return value */ herr_t ret; /* Generic return value */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; value_used = malloc(MPI_MAX_INFO_VAL + 1); VRFY(value_used, "malloc succeeded"); diff --git a/testpar/t_file_image.c b/testpar/t_file_image.c index 1790685cfe0..ae1658e47d3 100644 --- a/testpar/t_file_image.c +++ b/testpar/t_file_image.c @@ -58,7 +58,7 @@ * JRM -- 11/28/11 */ void -file_image_daisy_chain_test(void) +file_image_daisy_chain_test(const void H5_ATTR_UNUSED *params) { char file_name[1024] = "\0"; int mpi_size, mpi_rank; diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index c00d139d08e..e7cd95de672 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -192,7 +192,7 @@ filter_read_internal(const char *filename, hid_t dcpl, hsize_t *dset_size) */ void -test_filter_read(void) +test_filter_read(const void *params) { hid_t dc; /* HDF5 IDs */ const hsize_t chunk_size[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ @@ -220,7 +220,7 @@ test_filter_read(void) hsize_t combo_size; /* Size of dataset with multiple filters */ #endif /* H5_HAVE_FILTER_DEFLATE || H5_HAVE_FILTER_SZIP */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; if (VERBOSE_MED) printf("Parallel reading of dataset written with filters %s\n", filename); diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index fad597e17da..69f4f12551b 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -9989,12 +9989,17 @@ main(int argc, char **argv) if (VERBOSE_MED) h5_show_hostname(); - TestAlarmOn(); + if (TestAlarmOn() < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't enable test timer\n"); + fflush(stderr); + MPI_Abort(MPI_COMM_WORLD, -1); + } /* * Get the TestExpress level setting */ - test_express_level_g = GetTestExpress(); + test_express_level_g = h5_get_testexpress(); if ((test_express_level_g >= 1) && MAINPROCESS) { printf("** Some tests will be skipped due to TestExpress setting.\n"); printf("** Exhaustive tests will only be performed for the first available filter.\n"); diff --git a/testpar/t_filters_parallel.h b/testpar/t_filters_parallel.h index 04d36395dbc..f853b779e89 100644 --- a/testpar/t_filters_parallel.h +++ b/testpar/t_filters_parallel.h @@ -24,6 +24,9 @@ #include "stdlib.h" #include "testpar.h" +/* Include testing framework functionality */ +#include "testframe.h" + #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) /* Used to load other filters than GZIP */ diff --git a/testpar/t_init_term.c b/testpar/t_init_term.c index 0268e3d9eca..ec12396bc05 100644 --- a/testpar/t_init_term.c +++ b/testpar/t_init_term.c @@ -15,7 +15,7 @@ * termination of the HDF5 library with MPI init and finalize. */ -#include "testphdf5.h" +#include "testpar.h" int nerrors = 0; /* errors count */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index b9cb4cc5729..55e1758c3a0 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -31,6 +31,9 @@ static int read_attribute(hid_t, int, int); static int check_value(DATATYPE *, DATATYPE *, int); static void get_slab(hsize_t[], hsize_t[], hsize_t[], hsize_t[], int); +static void rr_obj_hdr_flush_confusion_writer(const void *params, MPI_Comm comm); +static void rr_obj_hdr_flush_confusion_reader(const void *params, MPI_Comm comm); + /* * The size value computed by this function is used extensively in * configuring tests for the current number of processes. @@ -72,7 +75,7 @@ get_size(void) * */ void -zero_dim_dset(void) +zero_dim_dset(const void *params) { int mpi_size, mpi_rank; const char *filename; @@ -95,7 +98,7 @@ zero_dim_dset(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((plist >= 0), "create_faccess_plist succeeded"); @@ -141,7 +144,7 @@ zero_dim_dset(void) * a slab of array to the file. */ void -multiple_dset_write(void) +multiple_dset_write(const void *params) { int i, j, n, mpi_size, mpi_rank, size; hid_t iof, plist, dataset, memspace, filespace; @@ -157,7 +160,7 @@ multiple_dset_write(void) char *filename; int ndatasets; - pt = GetTestParameters(); + pt = params; filename = pt->name; ndatasets = pt->count; @@ -235,7 +238,7 @@ multiple_dset_write(void) /* Example of using PHDF5 to create, write, and read compact dataset. */ void -compact_dataset(void) +compact_dataset(const void *params) { int i, j, mpi_size, mpi_rank, size, err_num = 0; hid_t iof, plist, dcpl, dxpl, dataset, filespace; @@ -274,7 +277,7 @@ compact_dataset(void) inme = malloc((size_t)size * (size_t)size * sizeof(double)); VRFY((outme != NULL), "malloc succeeded for inme"); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; VRFY((mpi_size <= size), "mpi_size <= size"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); @@ -375,7 +378,7 @@ compact_dataset(void) * of Null dataspace. */ void -null_dataset(void) +null_dataset(const void *params) { int mpi_size, mpi_rank; hid_t iof, plist, dxpl, dataset, attr, sid; @@ -403,7 +406,7 @@ null_dataset(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); iof = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); @@ -492,7 +495,7 @@ null_dataset(void) * the boundary of interest. */ void -big_dataset(void) +big_dataset(const void *params) { int mpi_size, mpi_rank; /* MPI info */ hid_t iof, /* File ID */ @@ -523,7 +526,7 @@ big_dataset(void) /* Verify MPI_Offset can handle larger than 2GB sizes */ VRFY((sizeof(MPI_Offset) > 4), "sizeof(MPI_Offset)>4"); - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl >= 0), "create_faccess_plist succeeded"); @@ -634,7 +637,7 @@ big_dataset(void) * default fill value of zeros to work correctly. */ void -dataset_fillvalue(void) +dataset_fillvalue(const void *params) { int mpi_size, mpi_rank; /* MPI info */ int err_num; /* Number of errors */ @@ -672,7 +675,7 @@ dataset_fillvalue(void) return; } - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Set the dataset dimension to be one row more than number of processes */ /* and calculate the actual dataset size. */ @@ -888,17 +891,17 @@ dataset_fillvalue(void) /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ void -collective_group_write_independent_group_read(void) +collective_group_write_independent_group_read(const void *params) { - collective_group_write(); - independent_group_read(); + collective_group_write(params); + independent_group_read(params); } /* Write multiple groups with a chunked dataset in each group collectively. * These groups and datasets are for testing independent read later. */ void -collective_group_write(void) +collective_group_write(const void *params) { int mpi_rank, mpi_size, size; int i, j, m; @@ -913,7 +916,7 @@ collective_group_write(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1011,7 +1014,7 @@ collective_group_write(void) * datasets independently. */ void -independent_group_read(void) +independent_group_read(const void *params) { int mpi_rank, m; hid_t plist, fid; @@ -1020,7 +1023,7 @@ independent_group_read(void) int ngroups; herr_t ret; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1139,7 +1142,7 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) * */ void -multiple_group_write(void) +multiple_group_write(const void *params) { int mpi_rank, mpi_size, size; int m; @@ -1152,7 +1155,7 @@ multiple_group_write(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1308,7 +1311,7 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter) * every dataset in every group and check their correctness. */ void -multiple_group_read(void) +multiple_group_read(const void *params) { int mpi_rank, mpi_size, error_num, size; int m; @@ -1320,7 +1323,7 @@ multiple_group_read(void) char *filename; int ngroups; - pt = GetTestParameters(); + pt = params; filename = pt->name; ngroups = pt->count; @@ -1617,7 +1620,7 @@ get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], hsize_t #define N 4 void -io_mode_confusion(void) +io_mode_confusion(const void *params) { /* * HDF5 APIs definitions @@ -1650,7 +1653,7 @@ io_mode_confusion(void) const H5Ptest_param_t *pt; char *filename; - pt = GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1897,7 +1900,7 @@ const char *lg_att_name[NUM_DATA_SETS] = {"large_attribute_0", "large_attribute "large_attribute_3"}; void -rr_obj_hdr_flush_confusion(void) +rr_obj_hdr_flush_confusion(const void *params) { /* MPI variables */ /* private communicator size and rank */ @@ -1946,9 +1949,9 @@ rr_obj_hdr_flush_confusion(void) * step. When all steps are done, they inform readers to end. */ if (is_reader) - rr_obj_hdr_flush_confusion_reader(comm); + rr_obj_hdr_flush_confusion_reader(params, comm); else - rr_obj_hdr_flush_confusion_writer(comm); + rr_obj_hdr_flush_confusion_writer(params, comm); MPI_Comm_free(&comm); if (verbose) @@ -1958,8 +1961,8 @@ rr_obj_hdr_flush_confusion(void) } /* rr_obj_hdr_flush_confusion() */ -void -rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) +static void +rr_obj_hdr_flush_confusion_writer(const void *params, MPI_Comm comm) { int i; int j; @@ -2008,7 +2011,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) * setup test bed related variables: */ - pt = (const H5Ptest_param_t *)GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); @@ -2339,8 +2342,8 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } /* rr_obj_hdr_flush_confusion_writer() */ -void -rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) +static void +rr_obj_hdr_flush_confusion_reader(const void *params, MPI_Comm comm) { int i; int j; @@ -2387,7 +2390,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) * setup test bed related variables: */ - pt = (const H5Ptest_param_t *)GetTestParameters(); + pt = params; filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_world_rank); @@ -2702,7 +2705,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) #define EXTRA_ALIGN 100 void -chunk_align_bug_1(void) +chunk_align_bug_1(const void *params) { int mpi_rank; hid_t file_id, dset_id, fapl_id, dcpl_id, space_id; @@ -2726,7 +2729,7 @@ chunk_align_bug_1(void) return; } - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Create file without alignment */ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index c0dabf54431..e26dbe63e92 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -26,6 +26,9 @@ #include "testpar.h" +/* Include testing framework functionality */ +#include "testframe.h" + /* FILENAME and filenames must have the same number of names */ const char *FILENAME[2] = {"MPItest", NULL}; char filenames[2][200]; @@ -175,6 +178,8 @@ test_mpio_overlap_writes(char *filename) #define GB 1073741824 /* 1024**3 == 2**30 */ #define TWO_GB_LESS1 2147483647 /* 2**31 - 1 */ #define FOUR_GB_LESS1 4294967295L /* 2**32 - 1 */ + +#ifndef H5_HAVE_WIN32_API /* * Verify that MPI_Offset exceeding 2**31 can be computed correctly. * Print any failure as information only, not as an error so that this @@ -409,6 +414,7 @@ test_mpio_gb_file(char *filename) free(buf); return (nerrs); } +#endif /* * MPI-IO Test: One writes, Many reads. @@ -1008,8 +1014,10 @@ parse_options(int argc, char **argv) else { switch (*(*argv + 1)) { case 'v': - if (*((*argv + 1) + 1)) - ParseTestVerbosity((*argv + 1) + 1); + if (*((*argv + 1) + 1)) { + if (ParseTestVerbosity((*argv + 1) + 1) < 0) + return 1; + } else SetTestVerbosity(VERBO_MED); break; @@ -1120,7 +1128,12 @@ main(int argc, char **argv) H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* set alarm. */ - TestAlarmOn(); + if (TestAlarmOn() < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't enable test timer\n"); + fflush(stderr); + MPI_Abort(MPI_COMM_WORLD, -1); + } /*======================================= * MPIO 1 write Many read test diff --git a/testpar/t_oflush.c b/testpar/t_oflush.c index 4a91be17719..70257a40f85 100644 --- a/testpar/t_oflush.c +++ b/testpar/t_oflush.c @@ -25,7 +25,7 @@ #define RANK 2 void -test_oflush(void) +test_oflush(const void *params) { int mpi_size, mpi_rank; hid_t file, dataset; @@ -50,7 +50,7 @@ test_oflush(void) for (i = 0; i < NY; i++) data[j][i] = i + j; - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((file >= 0), "file creation succeeded"); diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index 7fdefeb3ee9..6a3909173d4 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -28,7 +28,7 @@ *------------------------------------------------------------------------- */ void -test_fapl_mpio_dup(void) +test_fapl_mpio_dup(const void H5_ATTR_UNUSED *params) { int mpi_size, mpi_rank; MPI_Comm comm, comm_tmp; @@ -190,7 +190,7 @@ test_fapl_mpio_dup(void) *------------------------------------------------------------------------- */ void -test_get_dxpl_mpio(void) +test_get_dxpl_mpio(const void *params) { hid_t fid = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; @@ -222,7 +222,7 @@ test_get_dxpl_mpio(void) VRFY((fapl >= 0), "Fapl creation succeeded"); /* Create a file */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); VRFY((fid >= 0), "H5Fcreate succeeded"); diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index 4fd7b5a0231..a2335fb6f53 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -15,7 +15,14 @@ * and makes sure the objects created are there. */ -#include "testphdf5.h" +#include "testpar.h" + +#define RANK 2 +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + +/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; int nerrors = 0; /* errors count */ @@ -115,8 +122,6 @@ main(int argc, char **argv) if (data_array) free(data_array); - nerrors += GetTestNumErrs(); - if (MAINPROCESS) { if (0 == nerrors) PASSED(); diff --git a/testpar/t_prop.c b/testpar/t_prop.c index af7b9a891f8..789796b7ebd 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -88,7 +88,7 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) } void -test_plist_ed(void) +test_plist_ed(const void H5_ATTR_UNUSED *params) { hid_t dcpl; /* dataset create prop. list */ hid_t dapl; /* dataset access prop. list */ @@ -451,7 +451,7 @@ test_plist_ed(void) } void -external_links(void) +external_links(const void H5_ATTR_UNUSED *params) { hid_t lcpl = H5I_INVALID_HID; /* link create prop. list */ hid_t lapl = H5I_INVALID_HID; /* link access prop. list */ diff --git a/testpar/t_pshutdown.c b/testpar/t_pshutdown.c index 92f0bf17429..2133c9f7a26 100644 --- a/testpar/t_pshutdown.c +++ b/testpar/t_pshutdown.c @@ -19,7 +19,14 @@ * all created objects are there. */ -#include "testphdf5.h" +#include "testpar.h" + +#define RANK 2 +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + +/* Dataset data type. Int's can be easily octo dumped. */ +typedef int DATATYPE; int nerrors = 0; /* errors count */ @@ -156,8 +163,6 @@ main(int argc, char **argv) MPI_Finalize(); - nerrors += GetTestNumErrs(); - if (MAINPROCESS) { if (0 == nerrors) PASSED(); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 8aeed30e078..ee226e64c0a 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -22,12 +22,19 @@ #define H5S_TESTING #include "H5Spkg.h" /* Dataspaces */ -#include "testphdf5.h" + +#include "testpar.h" + +/* Include testing framework functionality */ +#include "testframe.h" #ifndef PATH_MAX #define PATH_MAX 512 #endif +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ + /* FILENAME and filenames must have the same number of names. * Use PARATESTFILE in general and use a separated filename only if the file * created in one test is accessed by a different test. @@ -39,6 +46,21 @@ const char *FILENAME[NFILENAME] = {"ShapeSameTest", NULL}; char *filenames[NFILENAME]; hid_t fapl; /* file access property list */ +/* global variables */ +int dim0; +int dim1; +int chunkdim0; +int chunkdim1; +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ +int ngroups = 512; /* number of groups to create in root + * group. */ +int facc_type = FACC_MPIO; /*Test file access type */ +int dxfer_coll_type = DXFER_COLLECTIVE_IO; + +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ + /* On Lustre (and perhaps other parallel file systems?), we have severe * slow downs if two or more processes attempt to access the same file system * block. To minimize this problem, we set alignment in the shape same tests @@ -111,6 +133,11 @@ struct hs_dr_pio_test_vars_t { int64_t tests_skipped; }; +/* Structure for passing test parameters around */ +typedef struct test_params_t { + char *filename; +} test_params_t; + /*------------------------------------------------------------------------- * Function: hs_dr_pio_test__setup() * @@ -125,10 +152,10 @@ struct hs_dr_pio_test_vars_t { #define CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG 0 static void -hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker_edge_size, - const int chunk_edge_size, const int small_rank, const int large_rank, - const bool use_collective_io, const hid_t dset_type, const int express_test, - struct hs_dr_pio_test_vars_t *tv_ptr) +hs_dr_pio_test__setup(const void *params, const int test_num, const int edge_size, + const int checker_edge_size, const int chunk_edge_size, const int small_rank, + const int large_rank, const bool use_collective_io, const hid_t dset_type, + const int express_test, struct hs_dr_pio_test_vars_t *tv_ptr) { #if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG const char *fcnName = "hs_dr_pio_test__setup()"; @@ -246,7 +273,7 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker memset(tv_ptr->large_ds_slice_buf, 0, sizeof(uint32_t) * tv_ptr->large_ds_slice_size); - filename = (const char *)GetTestParameters(); + filename = ((const test_params_t *)params)->filename; assert(filename != NULL); #if CONTIG_HS_DR_PIO_TEST__SETUP__DEBUG if (MAINPROCESS) { @@ -1697,11 +1724,11 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) #define CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void -contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int chunk_edge_size, - const int small_rank, const int large_rank, const bool use_collective_io, - const hid_t dset_type, int express_test, int *skips_ptr, int max_skips, - int64_t *total_tests_ptr, int64_t *tests_run_ptr, int64_t *tests_skipped_ptr, - int mpi_rank) +contig_hs_dr_pio_test__run_test(const void *params, const int test_num, const int edge_size, + const int chunk_edge_size, const int small_rank, const int large_rank, + const bool use_collective_io, const hid_t dset_type, int express_test, + int *skips_ptr, int max_skips, int64_t *total_tests_ptr, + int64_t *tests_run_ptr, int64_t *tests_skipped_ptr, int mpi_rank) { #if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG const char *fcnName = "contig_hs_dr_pio_test__run_test()"; @@ -1771,8 +1798,8 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i printf("\r - running test #%lld: small rank = %d, large rank = %d", (long long)(test_num + 1), small_rank, large_rank); - hs_dr_pio_test__setup(test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, use_collective_io, - dset_type, express_test, tv_ptr); + hs_dr_pio_test__setup(params, test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, + use_collective_io, dset_type, express_test, tv_ptr); /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; @@ -1885,7 +1912,7 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i #define CONTIG_HS_DR_PIO_TEST__DEBUG 0 static void -contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) +contig_hs_dr_pio_test(const void *params, ShapeSameTestMethods sstest_type) { int express_test; int local_express_test; @@ -1943,9 +1970,10 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) /* contiguous data set, independent I/O */ chunk_edge_size = 0; - contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, - express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); + contig_hs_dr_pio_test__run_test(params, test_num, edge_size, chunk_edge_size, small_rank, + large_rank, false, dset_type, express_test, &skips, + max_skips, &total_tests, &tests_run, &tests_skipped, + mpi_rank); test_num++; break; /* end of case IND_CONTIG */ @@ -1955,7 +1983,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 0; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -1965,9 +1993,10 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) /* chunked data set, independent I/O */ chunk_edge_size = 5; - contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, false, dset_type, - express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); + contig_hs_dr_pio_test__run_test(params, test_num, edge_size, chunk_edge_size, small_rank, + large_rank, false, dset_type, express_test, &skips, + max_skips, &total_tests, &tests_run, &tests_skipped, + mpi_rank); test_num++; break; /* end of case IND_CHUNKED */ @@ -1977,7 +2006,7 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) chunk_edge_size = 5; contig_hs_dr_pio_test__run_test( - test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, + params, test_num, edge_size, chunk_edge_size, small_rank, large_rank, true, dset_type, express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3629,11 +3658,12 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) #define CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG 0 static void -ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const int checker_edge_size, - const int chunk_edge_size, const int small_rank, const int large_rank, - const bool use_collective_io, const hid_t dset_type, const int express_test, - int *skips_ptr, int max_skips, int64_t *total_tests_ptr, - int64_t *tests_run_ptr, int64_t *tests_skipped_ptr, int mpi_rank) +ckrbrd_hs_dr_pio_test__run_test(const void *params, const int test_num, const int edge_size, + const int checker_edge_size, const int chunk_edge_size, const int small_rank, + const int large_rank, const bool use_collective_io, const hid_t dset_type, + const int express_test, int *skips_ptr, int max_skips, + int64_t *total_tests_ptr, int64_t *tests_run_ptr, int64_t *tests_skipped_ptr, + int mpi_rank) { #if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG @@ -3704,8 +3734,8 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i printf("\r - running test #%lld: small rank = %d, large rank = %d", (long long)(test_num + 1), small_rank, large_rank); - hs_dr_pio_test__setup(test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, - use_collective_io, dset_type, express_test, tv_ptr); + hs_dr_pio_test__setup(params, test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, + large_rank, use_collective_io, dset_type, express_test, tv_ptr); /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; @@ -3800,7 +3830,7 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i */ static void -ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) +ckrbrd_hs_dr_pio_test(const void *params, ShapeSameTestMethods sstest_type) { int express_test; int local_express_test; @@ -3865,9 +3895,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case IND_CONTIG: /* contiguous data set, independent I/O */ chunk_edge_size = 0; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, - small_rank, large_rank, false, dset_type, express_test, - &skips, max_skips, &total_tests, &tests_run, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, + chunk_edge_size, small_rank, large_rank, false, dset_type, + express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3876,9 +3906,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case COL_CONTIG: /* contiguous data set, collective I/O */ chunk_edge_size = 0; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, - small_rank, large_rank, true, dset_type, express_test, - &skips, max_skips, &total_tests, &tests_run, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, + chunk_edge_size, small_rank, large_rank, true, dset_type, + express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3887,9 +3917,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case IND_CHUNKED: /* chunked data set, independent I/O */ chunk_edge_size = 5; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, - small_rank, large_rank, false, dset_type, express_test, - &skips, max_skips, &total_tests, &tests_run, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, + chunk_edge_size, small_rank, large_rank, false, dset_type, + express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3898,9 +3928,9 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) case COL_CHUNKED: /* chunked data set, collective I/O */ chunk_edge_size = 5; - ckrbrd_hs_dr_pio_test__run_test(test_num, edge_size, checker_edge_size, chunk_edge_size, - small_rank, large_rank, true, dset_type, express_test, - &skips, max_skips, &total_tests, &tests_run, + ckrbrd_hs_dr_pio_test__run_test(params, test_num, edge_size, checker_edge_size, + chunk_edge_size, small_rank, large_rank, true, dset_type, + express_test, &skips, max_skips, &total_tests, &tests_run, &tests_skipped, mpi_rank); test_num++; break; @@ -3939,21 +3969,6 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) * Main driver of the Parallel HDF5 tests */ -/* global variables */ -int dim0; -int dim1; -int chunkdim0; -int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ -int ngroups = 512; /* number of groups to create in root - * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ -int dxfer_coll_type = DXFER_COLLECTIVE_IO; - -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ - /* other option flags */ #ifdef USE_PAUSE @@ -4015,20 +4030,20 @@ MPI_Init(int *argc, char ***argv) * Show command usage */ static void -usage(void) +usage(FILE *stream) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, - COL_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + fprintf(stream, " [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + fprintf(stream, "\t-m" + "\tset number of datasets for the multiple dataset test\n"); + fprintf(stream, "\t-n" + "\tset number of groups for the multiple group test\n"); + fprintf(stream, "\t-f \tfilename prefix\n"); + fprintf(stream, "\t-2\t\tuse Split-file together with MPIO\n"); + fprintf(stream, "\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, + COL_FACTOR); + fprintf(stream, "\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + fprintf(stream, "\n"); } /* @@ -4162,120 +4177,68 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), ""); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - /* Shape Same test using contiguous hyperslab using independent IO on contiguous datasets */ static void -sscontig1(void) +sscontig1(const void *params) { - contig_hs_dr_pio_test(IND_CONTIG); + contig_hs_dr_pio_test(params, IND_CONTIG); } /* Shape Same test using contiguous hyperslab using collective IO on contiguous datasets */ static void -sscontig2(void) +sscontig2(const void *params) { - contig_hs_dr_pio_test(COL_CONTIG); + contig_hs_dr_pio_test(params, COL_CONTIG); } /* Shape Same test using contiguous hyperslab using independent IO on chunked datasets */ static void -sscontig3(void) +sscontig3(const void *params) { - contig_hs_dr_pio_test(IND_CHUNKED); + contig_hs_dr_pio_test(params, IND_CHUNKED); } /* Shape Same test using contiguous hyperslab using collective IO on chunked datasets */ static void -sscontig4(void) +sscontig4(const void *params) { - contig_hs_dr_pio_test(COL_CHUNKED); + contig_hs_dr_pio_test(params, COL_CHUNKED); } /* Shape Same test using checker hyperslab using independent IO on contiguous datasets */ static void -sschecker1(void) +sschecker1(const void *params) { - ckrbrd_hs_dr_pio_test(IND_CONTIG); + ckrbrd_hs_dr_pio_test(params, IND_CONTIG); } /* Shape Same test using checker hyperslab using collective IO on contiguous datasets */ static void -sschecker2(void) +sschecker2(const void *params) { - ckrbrd_hs_dr_pio_test(COL_CONTIG); + ckrbrd_hs_dr_pio_test(params, COL_CONTIG); } /* Shape Same test using checker hyperslab using independent IO on chunked datasets */ static void -sschecker3(void) +sschecker3(const void *params) { - ckrbrd_hs_dr_pio_test(IND_CHUNKED); + ckrbrd_hs_dr_pio_test(params, IND_CHUNKED); } /* Shape Same test using checker hyperslab using collective IO on chunked datasets */ static void -sschecker4(void) +sschecker4(const void *params) { - ckrbrd_hs_dr_pio_test(COL_CHUNKED); + ckrbrd_hs_dr_pio_test(params, COL_CHUNKED); } int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ - int mpi_code; + test_params_t test_params; + int mpi_size, mpi_rank; /* mpi variables */ + int mpi_code; #ifdef H5_HAVE_TEST_API int required = MPI_THREAD_MULTIPLE; int provided; @@ -4319,8 +4282,6 @@ main(int argc, char **argv) return -1; } - mpi_rank_framework_g = mpi_rank; - dim0 = ROW_FACTOR * mpi_size; dim1 = COL_FACTOR * mpi_size; @@ -4374,28 +4335,51 @@ main(int argc, char **argv) } /* Initialize testing framework */ - TestInit(argv[0], usage, parse_options); + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { + if (MAINPROCESS) { + fprintf(stderr, "couldn't initialize testing framework\n"); + fflush(stderr); + } + + MPI_Finalize(); + return -1; + } + + test_params.filename = PARATESTFILE; /* Shape Same tests using contiguous hyperslab */ - AddTest("sscontig1", sscontig1, NULL, "Cntg hslab, ind IO, cntg dsets", PARATESTFILE); - AddTest("sscontig2", sscontig2, NULL, "Cntg hslab, col IO, cntg dsets", PARATESTFILE); - AddTest("sscontig3", sscontig3, NULL, "Cntg hslab, ind IO, chnk dsets", PARATESTFILE); - AddTest("sscontig4", sscontig4, NULL, "Cntg hslab, col IO, chnk dsets", PARATESTFILE); + AddTest("sscontig1", sscontig1, NULL, NULL, &test_params, sizeof(test_params), + "Cntg hslab, ind IO, cntg dsets"); + AddTest("sscontig2", sscontig2, NULL, NULL, &test_params, sizeof(test_params), + "Cntg hslab, col IO, cntg dsets"); + AddTest("sscontig3", sscontig3, NULL, NULL, &test_params, sizeof(test_params), + "Cntg hslab, ind IO, chnk dsets"); + AddTest("sscontig4", sscontig4, NULL, NULL, &test_params, sizeof(test_params), + "Cntg hslab, col IO, chnk dsets"); /* Shape Same tests using checker board hyperslab */ - AddTest("sschecker1", sschecker1, NULL, "Check hslab, ind IO, cntg dsets", PARATESTFILE); - AddTest("sschecker2", sschecker2, NULL, "Check hslab, col IO, cntg dsets", PARATESTFILE); - AddTest("sschecker3", sschecker3, NULL, "Check hslab, ind IO, chnk dsets", PARATESTFILE); - AddTest("sschecker4", sschecker4, NULL, "Check hslab, col IO, chnk dsets", PARATESTFILE); + AddTest("sschecker1", sschecker1, NULL, NULL, &test_params, sizeof(test_params), + "Check hslab, ind IO, cntg dsets"); + AddTest("sschecker2", sschecker2, NULL, NULL, &test_params, sizeof(test_params), + "Check hslab, col IO, cntg dsets"); + AddTest("sschecker3", sschecker3, NULL, NULL, &test_params, sizeof(test_params), + "Check hslab, ind IO, chnk dsets"); + AddTest("sschecker4", sschecker4, NULL, NULL, &test_params, sizeof(test_params), + "Check hslab, col IO, chnk dsets"); /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); /* setup file access property list */ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* Parse command line arguments */ - TestParseCmdLine(argc, argv); + if (TestParseCmdLine(argc, argv) < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + MPI_Abort(MPI_COMM_WORLD, -1); + } if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) { printf("===================================\n" @@ -4413,7 +4397,7 @@ main(int argc, char **argv) /* Display test summary, if requested */ if (MAINPROCESS && GetTestSummary()) - TestSummary(); + TestSummary(stdout); /* Clean up test files */ h5_delete_all_test_files(FILENAME, fapl); diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index b381ef5d77c..1541bf6b894 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -36,8 +36,8 @@ #define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 -static void coll_write_test(int chunk_factor); -static void coll_read_test(void); +static void coll_write_test(const void *params, int chunk_factor); +static void coll_read_test(const void *params); /*------------------------------------------------------------------------- * Function: coll_irregular_cont_write @@ -52,7 +52,7 @@ static void coll_read_test(void); *------------------------------------------------------------------------- */ void -coll_irregular_cont_write(void) +coll_irregular_cont_write(const void *params) { int mpi_rank; @@ -71,7 +71,7 @@ coll_irregular_cont_write(void) return; } - coll_write_test(0); + coll_write_test(params, 0); } /*------------------------------------------------------------------------- @@ -87,7 +87,7 @@ coll_irregular_cont_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_cont_read(void) +coll_irregular_cont_read(const void *params) { int mpi_rank; @@ -106,7 +106,7 @@ coll_irregular_cont_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -122,7 +122,7 @@ coll_irregular_cont_read(void) *------------------------------------------------------------------------- */ void -coll_irregular_simple_chunk_write(void) +coll_irregular_simple_chunk_write(const void *params) { int mpi_rank; @@ -141,7 +141,7 @@ coll_irregular_simple_chunk_write(void) return; } - coll_write_test(1); + coll_write_test(params, 1); } /*------------------------------------------------------------------------- @@ -157,7 +157,7 @@ coll_irregular_simple_chunk_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_simple_chunk_read(void) +coll_irregular_simple_chunk_read(const void *params) { int mpi_rank; @@ -176,7 +176,7 @@ coll_irregular_simple_chunk_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -192,7 +192,7 @@ coll_irregular_simple_chunk_read(void) *------------------------------------------------------------------------- */ void -coll_irregular_complex_chunk_write(void) +coll_irregular_complex_chunk_write(const void *params) { int mpi_rank; @@ -211,7 +211,7 @@ coll_irregular_complex_chunk_write(void) return; } - coll_write_test(4); + coll_write_test(params, 4); } /*------------------------------------------------------------------------- @@ -227,7 +227,7 @@ coll_irregular_complex_chunk_write(void) *------------------------------------------------------------------------- */ void -coll_irregular_complex_chunk_read(void) +coll_irregular_complex_chunk_read(const void *params) { int mpi_rank; @@ -246,7 +246,7 @@ coll_irregular_complex_chunk_read(void) return; } - coll_read_test(); + coll_read_test(params); } /*------------------------------------------------------------------------- @@ -263,7 +263,7 @@ coll_irregular_complex_chunk_read(void) *------------------------------------------------------------------------- */ void -coll_write_test(int chunk_factor) +coll_write_test(const void *params, int chunk_factor) { const char *filename; @@ -301,7 +301,7 @@ coll_write_test(int chunk_factor) MPI_Comm_rank(comm, &mpi_rank); /* Obtain file name */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* * Buffers' initialization. @@ -717,7 +717,7 @@ coll_write_test(int chunk_factor) *------------------------------------------------------------------------- */ static void -coll_read_test(void) +coll_read_test(const void *params) { const char *filename; @@ -751,7 +751,7 @@ coll_read_test(void) MPI_Comm_rank(comm, &mpi_rank); /* Obtain file name */ - filename = GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; /* Initialize the buffer */ @@ -1504,8 +1504,8 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr, #define LDSCT_DS_RANK 5 static void -lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_collective_io, - const hid_t dset_type) +lower_dim_size_comp_test__run_test(const void *params, const int chunk_edge_size, + const bool use_collective_io, const hid_t dset_type) { #if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG const char *fcnName = "lower_dim_size_comp_test__run_test()"; @@ -1636,7 +1636,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_col /* get the file name */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* ---------------------------------------- @@ -2349,7 +2349,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const bool use_col */ void -lower_dim_size_comp_test(void) +lower_dim_size_comp_test(const void *params) { /* const char *fcnName = "lower_dim_size_comp_test()"; */ int chunk_edge_size = 0; @@ -2372,10 +2372,10 @@ lower_dim_size_comp_test(void) HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); for (use_collective_io = 0; use_collective_io <= 1; use_collective_io++) { chunk_edge_size = 0; - lower_dim_size_comp_test__run_test(chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); + lower_dim_size_comp_test__run_test(params, chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); chunk_edge_size = 5; - lower_dim_size_comp_test__run_test(chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); + lower_dim_size_comp_test__run_test(params, chunk_edge_size, (bool)use_collective_io, H5T_NATIVE_UINT); } /* end for */ return; @@ -2411,7 +2411,7 @@ lower_dim_size_comp_test(void) #define LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE 16 void -link_chunk_collective_io_test(void) +link_chunk_collective_io_test(const void *params) { /* const char *fcnName = "link_chunk_collective_io_test()"; */ const char *filename; @@ -2459,7 +2459,7 @@ link_chunk_collective_io_test(void) assert(mpi_size > 0); /* get the file name */ - filename = (const char *)GetTestParameters(); + filename = ((const H5Ptest_param_t *)params)->name; assert(filename != NULL); /* setup file access template */ diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index aa2da851eaa..68ae70c8ade 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -27,6 +27,9 @@ #ifdef H5_HAVE_SUBFILING_VFD +/* Include testing framework functionality -- currently just for test alarm timer */ +#include "testframe.h" + #include "H5FDsubfiling.h" #include "H5FDioc.h" @@ -3132,7 +3135,12 @@ main(int argc, char **argv) printf("Testing Subfiling VFD functionality\n"); } - TestAlarmOn(); + if (TestAlarmOn() < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't enable test timer\n"); + nerrors++; + goto exit; + } /* * Obtain and broadcast seed value since ranks diff --git a/testpar/t_vfd.c b/testpar/t_vfd.c index 3b924784ee3..5069577a318 100644 --- a/testpar/t_vfd.c +++ b/testpar/t_vfd.c @@ -14,7 +14,7 @@ * This file is a catchall for parallel VFD tests. */ -#include "testphdf5.h" +#include "testpar.h" #ifdef H5_HAVE_SUBFILING_VFD #include "H5FDsubfiling.h" diff --git a/testpar/testpar.c b/testpar/testpar.c new file mode 100644 index 00000000000..c674f61c5c2 --- /dev/null +++ b/testpar/testpar.c @@ -0,0 +1,107 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Provides support functions for hdf5 parallel tests. + */ + +#include "testpar.h" + +#define MAX_RANK 2 + +/* + * Create the appropriate File access property list + */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) +{ + hid_t ret_pl = H5I_INVALID_HID; + herr_t ret; /* generic return value */ + int mpi_rank; /* mpi variables */ + + /* need the rank for error checking macros */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + if ((ret_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + + if (l_facc_type == FACC_DEFAULT) + return ret_pl; + + if (l_facc_type == FACC_MPIO) { + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_mpio(ret_pl, comm, info)) < 0) + return H5I_INVALID_HID; + if ((ret = H5Pset_all_coll_metadata_ops(ret_pl, true)) < 0) + return H5I_INVALID_HID; + if ((ret = H5Pset_coll_metadata_write(ret_pl, true)) < 0) + return H5I_INVALID_HID; + return ret_pl; + } + + if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { + hid_t mpio_pl; + + if ((mpio_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_mpio(mpio_pl, comm, info)) < 0) + return H5I_INVALID_HID; + + /* setup file access template */ + if ((ret_pl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return H5I_INVALID_HID; + /* set Parallel access with communicator */ + if ((ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl)) < 0) + return H5I_INVALID_HID; + if (H5Pclose(mpio_pl) < 0) + return H5I_INVALID_HID; + + return ret_pl; + } + + /* unknown file access types */ + return ret_pl; +} + +/* + * Setup the coordinates for point selection. + */ +void +point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, + hsize_t coords[], int order) +{ + hsize_t i, j, k = 0, m, n, s1, s2; + + HDcompile_assert(MAX_RANK == 2); + + if (OUT_OF_ORDER == order) + k = (num_points * MAX_RANK) - 1; + else if (IN_ORDER == order) + k = 0; + + s1 = start[0]; + s2 = start[1]; + + for (i = 0; i < count[0]; i++) + for (j = 0; j < count[1]; j++) + for (m = 0; m < block[0]; m++) + for (n = 0; n < block[1]; n++) + if (OUT_OF_ORDER == order) { + coords[k--] = s2 + (stride[1] * j) + n; + coords[k--] = s1 + (stride[0] * i) + m; + } + else if (IN_ORDER == order) { + coords[k++] = s1 + stride[0] * i + m; + coords[k++] = s2 + stride[1] * j + n; + } +} diff --git a/testpar/testpar.h b/testpar/testpar.h index ca0f608d82e..71ff72a5f13 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -20,7 +20,30 @@ #include "h5test.h" +/* For now, include testing framework functionality since the MESG, VRFY, + * etc. macros depend on the test verbosity level + */ +#include "testframe.h" + +/* File_Access_type bits */ +#define FACC_DEFAULT 0x0 /* default */ +#define FACC_MPIO 0x1 /* MPIO */ +#define FACC_SPLIT 0x2 /* Split File */ + /* Constants definitions */ +#define DXFER_COLLECTIVE_IO 0x1 /* Collective IO */ +#define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */ + +/* Hyperslab layout styles */ +#define BYROW 1 /* divide into slabs of rows */ +#define BYCOL 2 /* divide into blocks of columns */ +#define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */ +#define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */ + +/* point selection order */ +#define IN_ORDER 1 +#define OUT_OF_ORDER 2 + #define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ /* Define some handy debugging shorthands, routines, ... */ @@ -104,6 +127,40 @@ MPI_BANNER("SYNC DONE"); \ } while (0) +/* Shared enum for some parallel tests that + * contains values to determine how parallel + * I/O is performed + */ +enum H5TEST_COLL_CHUNK_API { + API_NONE = 0, + API_LINK_HARD, + API_MULTI_HARD, + API_LINK_TRUE, + API_LINK_FALSE, + API_MULTI_COLL, + API_MULTI_IND +}; + +/* Shape Same Tests Definitions */ +typedef enum { + IND_CONTIG, /* Independent IO on contiguous datasets */ + COL_CONTIG, /* Collective IO on contiguous datasets */ + IND_CHUNKED, /* Independent IO on chunked datasets */ + COL_CHUNKED /* Collective IO on chunked datasets */ +} ShapeSameTestMethods; + /* End of Define some handy debugging shorthands, routines, ... */ +#ifdef __cplusplus +extern "C" { +#endif + +hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); + +void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, + hsize_t coords[], int order); + +#ifdef __cplusplus +} +#endif #endif /* TESTPAR_H */ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 960a5cf67a3..51dc3012c5b 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -104,20 +104,20 @@ MPI_Init(int *argc, char ***argv) * Show command usage */ static void -usage(void) +usage(FILE *stream) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, - COL_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + fprintf(stream, " [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + fprintf(stream, "\t-m" + "\tset number of datasets for the multiple dataset test\n"); + fprintf(stream, "\t-n" + "\tset number of groups for the multiple group test\n"); + fprintf(stream, "\t-f \tfilename prefix\n"); + fprintf(stream, "\t-2\t\tuse Split-file together with MPIO\n"); + fprintf(stream, "\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, + COL_FACTOR); + fprintf(stream, "\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + fprintf(stream, "\n"); } /* @@ -248,68 +248,12 @@ parse_options(int argc, char **argv) return (0); } -/* - * Create the appropriate File access property list - */ -hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) -{ - hid_t ret_pl = H5I_INVALID_HID; - herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ - - /* need the rank for error checking macros */ - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5Pcreate succeeded"); - - if (l_facc_type == FACC_DEFAULT) - return (ret_pl); - - if (l_facc_type == FACC_MPIO) { - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); - ret = H5Pset_all_coll_metadata_ops(ret_pl, true); - VRFY((ret >= 0), "H5Pset_all_coll_metadata_ops succeeded"); - ret = H5Pset_coll_metadata_write(ret_pl, true); - VRFY((ret >= 0), "H5Pset_coll_metadata_write succeeded"); - return (ret_pl); - } - - if (l_facc_type == (FACC_MPIO | FACC_SPLIT)) { - hid_t mpio_pl; - - mpio_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), "H5Pcreate succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); - - /* setup file access template */ - ret_pl = H5Pcreate(H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), "H5Pcreate succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return (ret_pl); - } - - /* unknown file access types */ - return (ret_pl); -} - int main(int argc, char **argv) { + H5Ptest_param_t test_params; int mpi_size, mpi_rank; /* mpi variables */ int mpi_code; - H5Ptest_param_t ndsets_params, ngroups_params; - H5Ptest_param_t collngroups_params; - H5Ptest_param_t io_mode_confusion_params; - H5Ptest_param_t rr_obj_flush_confusion_params; #ifdef H5_HAVE_TEST_API int required = MPI_THREAD_MULTIPLE; int provided; @@ -353,8 +297,6 @@ main(int argc, char **argv) return -1; } - mpi_rank_framework_g = mpi_rank; - dim0 = ROW_FACTOR * mpi_size; dim1 = COL_FACTOR * mpi_size; @@ -393,153 +335,183 @@ main(int argc, char **argv) VRFY((H5Pget_vol_cap_flags(fapl, &vol_cap_flags_g) >= 0), "H5Pget_vol_cap_flags succeeded"); /* Initialize testing framework */ - TestInit(argv[0], usage, parse_options); - - /* Tests are generally arranged from least to most complexity... */ - AddTest("mpiodup", test_fapl_mpio_dup, NULL, "fapl_mpio duplicate", NULL); - AddTest("getdxplmpio", test_get_dxpl_mpio, NULL, "dxpl_mpio get", PARATESTFILE); - - AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE); - AddTest("h5oflusherror", test_oflush, NULL, "H5Oflush failure", PARATESTFILE); - - AddTest("page_buffer", test_page_buffer_access, NULL, "page buffer usage in parallel", PARATESTFILE); - - AddTest("props", test_file_properties, NULL, "Coll Metadata file property settings", PARATESTFILE); - - AddTest("delete", test_delete, NULL, "MPI-IO VFD file delete", PARATESTFILE); - - AddTest("invlibverassert", test_invalid_libver_bounds_file_close_assert, NULL, - "Invalid libver bounds assertion failure", PARATESTFILE); - - AddTest("evictparassert", test_evict_on_close_parallel_unsupp, NULL, "Evict on close in parallel failure", - PARATESTFILE); - AddTest("fapl_preserve", test_fapl_preserve_hints, NULL, "preserve MPI I/O hints after fapl closed", - PARATESTFILE); - - AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); - AddTest("idsetr", dataset_readInd, NULL, "dataset independent read", PARATESTFILE); + if (TestInit(argv[0], usage, parse_options, mpi_rank) < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't initialize testing framework\n"); + MPI_Finalize(); + return -1; + } - AddTest("cdsetw", dataset_writeAll, NULL, "dataset collective write", PARATESTFILE); - AddTest("cdsetr", dataset_readAll, NULL, "dataset collective read", PARATESTFILE); + test_params.name = PARATESTFILE; + test_params.count = 0; - AddTest("eidsetw", extend_writeInd, NULL, "extendible dataset independent write", PARATESTFILE); - AddTest("eidsetr", extend_readInd, NULL, "extendible dataset independent read", PARATESTFILE); - AddTest("ecdsetw", extend_writeAll, NULL, "extendible dataset collective write", PARATESTFILE); - AddTest("ecdsetr", extend_readAll, NULL, "extendible dataset collective read", PARATESTFILE); - AddTest("eidsetw2", extend_writeInd2, NULL, "extendible dataset independent write #2", PARATESTFILE); - AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); - AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file", - PARATESTFILE); - AddTest("chkallocser2par", test_chunk_alloc_incr_ser_to_par, NULL, - "chunk allocation from serial to parallel file access", PARATESTFILE); - AddTest("fltread", test_filter_read, NULL, "parallel read of dataset written serially with filters", - PARATESTFILE); + /* Tests are generally arranged from least to most complexity... */ + AddTest("mpiodup", test_fapl_mpio_dup, NULL, NULL, NULL, 0, "fapl_mpio duplicate"); + AddTest("getdxplmpio", test_get_dxpl_mpio, NULL, NULL, &test_params, sizeof(test_params), + "dxpl_mpio get"); + + AddTest("split", test_split_comm_access, NULL, NULL, &test_params, sizeof(test_params), + "dataset using split communicators"); + AddTest("h5oflusherror", test_oflush, NULL, NULL, &test_params, sizeof(test_params), "H5Oflush failure"); + + AddTest("page_buffer", test_page_buffer_access, NULL, NULL, &test_params, sizeof(test_params), + "page buffer usage in parallel"); + + AddTest("props", test_file_properties, NULL, NULL, &test_params, sizeof(test_params), + "Coll Metadata file property settings"); + + AddTest("delete", test_delete, NULL, NULL, &test_params, sizeof(test_params), "MPI-IO VFD file delete"); + + AddTest("invlibverassert", test_invalid_libver_bounds_file_close_assert, NULL, NULL, &test_params, + sizeof(test_params), "Invalid libver bounds assertion failure"); + + AddTest("evictparassert", test_evict_on_close_parallel_unsupp, NULL, NULL, &test_params, + sizeof(test_params), "Evict on close in parallel failure"); + AddTest("fapl_preserve", test_fapl_preserve_hints, NULL, NULL, &test_params, sizeof(test_params), + "preserve MPI I/O hints after fapl closed"); + + AddTest("idsetw", dataset_writeInd, NULL, NULL, &test_params, sizeof(test_params), + "dataset independent write"); + AddTest("idsetr", dataset_readInd, NULL, NULL, &test_params, sizeof(test_params), + "dataset independent read"); + + AddTest("cdsetw", dataset_writeAll, NULL, NULL, &test_params, sizeof(test_params), + "dataset collective write"); + AddTest("cdsetr", dataset_readAll, NULL, NULL, &test_params, sizeof(test_params), + "dataset collective read"); + + AddTest("eidsetw", extend_writeInd, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset independent write"); + AddTest("eidsetr", extend_readInd, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset independent read"); + AddTest("ecdsetw", extend_writeAll, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset collective write"); + AddTest("ecdsetr", extend_readAll, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset collective read"); + AddTest("eidsetw2", extend_writeInd2, NULL, NULL, &test_params, sizeof(test_params), + "extendible dataset independent write #2"); + AddTest("selnone", none_selection_chunk, NULL, NULL, &test_params, sizeof(test_params), + "chunked dataset with none-selection"); + AddTest("calloc", test_chunk_alloc, NULL, NULL, &test_params, sizeof(test_params), + "parallel extend Chunked allocation on serial file"); + AddTest("chkallocser2par", test_chunk_alloc_incr_ser_to_par, NULL, NULL, &test_params, + sizeof(test_params), "chunk allocation from serial to parallel file access"); + AddTest("fltread", test_filter_read, NULL, NULL, &test_params, sizeof(test_params), + "parallel read of dataset written serially with filters"); #ifdef H5_HAVE_FILTER_DEFLATE - AddTest("cmpdsetr", compress_readAll, NULL, "compressed dataset collective read", PARATESTFILE); + AddTest("cmpdsetr", compress_readAll, NULL, NULL, &test_params, sizeof(test_params), + "compressed dataset collective read"); #endif /* H5_HAVE_FILTER_DEFLATE */ - AddTest("zerodsetr", zero_dim_dset, NULL, "zero dim dset", PARATESTFILE); + AddTest("zerodsetr", zero_dim_dset, NULL, NULL, &test_params, sizeof(test_params), "zero dim dset"); - ndsets_params.name = PARATESTFILE; - ndsets_params.count = ndatasets; - AddTest("ndsetw", multiple_dset_write, NULL, "multiple datasets write", &ndsets_params); + test_params.count = ndatasets; + AddTest("ndsetw", multiple_dset_write, NULL, NULL, &test_params, sizeof(test_params), + "multiple datasets write"); - ngroups_params.name = PARATESTFILE; - ngroups_params.count = ngroups; - AddTest("ngrpw", multiple_group_write, NULL, "multiple groups write", &ngroups_params); - AddTest("ngrpr", multiple_group_read, NULL, "multiple groups read", &ngroups_params); + test_params.count = ngroups; + AddTest("ngrpw", multiple_group_write, NULL, NULL, &test_params, sizeof(test_params), + "multiple groups write"); + AddTest("ngrpr", multiple_group_read, NULL, NULL, &test_params, sizeof(test_params), + "multiple groups read"); - AddTest("compact", compact_dataset, NULL, "compact dataset test", PARATESTFILE); + AddTest("compact", compact_dataset, NULL, NULL, &test_params, sizeof(test_params), + "compact dataset test"); - collngroups_params.name = PARATESTFILE; - collngroups_params.count = ngroups; + test_params.count = ngroups; /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ - AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL, - "collective grp/dset write - independent grp/dset read", &collngroups_params); + AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL, NULL, &test_params, + sizeof(test_params), "collective grp/dset write - independent grp/dset read"); #ifndef H5_HAVE_WIN32_API - AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); + AddTest("bigdset", big_dataset, NULL, NULL, &test_params, sizeof(test_params), "big dataset test"); #else printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif - AddTest("fill", dataset_fillvalue, NULL, "dataset fill value", PARATESTFILE); + AddTest("fill", dataset_fillvalue, NULL, NULL, &test_params, sizeof(test_params), "dataset fill value"); - AddTest("cchunk1", coll_chunk1, NULL, "simple collective chunk io", PARATESTFILE); - AddTest("cchunk2", coll_chunk2, NULL, "noncontiguous collective chunk io", PARATESTFILE); - AddTest("cchunk3", coll_chunk3, NULL, "multi-chunk collective chunk io", PARATESTFILE); - AddTest("cchunk4", coll_chunk4, NULL, "collective chunk io with partial non-selection ", PARATESTFILE); + AddTest("cchunk1", coll_chunk1, NULL, NULL, &test_params, sizeof(test_params), + "simple collective chunk io"); + AddTest("cchunk2", coll_chunk2, NULL, NULL, &test_params, sizeof(test_params), + "noncontiguous collective chunk io"); + AddTest("cchunk3", coll_chunk3, NULL, NULL, &test_params, sizeof(test_params), + "multi-chunk collective chunk io"); + AddTest("cchunk4", coll_chunk4, NULL, NULL, &test_params, sizeof(test_params), + "collective chunk io with partial non-selection"); if ((mpi_size < 3) && MAINPROCESS) { printf("Collective chunk IO optimization APIs "); printf("needs at least 3 processes to participate\n"); printf("Collective chunk IO API tests will be skipped \n"); } - AddTest((mpi_size < 3) ? "-cchunk5" : "cchunk5", coll_chunk5, NULL, - "linked chunk collective IO without optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk6" : "cchunk6", coll_chunk6, NULL, - "multi-chunk collective IO with direct request", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk7" : "cchunk7", coll_chunk7, NULL, - "linked chunk collective IO with optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk8" : "cchunk8", coll_chunk8, NULL, - "linked chunk collective IO transferring to multi-chunk", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk9" : "cchunk9", coll_chunk9, NULL, - "multiple chunk collective IO with optimization", PARATESTFILE); - AddTest((mpi_size < 3) ? "-cchunk10" : "cchunk10", coll_chunk10, NULL, - "multiple chunk collective IO transferring to independent IO", PARATESTFILE); + AddTest((mpi_size < 3) ? "-cchunk5" : "cchunk5", coll_chunk5, NULL, NULL, &test_params, + sizeof(test_params), "linked chunk collective IO without optimization"); + AddTest((mpi_size < 3) ? "-cchunk6" : "cchunk6", coll_chunk6, NULL, NULL, &test_params, + sizeof(test_params), "multi-chunk collective IO with direct request"); + AddTest((mpi_size < 3) ? "-cchunk7" : "cchunk7", coll_chunk7, NULL, NULL, &test_params, + sizeof(test_params), "linked chunk collective IO with optimization"); + AddTest((mpi_size < 3) ? "-cchunk8" : "cchunk8", coll_chunk8, NULL, NULL, &test_params, + sizeof(test_params), "linked chunk collective IO transferring to multi-chunk"); + AddTest((mpi_size < 3) ? "-cchunk9" : "cchunk9", coll_chunk9, NULL, NULL, &test_params, + sizeof(test_params), "multiple chunk collective IO with optimization"); + AddTest((mpi_size < 3) ? "-cchunk10" : "cchunk10", coll_chunk10, NULL, NULL, &test_params, + sizeof(test_params), "multiple chunk collective IO transferring to independent IO"); /* irregular collective IO tests*/ - AddTest("ccontw", coll_irregular_cont_write, NULL, "collective irregular contiguous write", PARATESTFILE); - AddTest("ccontr", coll_irregular_cont_read, NULL, "collective irregular contiguous read", PARATESTFILE); - AddTest("cschunkw", coll_irregular_simple_chunk_write, NULL, "collective irregular simple chunk write", - PARATESTFILE); - AddTest("cschunkr", coll_irregular_simple_chunk_read, NULL, "collective irregular simple chunk read", - PARATESTFILE); - AddTest("ccchunkw", coll_irregular_complex_chunk_write, NULL, "collective irregular complex chunk write", - PARATESTFILE); - AddTest("ccchunkr", coll_irregular_complex_chunk_read, NULL, "collective irregular complex chunk read", - PARATESTFILE); - - AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE); - - io_mode_confusion_params.name = PARATESTFILE; - io_mode_confusion_params.count = 0; /* value not used */ - - AddTest("I/Omodeconf", io_mode_confusion, NULL, "I/O mode confusion test -- hangs quickly on failure", - &io_mode_confusion_params); + AddTest("ccontw", coll_irregular_cont_write, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular contiguous write"); + AddTest("ccontr", coll_irregular_cont_read, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular contiguous read"); + AddTest("cschunkw", coll_irregular_simple_chunk_write, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular simple chunk write"); + AddTest("cschunkr", coll_irregular_simple_chunk_read, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular simple chunk read"); + AddTest("ccchunkw", coll_irregular_complex_chunk_write, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular complex chunk write"); + AddTest("ccchunkr", coll_irregular_complex_chunk_read, NULL, NULL, &test_params, sizeof(test_params), + "collective irregular complex chunk read"); + + AddTest("null", null_dataset, NULL, NULL, &test_params, sizeof(test_params), "null dataset test"); + + test_params.count = 0; + AddTest("I/Omodeconf", io_mode_confusion, NULL, NULL, &test_params, sizeof(test_params), + "I/O mode confusion test -- hangs quickly on failure"); if ((mpi_size < 3) && MAINPROCESS) { printf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n"); printf("rr_obj_hdr_flush_confusion test will be skipped \n"); } if (mpi_size > 2) { - rr_obj_flush_confusion_params.name = PARATESTFILE; - rr_obj_flush_confusion_params.count = 0; /* value not used */ - AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, - "round robin object header flush confusion test", &rr_obj_flush_confusion_params); + test_params.count = 0; + AddTest("rrobjflushconf", rr_obj_hdr_flush_confusion, NULL, NULL, &test_params, sizeof(test_params), + "round robin object header flush confusion test"); } - AddTest("alnbg1", chunk_align_bug_1, NULL, "Chunk allocation with alignment bug.", PARATESTFILE); + AddTest("alnbg1", chunk_align_bug_1, NULL, NULL, &test_params, sizeof(test_params), + "Chunk allocation with alignment bug."); - AddTest("tldsc", lower_dim_size_comp_test, NULL, - "test lower dim size comp in span tree to mpi derived type", PARATESTFILE); + AddTest("tldsc", lower_dim_size_comp_test, NULL, NULL, &test_params, sizeof(test_params), + "test lower dim size comp in span tree to mpi derived type"); - AddTest("lccio", link_chunk_collective_io_test, NULL, "test mpi derived type management", PARATESTFILE); + AddTest("lccio", link_chunk_collective_io_test, NULL, NULL, &test_params, sizeof(test_params), + "test mpi derived type management"); - AddTest("actualio", actual_io_mode_tests, NULL, "test actual io mode proprerty", PARATESTFILE); + AddTest("actualio", actual_io_mode_tests, NULL, NULL, &test_params, sizeof(test_params), + "test actual io mode proprerty"); - AddTest("nocolcause", no_collective_cause_tests, NULL, "test cause for broken collective io", - PARATESTFILE); + AddTest("nocolcause", no_collective_cause_tests, NULL, NULL, &test_params, sizeof(test_params), + "test cause for broken collective io"); - AddTest("edpl", test_plist_ed, NULL, "encode/decode Property Lists", NULL); + AddTest("edpl", test_plist_ed, NULL, NULL, NULL, 0, "encode/decode Property Lists"); - AddTest("extlink", external_links, NULL, "test external links", NULL); + AddTest("extlink", external_links, NULL, NULL, NULL, 0, "test external links"); if ((mpi_size < 2) && MAINPROCESS) { printf("File Image Ops daisy chain test needs at least 2 processes.\n"); printf("File Image Ops daisy chain test will be skipped \n"); } - AddTest((mpi_size < 2) ? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL, - "file image ops daisy chain", NULL); + AddTest((mpi_size < 2) ? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL, NULL, NULL, 0, + "file image ops daisy chain"); /* Atomicity operations are not supported for OpenMPI versions < major * version 5 and will sporadically fail. @@ -557,31 +529,38 @@ main(int argc, char **argv) printf("Atomicity tests will not work with a non MPIO VFD\n"); } else if (mpi_size >= 2 && facc_type == FACC_MPIO) { - AddTest("atomicity", dataset_atomicity, NULL, "dataset atomic updates", PARATESTFILE); + AddTest("atomicity", dataset_atomicity, NULL, NULL, &test_params, sizeof(test_params), + "dataset atomic updates"); } #endif - AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); + AddTest("denseattr", test_dense_attr, NULL, NULL, &test_params, sizeof(test_params), + "Store Dense Attributes"); - AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, - "Collective Metadata read with some ranks having no selection", PARATESTFILE); - AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL, - "Collective MD read with multi chunk I/O (H5D__chunk_addrmap)", PARATESTFILE); - AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL, - "Collective MD read with link chunk I/O (H5D__sort_chunk)", PARATESTFILE); - AddTest("GH_coll_MD_wr", test_collective_global_heap_write, NULL, - "Collective MD write of global heap data", PARATESTFILE); - AddTest("COLLIO_INDMDWR", test_coll_io_ind_md_write, NULL, - "Collective I/O with Independent metadata writes", PARATESTFILE); + AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, NULL, &test_params, + sizeof(test_params), "Collective Metadata read with some ranks having no selection"); + AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL, NULL, &test_params, + sizeof(test_params), "Collective MD read with multi chunk I/O (H5D__chunk_addrmap)"); + AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL, NULL, &test_params, + sizeof(test_params), "Collective MD read with link chunk I/O (H5D__sort_chunk)"); + AddTest("GH_coll_MD_wr", test_collective_global_heap_write, NULL, NULL, &test_params, sizeof(test_params), + "Collective MD write of global heap data"); + AddTest("COLLIO_INDMDWR", test_coll_io_ind_md_write, NULL, NULL, &test_params, sizeof(test_params), + "Collective I/O with Independent metadata writes"); /* Display testing information */ - TestInfo(argv[0]); + TestInfo(stdout); /* setup file access property list */ H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* Parse command line arguments */ - TestParseCmdLine(argc, argv); + if (TestParseCmdLine(argc, argv) < 0) { + if (MAINPROCESS) + fprintf(stderr, "couldn't parse command-line arguments\n"); + TestShutdown(); + MPI_Abort(MPI_COMM_WORLD, -1); + } if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) { printf("===================================\n" @@ -599,7 +578,7 @@ main(int argc, char **argv) /* Display test summary, if requested */ if (MAINPROCESS && GetTestSummary()) - TestSummary(); + TestSummary(stdout); /* Clean up test files */ h5_delete_all_test_files(FILENAME, fapl); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 31b7c6963d5..345045e4f28 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -15,17 +15,10 @@ #ifndef PHDF5TEST_H #define PHDF5TEST_H -#include "testpar.h" +/* Include testing framework functionality */ +#include "testframe.h" -enum H5TEST_COLL_CHUNK_API { - API_NONE = 0, - API_LINK_HARD, - API_MULTI_HARD, - API_LINK_TRUE, - API_LINK_FALSE, - API_MULTI_COLL, - API_MULTI_IND -}; +#include "testpar.h" #ifndef false #define false 0 @@ -51,23 +44,6 @@ enum H5TEST_COLL_CHUNK_API { #define DATASETNAME8 "Data8" #define DATASETNAME9 "Data9" -/* point selection order */ -#define IN_ORDER 1 -#define OUT_OF_ORDER 2 - -/* Hyperslab layout styles */ -#define BYROW 1 /* divide into slabs of rows */ -#define BYCOL 2 /* divide into blocks of columns */ -#define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */ -#define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */ - -/* File_Access_type bits */ -#define FACC_DEFAULT 0x0 /* default */ -#define FACC_MPIO 0x1 /* MPIO */ -#define FACC_SPLIT 0x2 /* Split File */ - -#define DXFER_COLLECTIVE_IO 0x1 /* Collective IO*/ -#define DXFER_INDEPENDENT_IO 0x2 /* Independent IO collectively */ /*Constants for collective chunk definitions */ #define SPACE_DIM1 24 #define SPACE_DIM2 4 @@ -211,14 +187,6 @@ typedef struct H5Ptest_param_t /* holds extra test parameters */ /* Dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; -/* Shape Same Tests Definitions */ -typedef enum { - IND_CONTIG, /* Independent IO on contiguous datasets */ - COL_CONTIG, /* Collective IO on contiguous datasets */ - IND_CHUNKED, /* Independent IO on chunked datasets */ - COL_CHUNKED /* Collective IO on chunked datasets */ -} ShapeSameTestMethods; - /* Shared global variables */ extern int dim0, dim1; /*Dataset dimensions */ extern int chunkdim0, chunkdim1; /*Chunk dimensions */ @@ -227,86 +195,81 @@ extern int facc_type; /*Test file access type */ extern int dxfer_coll_type; /* Test program prototypes */ -void test_plist_ed(void); -void external_links(void); -void zero_dim_dset(void); -void test_file_properties(void); -void test_delete(void); -void test_invalid_libver_bounds_file_close_assert(void); -void test_evict_on_close_parallel_unsupp(void); -void test_fapl_preserve_hints(void); -void multiple_dset_write(void); -void multiple_group_write(void); -void multiple_group_read(void); -void collective_group_write_independent_group_read(void); -void collective_group_write(void); -void independent_group_read(void); -void test_fapl_mpio_dup(void); -void test_get_dxpl_mpio(void); -void test_split_comm_access(void); -void test_page_buffer_access(void); -void dataset_atomicity(void); -void dataset_writeInd(void); -void dataset_writeAll(void); -void extend_writeInd(void); -void extend_writeInd2(void); -void extend_writeAll(void); -void dataset_readInd(void); -void dataset_readAll(void); -void extend_readInd(void); -void extend_readAll(void); -void none_selection_chunk(void); -void actual_io_mode_tests(void); -void no_collective_cause_tests(void); -void test_chunk_alloc(void); -void test_chunk_alloc_incr_ser_to_par(void); -void test_filter_read(void); -void compact_dataset(void); -void null_dataset(void); -void big_dataset(void); -void dataset_fillvalue(void); -void coll_chunk1(void); -void coll_chunk2(void); -void coll_chunk3(void); -void coll_chunk4(void); -void coll_chunk5(void); -void coll_chunk6(void); -void coll_chunk7(void); -void coll_chunk8(void); -void coll_chunk9(void); -void coll_chunk10(void); -void coll_irregular_cont_read(void); -void coll_irregular_cont_write(void); -void coll_irregular_simple_chunk_read(void); -void coll_irregular_simple_chunk_write(void); -void coll_irregular_complex_chunk_read(void); -void coll_irregular_complex_chunk_write(void); -void io_mode_confusion(void); -void rr_obj_hdr_flush_confusion(void); -void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm); -void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm); -void chunk_align_bug_1(void); -void lower_dim_size_comp_test(void); -void link_chunk_collective_io_test(void); +void test_plist_ed(const void *params); +void external_links(const void *params); +void zero_dim_dset(const void *params); +void test_file_properties(const void *params); +void test_delete(const void *params); +void test_invalid_libver_bounds_file_close_assert(const void *params); +void test_evict_on_close_parallel_unsupp(const void *params); +void test_fapl_preserve_hints(const void *params); +void multiple_dset_write(const void *params); +void multiple_group_write(const void *params); +void multiple_group_read(const void *params); +void collective_group_write_independent_group_read(const void *params); +void collective_group_write(const void *params); +void independent_group_read(const void *params); +void test_fapl_mpio_dup(const void *params); +void test_get_dxpl_mpio(const void *params); +void test_split_comm_access(const void *params); +void test_page_buffer_access(const void *params); +void dataset_atomicity(const void *params); +void dataset_writeInd(const void *params); +void dataset_writeAll(const void *params); +void extend_writeInd(const void *params); +void extend_writeInd2(const void *params); +void extend_writeAll(const void *params); +void dataset_readInd(const void *params); +void dataset_readAll(const void *params); +void extend_readInd(const void *params); +void extend_readAll(const void *params); +void none_selection_chunk(const void *params); +void actual_io_mode_tests(const void *params); +void no_collective_cause_tests(const void *params); +void test_chunk_alloc(const void *params); +void test_chunk_alloc_incr_ser_to_par(const void *params); +void test_filter_read(const void *params); +void compact_dataset(const void *params); +void null_dataset(const void *params); +void big_dataset(const void *params); +void dataset_fillvalue(const void *params); +void coll_chunk1(const void *params); +void coll_chunk2(const void *params); +void coll_chunk3(const void *params); +void coll_chunk4(const void *params); +void coll_chunk5(const void *params); +void coll_chunk6(const void *params); +void coll_chunk7(const void *params); +void coll_chunk8(const void *params); +void coll_chunk9(const void *params); +void coll_chunk10(const void *params); +void coll_irregular_cont_read(const void *params); +void coll_irregular_cont_write(const void *params); +void coll_irregular_simple_chunk_read(const void *params); +void coll_irregular_simple_chunk_write(const void *params); +void coll_irregular_complex_chunk_read(const void *params); +void coll_irregular_complex_chunk_write(const void *params); +void io_mode_confusion(const void *params); +void rr_obj_hdr_flush_confusion(const void *params); +void chunk_align_bug_1(const void *params); +void lower_dim_size_comp_test(const void *params); +void link_chunk_collective_io_test(const void *params); void contig_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); void checker_board_hyperslab_dr_pio_test(ShapeSameTestMethods sstest_type); -void file_image_daisy_chain_test(void); +void file_image_daisy_chain_test(const void *params); #ifdef H5_HAVE_FILTER_DEFLATE -void compress_readAll(void); +void compress_readAll(const void *params); #endif /* H5_HAVE_FILTER_DEFLATE */ -void test_dense_attr(void); -void test_partial_no_selection_coll_md_read(void); -void test_multi_chunk_io_addrmap_issue(void); -void test_link_chunk_io_sort_chunk_issue(void); -void test_collective_global_heap_write(void); -void test_coll_io_ind_md_write(void); -void test_oflush(void); +void test_dense_attr(const void *params); +void test_partial_no_selection_coll_md_read(const void *params); +void test_multi_chunk_io_addrmap_issue(const void *params); +void test_link_chunk_io_sort_chunk_issue(const void *params); +void test_collective_global_heap_write(const void *params); +void test_coll_io_ind_md_write(const void *params); +void test_oflush(const void *params); /* commonly used prototypes */ -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type); MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); -int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, - DATATYPE *original); -void point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], size_t num_points, - hsize_t coords[], int order); +int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, + DATATYPE *original); #endif /* PHDF5TEST_H */ diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index fa1dc90081b..1cbed04df19 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -752,7 +752,7 @@ check_options(pack_opt_t *options) if (options->ublock_filename == NULL && options->ublock_size != 0) { if (options->verbose > 0) { - printf("Warning: user block file name missing. Reserving a size of %ld...\n", + printf("Warning: user block file name missing. Reserving a size of %" PRIuHSIZE "...\n", options->ublock_size); } }
diff --git a/doxygen/dox/ReferenceManual.dox b/doxygen/dox/ReferenceManual.dox index ac1a4f22904..fa1b9f931fe 100644 --- a/doxygen/dox/ReferenceManual.dox +++ b/doxygen/dox/ReferenceManual.dox @@ -31,7 +31,7 @@ The functions provided by the HDF5 API are grouped into the following
Event Set (H5ES)@ref H5ES "C""C++""Fortran""Java"HDF5 event set life cycle used with HDF5 VOL connectors that enable the asynchronous feature in HDF5. +Event Set (H5ES)@ref H5ES "C""C++"@ref FH5ES "Fortran""Java"HDF5 event set life cycle used with HDF5 VOL connectors that enable the asynchronous feature in HDF5.