diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-20 04:44:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-12-20 04:44:54 (GMT) |
commit | eefddf281366e8327dd7397db4a2f2e7edabcf17 (patch) | |
tree | 913e8a1ed10612b40fd6b8c6976e2dbdfc647467 /hl/tools/h5watch | |
parent | ab3963b28e59419f8e857ec224dd4efa3ea6dd8e (diff) | |
download | hdf5-eefddf281366e8327dd7397db4a2f2e7edabcf17.zip hdf5-eefddf281366e8327dd7397db4a2f2e7edabcf17.tar.gz hdf5-eefddf281366e8327dd7397db4a2f2e7edabcf17.tar.bz2 |
Bring new/updated tests from revise+chunks branch: flush1/flush2 update and
flushrefresh test. (Also refactor of message send / wait code)
Diffstat (limited to 'hl/tools/h5watch')
-rw-r--r-- | hl/tools/h5watch/Makefile.am | 8 | ||||
-rw-r--r-- | hl/tools/h5watch/extend_dset.c | 62 |
2 files changed, 13 insertions, 57 deletions
diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am index a5891ef..35a08e6 100644 --- a/hl/tools/h5watch/Makefile.am +++ b/hl/tools/h5watch/Makefile.am @@ -37,6 +37,14 @@ h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # Programs all depend on the hdf5 library, the tools library, and the HL # library. LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) + +# Add extend_dset specific preprocessor flags here +# (add the main test subdirectory to the include file path) +extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test +# Add extend_dset specific library flags here +# (add the main test library to the list of libraries) +extend_dset_LDADD=$(LDADD) $(LIBH5TEST) + # CHECK_CLEANFILES+=*.h5 DISTCLEANFILES=testh5watch.sh diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c index 023e201..4038a4f 100644 --- a/hl/tools/h5watch/extend_dset.c +++ b/hl/tools/h5watch/extend_dset.c @@ -14,6 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "H5HLprivate2.h" +#include "h5test.h" /* * Extending datasets in WATCH.h5 generated by h5watchgentest.c @@ -30,8 +31,6 @@ #define WRITER_MESSAGE "writer_message" /* The message received from the test script to start extending dataset */ #define READER_MESSAGE "reader_message" -/* Message timeout in seconds */ -#define MESSAGE_TIMEOUT 300 /* Size of data buffer */ #define TEST_BUF_SIZE 100 @@ -57,8 +56,6 @@ int two_tests[TWO_NTESTS][2] = { {2, 2}, {2, -11}, {2, 0}, static herr_t extend_dset_two(const char *file, char *dname); static herr_t extend_dset_one(const char *file, char *dname); -void send_message(const char *file); -static herr_t wait_message(const char *file); /* Data structures for datasets with compound data type */ @@ -87,55 +84,6 @@ typedef struct set_t { } set_t; /* - * To send a message by creating the file. - */ -void -send_message(const char *file) -{ - FILE *id; - - id = HDfopen(file, "w+"); - HDfclose(id); -} /* end send_message() */ - -/* - * - * Repeatedly check for the message file. - * It will stop when the file exists or exceeds the timeout limit. - */ -static herr_t -wait_message(const char *file) -{ - FILE *id; /* File pointer */ - time_t t0, t1; /* Time info */ - - /* Start timer */ - HDtime(&t0); - - /* Wait for message from test script to start work */ - while((id = HDfopen(file, "r")) == NULL) { - /* Get current time */ - HDtime(&t1); - /* - * Determine time difference-- - * if waiting too long for the message, then it is - * unlikely the message will get sent, then fail rather - * than loop forever. - */ - if(HDdifftime(t1, t0) > MESSAGE_TIMEOUT) - goto error; - } /* end while */ - - HDfclose(id); - HDunlink(file); - - return SUCCEED; - -error: - return FAIL; -} /* end wait_message() */ - -/* *********************************************************************** * * Extending a two-dimensional dataset: @@ -198,7 +146,7 @@ extend_dset_two(const char *file, char *dname) goto error; /* Send message to the test script to start "h5watch" */ - send_message(WRITER_MESSAGE); + h5_send_message(WRITER_MESSAGE, NULL, NULL); if((sid = H5Dget_space(did)) < 0) goto error; @@ -215,7 +163,7 @@ extend_dset_two(const char *file, char *dname) goto error; /* Wait for message from the test script to start extending dataset */ - if(wait_message(READER_MESSAGE) < 0) + if(h5_wait_message(READER_MESSAGE) < 0) goto error; /* Loop through different variations of extending the dataset */ @@ -355,7 +303,7 @@ extend_dset_one(const char *file, char *dname) goto error; /* Send message to the test script to start "h5watch" */ - send_message(WRITER_MESSAGE); + h5_send_message(WRITER_MESSAGE, NULL, NULL); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) goto error; @@ -369,7 +317,7 @@ extend_dset_one(const char *file, char *dname) goto error; /* Wait for message from the test script to start extending dataset */ - if(wait_message(READER_MESSAGE) < 0) + if(h5_wait_message(READER_MESSAGE) < 0) goto error; /* Loop through different variations of extending the dataset */ |