summaryrefslogtreecommitdiffstats
path: root/test/stab.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/stab.c')
-rw-r--r--test/stab.c236
1 files changed, 118 insertions, 118 deletions
diff --git a/test/stab.c b/test/stab.c
index 37097b7..80c8b06 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -16,13 +16,13 @@
* Tuesday, November 24, 1998
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
#include "h5test.h"
-#include "H5Gpkg.h" /* Groups */
+#include "H5Gpkg.h" /* Groups */
const char *FILENAME[] = {
"stab",
@@ -78,17 +78,17 @@ const char *FILENAME[] = {
#define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5"
#define CORRUPT_STAB_DSET "DS1"
-
+
/*-------------------------------------------------------------------------
- * Function: test_misc
+ * Function: test_misc
*
- * Purpose: Test miscellaneous group stuff.
+ * Purpose: Test miscellaneous group stuff.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
*-------------------------------------------------------------------------
@@ -96,10 +96,10 @@ const char *FILENAME[] = {
static int
test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t g1 = (-1), g2 = (-1), g3 = (-1);
- char filename[NAME_BUF_SIZE];
- char comment[64];
+ hid_t fid = (-1); /* File ID */
+ hid_t g1 = (-1), g2 = (-1), g3 = (-1);
+ char filename[NAME_BUF_SIZE];
+ char comment[64];
if(new_format)
TESTING("miscellaneous group tests (w/new group format)")
@@ -125,10 +125,10 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR
if(HDstrcmp(comment, "hello world")) {
- H5_FAILED();
- puts(" Read the wrong comment string from the group.");
- printf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" Read the wrong comment string from the group.");
+ HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment);
+ TEST_ERROR
}
if(H5Gclose(g1) < 0) TEST_ERROR
if(H5Gclose(g2) < 0) TEST_ERROR
@@ -153,21 +153,21 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Gclose(g1);
- H5Gclose(g2);
- H5Gclose(g3);
- H5Fclose(fid);
+ H5Gclose(g1);
+ H5Gclose(g2);
+ H5Gclose(g3);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
}
-
+
/*-------------------------------------------------------------------------
* Purpose: Creates a group with a very long name
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
* Programmer: Robb Matzke <matzke@llnl.gov> 2002-03-28
*
@@ -177,10 +177,10 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
static int
test_long(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
+ hid_t fid = (-1); /* File ID */
hid_t g1 = (-1), g2 = (-1);
char *name1 = NULL, *name2 = NULL;
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
size_t i;
if(new_format)
@@ -198,7 +198,7 @@ test_long(hid_t fcpl, hid_t fapl, hbool_t new_format)
name1[i] = (char)('A' + i%26);
name1[LONG_NAME_LEN - 1] = '\0';
name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2));
- sprintf(name2, "%s/%s", name1, name1);
+ HDsprintf(name2, "%s/%s", name1, name1);
/* Create groups */
if((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -226,22 +226,22 @@ error:
H5E_BEGIN_TRY {
H5Gclose(g1);
H5Gclose(g2);
- H5Fclose(fid);
+ H5Fclose(fid);
HDfree(name2);
HDfree(name1);
} H5E_END_TRY;
return 1;
} /* end test_long() */
-
+
/*-------------------------------------------------------------------------
* Function: test_large
*
* Purpose: Creates a really large directory.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: number of errors
+ * Failure: number of errors
*
* Programmer: Robb Matzke
* robb@maya.nuance.com
@@ -252,9 +252,9 @@ error:
static int
test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
+ hid_t fid = (-1); /* File ID */
hid_t cwg = (-1), dir = (-1); /* Group IDs */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
char name[NAME_BUF_SIZE];
int i;
@@ -275,8 +275,8 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
if(new_format)
if(H5G__has_stab_test(cwg) != FALSE) TEST_ERROR
for(i = 0; i < LARGE_NOBJS; i++) {
- sprintf(name, "%05d%05d", (HDrandom() % 100000), i);
- if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i);
+ if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(dir) < 0) TEST_ERROR
}
if(new_format)
@@ -291,14 +291,14 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Gclose(dir);
- H5Gclose(cwg);
- H5Fclose(fid);
+ H5Gclose(dir);
+ H5Gclose(cwg);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end test_large() */
-
+
/*-------------------------------------------------------------------------
* Function: lifecycle
*
@@ -318,19 +318,19 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format)
static int
lifecycle(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
hid_t gcpl = (-1); /* Group creation property list ID */
size_t lheap_size_hint; /* Local heap size hint */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
- unsigned nmsgs; /* Number of messages in group's header */
+ unsigned est_num_entries; /* Estimated # of entries in group */
+ unsigned est_name_len; /* Estimated length of entry name */
+ unsigned nmsgs; /* Number of messages in group's header */
H5O_info_t oinfo; /* Object info */
char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
unsigned u; /* Local index variable */
h5_stat_size_t file_size; /* Size of each file created */
@@ -385,7 +385,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
/* Create first "bottom" group */
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check on bottom group's status */
@@ -402,7 +402,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
/* Create several more bottom groups, to push the top group almost to a symbol table */
/* (Start counting at '1', since we've already created one bottom group */
for(u = 1; u < LIFECYCLE_MAX_COMPACT; u++) {
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check on bottom group's status */
@@ -426,7 +426,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(oinfo.hdr.nchunks != 1) TEST_ERROR
/* Create one more "bottom" group, which should push top group into using a symbol table */
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check on bottom group's status */
@@ -449,7 +449,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
/* Unlink objects from top group */
while(u >= LIFECYCLE_MIN_DENSE) {
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
@@ -462,7 +462,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink one more object from the group, which should transform back to using links */
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
u--;
@@ -472,10 +472,10 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR
/* Unlink last two objects from top group */
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
u--;
- sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
+ HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Check on top group's status */
@@ -505,15 +505,15 @@ lifecycle(hid_t fcpl, hid_t fapl2)
error:
H5E_BEGIN_TRY {
- H5Gclose(gcpl);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gcpl);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end lifecycle() */
-
+
/*-------------------------------------------------------------------------
* Function: long_compact
*
@@ -532,11 +532,11 @@ error:
static int
long_compact(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Group ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Group ID */
char *objname = NULL; /* Object name */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
h5_stat_size_t file_size; /* Size of each file created */
@@ -638,9 +638,9 @@ long_compact(hid_t fcpl, hid_t fapl2)
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
if(objname)
@@ -649,7 +649,7 @@ error:
return 1;
} /* end long_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: read_old
*
@@ -691,7 +691,7 @@ read_old(void)
/* Create a bunch of objects in the group */
for(u = 0; u < READ_OLD_NGROUPS; u++) {
- sprintf(objname, "Group %u", u);
+ HDsprintf(objname, "Group %u", u);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check on bottom group's status */
@@ -709,7 +709,7 @@ read_old(void)
/* Delete new objects from old group */
for(u = 0; u < READ_OLD_NGROUPS; u++) {
- sprintf(objname, "Group %u", u);
+ HDsprintf(objname, "Group %u", u);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
} /* end for */
@@ -730,13 +730,13 @@ read_old(void)
error:
H5E_BEGIN_TRY {
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end read_old() */
-
+
/*-------------------------------------------------------------------------
* Function: no_compact
*
@@ -755,16 +755,16 @@ error:
static int
no_compact(hid_t fcpl, hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
hid_t gcpl = (-1); /* Group creation property list ID */
char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
h5_stat_size_t file_size; /* Size of each file created */
- unsigned est_num_entries; /* Estimated # of entries in group */
- unsigned est_name_len; /* Estimated length of entry name */
+ unsigned est_num_entries; /* Estimated # of entries in group */
+ unsigned est_name_len; /* Estimated length of entry name */
TESTING("group without compact form");
@@ -802,7 +802,7 @@ no_compact(hid_t fcpl, hid_t fapl2)
if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR
/* Create first "bottom" group */
- sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
+ HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check on bottom group's status */
@@ -817,7 +817,7 @@ no_compact(hid_t fcpl, hid_t fapl2)
if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Unlink object from top group */
- sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
+ HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0);
if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Check on top group's status */
@@ -843,15 +843,15 @@ no_compact(hid_t fcpl, hid_t fapl2)
error:
H5E_BEGIN_TRY {
- H5Gclose(gcpl);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gcpl);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end no_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: gcpl_on_root
*
@@ -869,15 +869,15 @@ error:
static int
gcpl_on_root(hid_t fapl2)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
- hid_t gid2 = (-1); /* Datatype ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
+ hid_t gid2 = (-1); /* Datatype ID */
hid_t fcpl = (-1); /* File creation property list ID */
hid_t gcpl = (-1); /* Group creation property list ID */
hid_t lcpl = (-1); /* Link creation property list ID */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
TESTING("setting root group creation properties");
@@ -962,17 +962,17 @@ gcpl_on_root(hid_t fapl2)
error:
H5E_BEGIN_TRY {
- H5Gclose(lcpl);
- H5Gclose(gcpl);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Gclose(fcpl);
- H5Fclose(fid);
+ H5Gclose(lcpl);
+ H5Gclose(gcpl);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Gclose(fcpl);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end gcpl_on_root() */
-
+
/*-------------------------------------------------------------------------
* Function: old_api
*
@@ -990,11 +990,11 @@ static int
old_api(hid_t fapl)
{
#ifndef H5_NO_DEPRECATED_SYMBOLS
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group ID */
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group ID */
h5_stat_size_t small_file_size; /* Size of small group file */
h5_stat_size_t large_file_size; /* Size of large group file */
- char filename[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
#endif /* H5_NO_DEPRECATED_SYMBOLS */
TESTING("old API routines");
@@ -1049,7 +1049,7 @@ old_api(hid_t fapl)
fapl = fapl;
SKIPPED();
- puts(" Deprecated API symbols not enabled");
+ HDputs(" Deprecated API symbols not enabled");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
return 0;
@@ -1057,14 +1057,14 @@ old_api(hid_t fapl)
#ifndef H5_NO_DEPRECATED_SYMBOLS
error:
H5E_BEGIN_TRY {
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end old_api() */
-
+
/*-------------------------------------------------------------------------
* Function: corrupt_stab_msg
*
@@ -1136,24 +1136,24 @@ corrupt_stab_msg(void)
error:
H5E_BEGIN_TRY {
- H5Dclose(did);
- H5Fclose(fid);
+ H5Dclose(did);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
} /* end corrupt_stab_msg() */
-
+
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Test groups
+ * Purpose: Test groups
*
- * Return: Success: zero
+ * Return: Success: zero
*
- * Failure: non-zero
+ * Failure: non-zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Modifications:
@@ -1163,12 +1163,12 @@ error:
int
main(void)
{
- hid_t fapl, fapl2; /* File access property list IDs */
- hid_t fcpl, fcpl2; /* File creation property list ID */
- unsigned new_format; /* Whether to use the new format or not */
- const char *env_h5_drvr; /* File Driver value from environment */
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
- int nerrors = 0;
+ hid_t fapl, fapl2; /* File access property list IDs */
+ hid_t fcpl, fcpl2; /* File creation property list ID */
+ unsigned new_format; /* Whether to use the new format or not */
+ const char *env_h5_drvr; /* File Driver value from environment */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int nerrors = 0;
/* Get the VFD to use */
env_h5_drvr = HDgetenv("HDF5_DRIVER");
@@ -1191,7 +1191,7 @@ main(void)
/* Set up file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
-
+
/* Set to use paged aggregation strategy and persisting free-space */
/* Skip testing for multi/split drivers */
if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0)
@@ -1241,7 +1241,7 @@ main(void)
if(nerrors)
goto error;
- puts("All symbol table tests passed.");
+ HDputs("All symbol table tests passed.");
/* Cleanup */
if (GetTestCleanup()) {
@@ -1253,7 +1253,7 @@ main(void)
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
}