summaryrefslogtreecommitdiffstats
path: root/test/vfd_swmr_group_writer.c
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2021-03-17 01:39:01 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2021-03-17 01:39:01 (GMT)
commit796018e5582d9c3d0d009cb58e4d4898723b0d32 (patch)
tree7d3543fb428a8c08c793536009e6699aee2917c5 /test/vfd_swmr_group_writer.c
parent20cbe6895872b162ca04ed371d211c8c5124e0db (diff)
downloadhdf5-796018e5582d9c3d0d009cb58e4d4898723b0d32.zip
hdf5-796018e5582d9c3d0d009cb58e4d4898723b0d32.tar.gz
hdf5-796018e5582d9c3d0d009cb58e4d4898723b0d32.tar.bz2
Re-arranged the communication between the writer and reader through named pipes to facilitate possible test improvements in the future.
Diffstat (limited to 'test/vfd_swmr_group_writer.c')
-rw-r--r--test/vfd_swmr_group_writer.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c
index 5e01c4e..3dd84ab 100644
--- a/test/vfd_swmr_group_writer.c
+++ b/test/vfd_swmr_group_writer.c
@@ -62,10 +62,9 @@ usage(const char *progname)
"-a steps: `steps` between adding attributes\n"
"-b: write data in big-endian byte order\n"
"-c steps: `steps` between communication between the writer and reader\n"
- "-n iterations: how many times to expand each dataset\n"
- " to %s.h5\n"
+ "-n ngroups: the number of groups\n"
"\n",
- progname, progname);
+ progname);
exit(EXIT_FAILURE);
}
@@ -334,10 +333,6 @@ main(int argc, char **argv)
errx(EXIT_FAILURE, "fifo_reader_to_writer open failed");
if (writer) {
- /* Writer tells reader to start verification */
- if (HDwrite(fd_writer_to_reader, &notify, sizeof(int)) < 0)
- err(EXIT_FAILURE, "write failed");
-
for (step = 0; step < s.nsteps; step++) {
dbgf(2, "writer: step %d\n", step);
@@ -368,34 +363,29 @@ main(int argc, char **argv)
}
}
} else {
- /* Start to verify group creation after receiving the writer's notice */
- if (HDread(fd_writer_to_reader, &notify, sizeof(int)) < 0)
- err(EXIT_FAILURE, "read failed");
-
- /* Both notify and verify are 0 now */
- if (notify != verify)
- errx(EXIT_FAILURE, "received message %d, expecting %d", notify, verify);
-
for (step = 0; step < s.nsteps; step++) {
dbgf(2, "reader: step %d\n", step);
- while (!verify_group(&s, step))
- ;
-
- /* At communication interval, waits for the writer's notice and responds back */
+ /* At communication interval, waits for the writer to finish creation before starting verification */
if (step % s.csteps == 0) {
/* The writer should have bumped up the value of notify.
* Do the same with verify and confirm it */
verify++;
+ /* Receive the notify that the writer bumped up the value */
if (HDread(fd_writer_to_reader, &notify, sizeof(int)) < 0)
err(EXIT_FAILURE, "read failed");
if (notify != verify)
errx(EXIT_FAILURE, "received message %d, expecting %d", notify, verify);
+ }
+ while (!verify_group(&s, step))
+ ;
+
+ if (step % s.csteps == 0) {
/* Send back the same nofity value for acknowledgement to tell the writer
- * move to the next step */
+ * move to the next step. */
if (HDwrite(fd_reader_to_writer, &notify, sizeof(int)) < 0)
err(EXIT_FAILURE, "write failed");
}