diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/atomic_reader.c | 30 | ||||
-rw-r--r-- | test/atomic_writer.c | 10 | ||||
-rw-r--r-- | test/cmpd_dset.c | 2 | ||||
-rw-r--r-- | test/istore.c | 2 | ||||
-rw-r--r-- | test/tattr.c | 29 | ||||
-rw-r--r-- | test/testframe.c | 202 | ||||
-rw-r--r-- | test/testhdf5.h | 90 | ||||
-rw-r--r-- | test/testmeta.c | 110 | ||||
-rw-r--r-- | test/tfile.c | 5 | ||||
-rw-r--r-- | test/th5s.c | 36 | ||||
-rw-r--r-- | test/trefer.c | 4 | ||||
-rw-r--r-- | test/tsohm.c | 12 |
12 files changed, 256 insertions, 276 deletions
diff --git a/test/atomic_reader.c b/test/atomic_reader.c index 3e3a20a..5c1241f 100644 --- a/test/atomic_reader.c +++ b/test/atomic_reader.c @@ -55,7 +55,7 @@ int verify(int fd, unsigned int k); void print_info(int *info, unsigned int lastr, unsigned iteration); - + /*------------------------------------------------------------------------- * Function: usage * @@ -63,7 +63,7 @@ void print_info(int *info, unsigned int lastr, unsigned iteration); * * Parameters: None * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -78,13 +78,13 @@ usage(void) printf("\n"); } /* usage() */ - + /*------------------------------------------------------------------------- * Function: verify * * Purpose: To verify that the data read is the pattern expected. * Each integer read should be the same as the index. - * When a difference is encountered, the remaining integers + * When a difference is encountered, the remaining integers * read should be the same as the previous index. * For example, the pattern expected should be either: * a) 01234567....n-1 @@ -93,11 +93,11 @@ usage(void) * the remaining integers should be all "3"s as: * 012333333333333 * - * Parameters: + * Parameters: * fd -- the file descriptor * k -- the number of integers to read * - * Return: + * Return: * positive on success * negative on failure * @@ -106,9 +106,9 @@ usage(void) int verify(int fd, unsigned int k) { - unsigned int i; /* local index variable */ - ssize_t bytes_read; /* the number of bytes read */ - unsigned int *buf = NULL; /* buffer to hold data read */ + unsigned int i; /* local index variable */ + ssize_t bytes_read; /* the number of bytes read */ + unsigned int *buf = NULL; /* buffer to hold data read */ /* Allocate buffer for data read */ if((buf = (unsigned int *)malloc(k * sizeof(unsigned int))) == NULL) { @@ -165,13 +165,13 @@ error: } /* end verify() */ - + /*------------------------------------------------------------------------- * Function: print_info * * Purpose: To print the statistics gathered for re-reads * - * Parameters: + * Parameters: * info -- the array storing the statistics for re-reads * lastr -- the last read completed * iteration -- the current iteration @@ -183,7 +183,7 @@ error: void print_info(int *info, unsigned int lastr, unsigned iteration) { - unsigned j; /* local index variable */ + unsigned j; /* local index variable */ printf("--------statistics for %u reads (iteration %u)--------\n", lastr, iteration); @@ -193,13 +193,13 @@ print_info(int *info, unsigned int lastr, unsigned iteration) printf("--------end statistics for %u reads (iteration %u)--------\n", lastr, iteration); } /* print_info() */ - + /*------------------------------------------------------------------------- * Function: main * * Purpose: To verify that the data read is the pattern expected. - * (1) Make sure the file opens successfully and the # of bytes read is as expected - * (2) Iterate the reader with i iterations + * (1) Make sure the file opens successfully and the # of bytes read is as expected + * (2) Iterate the reader with i iterations * (3) Read and verify n integers for each iteration * (4) On verification error, re-read the data at most READ_TRIES * times to see if correct data can be obtained diff --git a/test/atomic_writer.c b/test/atomic_writer.c index 218d4da..b9ea03a 100644 --- a/test/atomic_writer.c +++ b/test/atomic_writer.c @@ -14,7 +14,7 @@ * * Created: atomic_writer.c * - * Purpose: This is the "writer" part of the standalone test to check + * Purpose: This is the "writer" part of the standalone test to check * atomic read-write operation on a system. * a) atomic_writer.c--the writer (this file) * b) atomic_reader.c--the reader @@ -53,7 +53,7 @@ static void usage(void); - + /*------------------------------------------------------------------------- * Function: usage * @@ -77,12 +77,12 @@ usage(void) } /* usage() */ - + /*------------------------------------------------------------------------- * Function: main * * Purpose: To write a series of integers to a file for the reader to verify the data. - * A write is atomic if the whole amount written in one operation is not interleaved + * A write is atomic if the whole amount written in one operation is not interleaved * with data from any other process. * (1) Iterate with i iterations * (2) Write a series of integers (0 to n-1) to the file with this pattern: @@ -196,7 +196,7 @@ main(int argc, char *argv[]) printf("WRITER: error from lseek\n"); goto error; } /* end if */ - + /* Write the data */ if((bytes_wrote = write(fd, buf, ((num-n) * sizeof(unsigned int)))) < 0) { printf("WRITER: error from write\n"); diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index eef2070..ff3767c 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2217,7 +2217,7 @@ main (int argc, char *argv[]) if (argc>1) { if (argc>2 || strcmp("--noopt", argv[1])) { HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); } diff --git a/test/istore.c b/test/istore.c index 7489b7e..8759be3 100644 --- a/test/istore.c +++ b/test/istore.c @@ -338,7 +338,7 @@ test_extend(hid_t f, const char *prefix, HDfprintf(stderr,",%lu", (unsigned long)size[1]); if (ndims > 2) HDfprintf(stderr,",%lu", (unsigned long)size[2]); - HD fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); + HDfprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); if (0 == nelmts) HDfprintf(stderr," *SKIPPED*"); HDfprintf(stderr,"\n"); diff --git a/test/tattr.c b/test/tattr.c index 50704c6..7c2b5ce 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -11163,17 +11163,18 @@ test_attr(void) { hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ - hid_t dcpl = -1; - unsigned new_format; /* Whether to use the new format or not */ - unsigned use_shared; /* Whether to use shared attributes or not */ - unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ - herr_t ret; /* Generic return value */ + hid_t dcpl = -1; /* Dataset creation property list */ + unsigned new_format; /* Whether to use the new format or not */ + unsigned use_shared; /* Whether to use shared attributes or not */ + unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ + herr_t ret; /* Generic return value */ MESSAGE(5, ("Testing Attributes\n")); fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* fapl2 uses "latest version of the format" for creating objects in the file */ fapl2 = H5Pcopy(fapl); CHECK(fapl2, FAIL, "H5Pcopy"); ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); @@ -11207,6 +11208,7 @@ test_attr(void) for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; + /* Set the FAPL for the type of format */ if(new_format) { MESSAGE(7, ("testing with new file format\n")); my_fapl = fapl2; @@ -11262,8 +11264,7 @@ test_attr(void) test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ - /* New attribute API routine tests - */ + /* New attribute API routine tests */ test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */ test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */ test_attr_iterate2(new_format, my_fcpl, my_fapl); /* Test iterating over attributes by index */ @@ -11271,8 +11272,7 @@ test_attr(void) test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */ test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */ - /* Tests that address specific bugs - */ + /* Tests that address specific bugs */ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ @@ -11285,8 +11285,7 @@ test_attr(void) test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ - /* tests specific to the "new format" - */ + /* tests specific to the "new format" */ if (new_format == TRUE) { /* General attribute tests */ test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ @@ -11297,8 +11296,7 @@ test_attr(void) test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */ - /* Attribute creation order tests - */ + /* Attribute creation order tests */ test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */ test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */ test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */ @@ -11306,8 +11304,7 @@ test_attr(void) test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ - /* More complex tests with exclusively both "new format" and "shared" attributes - */ + /* More complex tests with exclusively both "new format" and "shared" attributes */ if(use_shared == TRUE) { test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */ test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */ @@ -11365,6 +11362,6 @@ test_attr(void) void cleanup_attr(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/testframe.c b/test/testframe.c index a096f36..68c66ec 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -42,10 +42,10 @@ typedef struct TestStruct { * Variables used by testing framework. */ static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ -static int num_errs = 0; /* Total number of errors during testing */ +static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ static TestStruct *Test = NULL; /* Array of tests */ static unsigned TestAlloc = 0; /* Size of the Test array */ @@ -74,14 +74,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con { /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { - HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", - TheDescr, MAXTESTDESC); - exit(EXIT_FAILURE); + HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", TheDescr, MAXTESTDESC); + HDexit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { - HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); - exit(EXIT_FAILURE); + HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", MAXTESTNAME); + HDexit(EXIT_FAILURE); } /* end if */ /* Check for increasing the Test array size */ @@ -167,7 +165,7 @@ void TestUsage(void) unsigned i; print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "<extra options>" : "")); + TestProgName, (TestPrivateUsage ? "<extra options>" : "")); print_func(" [-[e]x[clude] name]+ \n"); print_func(" [-o[nly] name]+ \n"); print_func(" [-b[egin] name] \n"); @@ -228,78 +226,80 @@ void TestParseCmdLine(int argc, char *argv[]) int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + if ((HDstrcmp(*argv, "-verbose") == 0) || (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if(argc > 0) { - unsigned Loop; + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; - --argc; ++argv; + --argc; ++argv; - /* Skip all tests, then activate only one. */ + /* Skip all tests, then activate only one. */ if(!skipped_all) { for(Loop = 0; Loop < Index; Loop++) Test[Loop].SkipFlag = 1; skipped_all = TRUE; } /* end if */ - SetTest(*argv, ONLYTEST); - } /* end if */ - else { - TestUsage(); - exit(EXIT_FAILURE); + SetTest(*argv, ONLYTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + Summary = 1; + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + TestUsage(); + HDexit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) - Summary = 1; - else if (HDstrcmp(*argv, "-enable-error-stack") == 0) - enable_error_stack = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { - TestUsage(); - exit(EXIT_SUCCESS); - } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + HDexit(EXIT_FAILURE); } } @@ -318,10 +318,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -440,18 +440,18 @@ int GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if(TestExpress==-1) { - env_val = getenv("HDF5TestExpress"); - - if(env_val == NULL) - SetTestExpress(1); - else if(strcmp(env_val, "0") == 0) - SetTestExpress(0); - else if(strcmp(env_val, "1") == 0) - SetTestExpress(1); - else if(strcmp(env_val, "2") == 0) - SetTestExpress(2); - else - SetTestExpress(3); + env_val = getenv("HDF5TestExpress"); + + if(env_val == NULL) + SetTestExpress(1); + else if(strcmp(env_val, "0") == 0) + SetTestExpress(0); + else if(strcmp(env_val, "1") == 0) + SetTestExpress(1); + else if(strcmp(env_val, "2") == 0) + SetTestExpress(2); + else + SetTestExpress(3); } return(TestExpress); @@ -508,13 +508,13 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } @@ -582,29 +582,29 @@ void SetTest(const char *testname, int action) switch (action){ case SKIPTEST: for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } break; case BEGINTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } } break; case ONLYTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) == 0) { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) == 0) { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } } break; default: diff --git a/test/testhdf5.h b/test/testhdf5.h index 1f3f6a0..ef3b784 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -177,53 +177,53 @@ extern "C" { #endif /* Prototypes for the test routines */ -void test_metadata(void); -void test_checksum(void); -void test_tst(void); -void test_heap(void); -void test_refstr(void); -void test_file(void); -void test_h5o(void); -void test_h5t(void); -void test_h5s(void); -void test_coords(void); -void test_h5d(void); -void test_attr(void); -void test_select(void); -void test_time(void); -void test_reference(void); -void test_vltypes(void); -void test_vlstrings(void); -void test_iterate(void); -void test_array(void); -void test_genprop(void); -void test_configure(void); -void test_misc(void); -void test_ids(void); -void test_skiplist(void); -void test_sohm(void); -void test_unicode(void); +void test_metadata(void); +void test_checksum(void); +void test_tst(void); +void test_heap(void); +void test_refstr(void); +void test_file(void); +void test_h5o(void); +void test_h5t(void); +void test_h5s(void); +void test_coords(void); +void test_h5d(void); +void test_attr(void); +void test_select(void); +void test_time(void); +void test_reference(void); +void test_vltypes(void); +void test_vlstrings(void); +void test_iterate(void); +void test_array(void); +void test_genprop(void); +void test_configure(void); +void test_misc(void); +void test_ids(void); +void test_skiplist(void); +void test_sohm(void); +void test_unicode(void); /* Prototypes for the cleanup routines */ -void cleanup_metadata(void); -void cleanup_checksum(void); -void cleanup_file(void); -void cleanup_h5o(void); -void cleanup_h5s(void); -void cleanup_coords(void); -void cleanup_attr(void); -void cleanup_select(void); -void cleanup_time(void); -void cleanup_reference(void); -void cleanup_vltypes(void); -void cleanup_vlstrings(void); -void cleanup_iterate(void); -void cleanup_array(void); -void cleanup_genprop(void); -void cleanup_configure(void); -void cleanup_sohm(void); -void cleanup_misc(void); -void cleanup_unicode(void); +void cleanup_metadata(void); +void cleanup_checksum(void); +void cleanup_file(void); +void cleanup_h5o(void); +void cleanup_h5s(void); +void cleanup_coords(void); +void cleanup_attr(void); +void cleanup_select(void); +void cleanup_time(void); +void cleanup_reference(void); +void cleanup_vltypes(void); +void cleanup_vlstrings(void); +void cleanup_iterate(void); +void cleanup_array(void); +void cleanup_genprop(void); +void cleanup_configure(void); +void cleanup_sohm(void); +void cleanup_misc(void); +void cleanup_unicode(void); #ifdef __cplusplus } diff --git a/test/testmeta.c b/test/testmeta.c index b97eb68..9a40e6f 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -23,34 +23,34 @@ */ -#include "hdf5.h" +#include "h5test.h" -#define FILEN "testmeta.h5" +#define FILEN "testmeta.h5" -#define CHUNK_SIZE 512 +#define CHUNK_SIZE 512 -#define NDATAARRAYS 3 -/*#define NPOINTS 2048*/ -#define NPOINTS 20 -#define NEXTARRAYS 10 -#define NDATAOBJECTS 100000 +#define NDATAARRAYS 3 +/*#define NPOINTS 2048*/ +#define NPOINTS 20 +#define NEXTARRAYS 10 +#define NDATAOBJECTS 100000 int main(void) { - hid_t file_id, prop_id, memspace_id, type_id; - hid_t group_id; - hid_t dataset_id, dataspace_id; - herr_t status; - hsize_t dims[1]; - hsize_t maxdims[1]; - float data[NPOINTS]; - float floatval; - unsigned numdataobj = 0; - unsigned i, j; - char name[80]; - hsize_t start[1] = {0}; - hsize_t stride[1] = {1}; - hsize_t count[1] = {1}; + hid_t file_id, prop_id, memspace_id, type_id; + hid_t group_id; + hid_t dataset_id, dataspace_id; + herr_t status; + hsize_t dims[1]; + hsize_t maxdims[1]; + float data[NPOINTS]; + float floatval; + unsigned numdataobj = 0; + unsigned i, j; + char name[80]; + hsize_t start[1] = {0}; + hsize_t stride[1] = {1}; + hsize_t count[1] = {1}; /* Create a file */ file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -64,8 +64,7 @@ int main(void) H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write value to NumDataObj dataset */ - status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &numdataobj); + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); /* Close the identifiers */ status = H5Dclose(dataset_id); @@ -78,16 +77,14 @@ int main(void) status = H5Pset_chunk(prop_id, 1, dims); /* Create dataspace */ - dims[0]=1; - maxdims[0]=H5S_UNLIMITED; + dims[0] = 1; + maxdims[0] = H5S_UNLIMITED; dataspace_id = H5Screate_simple(1, dims, maxdims); - for(i=0; i<NEXTARRAYS; i++) - { + for(i = 0; i < NEXTARRAYS; i++) { /* Create dataset */ sprintf(name, "/ExtArray%06d", i); - dataset_id = H5Dcreate2(file_id, name, - H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); + dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); /* Close the identifier */ status = H5Dclose(dataset_id); @@ -101,47 +98,43 @@ int main(void) group_id = H5Gcreate2(file_id, "/DataArray", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(group_id); - for(j=0; j<NDATAOBJECTS; j++) - { + for(j = 0; j < NDATAOBJECTS; j++) { /* Removed print statement as it would lock system resources on Windows */ /* - * printf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); + * HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); * fflush(stdout); */ floatval = (float)j; /* Create group to hold data arrays for this object */ - sprintf(name, "/DataArray/%06d", j); + HDsprintf(name, "/DataArray/%06d", j); group_id = H5Gcreate2(file_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(group_id < 0) { - fprintf(stderr, "Failed to create DataArray group.\n"); + HDfprintf(stderr, "Failed to create DataArray group.\n"); status = H5Fclose(file_id); return -1; } /* Loop over data arrays */ - for(i=0; i<NDATAARRAYS; i++) - { + for(i = 0; i < NDATAARRAYS; i++) { /* Create dataspace */ dims[0]=NPOINTS; maxdims[0]=NPOINTS; dataspace_id = H5Screate_simple(1 ,dims, maxdims); /* Create dataset */ - sprintf(name, "DataArray%06d", i); - dataset_id = H5Dcreate2(group_id, name, - H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + HDsprintf(name, "DataArray%06d", i); + dataset_id = H5Dcreate2(group_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to create DataArray dataset.\n"); + HDfprintf(stderr, "Failed to create DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* Write the data array data */ - status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, data); + status = H5Dwrite(dataset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if(status < 0) { - fprintf(stderr, "Failed to write DataArray dataset.\n"); + HDfprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -154,17 +147,16 @@ int main(void) /* Open NumDataObj dataset */ dataset_id = H5Dopen2(file_id, "/NumDataObj", H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to open NumDataObj dataset.\n"); + HDfprintf(stderr, "Failed to open NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; } /* Write value to NumDataObj dataset */ numdataobj = j + 1; - status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &numdataobj); + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); if(status < 0) { - fprintf(stderr, "Failed to write NumDataObj dataset.\n"); + HDfprintf(stderr, "Failed to write NumDataObj dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -176,10 +168,10 @@ int main(void) /* Extend attribute arrays */ for(i = 0; i < NEXTARRAYS; i++) { /* Open extendable dataset */ - sprintf(name, "/ExtArray%06d", i); + HDsprintf(name, "/ExtArray%06d", i); dataset_id = H5Dopen2(file_id, name, H5P_DEFAULT); if(dataset_id < 0) { - fprintf(stderr, "Failed to open ExtArray dataset.\n"); + HDfprintf(stderr, "Failed to open ExtArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* end if */ @@ -188,7 +180,7 @@ int main(void) dims[0] = (hsize_t)j + 1; status = H5Dset_extent(dataset_id, dims); if(status < 0) { - fprintf(stderr, "Failed to extend DataArray dataset.\n"); + HDfprintf(stderr, "Failed to extend DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } /* end if */ @@ -200,16 +192,12 @@ int main(void) type_id = H5Dget_type(dataset_id); start[0] = 0; - status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, - start, stride, count, NULL); + status = H5Sselect_hyperslab(memspace_id, H5S_SELECT_SET, start, stride, count, NULL); start[0] = (hssize_t)j; - status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, - start, stride, count, NULL); - status = H5Dwrite(dataset_id, type_id, memspace_id, - dataspace_id, H5P_DEFAULT, &floatval); - if(status < 0) - { - fprintf(stderr, "Failed to write DataArray dataset.\n"); + status = H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, start, stride, count, NULL); + status = H5Dwrite(dataset_id, type_id, memspace_id, dataspace_id, H5P_DEFAULT, &floatval); + if(status < 0) { + HDfprintf(stderr, "Failed to write DataArray dataset.\n"); status = H5Fclose(file_id); return -1; } @@ -226,7 +214,7 @@ int main(void) /* Close the file */ status = H5Fclose(file_id); - printf("\n"); + HDprintf("\n"); return 0; } diff --git a/test/tfile.c b/test/tfile.c index 40c2d4b..f39da5a 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -966,7 +966,7 @@ test_file_close(void) ****************************************************************/ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, - hid_t *ret_gid2, hid_t *ret_gid3) + hid_t *ret_gid2, hid_t *ret_gid3) { ssize_t oid_count; herr_t ret; @@ -1120,8 +1120,7 @@ test_get_obj_ids(void) /* Call the public function H5F_get_obj_ids to use H5F__get_objects. User reported having problem here. * that the returned size (ret_count) from H5Fget_obj_ids is one greater than the size passed in - * (oid_list_size). - */ + * (oid_list_size) */ ret_count = H5Fget_obj_ids(fid, H5F_OBJ_ALL, (size_t)oid_list_size, oid_list); CHECK(ret_count, FAIL, "H5Fget_obj_ids"); VERIFY(ret_count, oid_list_size, "H5Fget_obj_count"); diff --git a/test/th5s.c b/test/th5s.c index 16e20b1..1a4456a 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1184,24 +1184,24 @@ test_h5s_zero_dim(void) static void test_h5s_encode(H5F_libver_t low, H5F_libver_t high) { - hid_t sid1, sid2, sid3; /* Dataspace ID */ - hid_t decoded_sid1, decoded_sid2, decoded_sid3; - int rank; /* Logical rank of dataspace */ - hid_t fapl = -1; /* File access property list ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - size_t sbuf_size=0, null_size=0, scalar_size=0; - unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL; - hsize_t tdims[4]; /* Dimension array to test with */ - hssize_t n; /* Number of dataspace elements */ - hsize_t start[] = {0, 0, 0}; - hsize_t stride[] = {2, 5, 3}; - hsize_t count[] = {2, 2, 2}; - hsize_t block[] = {1, 3, 1}; - H5S_sel_type sel_type; - H5S_class_t space_type; - hssize_t nblocks; - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t sid1, sid2, sid3; /* Dataspace ID */ + hid_t decoded_sid1, decoded_sid2, decoded_sid3; + int rank; /* Logical rank of dataspace */ + hid_t fapl = -1; /* File access property list ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + size_t sbuf_size=0, null_size=0, scalar_size=0; + unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL; + hsize_t tdims[4]; /* Dimension array to test with */ + hssize_t n; /* Number of dataspace elements */ + hsize_t start[] = {0, 0, 0}; + hsize_t stride[] = {2, 5, 3}; + hsize_t count[] = {2, 2, 2}; + hsize_t block[] = {1, 3, 1}; + H5S_sel_type sel_type; + H5S_class_t space_type; + hssize_t nblocks; + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace Encoding and Decoding\n")); diff --git a/test/trefer.c b/test/trefer.c index 9af5c89..7158984 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -21,7 +21,7 @@ #include "testhdf5.h" -#define FILE1 "trefer1.h5" +#define FILE1 "trefer1.h5" #define FILE2 "trefer2.h5" #define FILE3 "trefer3.h5" @@ -941,7 +941,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) uint8_t *tu8; /* Temporary pointer to uint8 data */ H5O_type_t obj_type; /* Object type */ int i; /* counting variables */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); diff --git a/test/tsohm.c b/test/tsohm.c index 9216b3e..a064940 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3730,8 +3730,7 @@ test_sohm_external_dtype(void) ret = H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT); CHECK_I(ret, "H5Tinsert"); - /* Set up dataset in first file - */ + /* Set up dataset in first file */ file1 = H5Fcreate(FILENAME_SRC, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file1, "H5Fcreate"); @@ -3767,8 +3766,7 @@ test_sohm_external_dtype(void) ret = H5Dclose(dataset1); CHECK_I(ret, "H5Dclose"); - /* Create dataset in second file using datatype from dataset in the first file - */ + /* Create dataset in second file using datatype from dataset in the first file */ file2 = H5Fcreate(FILENAME_DST, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); CHECK_I(file2, "H5Fcreate"); @@ -3797,8 +3795,7 @@ test_sohm_external_dtype(void) ret = H5Fclose(file1); CHECK_I(ret, "H5Fclose"); - /* Verify that datatype details are still accessible by second file - */ + /* Verify that datatype details are still accessible by second file */ dataset2 = H5Dopen2(file2, "dataset_2", H5P_DEFAULT); CHECK_I(dataset2, "H5Dopen2"); @@ -3808,8 +3805,7 @@ test_sohm_external_dtype(void) dtype_class = H5Tget_class(dset2_tid); VERIFY(dtype_class, H5T_COMPOUND, "H5Tget_class"); - /* Cleanup - */ + /* Cleanup */ ret = H5Tclose(dset2_tid); CHECK_I(ret, "H5Tclose"); ret = H5Dclose(dataset2); |