From 1ff1d02c683e6314200e8fc90fbb36e238185fb1 Mon Sep 17 00:00:00 2001 From: Leon Arber Date: Thu, 8 Dec 2005 16:24:51 -0500 Subject: [svn-r11777] Purpose: Feature Description: Added blurb about future todo's for this test. Added support for HDF5_PARAPREFIX to determine the directory where the test file is stored. Solution: Used getenv_all to get the value of HDF5_PARAPREFIX. Note that, if a command-line parameter is passed to the program to specify a path, it will override the value of HDF5_PARAPREFIX. Platforms tested: copper, colonelk Misc. update: --- testpar/t_posix_compliant.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/testpar/t_posix_compliant.c b/testpar/t_posix_compliant.c index fca737a..17d7572 100644 --- a/testpar/t_posix_compliant.c +++ b/testpar/t_posix_compliant.c @@ -23,6 +23,11 @@ * uses MPI I/O (MPI_File_read, MPI_File_write). Each set has multiple sub-tests, which * test varying patters of writes and reads. * + * + * TODO: + * Add corresponding posix i/o tests for each MPI i/o test. Currently, not all of the + * MPI IO tests are implemented using fwrite/fread. + * * Leon Arber * larber@ncsa.uiuc.edu */ @@ -32,8 +37,10 @@ #include #include #include - +#ifdef _POSIX_SOURCE #include +#endif +#include "h5test.h" static char* testfile = NULL; @@ -662,13 +669,23 @@ int main(int argc, char* argv[]) char optstring[] = "h x m p: s: v:"; err_flag = 0; - testfile = (char*) malloc(strlen("posix_test")+1); - memset(testfile, 0, strlen("posix_test")+1); MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); + testfile = getenv_all(MPI_COMM_WORLD, 0, "HDF5_PARAPREFIX"); + if(!testfile) + { + testfile = strdup("posix_test"); + } + else + { + testfile = (char*) realloc(testfile, strlen(testfile) + 1 + strlen("posix_test")); + strcat(testfile, "/posix_test"); + } + + while((opt = getopt(argc, argv, optstring)) != -1) { switch(opt) @@ -693,9 +710,11 @@ int main(int argc, char* argv[]) break; case 'p': testfile = (char*) realloc(testfile, strlen(optarg) + 1 + strlen("posix_test")); + memset(testfile, 0, strlen(optarg)+1+strlen("posix_test")); strcpy(testfile, optarg); /* Append a / just in case they didn't end their path with one */ - strcat(testfile, "/"); + strcat(testfile, "/posix_test"); + fprintf(stderr, "Task %d setting testfile to: %s\n", rank, testfile); break; case 's': write_size = atoi(optarg); @@ -706,8 +725,6 @@ int main(int argc, char* argv[]) } } - strcat(testfile, "posix_test"); - if( (optind < argc) && (rank == 0)) fprintf(stderr, "Unkown command-line argument passed. Continuing anyway...\n"); -- cgit v0.12