diff options
Diffstat (limited to 'hl/tools/h5watch/extend_dset.c')
-rw-r--r-- | hl/tools/h5watch/extend_dset.c | 62 |
1 files changed, 5 insertions, 57 deletions
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 */ |