summaryrefslogtreecommitdiffstats
path: root/test/external.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-11-21 03:36:51 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-11-21 03:36:51 (GMT)
commit7488c6366e878651f6bb8dc94f05eb69cd0df83b (patch)
treec2ba0295a0bec1b350fa3d4fa291b46ac75e271f /test/external.c
parent6345a417a3930b32ec9e5fc087e0aeb20a94aed7 (diff)
downloadhdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.zip
hdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.tar.gz
hdf5-7488c6366e878651f6bb8dc94f05eb69cd0df83b.tar.bz2
[svn-r936] Changes since 19981119
---------------------- ./src/H5.c ./src/H5A.c ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5E.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5HG.c ./src/H5HL.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5MF.c ./src/H5MM.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5V.c ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Most of these changes are because the `interface_initialize_g' variable change from hbool_t to int. It's a one line change. Changed the way the library is closed so we have more control over the order the interfaces are shut down. Instead of registering an atexit() function for every interface in some haphazard order we just register one: H5_term_library() which then calls the H5*_term_interface() functions in a well-defined order. If the library is closed and then reopened repeatedly by calling H5close() and H5open() in a loop we only add one copy of the library termination functions with atexit(). Termination is a two-step process in order to help detect programming errors that would cause an infinite loop caused by the termination of one interface waking up some other previously terminated interface. The first step terminates the interface and *marks it as unusable*. After all interfaces are terminated then we mark them all as usable again. The FUNC_ENTER() macro has been modified to return failure or to dump core (depending on whether NDEBUG is defined) if we try to call an interface while it's shutting down. ./src/H5.c The H5dont_atexit() function returns failure if it's called more than once or if it's called too late. However, the error stack is not automatically printed on failure because the library might not be initialized yet ./test/chunk.c ./test/flush1.c ./test/flush2.c ./test/iopipe.c ./test/overhead.c ./test/ragged.c Changed the extra cast for Win32 so we do floating point division again -- it was just confusion about precedence and associativity of casting and the C coercion rules. Removed extra carriage returns inserted by broken operating system. ./src/H5Ffamily.c Fixed an bug where H5F_fam_write() lowered the EOF marker for one of the family members causing H5F_fam_read() to read zeros. ./test/h5test.h [NEW] ./test/h5test.c [NEW] ./test/Makefile.in ./test/bittests.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Support library for test files. This isn't done yet but Katie's contractions are ~10 minutes apart so I figured I better back this stuff up just in case I'm not here next week... Eventually all test files will understand HDF5_DRIVER to name the low level file driver and parameters so we can easily test various drivers. They will also understand HDF5_PREFIX to prepend to the beginning of file names which is necessary for testing ROMIO with various drivers. Also, the cleanup function will know how to use the file name prefix and will understand different file driver naming schemes like file families. I'm not sure they'll understand the `gsf:' type prefixes yet. Note, the external test is completely commented out because I'm in the middle of modifying it. It will still compile and run but it doesn't test anything at the moment.
Diffstat (limited to 'test/external.c')
-rw-r--r--test/external.c119
1 files changed, 34 insertions, 85 deletions
diff --git a/test/external.c b/test/external.c
index a6ecc16..cfb413a 100644
--- a/test/external.c
+++ b/test/external.c
@@ -7,69 +7,20 @@
*
* Purpose: Tests datasets stored in external raw files.
*/
-
-/* See H5private.h for how to include headers */
-#undef NDEBUG
-#include <H5config.h>
-
-#ifdef STDC_HEADERS
-# include <assert.h>
-# include <fcntl.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-#endif
-
-#ifdef HAVE_IO_H
-# include <io.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
-#endif
-
-#include <hdf5.h>
-
-#ifndef HAVE_ATTRIBUTE
-# undef __attribute__
-# define __attribute__(X) /*void*/
-# define __unused__ /*void*/
+#if 1 /* have to go, and this is only half baked.... 19981120 rpm*/
+int main(void) {return 0;}
#else
-# define __unused__ __attribute__((unused))
-#endif
-#define TEST_FILE_NAME1 "extern_1.h5"
-#define TEST_FILE_NAME2 "extern_2.h5"
-#define TEST_FILE_NAME3 "extern_3.h5"
+#include <h5test.h>
-static int nerrors_g = 0;
+const char *FILENAME[] = {
+ "extern_1",
+ "extern_2",
+ "extern_3",
+ NULL
+};
-
-/*-------------------------------------------------------------------------
- * 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);
- nerrors_g++;
- return 0;
-}
+static int nerrors_g = 0;
/*-------------------------------------------------------------------------
@@ -135,7 +86,7 @@ same_contents (const char *name1, const char *name2)
*-------------------------------------------------------------------------
*/
static void
-test_1 (void)
+test_1 (hid_t fapl)
{
hid_t file, plist, space, dset, grp;
herr_t status;
@@ -143,42 +94,37 @@ test_1 (void)
herr_t (*func)(void*) = NULL;
void *client_data = NULL;
int n;
-
+ char filename[1024];
/*
* Create the file and an initial group. This causes messages about
* debugging to be emitted before we start playing games with what the
* output looks like.
*/
- file = H5Fcreate (TEST_FILE_NAME1, H5F_ACC_TRUNC|H5F_ACC_DEBUG,
- H5P_DEFAULT, H5P_DEFAULT);
- assert (file>=0);
- grp = H5Gcreate (file, "emit-diagnostics", 8);
- H5Gclose (grp);
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if ((file = H5Fcreate (filename, H5F_ACC_TRUNC|H5F_ACC_DEBUG,
+ H5P_DEFAULT, fapl))<0) goto error;
+ if ((grp = H5Gcreate (file, "emit-diagnostics", 8))<0) goto error;
+ if (H5Gclose (grp)<0) goto error;
/*
* A single external file for a non-extendible dataset.
*/
- do {
- printf ("%-70s", "...fixed-size data space, exact storage");
- fflush (stdout);
- plist = H5Pcreate (H5P_DATASET_CREATE);
- assert (plist>=0);
- status = H5Pset_external (plist, "ext1.data", 0, (hsize_t)400);
- assert (status>=0);
+ TESTING("fixed-size data space, exact storage");
+ if ((plist = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
+ if (H5Pset_external (plist, "ext1.data", 0, (hsize_t)400)<0) goto error;
- size[0] = max_size[0] = 100;
- space = H5Screate_simple (1, size, max_size);
- assert (space>=0);
+ size[0] = max_size[0] = 100;
+ if ((space = H5Screate_simple (1, size, max_size))<0) goto error;
+
+ /* Create the dataset, the `dset1' name is used later too */
+ if ((dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, plist))<0)
+ goto error;
+ if (H5Dclose (dset)<0) goto error;
+ if (H5Sclose (space)<0) goto error;
+ if (H5Pclose (plist)<0) goto error;
+ PASSED();
- /* Create the dataset, the `dset1' name is used later too */
- dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, plist);
- if (dset<0) break;
- H5Dclose (dset);
- puts (" PASSED");
- } while (0);
- H5Sclose (space);
- H5Pclose (plist);
/*
* A single external file which is too small to represent all the data.
@@ -490,6 +436,8 @@ test_1 (void)
/* END OF TESTS */
H5Fclose (file);
+
+ error:
}
@@ -586,7 +534,7 @@ test_2 (void)
puts (" Failed to read dataset");
break;
}
-
+
for (i=0; i<100; i++) {
if (whole[i]!=(signed)i) {
puts ("*FAILED*");
@@ -856,3 +804,4 @@ main (void)
return (nerrors_g?1:0);
}
+#endif