summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2005-09-19 20:32:18 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2005-09-19 20:32:18 (GMT)
commit465f9be6e3f818d20c650976a14d7698063cad00 (patch)
tree944e7c7b9fe3f25e4d285a6daaf01362cac1fb15 /test
parentbd24d226d67b26dd43910df4e677751e6120f8f5 (diff)
downloadhdf5-465f9be6e3f818d20c650976a14d7698063cad00.zip
hdf5-465f9be6e3f818d20c650976a14d7698063cad00.tar.gz
hdf5-465f9be6e3f818d20c650976a14d7698063cad00.tar.bz2
[svn-r11441] Purpose:
Feature. Description: Added ALARM_ON, ALARM_OFF feature to terminate tests that run more than the default time limit. So far, the feature is applied in the standard test frame. Platforms tested: heping PP.
Diffstat (limited to 'test')
-rw-r--r--test/h5test.c14
-rw-r--r--test/h5test.h9
-rw-r--r--test/testframe.c4
3 files changed, 19 insertions, 8 deletions
diff --git a/test/h5test.c b/test/h5test.c
index c582442..e2caea9 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -89,7 +89,7 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */
*/
static const char *multi_letters = "msbrglo";
-static herr_t h5_errors(hid_t err_stack, void *client_data);
+static herr_t h5_errors(void *client_data);
/*-------------------------------------------------------------------------
@@ -109,11 +109,10 @@ static herr_t h5_errors(hid_t err_stack, void *client_data);
*-------------------------------------------------------------------------
*/
static herr_t
-h5_errors(hid_t err_stack, void UNUSED *client_data)
+h5_errors(void UNUSED *client_data)
{
H5_FAILED();
- H5Eprint_stack(err_stack, stdout);
-
+ H5Eprint(stdout);
return 0;
}
@@ -215,8 +214,7 @@ h5_reset(void)
HDfflush(stdout);
HDfflush(stderr);
H5close();
-
- H5Eset_auto_stack(H5E_DEFAULT, h5_errors, NULL);
+ H5Eset_auto(h5_errors, NULL);
/*
* Cause the library to emit some diagnostics early so they don't
@@ -625,10 +623,12 @@ h5_show_hostname(void)
}
else
printf(" hostname=%s\n", hostname);
+#else
+ printf(" gethostname not supported\n");
+#endif
#ifdef WIN32
WSACleanup();
#endif
-#endif
}
diff --git a/test/h5test.h b/test/h5test.h
index 7aa585e..be5e769 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -107,6 +107,15 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define FAIL_STACK_ERROR {H5_FAILED(); AT(); \
H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
+/*
+ * Alarm definitions to wait up (terminate) a test that runs too long.
+ */
+#define alarm_seconds 1200 /* default is 20 minutes */
+#define ALARM_ON HDalarm(alarm_seconds)
+#define ALARM_OFF HDalarm(0)
+/* set alarms to N seconds if N > 0, else use default alarm_seconds. */
+#define ALARM_SET(N) HDalarm((N)>0 ? N : alarm_seconds)
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/test/testframe.c b/test/testframe.c
index 45992a0..4478cb4 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -133,7 +133,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
* half the functions this test calls are private, so automatic error
* reporting wouldn't do much good since it's triggered at the API layer.
*/
- H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
+ H5Eset_auto(NULL, NULL);
/*
* Record the program name and private routines if provided.
@@ -298,7 +298,9 @@ void PerformTests(void)
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
+ ALARM_ON;
Test[Loop].Call();
+ ALARM_OFF;
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));