summaryrefslogtreecommitdiffstats
path: root/testpar/t_mpi.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2004-08-19 06:32:47 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2004-08-19 06:32:47 (GMT)
commit3c596787759d86e8f672f51e8675e93dc3f6d6dc (patch)
tree82869255fc6b1a25161147e0194cde2c71746b06 /testpar/t_mpi.c
parent3fe6ec11413f24d5dfcab5ac050c9e7312c3fd9d (diff)
downloadhdf5-3c596787759d86e8f672f51e8675e93dc3f6d6dc.zip
hdf5-3c596787759d86e8f672f51e8675e93dc3f6d6dc.tar.gz
hdf5-3c596787759d86e8f672f51e8675e93dc3f6d6dc.tar.bz2
[svn-r9115] 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/t_mpi.c')
-rw-r--r--testpar/t_mpi.c19
1 files changed, 11 insertions, 8 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();