diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-10 20:36:33 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-10 20:36:33 (GMT) |
commit | c0c896e724c77226e3a73379f3571b323893335d (patch) | |
tree | 6ad76b3f1d04661b3353664d7a743bb7fea98362 /test | |
parent | 65d30cc9c36b782c704daeb4b3f75cdbc7bff680 (diff) | |
download | hdf5-c0c896e724c77226e3a73379f3571b323893335d.zip hdf5-c0c896e724c77226e3a73379f3571b323893335d.tar.gz hdf5-c0c896e724c77226e3a73379f3571b323893335d.tar.bz2 |
[svn-r12740] Description:
Update datasets and the layout, attributes and fill-value
object header messages to use the latest version
of the file format flag.
Tested on:
FreeBSD 4.11 (sleipnir)
Linux/64 2.4 (mir)
Linux/32 2.4 (heping)
Diffstat (limited to 'test')
-rw-r--r-- | test/fillval.c | 117 | ||||
-rw-r--r-- | test/links.c | 1 | ||||
-rw-r--r-- | test/tattr.c | 143 | ||||
-rw-r--r-- | test/unlink.c | 3 |
4 files changed, 166 insertions, 98 deletions
diff --git a/test/fillval.c b/test/fillval.c index b204523..2385585 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1266,7 +1266,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) *------------------------------------------------------------------------- */ static int -test_compatible(void) +test_compatible(hid_t fapl) { hid_t file=-1, dset1=-1, dset2=-1; hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1; @@ -1287,7 +1287,7 @@ test_compatible(void) } strcat(testfile, FILE_COMPATIBLE); - if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT))<0) { + if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, fapl))<0) { printf(" Could not open file %s. Try set $srcdir to point at the " "source directory of test\n", testfile); goto error; @@ -1409,68 +1409,97 @@ error: int main(int argc, char *argv[]) { - int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; const char *envval = NULL; - hid_t fapl=-1; envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) + if(envval == NULL) envval = "nomatch"; - if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { - if (argc>=2) { + if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { + int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; + hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ + hbool_t new_format; /* Whether to use the new format or not */ + + if(argc >= 2) { test_contig = test_chunk = test_compact = 0; - for (argno=1; argno<argc; argno++) { - if (!strcmp(argv[argno], "contiguous")) { + for(argno = 1; argno < argc; argno++) { + if(!strcmp(argv[argno], "contiguous")) test_contig = 1; - } else if (!strcmp(argv[argno], "chunked")) { + else if(!strcmp(argv[argno], "chunked")) test_chunk = 1; - } else if (!strcmp(argv[argno], "compact")) { + else if(!strcmp(argv[argno], "compact")) test_compact =1; - } else { + else { fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); exit(1); } - } - } + } /* end for */ + } /* end if */ h5_reset(); fapl = h5_fileaccess(); + /* Property list tests */ nerrors += test_getset(); - /* Chunked storage layout tests */ - if (test_chunk) { - nerrors += test_create(fapl, FILENAME[0], H5D_CHUNKED); - nerrors += test_rdwr (fapl, FILENAME[2], H5D_CHUNKED); - nerrors += test_extend(fapl, FILENAME[4], H5D_CHUNKED); - } - - /* Contiguous storage layout tests */ - if (test_contig) { - nerrors += test_create(fapl, FILENAME[1], H5D_CONTIGUOUS); - nerrors += test_rdwr (fapl, FILENAME[3], H5D_CONTIGUOUS); - nerrors += test_extend(fapl, FILENAME[5], H5D_CONTIGUOUS); - nerrors += test_compatible(); - } - - /* Compact dataset storage tests */ - if (test_compact) { - nerrors += test_create(fapl, FILENAME[6], H5D_COMPACT); - nerrors += test_rdwr (fapl, FILENAME[7], H5D_COMPACT); - } - - if (nerrors) goto error; + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR + + /* Set the "use the latest version of the format" flag for creating objects in the file */ + if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR + + /* Loop over using new group format */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; + + /* Set the FAPL for the type of format */ + if(new_format) { + puts("\nTesting with new file format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old file format:"); + my_fapl = fapl; + } /* end else */ + + /* Chunked storage layout tests */ + if(test_chunk) { + nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED); + nerrors += test_rdwr (my_fapl, FILENAME[2], H5D_CHUNKED); + nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED); + } /* end if */ + + /* Contiguous storage layout tests */ + if(test_contig) { + nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS); + nerrors += test_rdwr (my_fapl, FILENAME[3], H5D_CONTIGUOUS); + nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS); + nerrors += test_compatible(my_fapl); + } /* end if */ + + /* Compact dataset storage tests */ + if(test_compact) { + nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT); + nerrors += test_rdwr (my_fapl, FILENAME[7], H5D_COMPACT); + } /* end if */ + } /* end for */ + + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + if(nerrors) + goto error; puts("All fill value tests passed."); - if (h5_cleanup(FILENAME, fapl)) remove(FILE_NAME_RAW); - } + + if(h5_cleanup(FILENAME, fapl)) + remove(FILE_NAME_RAW); + } /* end if */ else - { puts("All fill value tests skipped - Incompatible with current Virtual File Driver"); - } - return 0; - error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + return 0; +error: + puts("***** FILL VALUE TESTS FAILED *****"); + return 1; } + diff --git a/test/links.c b/test/links.c index 2290e69..1a5f898 100644 --- a/test/links.c +++ b/test/links.c @@ -5266,4 +5266,3 @@ error: return 1; } - diff --git a/test/tattr.c b/test/tattr.c index b6514b7..86843d1 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -99,7 +99,7 @@ herr_t attr_op1(hid_t loc_id, const char *name, void *op_data); ** ****************************************************************/ static void -test_attr_basic_write(void) +test_attr_basic_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -120,7 +120,7 @@ test_attr_basic_write(void) MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for dataset */ @@ -263,7 +263,7 @@ test_attr_basic_write(void) CHECK(ret, FAIL, "H5Dclose"); /* Create group */ - group = H5Gcreate(fid1, GROUP1_NAME, 0); + group = H5Gcreate(fid1, GROUP1_NAME, (size_t)0); CHECK(group, FAIL, "H5Gcreate"); /* Create dataspace for attribute */ @@ -313,7 +313,7 @@ test_attr_basic_write(void) ** ****************************************************************/ static void -test_attr_basic_read(void) +test_attr_basic_read(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -328,7 +328,7 @@ test_attr_basic_read(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Create file */ - fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -400,7 +400,7 @@ test_attr_basic_read(void) ** ****************************************************************/ static void -test_attr_flush(void) +test_attr_flush(hid_t fapl) { hid_t fil, /* File ID */ att, /* Attribute ID */ @@ -413,7 +413,7 @@ test_attr_flush(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Flushing\n")); - fil = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fil = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fil, FAIL, "H5Fcreate"); spc = H5Screate(H5S_SCALAR); @@ -465,7 +465,7 @@ test_attr_flush(void) ** ****************************************************************/ static void -test_attr_plist(void) +test_attr_plist(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -481,7 +481,7 @@ test_attr_plist(void) MESSAGE(5, ("Testing Attribute Property Lists\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for dataset */ @@ -578,7 +578,7 @@ test_attr_plist(void) ** ****************************************************************/ static void -test_attr_compound_write(void) +test_attr_compound_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -593,7 +593,7 @@ test_attr_compound_write(void) MESSAGE(5, ("Testing Multiple Attribute Functions\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for dataset */ @@ -665,7 +665,7 @@ test_attr_compound_write(void) ** ****************************************************************/ static void -test_attr_compound_read(void) +test_attr_compound_read(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -691,7 +691,7 @@ test_attr_compound_read(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Open file */ - fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -812,7 +812,7 @@ test_attr_compound_read(void) ** ****************************************************************/ static void -test_attr_scalar_write(void) +test_attr_scalar_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -825,7 +825,7 @@ test_attr_scalar_write(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for dataset */ @@ -876,7 +876,7 @@ test_attr_scalar_write(void) ** ****************************************************************/ static void -test_attr_scalar_read(void) +test_attr_scalar_read(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -890,7 +890,7 @@ test_attr_scalar_read(void) MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n")); /* Create file */ - fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -941,7 +941,7 @@ test_attr_scalar_read(void) ** ****************************************************************/ static void -test_attr_mult_write(void) +test_attr_mult_write(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -957,7 +957,7 @@ test_attr_mult_write(void) MESSAGE(5, ("Testing Multiple Attribute Functions\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for dataset */ @@ -1059,7 +1059,7 @@ test_attr_mult_write(void) ** ****************************************************************/ static void -test_attr_mult_read(void) +test_attr_mult_read(hid_t fapl) { hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -1084,7 +1084,7 @@ test_attr_mult_read(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Open file */ - fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -1315,7 +1315,7 @@ herr_t attr_op1(hid_t UNUSED loc_id, const char *name, void *op_data) ** ****************************************************************/ static void -test_attr_iterate(void) +test_attr_iterate(hid_t fapl) { hid_t file; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ @@ -1328,7 +1328,7 @@ test_attr_iterate(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Open file */ - file = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(file, FAIL, "H5Fopen"); /* Create a dataspace */ @@ -1386,7 +1386,7 @@ test_attr_iterate(void) ** ****************************************************************/ static void -test_attr_delete(void) +test_attr_delete(hid_t fapl) { hid_t fid1; /* HDF5 File ID */ hid_t dataset; /* Dataset ID */ @@ -1399,7 +1399,7 @@ test_attr_delete(void) MESSAGE(5, ("Testing Basic Attribute Functions\n")); /* Open file */ - fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -1500,7 +1500,7 @@ test_attr_delete(void) ** ****************************************************************/ static void -test_attr_dtype_shared(void) +test_attr_dtype_shared(hid_t fapl) { hid_t file_id; /* File ID */ hid_t dset_id; /* Dataset ID */ @@ -1518,7 +1518,7 @@ test_attr_dtype_shared(void) MESSAGE(5, ("Testing Shared Datatypes with Attributes\n")); /* Create a file */ - file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Close file */ @@ -1531,7 +1531,7 @@ test_attr_dtype_shared(void) TestErrPrintf("Line %d: file size wrong!\n",__LINE__); /* Re-open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,H5P_DEFAULT); + file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Create a datatype to commit and use */ @@ -1616,7 +1616,7 @@ test_attr_dtype_shared(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open file */ - file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,H5P_DEFAULT); + file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl); CHECK(file_id, FAIL, "H5Fopen"); /* Open dataset */ @@ -1675,33 +1675,70 @@ test_attr_dtype_shared(void) void test_attr(void) { + hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ + hbool_t new_format; /* Whether to use the new format or not */ + herr_t ret; /* Generic return value */ + /* Output message about test being performed */ MESSAGE(5, ("Testing Attributes\n")); - /* These next two tests use the same file information */ - test_attr_basic_write(); /* Test basic H5A writing code */ - test_attr_basic_read(); /* Test basic H5A reading code */ - test_attr_flush(); /* Test H5A I/O in the presence of H5Fflush calls */ - - /* This next test uses the same file information */ - test_attr_plist(); /* Test attribute property lists */ - - /* These next two tests use the same file information */ - test_attr_compound_write(); /* Test complex datatype H5A writing code */ - test_attr_compound_read(); /* Test complex datatype H5A reading code */ - - /* These next two tests use the same file information */ - test_attr_scalar_write(); /* Test scalar dataspace H5A writing code */ - test_attr_scalar_read(); /* Test scalar dataspace H5A reading code */ - - /* These next four tests use the same file information */ - test_attr_mult_write(); /* Test H5A writing code for multiple attributes */ - test_attr_mult_read(); /* Test H5A reading code for multiple attributes */ - test_attr_iterate(); /* Test H5A iterator code */ - test_attr_delete(); /* Test H5A code for deleting attributes */ - - /* This next test use the same file information */ - test_attr_dtype_shared(); /* Test using shared dataypes in attributes */ + /* Create a default file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Copy the file access property list */ + fapl2 = H5Pcopy(fapl); + CHECK(fapl2, FAIL, "H5Pcopy"); + + /* Set the "use the latest version of the format" flag for creating objects in the file */ + ret = H5Pset_latest_format(fapl2, TRUE); + CHECK(ret, FAIL, "H5Pset_latest_format"); + + /* Loop over using new group format */ + 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; + } /* end if */ + else { + MESSAGE(7, ("testing with old file format\n")); + my_fapl = fapl; + } /* end else */ + + /* These next two tests use the same file information */ + test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ + test_attr_basic_read(my_fapl); /* Test basic H5A reading code */ + test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */ + + /* This next test uses the same file information */ + test_attr_plist(my_fapl); /* Test attribute property lists */ + + /* These next two tests use the same file information */ + test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */ + test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */ + + /* These next two tests use the same file information */ + test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */ + test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */ + + /* These next four tests use the same file information */ + test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */ + test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */ + test_attr_iterate(my_fapl); /* Test H5A iterator code */ + test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */ + + /* This next test use the same file information */ + test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */ + } /* end for */ + + /* Close FAPLs */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fapl2); + CHECK(ret, FAIL, "H5Pclose"); } /* test_attr() */ diff --git a/test/unlink.c b/test/unlink.c index 908ea1d..cb66177 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2486,6 +2486,9 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR } /* end for */ + /* Close 2nd FAPL */ + H5Pclose(fapl2); + if (nerrors) { printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); exit(1); |