diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-03-29 04:03:20 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-03-29 04:03:20 (GMT) |
commit | 8461df0911aecf6665b4a19d4a66e4d11bc31e3c (patch) | |
tree | 7c732c6dd13fbb1b64c57b2753459760d2f7191e /c++/test | |
parent | 54319cf88d1fece145a47960452ace57f3487f8f (diff) | |
download | hdf5-8461df0911aecf6665b4a19d4a66e4d11bc31e3c.zip hdf5-8461df0911aecf6665b4a19d4a66e4d11bc31e3c.tar.gz hdf5-8461df0911aecf6665b4a19d4a66e4d11bc31e3c.tar.bz2 |
[svn-r23485] Purpose: Fix bug HDFFV-8067
Description:
Applied the fix for HDFFV-8067 and the minor cleanups from the trunk.
Platforms tested:
Linux/32 2.6 (jam) with PGI compilers
Linux/32 2.6 (jam) with GNU compilers
Linux/64 2.6 (koala) with ICC compilers
SunOS 5.10 (emu)
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/dsets.cpp | 5 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 60 | ||||
-rw-r--r-- | c++/test/tfilter.cpp | 4 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 9 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 3 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 1 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 7 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 5 |
8 files changed, 40 insertions, 54 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index bb13f2f..744118f 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -288,11 +288,6 @@ test_datasize() { SUBTEST("DataSet::getInMemDataSize()"); - - int points[100][200]; - int check[100][200]; - int i, j, n; - try { // Open FILE1. diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index df01752..6e49162 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -111,22 +111,15 @@ static void test_file_create() // try to create the same file with H5F_ACC_TRUNC. This should fail // because file1 is the same file and is currently open. -/* These three are failing with new/PGI compiler, HDFFV-8067 - The line "H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E" - Results in this message: - "terminate called without an active exception - Command terminated by signal 6" - Commenting it out until it's fixed LK 20120626. -#ifndef H5_HAVE_FILE_VERSIONS try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E + // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "Attempted to create an existing file."); } catch( FileIException E ) // catch truncating existing file {} // do nothing, FAIL expected -#endif // Close file1 delete file1; file1 = NULL; @@ -141,10 +134,10 @@ static void test_file_create() } catch( FileIException E ) // catching creating existing file {} // do nothing, FAIL expected + // Test create with H5F_ACC_TRUNC. This will truncate the existing file. file1 = new H5File (FILE1, H5F_ACC_TRUNC); -#ifndef H5_HAVE_FILE_VERSIONS // Try to truncate first file again. This should fail because file1 // is the same file and is currently open. try { @@ -155,19 +148,17 @@ static void test_file_create() } catch( FileIException E ) // catching truncating opened file {} // do nothing, FAIL expected -#endif + // Try with H5F_ACC_EXCL. This should fail too because the file already // exists. try { -// H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E + H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); } catch( FileIException E ) // catching H5F_ACC_EXCL on existing file {} // do nothing, FAIL expected -*/ - std::cerr << "SKIPPED for HDFFV-8067" << std::endl; // Get the file-creation template FileCreatPropList tmpl1 = file1->getCreatePlist(); @@ -333,6 +324,7 @@ static void test_file_open() tmpl1.getSymk( iparm1, iparm2); verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + PASSED(); } // end of try block @@ -381,8 +373,16 @@ static void test_file_size() hsize_t file_size = file4.getFileSize(); // Check if file size is reasonable. It's supposed to be 2KB now. - if(file_size<1*KB || file_size>4*KB) - issue_fail_msg("test_file_size()", __LINE__, __FILE__); + if (file_size < 1*KB || file_size > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFileSize() returned unreasonable value"); + + // Get the amount of free space in the file + hssize_t free_space = file4.getFreeSpace(); + + // Check if it's reasonable. It's 0 now. + if (free_space < 0 || free_space > 4*KB) + issue_fail_msg("test_file_size()", __LINE__, __FILE__, "getFreeSpace returned unreasonable value"); + PASSED(); } // end of try block @@ -415,7 +415,8 @@ const int NX = 4; const int NY = 5; const H5std_string GROUPNAME ("group"); const H5std_string DSETNAME ("dataset"); -const H5std_string ATTRNAME ("attribute"); +const H5std_string DATTRNAME ("dataset attribute"); +const H5std_string FATTRNAME ("file attribute"); const H5std_string DTYPENAME ("compound"); // Compound datatype @@ -426,7 +427,7 @@ typedef struct s1_t { static void test_file_name() { - // Output message about test being performed + // Output message about test being performed. SUBTEST("File Name"); H5std_string file_name; @@ -438,42 +439,42 @@ static void test_file_name() file_name = file4.getFileName(); verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); - // Create a group in the root group + // Create a group in the root group. Group group(file4.createGroup(GROUPNAME, 0)); - // Get and verify file name + // Get and verify file name via a group. file_name = group.getFileName(); verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); - // Create the data space + // Create the data space. hsize_t dims[RANK] = {NX, NY}; DataSpace space(RANK, dims); - // Create a new dataset + // Create a new dataset. DataSet dataset(file4.createDataSet (DSETNAME, PredType::NATIVE_INT, space)); - // Get and verify file name + // Get and verify file name via a dataset. file_name = dataset.getFileName(); verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); - // Create an attribute for the dataset - Attribute attr(dataset.createAttribute(ATTRNAME, PredType::NATIVE_INT, space)); + // Create an attribute for the dataset. + Attribute attr(dataset.createAttribute(DATTRNAME, PredType::NATIVE_INT, space)); - // Get and verify file name + // Get and verify file name via an attribute. file_name = attr.getFileName(); verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); - // Create a compound datatype + // Create a compound datatype. CompType comp_type (sizeof(s1_t)); - // Insert fields + // Insert fields. comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT); comp_type.insertMember("b", HOFFSET(s1_t, b), PredType::NATIVE_FLOAT); - // Save it on file + // Save it on file. comp_type.commit(file4, DTYPENAME); - // Get and verify file name + // Get and verify file name via a committed datatype. comp_type.getFileName(); verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__); PASSED(); @@ -507,7 +508,6 @@ void test_file() { // Output message about test being performed MESSAGE(5, ("Testing File I/O operations\n")); - //MESSAGE("Testing File I/O operations\n"); test_file_create(); // Test file creation (also creation templates) test_file_open(); // Test file opening diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 0dbdf00..9e60655 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -47,12 +47,14 @@ #define FILTER_CHUNK_DIM2 25 // will do this function later or use it as guideline - BMR - 2007/01/26 +#if 0 static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted, hsize_t *dset_size) { cerr << "do nothing right now" << endl; return(0); } +#endif /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS 305 @@ -254,13 +256,11 @@ extern "C" void test_filters() { // Output message about test being performed - //MESSAGE("Testing Various Filters\n"); MESSAGE(5, ("Testing Various Filters\n")); hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template - int nerrors=0; // keep track of number of failures occurr try { // Use the file access template id to create a file access prop. list diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e6ed440..7947a9b 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,13 +188,7 @@ static void test_h5s_basic() * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenating the th5s.h5 file. */ - char testfile[512]=""; - char *srcdir = getenv("srcdir"); - if (srcdir && ((strlen(srcdir) + strlen(TESTFILE.c_str()) + 1) < sizeof(testfile))){ - strcpy(testfile, srcdir); - strcat(testfile, "/"); - } - strcat(testfile, TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); // Create file H5File fid1(testfile, H5F_ACC_RDONLY); @@ -575,7 +569,6 @@ extern "C" void test_h5s() { // Output message about test being performed - //MESSAGE("Testing Dataspaces\n"); MESSAGE(5, ("Testing Dataspaces\n")); test_h5s_basic(); // Test basic H5S code diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index e4e691a..fca5918 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -226,6 +226,7 @@ typedef struct { hbool_t *visited; /* Pointer to array of "visited link" flags */ } link_iter_info_t; +#if 0 /* Link visit structs */ typedef struct { const char *path; /* Path to link */ @@ -374,6 +375,7 @@ typedef struct { unsigned idx; /* Index in object visit structure */ const obj_visit_t *info; /* Pointer to the object visit structure to use */ } ovisit_ud_t; +#endif static const char *FILENAME[] = { "link0", @@ -529,7 +531,6 @@ void test_links() fapl_id = h5_fileaccess(); // Output message about test being performed - //MESSAGE("Testing Various Links\n"); MESSAGE(5, ("Testing Various Links\n")); try { diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 7f63d33..dcb32dc 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -244,7 +244,6 @@ static void test_reference_obj(void) verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__); // Test getObjnameByIdx(hsize_t idx, char* name, size_t size) - char name_C[DSET1_LEN+1]; group.getObjnameByIdx(0, name, name_size+1); verify_val(name, DSET1_NAME, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__); verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__); diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index d97a1ec..6950523 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -52,6 +52,7 @@ * normally require alignment. When set, all native datatypes must be aligned * on a byte boundary equal to the data size. */ +#if 0 #define TEST_ALIGNMENT /* Alignment test stuff */ @@ -61,6 +62,7 @@ #endif #define SET_ALIGNMENT(TYPE,VAL) \ H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL) +#endif const char *FILENAME[] = { "dtypes1.h5", @@ -143,9 +145,6 @@ static void test_classes() */ static void test_copy() { - hid_t a_copy; - herr_t status; - SUBTEST("DataType::copy() and DataType::operator="); try { // Test copying from a predefined datatype using DataType::operator= @@ -212,7 +211,6 @@ static void test_query() long c; double d; } s_type_t; - char filename[1024]; short enum_val; // Output message about test being performed @@ -387,7 +385,6 @@ static void test_transient () const H5std_string filename2("dtypes2.h5"); static void test_named () { - herr_t status; static hsize_t ds_size[2] = {10, 20}; hsize_t i; unsigned attr_data[10][20]; diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 73e54e0..89f24f2 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -129,7 +129,7 @@ void test_vlstr_free_custom(void *_mem, void *info) *------------------------------------------------------------------------- */ // String for testing datasets -static char stastring_ds_write[1]={'A'}; +// static char stastring_ds_write[1]={'A'}; // Info for a string dataset const H5std_string DSET1_NAME("String_ds"); @@ -687,6 +687,7 @@ static void test_vlstring_attribute() } } // test_vlstring_attribute() +#if 0 /*------------------------------------------------------------------------- * Function: test_read_vl_string_attribute * @@ -746,6 +747,7 @@ static void test_read_vl_string_attribute() issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_read_vl_string_attribute +#endif // 2013: need to verify before adding to test /*------------------------------------------------------------------------- * Function: test_vlstring_array_attribute @@ -957,7 +959,6 @@ extern "C" void test_vlstrings() { // Output message about test being performed - //MESSAGE("Testing Variable-Length Strings"); MESSAGE(5, ("Testing Variable-Length Strings")); // These tests use the same file |