From 27ed849cad4c7e88a540a34f46e70acde04721da Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sat, 14 Sep 2013 22:53:59 -0500 Subject: [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) --- c++/test/dsets.cpp | 9 ++++++--- 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); -- cgit v0.12