summaryrefslogtreecommitdiffstats
path: root/test/use_append_chunk_mirror.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-10-29 22:10:31 (GMT)
committerGitHub <noreply@github.com>2021-10-29 22:10:31 (GMT)
commit111c7ae9ac2efc29e8b399e6951253af9110b81a (patch)
treef69fa03253bdab97d7cf3615baff02cd936323f9 /test/use_append_chunk_mirror.c
parentdb30c2da68ece4a155e9e50c28ec16d6057509b2 (diff)
downloadhdf5-hdf5-1_10_8.zip
hdf5-hdf5-1_10_8.tar.gz
hdf5-hdf5-1_10_8.tar.bz2
Merge hdf5 1 10 8 (#1154)hdf5-1_10_8
Merge HDF5 1.10.8 release files to 1.10/master
Diffstat (limited to 'test/use_append_chunk_mirror.c')
-rw-r--r--test/use_append_chunk_mirror.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/test/use_append_chunk_mirror.c b/test/use_append_chunk_mirror.c
index 6ee01c0..b19c510 100644
--- a/test/use_append_chunk_mirror.c
+++ b/test/use_append_chunk_mirror.c
@@ -5,7 +5,7 @@
* 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://support.hdfgroup.org/ftp/HDF5/releases. *
+ * 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -91,11 +91,9 @@
#include "use.h"
/* This test uses many POSIX things that are not available on
- * Windows. We're using a check for fork(2) here as a proxy for
- * all POSIX/Unix/Linux things until this test can be made
- * more platform-independent.
+ * Windows.
*/
-#ifdef H5_HAVE_FORK
+#ifdef H5_HAVE_UNISTD_H
#ifdef H5_HAVE_MIRROR_VFD
@@ -106,9 +104,9 @@
#if CONNECT_WITH_JELLY
#define SERVER_IP "10.10.10.248" /* hard-coded IP address */
#else
-#define SERVER_IP "127.0.0.1" /* localhost */
-#endif /* CONNECT_WITH_JELLY */
-#define SERVER_PORT 3000 /* hard-coded port number */
+#define SERVER_IP "127.0.0.1" /* localhost */
+#endif /* CONNECT_WITH_JELLY */
+#define SERVER_PORT 3000 /* hard-coded port number */
#define MIRROR_FILE_NAME "shinano.h5" /* hard-coded duplicate/mirror filename */
static options_t UC_opts; /* Use Case Options */
@@ -117,23 +115,23 @@ static options_t UC_opts; /* Use Case Options */
* Return: 0 succeed; -1 fail.
*/
int
-setup_parameters(int argc, char * const argv[], options_t * opts)
+setup_parameters(int argc, char *const argv[], options_t *opts)
{
/* use case defaults */
HDmemset(opts, 0, sizeof(options_t));
- opts->chunksize = Chunksize_DFT;
- opts->use_swmr = TRUE;
- opts->iterations = 1;
+ opts->chunksize = Chunksize_DFT;
+ opts->use_swmr = TRUE;
+ opts->iterations = 1;
opts->chunkplanes = 1;
- opts->progname = THIS_PROGNAME;
+ opts->progname = THIS_PROGNAME;
if (parse_option(argc, argv, opts) < 0)
- return(-1);
+ return (-1);
opts->chunkdims[0] = opts->chunkplanes;
opts->chunkdims[1] = opts->chunkdims[2] = opts->chunksize;
- opts->dims[0] = 0;
+ opts->dims[0] = 0;
opts->max_dims[0] = H5S_UNLIMITED;
opts->dims[1] = opts->dims[2] = opts->max_dims[1] = opts->max_dims[2] = opts->chunksize;
@@ -141,10 +139,9 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
opts->nplanes = (hsize_t)opts->chunksize;
show_parameters(opts);
- return(0);
+ return (0);
} /* setup_parameters() */
-
/* Overall Algorithm:
* Parse options from user;
* Generate/pre-created test files needed and close it;
@@ -155,17 +152,17 @@ setup_parameters(int argc, char * const argv[], options_t * opts)
int
main(int argc, char *argv[])
{
- pid_t childpid=0;
- pid_t mypid, tmppid;
- int child_status;
- int child_wait_option=0;
- int ret_value = 0;
- int child_ret_value;
- hbool_t send_wait = FALSE;
- hid_t fid = -1; /* File ID */
- H5FD_mirror_fapl_t mirr_fa;
+ pid_t childpid = 0;
+ pid_t mypid, tmppid;
+ int child_status;
+ int child_wait_option = 0;
+ int ret_value = 0;
+ int child_ret_value;
+ hbool_t send_wait = FALSE;
+ hid_t fid = -1; /* File ID */
+ H5FD_mirror_fapl_t mirr_fa;
H5FD_splitter_vfd_config_t split_fa;
- hid_t mirr_fapl_id = H5I_INVALID_HID;
+ hid_t mirr_fapl_id = H5I_INVALID_HID;
if (setup_parameters(argc, argv, &UC_opts) < 0) {
Hgoto_error(1);
@@ -176,7 +173,6 @@ main(int argc, char *argv[])
mirr_fa.handshake_port = SERVER_PORT;
HDstrncpy(mirr_fa.remote_ip, SERVER_IP, H5FD_MIRROR_MAX_IP_LEN);
-
split_fa.wo_fapl_id = H5I_INVALID_HID;
split_fa.rw_fapl_id = H5I_INVALID_HID;
split_fa.magic = H5FD_SPLITTER_MAGIC;
@@ -215,9 +211,9 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa.wo_fapl_id = mirr_fapl_id;
+ split_fa.rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
@@ -237,7 +233,8 @@ main(int argc, char *argv[])
if (create_uc_file(&UC_opts) < 0) {
HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
- } else {
+ }
+ else {
HDprintf("File created.\n");
}
@@ -303,9 +300,9 @@ main(int argc, char *argv[])
}
/* Prepare parent "splitter" driver in UC_opts */
- split_fa.wo_fapl_id = mirr_fapl_id;
- split_fa.rw_fapl_id = H5P_DEFAULT;
- UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ split_fa.wo_fapl_id = mirr_fapl_id;
+ split_fa.rw_fapl_id = H5P_DEFAULT;
+ UC_opts.fapl_id = H5Pcreate(H5P_FILE_ACCESS);
if (UC_opts.fapl_id == H5I_INVALID_HID) {
HDfprintf(stderr, "can't create creation FAPL\n");
Hgoto_error(1);
@@ -323,7 +320,8 @@ main(int argc, char *argv[])
}
}
- if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), UC_opts.fapl_id)) < 0) {
+ if ((fid = H5Fopen(UC_opts.filename, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0),
+ UC_opts.fapl_id)) < 0) {
HDfprintf(stderr, "H5Fopen failed\n");
Hgoto_error(1);
}
@@ -359,11 +357,11 @@ main(int argc, char *argv[])
if (WIFEXITED(child_status)) {
if ((child_ret_value = WEXITSTATUS(child_status)) != 0) {
- HDprintf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
+ HDprintf("%d: child process exited with non-zero code (%d)\n", mypid, child_ret_value);
Hgoto_error(2);
}
- } else {
+ }
+ else {
HDprintf("%d: child process terminated abnormally\n", mypid);
Hgoto_error(2);
}
@@ -372,11 +370,12 @@ main(int argc, char *argv[])
done:
if (ret_value != 0) {
HDprintf("Error(s) encountered\n");
- } else {
+ }
+ else {
HDprintf("All passed\n");
}
- return(ret_value);
+ return (ret_value);
}
#else /* H5_HAVE_MIRROR_VFD */
@@ -390,7 +389,7 @@ main(void)
#endif /* H5_HAVE_MIRROR_VFD */
-#else /* H5_HAVE_FORK */
+#else /* H5_HAVE_UNISTD_H */
int
main(void)
@@ -399,5 +398,4 @@ main(void)
return EXIT_SUCCESS;
} /* end main() */
-#endif /* H5_HAVE_FORK */
-
+#endif /* H5_HAVE_UNISTD_H */