summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cmpd_dset.c5
-rw-r--r--test/dsets.c5
-rw-r--r--test/dtypes.c46
-rw-r--r--test/extend.c6
-rw-r--r--test/external.c31
-rw-r--r--test/gheap.c13
-rw-r--r--test/istore.c5
-rw-r--r--test/links.c6
-rw-r--r--test/shtype.c14
9 files changed, 92 insertions, 39 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 13d9ca3..1ccbe85 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -81,8 +81,11 @@ typedef struct s5_t {
static void
cleanup(void)
{
- remove(TEST_FILE_NAME);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/dsets.c b/test/dsets.c
index a6d86fa..fac3bdb 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -688,8 +688,11 @@ test_compression(hid_t file)
static void
cleanup(void)
{
- remove(TEST_FILE_NAME);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/dtypes.c b/test/dtypes.c
index 88b0d63..eed8a29 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -9,8 +9,18 @@
*/
#include <hdf5.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+#include <H5config.h>
+#ifndef HAVE_ATTRIBUTE
+# undef __attribute__
+# define __attribute__(X) /*void*/
+# define __unused__ /*void*/
+#else
+# define __unused__ __attribute__((unused))
+#endif
+
#define FILE_NAME_1 "dtypes1.h5"
#define FILE_NAME_2 "dtypes2.h5"
@@ -21,7 +31,7 @@ typedef struct complex_t {
/*-------------------------------------------------------------------------
- * Function: clean
+ * Function: cleanup
*
* Purpose: Removes test files
*
@@ -35,10 +45,12 @@ typedef struct complex_t {
*-------------------------------------------------------------------------
*/
static void
-clean (void)
+cleanup (void)
{
- remove (FILE_NAME_1);
- remove (FILE_NAME_2);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove (FILE_NAME_1);
+ remove (FILE_NAME_2);
+ }
}
@@ -59,7 +71,7 @@ clean (void)
*-------------------------------------------------------------------------
*/
static herr_t
-display_error_cb (void *client_data)
+display_error_cb (void __unused__ *client_data)
{
puts ("*FAILED*");
H5Eprint (stdout);
@@ -214,7 +226,7 @@ test_compound(void)
static herr_t
test_transient (void)
{
- static hsize_t ds_size[2] = {100, 200};
+ static hsize_t ds_size[2] = {10, 20};
hid_t file, type, space, dset, t2;
printf ("%-70s", "Testing transient data types");
@@ -239,9 +251,18 @@ test_transient (void)
/* Copying a predefined type results in a modifiable copy */
if ((type=H5Tcopy (H5T_NATIVE_INT))<0) goto error;
if (H5Tset_precision (type, 256)<0) goto error;
- if (H5Tclose (type)<0) goto error;
+
+ /* It should not be possible to create an attribute for a transient type */
+ H5E_BEGIN_TRY {
+ if (H5Acreate (type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT)>=0) {
+ puts ("*FAILED*");
+ puts (" Attributes should not be allowed for transient types!");
+ goto error;
+ }
+ } H5E_END_TRY;
/* Create a dataset from a transient data type */
+ if (H5Tclose (type)<0) goto error;
if ((type = H5Tcopy (H5T_NATIVE_INT))<0) goto error;
if ((dset=H5Dcreate (file, "dset1", type, space, H5P_DEFAULT))<0) {
goto error;
@@ -321,9 +342,9 @@ test_transient (void)
static herr_t
test_named (void)
{
- hid_t file, type, space, dset, t2;
+ hid_t file, type, space, dset, t2, attr1;
herr_t status;
- static hsize_t ds_size[2] = {100, 200};
+ static hsize_t ds_size[2] = {10, 20};
printf ("%-70s", "Testing named data types");
if ((file=H5Fcreate (FILE_NAME_2, H5F_ACC_TRUNC|H5F_ACC_DEBUG,
@@ -368,6 +389,11 @@ test_named (void)
}
} H5E_END_TRY;
+ /* It should be possible to define an attribute for the named type */
+ if ((attr1=H5Acreate (type, "attr1", H5T_NATIVE_INT, space,
+ H5P_DEFAULT))<0) goto error;
+ if (H5Aclose (attr1)<0) goto error;
+
/*
* Copying a committed type should result in a transient type which is
* not locked.
@@ -509,6 +535,6 @@ main(void)
exit(1);
}
printf("All data type tests passed.\n");
- clean ();
+ cleanup ();
return 0;
}
diff --git a/test/extend.c b/test/extend.c
index b582cc4..d1b3d0e 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -9,6 +9,7 @@
*/
#include <assert.h>
#include <hdf5.h>
+#include <stdlib.h>
#define TEST_FILE_NAME "extend.h5"
#define NX 100 /* USE AN EVEN NUMBER!*/
@@ -32,8 +33,11 @@
static void
cleanup(void)
{
- remove(TEST_FILE_NAME);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/external.c b/test/external.c
index 6857129..2c8e8a7 100644
--- a/test/external.c
+++ b/test/external.c
@@ -787,21 +787,24 @@ test_3 (void)
static void
cleanup(void)
{
- remove(TEST_FILE_NAME1);
- remove(TEST_FILE_NAME2);
- remove(TEST_FILE_NAME3);
- /* not sure if the following file names can be #defined */
- /* because some of them are created during runtime. */
- /* List them out this way for now. */
- remove("extern_1.raw");
- remove("extern_1b.raw");
- remove("extern_2.raw");
- remove("extern_2b.raw");
- remove("extern_3.raw");
- remove("extern_3b.raw");
- remove("extern_4.raw");
- remove("extern_4b.raw");
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME1);
+ remove(TEST_FILE_NAME2);
+ remove(TEST_FILE_NAME3);
+ /* not sure if the following file names can be #defined */
+ /* because some of them are created during runtime. */
+ /* List them out this way for now. */
+ remove("extern_1.raw");
+ remove("extern_1b.raw");
+ remove("extern_2.raw");
+ remove("extern_2b.raw");
+ remove("extern_3.raw");
+ remove("extern_3b.raw");
+ remove("extern_4.raw");
+ remove("extern_4b.raw");
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/gheap.c b/test/gheap.c
index 208f5e4..d6c6768 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -386,12 +386,15 @@ test_4 (void)
static void
cleanup(void)
{
- remove(TEST_FILE_NAME0);
- remove(TEST_FILE_NAME1);
- remove(TEST_FILE_NAME2);
- remove(TEST_FILE_NAME3);
- remove(TEST_FILE_NAME4);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME0);
+ remove(TEST_FILE_NAME1);
+ remove(TEST_FILE_NAME2);
+ remove(TEST_FILE_NAME3);
+ remove(TEST_FILE_NAME4);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/istore.c b/test/istore.c
index fb02e20..15753a8 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -543,8 +543,11 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
static void
cleanup(void)
{
- remove(FILENAME);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(FILENAME);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/links.c b/test/links.c
index 81c185d..006bf37 100644
--- a/test/links.c
+++ b/test/links.c
@@ -8,6 +8,7 @@
* Purpose: Tests hard and soft (symbolic) links.
*/
#include <hdf5.h>
+#include <stdlib.h>
#define TEST_FILE_NAME "links.h5"
@@ -29,8 +30,11 @@
static void
cleanup(void)
{
- remove(TEST_FILE_NAME);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main
diff --git a/test/shtype.c b/test/shtype.c
index ba6c32d..c86998d 100644
--- a/test/shtype.c
+++ b/test/shtype.c
@@ -9,6 +9,7 @@
*/
#include <assert.h>
#include <hdf5.h>
+#include <stdlib.h>
#include <H5config.h>
#ifndef HAVE_ATTRIBUTE
@@ -286,12 +287,15 @@ test_3 (void)
static void
cleanup(void)
{
- remove(TEST_FILE_NAME0);
- remove(TEST_FILE_NAME1);
- remove(TEST_FILE_NAME2A);
- remove(TEST_FILE_NAME2B);
- remove(TEST_FILE_NAME3);
+ if (!getenv ("HDF5_NOCLEANUP")) {
+ remove(TEST_FILE_NAME0);
+ remove(TEST_FILE_NAME1);
+ remove(TEST_FILE_NAME2A);
+ remove(TEST_FILE_NAME2B);
+ remove(TEST_FILE_NAME3);
+ }
}
+
/*-------------------------------------------------------------------------
* Function: main