summaryrefslogtreecommitdiffstats
path: root/test/flush1.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/flush1.c')
-rw-r--r--test/flush1.c75
1 files changed, 15 insertions, 60 deletions
diff --git a/test/flush1.c b/test/flush1.c
index f353100..7ffcec3 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -11,57 +11,12 @@
* calling _exit(0) since this doesn't flush HDF5 caches but
* still exits with success.
*/
+#include <h5test.h>
-/* See H5private.h for how to include headers */
-#undef NDEBUG
-#include <hdf5.h>
-
-#ifdef STDC_HEADERS
-# include <stdio.h>
-# include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
-#endif
-
-#ifndef HAVE_ATTRIBUTE
-# undef __attribute__
-# define __attribute__(X) /*void*/
-# define __unused__ /*void*/
-#else
-# define __unused__ __attribute__((unused))
-#endif
-
-
-#define FILE_NAME_1 "flush.h5" /*do not clean up*/
-
-
-
-/*-------------------------------------------------------------------------
- * Function: display_error_cb
- *
- * Purpose: Displays the error stack after printing "*FAILED*".
- *
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Wednesday, March 4, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-display_error_cb (void __unused__ *client_data)
-{
- puts ("*FAILED*");
- H5Eprint (stdout);
- return 0;
-}
+const char *FILENAME[] = {
+ "flush",
+ NULL
+};
/*-------------------------------------------------------------------------
@@ -83,20 +38,21 @@ display_error_cb (void __unused__ *client_data)
int
main(void)
{
- hid_t file, dcpl, space, dset, groups, grp;
+ hid_t fapl, file, dcpl, space, dset, groups, grp;
hsize_t ds_size[2] = {100, 100};
hsize_t ch_size[2] = {5, 5};
double the_data[100][100];
hsize_t i, j;
- char name[256];
+ char name[1024];
- printf("%-70s", "Testing H5Fflush (part1)");
- fflush(stdout);
- H5Eset_auto(display_error_cb, NULL);
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ TESTING("H5Fflush (part1)");
/* Create the file */
- if ((file=H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC,
- H5P_DEFAULT, H5P_DEFAULT))<0) goto error;
+ h5_fixname(FILENAME[0], fapl, name, sizeof name);
+ if ((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error;
/* Create a chunked dataset */
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
@@ -129,14 +85,13 @@ main(void)
/* Flush and exit without closing the library */
if (H5Fflush(file, H5F_SCOPE_GLOBAL)<0) goto error;
- puts(" PASSED");
+ PASSED();
fflush(stdout);
fflush(stderr);
_exit(0);
error:
- printf("*FAILED*");
- return 1;
+ _exit(1);
}