summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-08-19 06:34:59 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-08-19 06:34:59 (GMT)
commit19cb3b5ae784c804efbc9a730bebb710845e4602 (patch)
tree02951364f326db62aa92e07ffd7285febd6ecbad /testpar
parentd3e91f26898ea8de856bb82e8d9643dccae0d138 (diff)
downloadhdf5-19cb3b5ae784c804efbc9a730bebb710845e4602.zip
hdf5-19cb3b5ae784c804efbc9a730bebb710845e4602.tar.gz
hdf5-19cb3b5ae784c804efbc9a730bebb710845e4602.tar.bz2
[svn-r9116] Purpose:
feature Description: Another revamp of the test interface. TestInit: is used to register Test Program name, test program specific Usage and option parsing routines. TestUsage: will invoke extra usage routine if provided. TestParseCmdLine: will invoke extra option parsing routine if provided. GetTestSummary() and GetTestCleanup() replaces the previous Summary and CleanUp arguments of TestParseCmdLine. test/testhdf5, test/ttsafe.c, testpar/t_mpi.c, testpar/testphdf5.c: All have been updated to use the new Test Routines. testpar/t_mpi.c: Also a fix of a compiler optimization bug when pgcc in Linux is used to compile it. Changed buf[] and expected to unsigned char type to avoid a bug that failed to do sign-extension. Platforms tested: "h5committested" Also tested thread-safe option in eirene.
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_mpi.c19
-rw-r--r--testpar/testphdf5.c26
2 files changed, 24 insertions, 21 deletions
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 43eafea..2d5da66 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -54,7 +54,7 @@ test_mpio_overlap_writes(char *filename)
MPI_File fh;
int i;
int vrfyerrs;
- char buf[4093]; /* use some prime number for size */
+ unsigned char buf[4093]; /* use some prime number for size */
int bufsize = sizeof(buf);
MPI_Offset stride;
MPI_Offset mpi_off;
@@ -97,7 +97,7 @@ test_mpio_overlap_writes(char *filename)
/* set data to some trivial pattern for easy verification */
for (i=0; i<stride; i++)
- buf[i] = (char)(mpi_off+i);
+ buf[i] = (unsigned char)(mpi_off+i);
mrc = MPI_File_write_at(fh, mpi_off, buf, (int)stride, MPI_BYTE,
&mpi_stat);
VRFY((mrc==MPI_SUCCESS), "");
@@ -143,12 +143,13 @@ test_mpio_overlap_writes(char *filename)
VRFY((mrc==MPI_SUCCESS), "");
vrfyerrs=0;
for (i=0; i<stride; i++){
- char expected;
- expected = (char)(mpi_off+i);
- if ((buf[i] != expected) &&
- (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED))
- printf("proc %d: found data error at [%ld], expect %d, got %d\n",
+ unsigned char expected;
+ expected = (unsigned char)(mpi_off+i);
+ if ((expected != buf[i]) &&
+ (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) {
+ printf("proc %d: found data error at [%ld], expect %u, got %u\n",
mpi_rank, (long)(mpi_off+i), expected, buf[i]);
+ }
}
if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
printf("proc %d: [more errors ...]\n", mpi_rank);
@@ -341,9 +342,10 @@ test_mpio_gb_file(char *filename)
vrfyerrs=0;
for (j=0; j<MB; j++){
if ((*(buf+j) != expected) &&
- (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED))
+ (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)){
printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n",
mpi_rank, (long)mpi_off, j, expected, *(buf+j));
+ }
}
if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED)
printf("proc %d: [more errors ...]\n", mpi_rank);
@@ -669,6 +671,7 @@ main(int argc, char **argv)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
H5open();
+ TestInit(argv[0], NULL, parse_options);
if (parse_options(argc, argv) != 0){
if (MAINPROCESS)
usage();
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index bc37cb9..0a99b02 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -119,7 +119,7 @@ int MPI_Init(int *argc, char ***argv)
static void
usage(void)
{
- printf("Usage: testphdf5 [-r] [-w] [-v<verbosity>] [-m<n_datasets>] [-n<n_groups>] "
+ printf(" [-r] [-w] [-v<verbosity>] [-m<n_datasets>] [-n<n_groups>] "
"[-o] [-f <prefix>] [-d <dim0> <dim1>]\n");
printf("\t-r\t\tno read test\n");
printf("\t-w\t\tno write test\n");
@@ -367,8 +367,6 @@ int main(int argc, char **argv)
int mpi_size, mpi_rank; /* mpi variables */
H5Ptest_param_t ndsets_params, ngroups_params;
H5Ptest_param_t collngroups_params;
- int Summary = 0;
- int CleanUp = 1;
/* Un-buffer the stdout and stderr */
setbuf(stderr, NULL);
@@ -387,7 +385,7 @@ int main(int argc, char **argv)
h5_show_hostname();
/* Initialize testing framework */
- TestInit();
+ TestInit(argv[0], usage, parse_options);
/* Tests are generally arranged from least to most complexity... */
AddTest("mpio_dup", test_fapl_mpio_dup, NULL,
@@ -447,13 +445,15 @@ int main(int argc, char **argv)
if(mpi_size > 64) {
- if(MAINPROCESS) {
- printf("The collective chunk IO test hasn't been tested for the number of process greater than 64\n");
- printf("Please try with the number of process no greater than 64\n");
- printf("All collective chunk tests will be skipped \n");
- }
+ if(MAINPROCESS) {
+ printf("Collective chunk IO tests haven't been tested \n");
+ printf(" for the number of process greater than 64.\n");
+ printf("Please try with the number of process \n");
+ printf(" no greater than 64 for collective chunk IO test.\n");
+ printf("Collective chunk tests will be skipped \n");
+ }
}
- else {
+ else {
AddTest("coll_chunked1", coll_chunk1,NULL,
"simple collective chunk io",filenames[9]);
AddTest("coll_chunked2", coll_chunk2,NULL,
@@ -472,7 +472,7 @@ int main(int argc, char **argv)
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* Parse command line arguments */
- TestParseCmdLine(argc, argv, &Summary, &CleanUp, parse_options);
+ TestParseCmdLine(argc, argv);
/*
if (parse_options(argc, argv) != 0){
@@ -497,11 +497,11 @@ int main(int argc, char **argv)
PerformTests();
/* Display test summary, if requested */
- if (Summary)
+ if (GetTestSummary())
TestSummary();
/* Clean up test files, if allowed */
- if (CleanUp && !getenv("HDF5_NOCLEANUP"))
+ if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
nerrors += GetTestNumErrs();