mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[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:
This commit is contained in:
parent
3f766acd0c
commit
1ff1d02c68
@ -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 <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _POSIX_SOURCE
|
||||
#include <getopt.h>
|
||||
#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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user