diff options
author | Richard Warren <Richard.Warren@hdfgroup.org> | 2017-11-03 01:24:38 (GMT) |
---|---|---|
committer | Richard Warren <Richard.Warren@hdfgroup.org> | 2017-11-03 01:24:38 (GMT) |
commit | 3e01676fa4820594abdc31fe1e6ddc716ddb7311 (patch) | |
tree | 9b7ebf1ab8a1244817dce8d927f4f3e190257a0d /testpar | |
parent | 62749cd371b57c3a07d5a4662fca641678ffe9e8 (diff) | |
download | hdf5-3e01676fa4820594abdc31fe1e6ddc716ddb7311.zip hdf5-3e01676fa4820594abdc31fe1e6ddc716ddb7311.tar.gz hdf5-3e01676fa4820594abdc31fe1e6ddc716ddb7311.tar.bz2 |
Add the modifications for Cmake testing to a 1_10 based branch: HDFFV-10318
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_pread.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/testpar/t_pread.c b/testpar/t_pread.c index b5a84f2..a527503 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -55,6 +55,9 @@ fools.\n"; static int generate_test_file(MPI_Comm comm, int mpi_rank, int group); static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group); +static char *test_argv0 = NULL; +extern char *dirname(char *path); /* Avoids additional includes */ + /*------------------------------------------------------------------------- * Function: generate_test_file @@ -392,9 +395,29 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id ) if ( pass ) { char cmd[256]; - - HDsprintf(cmd, "../tools/src/h5jam/h5jam -i %s -u %s -o %s", - data_filename, prolog_filename, reloc_data_filename); + char exe_path[256]; + char *relative_path = "../tools/src/h5jam"; + char *exe_dirname = relative_path; + + /* We're checking for the existance of the h5jam utility + * With Cmake testing, all binaries are in the same directory + * e.g. the same location where this executable is found. + * We've copied the argv[0] argument and check to see + * if h5jam is co-located here. Otherwise, the autotools + * put things into directories, hence the relative path. + */ + if (test_argv0 != NULL) { + HDstrncpy(exe_path, test_argv0, sizeof(exe_path)); + if ( (exe_dirname = (char *)dirname(exe_path)) != NULL) { + HDsprintf(cmd, "%s/h5jam", exe_dirname); + if ( HDaccess(cmd, F_OK) != 0) + exe_dirname = relative_path; + } + } + HDsprintf(cmd, "%s/h5jam -i %s -u %s -o %s", + exe_dirname, + data_filename, + prolog_filename, reloc_data_filename); if ( system(cmd) != 0 ) { pass = FALSE; @@ -680,7 +703,7 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id) } /* collect results from other processes. - * Only overwrite the failure message if no preveious error + * Only overwrite the failure message if no previous error * has been detected */ local_failure = ( pass ? 0 : 1 ); @@ -761,6 +784,17 @@ main( int argc, char **argv) int split_size; MPI_Comm group_comm = MPI_COMM_WORLD; + /* I don't believe that argv[0] can ever be NULL. + * It should thus be safe to dup and save as a check + * for cmake testing. Note that in our Cmake builds, + * all executables are located in the same directory. + * We assume (but we'll check) that the h5jam utility + * is in the directory as this executable. If that + * isn't true, then we can use a relative path that + * should be valid for the autotools environment. + */ + test_argv0 = HDstrdup(argv[0]); + if ( (MPI_Init(&argc, &argv)) != MPI_SUCCESS) { HDfprintf(stderr, "FATAL: Unable to initialize MPI\n"); HDexit(EXIT_FAILURE); @@ -785,11 +819,11 @@ main( int argc, char **argv) HDfprintf(stdout, "========================================\n"); } - if ( mpi_size < 4 ) { + if ( mpi_size < 3 ) { if ( mpi_rank == 0 ) { - HDprintf(" Need at least 4 processes. Exiting.\n"); + HDprintf(" Need at least 3 processes. Exiting.\n"); } goto finish; } |