diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2007-07-08 17:01:00 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2007-07-08 17:01:00 (GMT) |
commit | a0937890eaa5861db1f5e0b8ee27c427001c344d (patch) | |
tree | 30016e590de65395034eaca8fe988dbc6e4f4d27 | |
parent | 4bff0487793cbcd5d57aeb34368f74bb2f6b8056 (diff) | |
download | hdf5-a0937890eaa5861db1f5e0b8ee27c427001c344d.zip hdf5-a0937890eaa5861db1f5e0b8ee27c427001c344d.tar.gz hdf5-a0937890eaa5861db1f5e0b8ee27c427001c344d.tar.bz2 |
[svn-r13953] 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)
-rw-r--r-- | c++/test/tattr.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index a6fd8de..e5ceee6 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -1026,7 +1026,7 @@ test_attr_dtype_shared(void) h5_stat_size_t filesize; /* Size of file after modifications */ // Output message about test being performed - MESSAGE(5, ("Testing Shared Datatypes with Attributes\n")); + MESSAGE (5, ("Testing Shared Datatypes with Attributes\n")); try { // Create a file @@ -1057,6 +1057,11 @@ test_attr_dtype_shared(void) // 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); @@ -1122,6 +1127,8 @@ test_attr_dtype_shared(void) // 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__); |