summaryrefslogtreecommitdiffstats
path: root/test/h5test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/h5test.c')
-rw-r--r--test/h5test.c62
1 files changed, 47 insertions, 15 deletions
diff --git a/test/h5test.c b/test/h5test.c
index aa99c1f..f16b98f 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -28,7 +28,7 @@
#include "H5srcdir.h"
/* Necessary for h5_verify_cached_stabs() */
-#define H5G_PACKAGE
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "H5Gpkg.h"
@@ -91,6 +91,9 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
*/
static const char *multi_letters = "msbrglo";
+/* Previous error reporting function */
+static H5E_auto2_t err_func = NULL;
+
static herr_t h5_errors(hid_t estack, void *client_data);
static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
char *fullname, size_t size, hbool_t nest_printf);
@@ -122,7 +125,7 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
/*-------------------------------------------------------------------------
- * Function: h5_cleanup_files
+ * Function: h5_clean_files
*
* Purpose: Cleanup temporary test files (always).
* base_name contains the list of test file names.
@@ -131,13 +134,11 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data)
*
* Programmer: Neil Fortner
* June 1, 2015
- * Original: Albert Cheng
- * May 28, 1998
*
*-------------------------------------------------------------------------
*/
void
-h5_cleanup_files(const char *base_name[], hid_t fapl)
+h5_clean_files(const char *base_name[], hid_t fapl)
{
int i;
@@ -184,8 +185,11 @@ h5_cleanup_files(const char *base_name[], hid_t fapl)
}
} /* end for */
+ /* Close the FAPL used to access the file */
+ H5Pclose(fapl);
+
return;
-} /* end h5_cleanup_files() */
+} /* end h5_clean_files() */
/*-------------------------------------------------------------------------
@@ -208,14 +212,38 @@ h5_cleanup(const char *base_name[], hid_t fapl)
int retval = 0;
if(GetTestCleanup()) {
- /* Clean up files in base_name */
- h5_cleanup_files(base_name, fapl);
+ /* Clean up files in base_name, and the FAPL */
+ h5_clean_files(base_name, fapl);
retval = 1;
} /* end if */
- H5Pclose(fapl);
+ /* Restore the original error reporting routine */
+ h5_restore_err();
+
return retval;
+} /* end h5_cleanup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_restore_err
+ *
+ * Purpose: Restore the default error handler.
+ *
+ * Return: N/A
+ *
+ * Programmer: Quincey Koziol
+ * Sept 10, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+h5_restore_err(void)
+{
+ /* Restore the original error reporting routine */
+ HDassert(err_func != NULL);
+ H5Eset_auto2(H5E_DEFAULT, err_func, NULL);
+ err_func = NULL;
}
@@ -237,6 +265,10 @@ h5_reset(void)
HDfflush(stdout);
HDfflush(stderr);
H5close();
+
+ /* Save current error stack reporting routine and redirect to our local one */
+ HDassert(err_func == NULL);
+ H5Eget_auto2(H5E_DEFAULT, &err_func, NULL);
H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL);
/*
@@ -258,12 +290,12 @@ h5_reset(void)
*/
sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid());
H5E_BEGIN_TRY {
- hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
- H5P_DEFAULT);
- hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(grp);
- H5Fclose(file);
- HDunlink(filename);
+ hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
+ H5P_DEFAULT);
+ hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(grp);
+ H5Fclose(file);
+ HDunlink(filename);
} H5E_END_TRY;
}
#endif /* OLD_WAY */
'>dgp_ecr Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2006-08-21 01:08:41 (GMT)
committerdas <das>2006-08-21 01:08:41 (GMT)
commitd9504ba9f92205956e0b4aa1fa79e44b10a9d68d (patch)
tree79988284b81c4c2f62215be9b742d8dca444ab1c
parentd70383944a28777ea679b1e1b4be38c2a42b3960 (diff)
downloadtcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.zip
tcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.tar.gz
tcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.tar.bz2
* generic/tclClock.c (ClockClicksObjCmd): add support for Darwin
* generic/tclCmdMZ.c (Tcl_TimeObjCmd): nanosecond resolution timer * generic/tclInt.h: to [clock clicks] and [time] * unix/configure.in (Darwin): when TCL_WIDE_CLICKS defined. * unix/tclUnixTime.c (TclpGetWideClicks, TclpWideClicksToNanoseconds): * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
Diffstat
-rw-r--r--generic/tclClock.c9
-rw-r--r--generic/tclCmdMZ.c22
-rw-r--r--generic/tclInt.h6
-rwxr-xr-xunix/configure5
-rw-r--r--unix/configure.in4
-rw-r--r--unix/tclConfig.h.in3
-rw-r--r--unix/tclUnixTime.c94
7 files changed, 133 insertions, 10 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 1abd1e1..35bae5b 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclClock.c,v 1.56 2006/08/10 13:07:43 dkf Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.57 2006/08/21 01:08:41 das Exp $
*/
#include "tclInt.h"
@@ -1689,7 +1689,12 @@ ClockClicksObjCmd(
break;
case CLICKS_NATIVE:
Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (Tcl_WideInt)
- TclpGetClicks()));
+#ifndef TCL_WIDE_CLICKS
+ TclpGetClicks()
+#else
+ TclpGetWideClicks()
+#endif
+ ));
break;
case CLICKS_MICROS:
Tcl_GetTime(&now);
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index d955691..a77431c 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.134 2005/12/19 19:03:16 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.135 2006/08/21 01:08:41 das Exp $
*/
#include "tclInt.h"
@@ -2921,7 +2921,11 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
register int i, result;
int count;
double totalMicroSec;
+#ifndef TCL_WIDE_CLICKS
Tcl_Time start, stop;
+#else
+ Tcl_WideInt start, stop;
+#endif
if (objc == 2) {
count = 1;
@@ -2937,17 +2941,25 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
objPtr = objv[1];
i = count;
+#ifndef TCL_WIDE_CLICKS
Tcl_GetTime(&start);
+#else
+ start = TclpGetWideClicks();
+#endif
while (i-- > 0) {
result = Tcl_EvalObjEx(interp, objPtr, 0);
if (result != TCL_OK) {
return result;
}
}
+#ifndef TCL_WIDE_CLICKS
Tcl_GetTime(&stop);
-
- totalMicroSec = (((double) (stop.sec - start.sec))*1.0e6
- + (stop.usec - start.usec));
+ totalMicroSec = ((double) (stop.sec - start.sec))*1.0e6
+ + (stop.usec - start.usec);
+#else
+ stop = TclpGetWideClicks();
+ totalMicroSec = ((double) TclpWideClicksToNanoseconds(stop - start))/1.0e3;
+#endif
if (count <= 1) {
/*
@@ -2961,7 +2973,7 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
/*
* Construct the result as a list because many programs have always parsed
- * at such (extracting the first element, typically).
+ * as such (extracting the first element, typically).
*/
objs[1] = Tcl_NewStringObj("microseconds", -1);
diff --git a/generic/tclInt.h b/generic/tclInt.h
index ecc7615..0f34ea5 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.274 2006/07/21 14:56:14 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.275 2006/08/21 01:08:41 das Exp $
*/
#ifndef _TCLINT
@@ -2232,6 +2232,10 @@ MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer,
MODULE_SCOPE void TclInitThreadStorage(void);
MODULE_SCOPE void TclpFinalizeThreadDataThread(void);
MODULE_SCOPE void TclFinalizeThreadStorage(void);
+#ifdef TCL_WIDE_CLICKS
+MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void);
+MODULE_SCOPE Tcl_WideInt TclpWideClicksToNanoseconds(Tcl_WideInt clicks);
+#endif
/*
*----------------------------------------------------------------
diff --git a/unix/configure b/unix/configure