summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFang Guo <fangguo@ncsa.uiuc.edu>2005-08-19 20:00:17 (GMT)
committerFang Guo <fangguo@ncsa.uiuc.edu>2005-08-19 20:00:17 (GMT)
commit9498eb17706b19a88769b8f01b54d07ecf1bd112 (patch)
treeca7f5813597cb7e25fb6ae3881b0d5fd7c3da4c7 /test
parent8efd4418b0cf028726f05dc0fbb30651ba33ff3b (diff)
downloadhdf5-9498eb17706b19a88769b8f01b54d07ecf1bd112.zip
hdf5-9498eb17706b19a88769b8f01b54d07ecf1bd112.tar.gz
hdf5-9498eb17706b19a88769b8f01b54d07ecf1bd112.tar.bz2
[svn-r11267] Purpose:
Improvement Description: Add some assertion statements to locate the error when errors happen Solution: Platforms tested: MSVS 6.0 on windows XP and heping(enable threadsafe with pthread) Misc. update:
Diffstat (limited to 'test')
-rw-r--r--test/ttsafe_acreate.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index 311eec7..f4f418b 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -87,10 +87,12 @@ void tts_acreate(void)
* creation plist and default file access plist
*/
file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ assert(file>=0);
/* create a simple dataspace for the dataset */
dimsf[0] = 1;
dataspace = H5Screate_simple(1, dimsf, NULL);
+ assert(dataspace>=0);
/* define datatype for the data using native little endian integers */
datatype = H5Tcopy(H5T_NATIVE_INT);
@@ -98,11 +100,13 @@ void tts_acreate(void)
/* create a new dataset within the file */
dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT);
+ assert(dataset>=0);
/* initialize data for dataset and write value to dataset */
data = NUM_THREADS;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, &data);
+ ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, &data);
+ assert(ret>=0);
/*
* Simultaneously create a large number of attributes to be associated
@@ -114,11 +118,15 @@ void tts_acreate(void)
attrib_data->datatype = datatype;
attrib_data->dataspace = dataspace;
attrib_data->current_index = i;
- pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
+ ret=pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data);
+ assert(ret==0);
}
- for (i = 0; i < NUM_THREADS; i++)
- pthread_join(threads[i], NULL);
+ for (i = 0; i < NUM_THREADS; i++) {
+ ret=pthread_join(threads[i], NULL);
+ assert(ret==0);
+ }
+
/* verify the correctness of the test */
for (i = 0; i < NUM_THREADS; i++) {
@@ -128,7 +136,7 @@ void tts_acreate(void)
TestErrPrintf("unable to open appropriate attribute. Test failed!\n");
else {
ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer);
-
+
if (ret < 0 || buffer != i)
TestErrPrintf("wrong data values. Test failed!\n");