diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-09-15 03:53:59 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2013-09-15 03:53:59 (GMT) |
commit | 27ed849cad4c7e88a540a34f46e70acde04721da (patch) | |
tree | 5182471a0d3df901b0b37a313556b5e613f7d1fb | |
parent | a80cf34324810aa52c97586950606bbfc64b0e37 (diff) | |
download | hdf5-27ed849cad4c7e88a540a34f46e70acde04721da.zip hdf5-27ed849cad4c7e88a540a34f46e70acde04721da.tar.gz hdf5-27ed849cad4c7e88a540a34f46e70acde04721da.tar.bz2 |
[svn-r24142] Purpose: Fix bug in tests
Description:
- Passing the c_str() of an std string into a C function caused failure
on OpenVMS. Added a work around using temporary string. (th5s.cpp)
- Passing incorrect file access property list caused test_datasize() to
fail. Fixed.
- Close a group in test_dset, before the file can be properly closed.
This should fix the problem on OpenVMS.
Platforms tested:
Linux/32 2.6 (jam)
SunOS 5.11 (emu)
Linux/ppc64 (ostrich)
-rw-r--r-- | c++/test/dsets.cpp | 9 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 643762b..58436f1 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -283,13 +283,13 @@ test_simple_io( H5File& file) *------------------------------------------------------------------------- */ static herr_t -test_datasize() +test_datasize(FileAccPropList &fapl) { SUBTEST("DataSet::getInMemDataSize()"); try { // Open FILE1. - H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, FileAccPropList::DEFAULT); + H5File file(FILE1, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); // Open dataset DSET_SIMPLE_IO_NAME. DataSet dset = file.openDataSet (DSET_SIMPLE_IO_NAME); @@ -1067,9 +1067,12 @@ void test_dset() nerrors += test_multiopen (file)<0 ?1:0; nerrors += test_types(file)<0 ?1:0; + // Close group "emit diagnostics". + grp.close(); + // Close the file before testing data size. file.close(); - nerrors += test_datasize() <0 ? 1:0; + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception E) { diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 7947a9b..cfdeb1f 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -188,7 +188,10 @@ 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. */ - const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str()); + char *tmp_str = new char[TESTFILE.length()+1]; + strcpy(tmp_str, TESTFILE.c_str()); + const char *testfile = H5_get_srcdir_filename(tmp_str); + delete []tmp_str; // Create file H5File fid1(testfile, H5F_ACC_RDONLY); |