From f6ebd743d80ed41edd55065ed6aba6ae8d349ed7 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 8 Jul 2007 15:28:59 -0500 Subject: [svn-r13954] Purpose: Fix test Description: Compilers don't destroy temporary objects at the same time, some do immediately after use, some delay until the end of the scope. The delay makes it difficult to test the reference count functionality. Solution: Enclosed the operations on objects and check reference count after getting out of the enclosed block. This only works for the test! I'm assuming that checking reference count is just for the library to test that functionality; the user will not need to do that. :-/ Platforms tested: SunOS 5.10 (linew) Linux 2.6 (kagiso) --- c++/test/tattr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index c6225229..ca0516a 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1061,6 +1061,12 @@ static void test_attr_dtype_shared() // Create dataspace for dataset DataSpace dspace; + // Enclose the following so that all temporary objects can be + // destroyed before testing reference count - this is to overcome + // the different time when the temporary objects are to be destroyed + // by different compilers. + { + // Create dataset DataSet dset = fid1.createDataSet(DSET1_NAME, dtype, dspace); @@ -1126,6 +1132,8 @@ static void test_attr_dtype_shared() // Unlink the dataset fid1.unlink(DSET1_NAME); + } // end of enclosing to test reference counts + // Check reference count on named datatype fid1.getObjinfo(TYPE1_NAME, statbuf); verify_val((int)statbuf.nlink, 1, "H5File::unlink", __LINE__, __FILE__); -- cgit v0.12