summaryrefslogtreecommitdiffstats
path: root/tools/misc/repart_test.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2017-12-01 18:41:26 (GMT)
commitb8c6b68c35fa2be23ef488a1d81097ff3ed55000 (patch)
treec3429ee577e454526c8704d66a84f0c45b7959a1 /tools/misc/repart_test.c
parent23a702e7bad93fc4f14eab07678c75d276e2d0ad (diff)
parent60f76980aab92f0e0730170b99a2363acd3c97fa (diff)
downloadhdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.zip
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.tar.gz
hdf5-b8c6b68c35fa2be23ef488a1d81097ff3ed55000.tar.bz2
Merge pull request #811 in HDFFV/hdf5 from hdf5_1_8_20 to 1.8/masterhdf5-1_8_20
* commit '60f76980aab92f0e0730170b99a2363acd3c97fa': (108 commits) Update version numbers and remove empty sections in RELEASE.txt. Restore line 1154: C2Cppfunction_map.mht to HTML_EXTRA_FILES. Update version for 1.8.20 release. Fixed documentation warnings HDFFV-10329 Correct LINK INTERFACE and VS20013 compile Switch default build mode from development to production. Increment version string to pre2. Add RELEASE.txt note for HDFFV-10274. (cherry picked from commit f7a7d0a00613cba997212fa8032091629a678797) Initialize hid_t variables in test_Attr_bug9. (cherry picked from commit 97bc393449f3fe02c5992872ab2842e12f611ef0) Fix HDFFV-10274. When deleting all (or almost all) of the messages in an object header chunk, where the total amount deleted was greater than 64K, an error would occur due to an off by one error in the code that handled that case. Fixed this and added a test case. (cherry picked from commit 1b2c2ca9a6a7d7e1fcd5c3302e203f2e2dabf0af) Fix linking of libs Changed file path to relative. iAdd NAG to supported compilers in RELEASE.txt. Add description to RELEASE.txt for HDFFV-10323 Correct issue number Set version to 1.8.20-pre1 Update supported and tested platforms in RELEASE.txt. HDFFV-10321 Merge from 1.8 Incremented lib file .so numbers: revision for all except c++ for code change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. updated issues related to Fortran Incremented lib file .so numbers: revision for all except c++ for dcode change; current incremented, revision and age set to 0 for c++ due to symbols added and removed. ...
Diffstat (limited to 'tools/misc/repart_test.c')
-rw-r--r--tools/misc/repart_test.c94
1 files changed, 42 insertions, 52 deletions
diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c
index 372f46a..493f4ce 100644
--- a/tools/misc/repart_test.c
+++ b/tools/misc/repart_test.c
@@ -12,14 +12,12 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
- * June 1, 2005
- *
* Purpose: This program tests family files after being repartitioned
* by h5repart. It simply tries to reopen the files with
* correct family driver and member size.
*/
#include "hdf5.h"
+#include "H5private.h"
#define KB 1024
#define FAMILY_H5REPART_SIZE1 20000
@@ -42,52 +40,54 @@ herr_t test_sec2_h5repart_opens(void);
*
* Purpose: Tries to reopen family files.
*
- * Return: Success: exit(0)
- *
- * Failure: exit(1)
+ * Return: SUCCEED/FAIL
*
- * Programmer: Raymond Lu
- * June 1, 2005
- *
- * Modifications:
*-------------------------------------------------------------------------
*/
herr_t
test_family_h5repart_opens(void)
{
- hid_t file=(-1), fapl=(-1);
+ hid_t fid = -1;
+ hid_t fapl_id = -1;
/* open 1st file(single member file) with correct family size(20000 byte) */
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT)<0)
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT) < 0)
goto error;
- if((file=H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl))<0)
+ if ((fid = H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl_id))<0)
goto error;
- if(H5Fclose(file)<0)
+ if (H5Fclose(fid) < 0)
goto error;
/* open 2nd file(multiple member files) with correct family size(5KB) */
- if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE2, H5P_DEFAULT)<0)
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_H5REPART_SIZE2, H5P_DEFAULT) < 0)
+ goto error;
+
+ if ((fid = H5Fopen(FILENAME[1], H5F_ACC_RDWR, fapl_id)) < 0)
goto error;
- if((file=H5Fopen(FILENAME[1], H5F_ACC_RDWR, fapl))<0)
+ if (H5Pclose(fapl_id) < 0)
goto error;
- if(H5Fclose(file)<0)
+ if (H5Fclose(fid) < 0)
goto error;
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Pclose(fapl_id);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
-}
+
+ return FAIL;
+
+} /* end test_family_h5repart_opens() */
+
/*-------------------------------------------------------------------------
@@ -95,36 +95,32 @@ error:
*
* Purpose: Tries to reopen a sec2 file.
*
- * Return: Success: exit(0)
+ * Return: SUCCEED/FAIL
*
- * Failure: exit(1)
- *
- * Programmer: Raymond Lu
- * June 21, 2005
- *
- * Modifications:
*-------------------------------------------------------------------------
*/
herr_t
test_sec2_h5repart_opens(void)
{
- hid_t file=(-1);
+ hid_t fid = -1;
/* open the sec2 file */
- if((file=H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT))<0)
+ if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto error;
- if(H5Fclose(file)<0)
+ if (H5Fclose(fid) < 0)
goto error;
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
-}
+
+ return FAIL;
+
+} /* end test_sec2_h5repart_opens() */
/*-------------------------------------------------------------------------
@@ -132,32 +128,26 @@ error:
*
* Purpose: Tests h5repart-ed family files
*
- * Return: Success: exit(0)
- *
- * Failure: exit(1)
- *
- * Programmer: Raymond Lu
- * June 1, 2005
- *
- * Modifications:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
- int nerrors=0;
+ int nerrors = 0;
- nerrors += test_family_h5repart_opens()<0 ?1:0;
- nerrors += test_sec2_h5repart_opens()<0 ?1:0;
+ nerrors += test_family_h5repart_opens() < 0 ? 1 : 0;
+ nerrors += test_sec2_h5repart_opens() < 0 ? 1 : 0;
- if (nerrors) goto error;
+ if (nerrors)
+ goto error;
- return 0;
+ HDexit(EXIT_SUCCESS);
error:
nerrors = MAX(1, nerrors);
- printf("***** %d FAMILY FILE TEST%s FAILED! *****\n",
+ HDprintf("***** %d FAMILY FILE TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- return 1;
-}
+ HDexit(EXIT_FAILURE);
+} /* end main() */