2003-04-01 01:59:04 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:04 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
1997-07-31 05:17:56 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This header file contains information required for testing the HDF5 library.
|
|
|
|
*/
|
|
|
|
|
2004-01-07 01:53:13 +08:00
|
|
|
#ifndef TESTHDF5_H
|
|
|
|
#define TESTHDF5_H
|
1997-07-31 05:17:56 +08:00
|
|
|
|
2004-01-07 01:53:13 +08:00
|
|
|
/* Include generic testing header also */
|
|
|
|
#include "h5test.h"
|
|
|
|
|
1997-07-31 05:17:56 +08:00
|
|
|
/* Use %ld to print the value because long should cover most cases. */
|
|
|
|
/* Used to make certain a return value _is_not_ a value */
|
2020-09-30 22:27:10 +08:00
|
|
|
#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)); \
|
|
|
|
} \
|
|
|
|
if ((ret) == (val)) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
|
|
|
|
"in %s\n", \
|
|
|
|
where, (long)(ret), (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define CHECK_I(ret, where) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
if (VERBOSE_HI) { \
|
|
|
|
print_func(" 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), \
|
|
|
|
(int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2003-09-25 03:26:50 +08:00
|
|
|
|
2017-11-27 10:13:18 +08:00
|
|
|
/* Check that a pointer is valid (i.e.: not NULL) */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define CHECK_PTR(ret, where) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
if (VERBOSE_HI) { \
|
|
|
|
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
|
2022-07-11 23:29:46 +08:00
|
|
|
__FILE__, ((const void *)ret)); \
|
2020-09-30 22:27:10 +08:00
|
|
|
} \
|
|
|
|
if (!(ret)) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \
|
|
|
|
__FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2003-09-25 03:26:50 +08:00
|
|
|
|
2017-11-28 00:57:26 +08:00
|
|
|
/* Check that a pointer is NULL */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define CHECK_PTR_NULL(ret, where) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
if (VERBOSE_HI) { \
|
|
|
|
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
|
2022-07-11 23:29:46 +08:00
|
|
|
__FILE__, ((const void *)ret)); \
|
2020-09-30 22:27:10 +08:00
|
|
|
} \
|
|
|
|
if (ret) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \
|
|
|
|
(int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2017-11-28 00:57:26 +08:00
|
|
|
|
|
|
|
/* Check that two pointers are equal */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define CHECK_PTR_EQ(ret, val, where) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
if (VERBOSE_HI) { \
|
|
|
|
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
|
|
|
|
__FILE__, (const void *)(ret)); \
|
|
|
|
} \
|
|
|
|
if (ret != val) { \
|
|
|
|
TestErrPrintf( \
|
|
|
|
"*** UNEXPECTED RETURN from %s: returned value of %p is not equal to %p line %4d in %s\n", \
|
|
|
|
(where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2015-03-09 08:41:54 +08:00
|
|
|
|
2003-09-25 03:26:50 +08:00
|
|
|
/* Used to make certain a return value _is_ a value */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define VERIFY(_x, _val, where) \
|
|
|
|
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); \
|
|
|
|
} \
|
|
|
|
if ((__x) != (__val)) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
|
|
|
|
"in %s\n", \
|
|
|
|
(where), __val, __x, (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2003-09-25 03:26:50 +08:00
|
|
|
|
[svn-r17461] Description:
Fix a few more problems when the user block is not aligned properly.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.8 (amazon) in debug mode
Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-09-11 03:02:40 +08:00
|
|
|
/* Used to make certain a (non-'long' type's) return value _is_ a value */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define VERIFY_TYPE(_x, _val, _type, _format, where) \
|
|
|
|
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); \
|
|
|
|
} \
|
|
|
|
if ((__x) != (__val)) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED VALUE from %s should be " _format ", but is " _format \
|
|
|
|
" at line %4d " \
|
|
|
|
"in %s\n", \
|
|
|
|
(where), __val, __x, (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
[svn-r17461] Description:
Fix a few more problems when the user block is not aligned properly.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.8 (amazon) in debug mode
Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-09-11 03:02:40 +08:00
|
|
|
|
2005-07-21 22:48:26 +08:00
|
|
|
/* Used to make certain a string return value _is_ a value */
|
2020-09-30 22:27:10 +08:00
|
|
|
#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); \
|
|
|
|
} \
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(x, val) != 0) { \
|
2020-09-30 22:27:10 +08:00
|
|
|
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
|
|
|
|
"in %s\n", \
|
|
|
|
where, val, x, (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2005-07-21 22:48:26 +08:00
|
|
|
|
2003-09-25 03:26:50 +08:00
|
|
|
/* Used to document process through a test and to check for errors */
|
2020-09-30 22:27:10 +08:00
|
|
|
#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)); \
|
|
|
|
} \
|
|
|
|
if (VERBOSE_HI) \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
if ((ret) == FAIL) { \
|
|
|
|
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
|
|
|
|
"in %s\n", \
|
|
|
|
func, (long)(ret), (int)__LINE__, __FILE__); \
|
|
|
|
H5Eprint2(H5E_DEFAULT, stdout); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2003-09-25 03:26:50 +08:00
|
|
|
|
1997-07-31 05:17:56 +08:00
|
|
|
/* Used to document process through a test */
|
2012-09-14 01:08:01 +08:00
|
|
|
#if defined(H5_HAVE_PARALLEL) && defined(H5_PARALLEL_TEST)
|
2020-09-30 22:27:10 +08:00
|
|
|
#define MESSAGE(V, A) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
int mpi_rank; \
|
|
|
|
\
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \
|
|
|
|
if (mpi_rank == 0 && HDGetTestVerbosity() > (V)) \
|
|
|
|
print_func A; \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2012-09-14 01:08:01 +08:00
|
|
|
#else /* H5_HAVE_PARALLEL */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define MESSAGE(V, A) \
|
2023-06-16 12:49:02 +08:00
|
|
|
do { \
|
2020-09-30 22:27:10 +08:00
|
|
|
if (HDGetTestVerbosity() > (V)) \
|
|
|
|
print_func A; \
|
2023-06-16 12:49:02 +08:00
|
|
|
} while (0)
|
2012-09-14 01:08:01 +08:00
|
|
|
#endif /* H5_HAVE_PARALLEL */
|
1997-07-31 05:17:56 +08:00
|
|
|
|
2010-02-10 06:32:28 +08:00
|
|
|
/* Used to indicate an error that is complex to check for */
|
2020-09-30 22:27:10 +08:00
|
|
|
#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__); \
|
|
|
|
TestErrPrintf("*** UNEXPECTED RESULT from %s at line %4d in %s\n", where, (int)__LINE__, __FILE__); \
|
|
|
|
} while (0)
|
2010-02-10 06:32:28 +08:00
|
|
|
|
1997-07-31 05:17:56 +08:00
|
|
|
/* definitions for command strings */
|
2020-09-30 22:27:10 +08:00
|
|
|
#define VERBOSITY_STR "Verbosity"
|
|
|
|
#define SKIP_STR "Skip"
|
|
|
|
#define TEST_STR "Test"
|
|
|
|
#define CLEAN_STR "Cleanup"
|
1997-07-31 05:17:56 +08:00
|
|
|
|
2004-01-10 09:41:13 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
1997-07-31 05:17:56 +08:00
|
|
|
/* Prototypes for the test routines */
|
2019-08-25 03:07:19 +08:00
|
|
|
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);
|
2019-07-17 00:15:43 +08:00
|
|
|
void test_reference_deprec(void);
|
2019-08-25 03:07:19 +08:00
|
|
|
void test_vltypes(void);
|
|
|
|
void test_vlstrings(void);
|
|
|
|
void test_iterate(void);
|
|
|
|
void test_array(void);
|
|
|
|
void test_genprop(void);
|
|
|
|
void test_configure(void);
|
2022-08-06 07:11:13 +08:00
|
|
|
void test_h5_system(void);
|
2019-08-25 03:07:19 +08:00
|
|
|
void test_misc(void);
|
|
|
|
void test_ids(void);
|
|
|
|
void test_skiplist(void);
|
|
|
|
void test_sohm(void);
|
|
|
|
void test_unicode(void);
|
1997-07-31 05:17:56 +08:00
|
|
|
|
1998-07-03 08:57:00 +08:00
|
|
|
/* Prototypes for the cleanup routines */
|
2019-08-25 03:07:19 +08:00
|
|
|
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);
|
2019-07-17 00:15:43 +08:00
|
|
|
void cleanup_reference_deprec(void);
|
2019-08-25 03:07:19 +08:00
|
|
|
void cleanup_vltypes(void);
|
|
|
|
void cleanup_vlstrings(void);
|
|
|
|
void cleanup_iterate(void);
|
|
|
|
void cleanup_array(void);
|
|
|
|
void cleanup_genprop(void);
|
|
|
|
void cleanup_configure(void);
|
2022-08-06 07:11:13 +08:00
|
|
|
void cleanup_h5_system(void);
|
2019-08-25 03:07:19 +08:00
|
|
|
void cleanup_sohm(void);
|
|
|
|
void cleanup_misc(void);
|
|
|
|
void cleanup_unicode(void);
|
1998-07-03 08:57:00 +08:00
|
|
|
|
2004-01-10 09:41:13 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-07 01:53:13 +08:00
|
|
|
#endif /* TESTHDF5_H */
|