diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | config/cmake/cacheinit.cmake | 2 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 36 | ||||
-rw-r--r-- | test/err_compat.c | 196 | ||||
-rw-r--r-- | test/testfiles/err_compat_2 | 2 |
5 files changed, 133 insertions, 106 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index eb22c7e..a9a759f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -642,7 +642,8 @@ if (H5_HAVE_PARALLEL) endif () endif () -#set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) +#option (DEFAULT_API_VERSION "Enable v1.12 API (v16, v18, v110, v112)" "v112") +set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)") set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112) #----------------------------------------------------------------------------- # Option to use 1.6.x API diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 01c2221..5254115 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -35,8 +35,6 @@ set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) -set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) - set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cc166ec..f763897 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -776,15 +776,43 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +else () + add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" + -D "TEST_OUTPUT=err_compat.txt" + -D "TEST_REFERENCE=err_compat_2" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-err_compat PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) endif () #-- Adding test for error_test if (HDF5_USE_16_API_DEFAULT OR MINGW) - add_test ( - NAME H5TEST-error_test - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $<TARGET_FILE:error_test>" + add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:error_test>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_2" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-error_test PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" diff --git a/test/err_compat.c b/test/err_compat.c index 4860a3c..ed85524 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests Error API + * Purpose: Tests Error API */ #include "h5test.h" #ifdef H5_NO_DEPRECATED_SYMBOLS int main(void) { - printf("Test skipped because backward compatability with v1.6 is NOT configured in\n"); + printf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); return 0; } #else /* H5_NO_DEPRECATED_SYMBOLS */ @@ -35,7 +35,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)-1 @@ -43,17 +43,17 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data); herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data); - + /*------------------------------------------------------------------------- - * Function: user_print1 + * Function: user_print1 * - * Purpose: This function is a user-defined old-style printing function. - * This is just a convenience function for H5Ewalk1() with a + * Purpose: This function is a user-defined old-style printing function. + * This is just a convenience function for H5Ewalk1() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -73,17 +73,17 @@ user_print1(FILE *stream) } - + /*------------------------------------------------------------------------- - * Function: user_print2 + * Function: user_print2 * - * Purpose: This function is a user-defined new-style printing function. - * This is just a convenience function for H5Ewalk2() with a + * Purpose: This function is a user-defined new-style printing function. + * This is just a convenience function for H5Ewalk2() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -103,18 +103,18 @@ user_print2(hid_t err_stack, FILE *stream) } - + /*------------------------------------------------------------------------- * Function: custom_print_cb1 * - * Purpose: Callback function to print error stack in customized way + * Purpose: Callback function to print error stack in customized way * for H5Ewalk1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * * Modifications: @@ -124,10 +124,10 @@ user_print2(hid_t err_stack, FILE *stream) herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) { - FILE *stream = (FILE *)client_data; + FILE *stream = (FILE *)client_data; char *maj = NULL; char *min = NULL; - const int indent = 4; + const int indent = 4; if(NULL == (min = H5Eget_minor(err_desc->min_num))) TEST_ERROR; @@ -136,9 +136,9 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) TEST_ERROR; fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); - + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -152,22 +152,22 @@ error: H5free_memory(maj); if(min) H5free_memory(min); - + return -1; } - + /*------------------------------------------------------------------------- * Function: custom_print_cb2 * - * Purpose: Callback function to print error stack in customized way + * Purpose: Callback function to print error stack in customized way * for H5Ewalk1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * * Modifications: @@ -177,10 +177,10 @@ error: herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) { - FILE *stream = (FILE *)client_data; + FILE *stream = (FILE *)client_data; char *maj = NULL; char *min = NULL; - const int indent = 4; + const int indent = 4; if(NULL == (min = H5Eget_minor(err_desc->min_num))) TEST_ERROR; @@ -189,9 +189,9 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) TEST_ERROR; fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); - + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -205,22 +205,22 @@ error: H5free_memory(maj); if(min) H5free_memory(min); - + return -1; } - + /*------------------------------------------------------------------------- - * Function: test_error1 + * Function: test_error1 * - * Purpose: Test the backward compatibility of H5Eset/get_auto. + * Purpose: Test the backward compatibility of H5Eset/get_auto. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * 17 September 2010 + * Programmer: Raymond Lu + * 17 September 2010 * * * Modifications: @@ -230,8 +230,8 @@ error: static herr_t test_error1(void) { - hid_t dataset, space; - hsize_t dims[2]; + hid_t dataset, space; + hsize_t dims[2]; H5E_auto1_t old_func1; H5E_auto2_t old_func2; void *old_data; @@ -245,48 +245,48 @@ test_error1(void) dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; - /* Use H5Eget_auto2 to query the default printing function. The library + /* Use H5Eget_auto2 to query the default printing function. The library *should indicate H5Eprint2 as the default. */ if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0) - TEST_ERROR; + TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) - TEST_ERROR; + TEST_ERROR; /* This function sets the default printing function to be H5Eprint2. */ if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; /* This call should work. It simply returns H5Eprint1. */ if((ret = H5Eget_auto1(&old_func1, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func1 || (H5E_auto1_t)H5Eprint1 != old_func1) - TEST_ERROR; + TEST_ERROR; /* This function changes the old-style printing function to be user_print1. */ if(H5Eset_auto1((H5E_auto1_t)user_print1, stderr)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; - /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. - * Once the H5Eset_auto1 is called with a user-defined printing function, - * a call to H5Eget_auto2 will fail. But keep in mind the printing function is + /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. + * Once the H5Eset_auto1 is called with a user-defined printing function, + * a call to H5Eget_auto2 will fail. But keep in mind the printing function is * user_print1. */ if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))>=0) TEST_ERROR; @@ -295,44 +295,44 @@ test_error1(void) if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; /* This function changes the new-style printing function back to the default H5Eprint2. */ if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL)<0) TEST_ERROR; - /* This call should work because the H5Eset_auto2 above restored the default printing + /* This call should work because the H5Eset_auto2 above restored the default printing * function H5Eprint2. It simply returns user_print1. */ if((ret = H5Eget_auto1(&old_func1, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func1 || (H5E_auto1_t)user_print1 != old_func1) - TEST_ERROR; + TEST_ERROR; /* This function changes the new-style printing function back to the default H5Eprint1. */ if(H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL)<0) TEST_ERROR; - /* This call should work because the H5Eset_auto1 above restored the default printing + /* This call should work because the H5Eset_auto1 above restored the default printing * function H5Eprint1. It simply returns H5Eprint2. */ if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) - TEST_ERROR; + TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; return 0; @@ -341,18 +341,18 @@ test_error1(void) return -1; } - + /*------------------------------------------------------------------------- - * Function: test_error2 + * Function: test_error2 * - * Purpose: Test error API functions, mainly on H5Epush1. + * Purpose: Test error API functions, mainly on H5Epush1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * July 10, 2003 + * Programmer: Raymond Lu + * July 10, 2003 * * * Modifications: @@ -362,8 +362,8 @@ test_error1(void) static herr_t test_error2(hid_t file) { - hid_t dataset, space; - hsize_t dims[2]; + hid_t dataset, space; + hsize_t dims[2]; const char *FUNC_test_error="test_error2"; TESTING("error API based on data I/O"); @@ -381,7 +381,7 @@ test_error2(hid_t file) /* Create the dataset */ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, "H5Dcreate2 failed"); goto error; @@ -411,18 +411,18 @@ test_error2(hid_t file) return -1; } - + /*------------------------------------------------------------------------- * Function: dump_error * - * Purpose: Prints error stack in default and customized ways. + * Purpose: Prints error stack in default and customized ways. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * July 17, 2003 + * Programmer: Raymond Lu + * July 17, 2003 * * * Modifications: @@ -449,14 +449,14 @@ dump_error(void) } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test error API. + * Purpose: Test error API. * - * Programmer: Raymond Lu - * July 10, 2003 + * Programmer: Raymond Lu + * July 10, 2003 * * Modifications: * @@ -465,8 +465,8 @@ dump_error(void) int main(void) { - hid_t file, fapl; - char filename[1024]; + hid_t file, fapl; + char filename[1024]; const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); @@ -474,7 +474,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR ; + TEST_ERROR ; /* Test error stack */ diff --git a/test/testfiles/err_compat_2 b/test/testfiles/err_compat_2 index 75e8769..467ba4c 100644 --- a/test/testfiles/err_compat_2 +++ b/test/testfiles/err_compat_2 @@ -1 +1 @@ -Test skipped because backward compatbility with v1.6 is NOT configured in +Test skipped because backward compatibility with v1.6 is NOT configured in |