summaryrefslogtreecommitdiffstats
path: root/tools/test/misc
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-07-22 20:03:22 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-07-22 20:03:22 (GMT)
commit099c7242fbdf698cbb13339bfc71f38b8f363dfe (patch)
tree1ed51040cf41c16f2c55db79133ca86dfa0d3052 /tools/test/misc
parent0ee5d676210291f784ce273ee34b1a7d383ec694 (diff)
downloadhdf5-099c7242fbdf698cbb13339bfc71f38b8f363dfe.zip
hdf5-099c7242fbdf698cbb13339bfc71f38b8f363dfe.tar.gz
hdf5-099c7242fbdf698cbb13339bfc71f38b8f363dfe.tar.bz2
Merge from dev of tools changes
Diffstat (limited to 'tools/test/misc')
-rw-r--r--tools/test/misc/CMakeLists.txt2
-rw-r--r--tools/test/misc/Makefile.am2
-rw-r--r--tools/test/misc/clear_open_chk.c2
-rw-r--r--tools/test/misc/h5clear_gentest.c25
-rw-r--r--tools/test/misc/h5repart_gentest.c71
-rw-r--r--tools/test/misc/testfiles/h5mkgrp_help.txt1
6 files changed, 65 insertions, 38 deletions
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index 060c15b..8f13d84 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -18,7 +18,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repart_gentest>)
add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c)
- target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_TEST_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT ONLY_SHARED_LIBS)
TARGET_C_PROPERTIES (h5clear_gentest STATIC)
target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
diff --git a/tools/test/misc/Makefile.am b/tools/test/misc/Makefile.am
index f2d2489..c58ba38 100644
--- a/tools/test/misc/Makefile.am
+++ b/tools/test/misc/Makefile.am
@@ -21,7 +21,7 @@ include $(top_srcdir)/config/commence.am
SUBDIRS=vds
# Include src directory
-AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib
#test scripts and programs
TEST_PROG=h5repart_gentest h5clear_gentest talign
diff --git a/tools/test/misc/clear_open_chk.c b/tools/test/misc/clear_open_chk.c
index 3a61385..7d22ca6 100644
--- a/tools/test/misc/clear_open_chk.c
+++ b/tools/test/misc/clear_open_chk.c
@@ -53,7 +53,7 @@ main(int argc, char *argv[])
fname = HDstrdup(argv[1]);
/* Try opening the file */
- if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) {
HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
HDfree(fname);
HDexit(EXIT_FAILURE);
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index d5f415e..8d6883c 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "hdf5.h"
-#include "H5private.h"
+#include "h5test.h"
/* The HDF5 test files */
const char *FILENAME[] = {
@@ -62,13 +62,21 @@ gen_cache_image_file(const char *fname)
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2]; /* Dimension sizes */
hsize_t chunks[2]; /* Chunked dimension sizes */
- int buf[50][100]; /* Buffer for data to write */
int i, j; /* Local index variables */
+ int **buf = NULL; /* Buffer for data to write */
H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
{ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
TRUE, FALSE,
H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE};
+ /* Create and fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100);
+ if (NULL == buf)
+ goto error;
+ for(i = 0; i < 50; i++)
+ for(j = 0; j < 100; j++)
+ buf[i][j] = i * j;
+
/* Create a copy of file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
@@ -91,11 +99,6 @@ gen_cache_image_file(const char *fname)
if((sid = H5Screate_simple(2, dims, NULL)) < 0)
goto error;
- /* Initialize buffer for writing to dataset */
- for(i = 0; i < 50; i++)
- for(j = 0; j < 100; j++)
- buf[i][j] = i * j;
-
/* Set up to create a chunked dataset */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
@@ -107,7 +110,7 @@ gen_cache_image_file(const char *fname)
goto error;
/* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
goto error;
/* Closing */
@@ -121,6 +124,9 @@ gen_cache_image_file(const char *fname)
goto error;
if(H5Fclose(fid) < 0)
goto error;
+
+ HDfree(buf);
+
return 0;
error:
@@ -132,6 +138,9 @@ error:
H5Pclose(fapl);
H5Pclose(dcpl);
} H5E_END_TRY;
+
+ HDfree(buf);
+
return 1;
} /* gen_cache_image_file() */
diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c
index 5c1ff87..bd94104 100644
--- a/tools/test/misc/h5repart_gentest.c
+++ b/tools/test/misc/h5repart_gentest.c
@@ -25,7 +25,8 @@
#define FAMILY_SIZE 1024
#define FILENAME "family_file%05d.h5"
-static int buf[FAMILY_NUMBER][FAMILY_SIZE];
+int **buf = NULL;
+int *buf_data = NULL;
int main(void)
{
@@ -34,66 +35,82 @@ int main(void)
int i, j;
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) {
+ HDperror("HDcalloc");
+ HDexit(EXIT_FAILURE);
+ }
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) {
+ HDperror("HDcalloc");
+ HDexit(EXIT_FAILURE);
+ }
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
/* Set property list and file name for FAMILY driver */
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- perror ("H5Pcreate");
- exit (EXIT_FAILURE);
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ HDperror("H5Pcreate");
+ HDexit(EXIT_FAILURE);
}
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) {
- perror ("H5Pset_fapl_family");
- exit (EXIT_FAILURE);
+ HDperror("H5Pset_fapl_family");
+ HDexit(EXIT_FAILURE);
}
if((file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) {
- perror("H5Fcreate");
- exit(EXIT_FAILURE);
+ HDperror("H5Fcreate");
+ HDexit(EXIT_FAILURE);
}
/* Create and write dataset */
if((space = H5Screate_simple(2, dims, NULL)) < 0) {
- perror("H5Screate_simple");
- exit(EXIT_FAILURE);
+ HDperror("H5Screate_simple");
+ HDexit(EXIT_FAILURE);
}
if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- perror("H5Dcreate2");
- exit(EXIT_FAILURE);
+ HDperror("H5Dcreate2");
+ HDexit(EXIT_FAILURE);
}
- for(i = 0; i<FAMILY_NUMBER; i++)
- for(j = 0; j<FAMILY_SIZE; j++)
+ for(i = 0; i < FAMILY_NUMBER; i++)
+ for(j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = i * 10000 + j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) {
- perror("H5Dwrite");
- exit(EXIT_FAILURE);
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) {
+ HDperror("H5Dwrite");
+ HDexit(EXIT_FAILURE);
}
if(H5Sclose(space) < 0) {
- perror ("H5Sclose");
- exit (EXIT_FAILURE);
+ HDperror("H5Sclose");
+ HDexit(EXIT_FAILURE);
}
if(H5Dclose(dset) < 0) {
- perror ("H5Dclose");
- exit (EXIT_FAILURE);
+ HDperror("H5Dclose");
+ HDexit(EXIT_FAILURE);
}
if(H5Pclose(fapl) < 0) {
- perror ("H5Pclose");
- exit (EXIT_FAILURE);
+ HDperror("H5Pclose");
+ HDexit(EXIT_FAILURE);
}
if(H5Fclose(file) < 0) {
- perror ("H5Fclose");
- exit (EXIT_FAILURE);
+ HDperror("H5Fclose");
+ HDexit(EXIT_FAILURE);
}
- puts(" PASSED"); fflush(stdout);
+ HDfree(buf);
+ HDfree(buf_data);
+
+ HDputs(" PASSED");
+ HDfflush(stdout);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/tools/test/misc/testfiles/h5mkgrp_help.txt b/tools/test/misc/testfiles/h5mkgrp_help.txt
index ba130f6..2f67c4b 100644
--- a/tools/test/misc/testfiles/h5mkgrp_help.txt
+++ b/tools/test/misc/testfiles/h5mkgrp_help.txt
@@ -5,3 +5,4 @@ usage: h5mkgrp [OPTIONS] FILE GROUP...
-p, --parents No error if existing, make parent groups as needed
-v, --verbose Print information about OBJECTS and OPTIONS
-V, --version Print version number and exit
+