diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-09-23 20:30:07 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-09-23 20:30:07 (GMT) |
commit | a4d6a270783d69c663357c31fcd6196b98706dfb (patch) | |
tree | ce4cd3ff16aa0a3918c4e999d3b6ba63a35a41fe /test/mtime.c | |
parent | a0947d808fb3b0af98032beb1a4f5353443c8aa3 (diff) | |
download | hdf5-a4d6a270783d69c663357c31fcd6196b98706dfb.zip hdf5-a4d6a270783d69c663357c31fcd6196b98706dfb.tar.gz hdf5-a4d6a270783d69c663357c31fcd6196b98706dfb.tar.bz2 |
HDFFV-10903 merge S3 from dev
Diffstat (limited to 'test/mtime.c')
-rw-r--r-- | test/mtime.c | 66 |
1 files changed, 27 insertions, 39 deletions
diff --git a/test/mtime.c b/test/mtime.c index b50dfeb..2e4b2a4 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Thursday, July 30, 1998 * - * Purpose: Determines if the modification time message is working - * properly. Specifically, the code in H5O_mtime_decode() is - * very OS-dependent and this test tries to figure out if it's - * working properly. + * Purpose: Determines if the modification time message is working + * properly. Specifically, the code in H5O_mtime_decode() is + * very OS-dependent and this test tries to figure out if it's + * working properly. */ #include "h5test.h" #include "H5srcdir.h" @@ -33,17 +33,17 @@ const char *FILENAME[] = { #define TESTFILE2 "tmtimen.h5" #define MTIME2 1041606478 - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: H5O_mtime_decode() test. + * Purpose: H5O_mtime_decode() test. * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 30, 1998 * * Modifications: @@ -58,13 +58,13 @@ const char *FILENAME[] = { int main(void) { - hid_t fapl, file, space, dset; - hsize_t size[1] = {2}; - time_t now; - struct tm *tm; - H5O_info_t oi1, oi2; - signed char buf1[32], buf2[32]; - char filename[1024]; + hid_t fapl, file, space, dset; + hsize_t size[1] = {2}; + time_t now; + struct tm *tm; + H5O_info_t oi1, oi2; + signed char buf1[32], buf2[32]; + char filename[1024]; h5_reset(); fapl = h5_fileaccess(); @@ -99,18 +99,18 @@ main(void) /* Compare addresses & times from the two ways of calling H5Oget_info() */ if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) { H5_FAILED(); - puts(" Calling H5Oget_info() with the dataset ID returned"); - puts(" different values than calling it with a file and dataset"); - puts(" name."); + HDputs(" Calling H5Oget_info() with the dataset ID returned"); + HDputs(" different values than calling it with a file and dataset"); + HDputs(" name."); goto error; } /* Compare times -- they must be within 60 seconds of one another */ if(0 == oi1.ctime) { SKIPPED(); - puts(" The modification time could not be decoded on this OS."); - puts(" Modification times will be mantained in the file but"); - puts(" cannot be queried on this system. See H5O_mtime_decode()."); + HDputs(" The modification time could not be decoded on this OS."); + HDputs(" Modification times will be mantained in the file but"); + HDputs(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) { H5_FAILED(); @@ -130,14 +130,8 @@ main(void) TESTING("accessing old modification time messages"); { - char testfile[512]=""; - char *srcdir = HDgetenv("srcdir"); + const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */ - if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE1) + 1) < sizeof(testfile))){ - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, TESTFILE1); file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0) @@ -166,21 +160,15 @@ main(void) TESTING("accessing new modification time messages"); { - char testfile[512]=""; - char *srcdir = HDgetenv("srcdir"); + const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */ - if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE2) + 1) < sizeof(testfile))){ - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, TESTFILE2); file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); - puts(" Modification time incorrect."); + HDputs(" Modification time incorrect."); goto error; } if(H5Fclose(file) < 0) TEST_ERROR; @@ -198,7 +186,7 @@ main(void) if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR /* All looks good */ - puts("All modification time tests passed."); + HDputs("All modification time tests passed."); h5_cleanup(FILENAME, fapl); return 0; |