[svn-r18413] Description:

Unify srcdir handling for test executables and allow them to use the srcdir
setting from configure time without requiring the 'srcdir' environment variable
be set (although you still can, to override the built in setting).  Attempted
to get this right for Windows builds also.

    Also add dependency between src/H5Tinit.c and src/libhdf5.settings, so
that the test/testcheck_version.sh script works correctly.

Tested on:
    Linux/32 2.6 (jam)
    Mac OS X/32 10.6.2 (amazon)
This commit is contained in:
Quincey Koziol 2010-03-17 16:38:20 -05:00
parent 8a14f5dc0e
commit fd547cd11f
50 changed files with 693 additions and 320 deletions

View File

@ -340,6 +340,7 @@
./c++/src/header_files/image001.jpg
./c++/src/header_files/image002.jpg
./c++/test/H5srcdir.h.in
./c++/test/Makefile.am
./c++/test/Makefile.in
./c++/test/dsets.cpp
@ -364,6 +365,7 @@
#------------------------------------------------------------------------------
./perform/COPYING
./perform/H5srcdir.h.in
./perform/Makefile.am
./perform/Makefile.in
./perform/benchpar.c
@ -787,6 +789,7 @@
./src/H5win32defs.h
./test/COPYING
./test/H5srcdir.h.in
./test/Makefile.am
./test/Makefile.in
./test/app_ref.c
@ -932,6 +935,7 @@
./test/testfiles/error_test_2
./testpar/COPYING
./testpar/H5srcdir.h.in
./testpar/Makefile.am
./testpar/Makefile.in
./testpar/t_cache.c
@ -1026,6 +1030,7 @@
./tools/h5diff/testph5diff.sh
# h5repack sources
./tools/h5repack/H5srcdir.h.in
./tools/h5repack/Makefile.am
./tools/h5repack/Makefile.in
./tools/h5repack/h5repack.sh.in
@ -1705,6 +1710,7 @@
./hl/src/H5TBpublic.h
./hl/src/hdf5_hl.h
./hl/test/COPYING
./hl/test/H5srcdir.h.in
./hl/test/Makefile.am
./hl/test/Makefile.in
./hl/test/dsdata.txt
@ -1877,6 +1883,7 @@
./windows/c++/examples/writedatatestdll/writedatatestdll.vcproj
# C++ Tests
./windows/c++/test/H5srcdir.h
./windows/c++/test/checkcpptests.bat
./windows/c++/test/testhdf5_cpp/testhdf5_cpp.vcproj
./windows/c++/test/testhdf5_cppdll/testhdf5_cppdll.vcproj
@ -2019,6 +2026,7 @@
./windows/hl/fortran/test/hl_test_table_fortrandll/hl_test_table_fortrandll.vfproj
# High-Level Library Tests
./windows/hl/test/H5srcdir.h
./windows/hl/test/checkhltests.bat
./windows/hl/test/hl_test_ds/hl_test_ds.vcproj
./windows/hl/test/hl_test_dsdll/hl_test_dsdll.vcproj
@ -2045,6 +2053,7 @@
./windows/misc/typegen/h5tinit/h5tinit.vcproj
# Performance Tests
./windows/perform/H5srcdir.h
./windows/perform/checkperformtests.bat
./windows/perform/perf_serialdll/perf_serialdll.vcproj
./windows/perform/perf_serial/perf_serial.vcproj
@ -2078,6 +2087,7 @@
./windows/src/H5pubconf.h
# Library Test Projects
./windows/test/H5srcdir.h
./windows/test/checktests.bat
./windows/test/testerror.bat
./windows/test/app_ref/app_ref.vcproj
@ -2207,6 +2217,7 @@
./windows/tools/h5lsdll/h5lsdll.vcproj
./windows/tools/h5mkgrp/h5mkgrp.vcproj
./windows/tools/h5mkgrp/testh5mkgrp.bat
./windows/tools/h5repack/H5srcdir.h
./windows/tools/h5repack/h5repack.vcproj
./windows/tools/h5repack/h5repack.bat
./windows/tools/h5repackdll/h5repackdll.vcproj

52
c++/test/H5srcdir.h.in Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -50,8 +50,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
# Shared C++ libraries aren't universally supported.
@ -65,7 +65,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = H5srcdir.h
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = testhdf5$(EXEEXT)
am_testhdf5_OBJECTS = testhdf5.$(OBJEXT) dsets.$(OBJEXT) \
@ -420,6 +420,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \

View File

@ -43,6 +43,7 @@
#endif
#include "h5cpputil.h" // C++ utilility header file
#include "H5srcdir.h"
const H5std_string TESTFILE("th5s.h5");
const H5std_string DATAFILE("th5s1.h5");
@ -184,13 +185,7 @@ static void test_h5s_basic()
* If this test fails and the H5S_MAX_RANK variable has changed, follow
* the instructions in space_overflow.c for regenating the th5s.h5 file.
*/
char testfile[512]="";
char *srcdir = getenv("srcdir");
if (srcdir && ((strlen(srcdir) + strlen(TESTFILE.c_str()) + 1) < sizeof(testfile))){
strcpy(testfile, srcdir);
strcat(testfile, "/");
}
strcat(testfile, TESTFILE.c_str());
const char *testfile = H5_get_srcdir_filename(TESTFILE.c_str());
// Create file
H5File fid1(testfile, H5F_ACC_RDONLY);

10
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in 18350 2010-02-28 14:37:04Z hdftest .
# From configure.in Id: configure.in 18406 2010-03-14 15:04:16Z hdftest .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for HDF5 1.9.63.
#
@ -28266,7 +28266,7 @@ if test -n "$TESTPARALLEL"; then
fi
fi
ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/testlibinfo.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/H5srcdir.h test/testlibinfo.sh testpar/Makefile testpar/H5srcdir.h testpar/testph5.sh perform/Makefile perform/H5srcdir.h tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/H5srcdir.h tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir.h c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
cat >confcache <<\_ACEOF
@ -29478,10 +29478,13 @@ do
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"test/testcheck_version.sh") CONFIG_FILES="$CONFIG_FILES test/testcheck_version.sh" ;;
"test/testerror.sh") CONFIG_FILES="$CONFIG_FILES test/testerror.sh" ;;
"test/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES test/H5srcdir.h" ;;
"test/testlibinfo.sh") CONFIG_FILES="$CONFIG_FILES test/testlibinfo.sh" ;;
"testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;;
"testpar/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES testpar/H5srcdir.h" ;;
"testpar/testph5.sh") CONFIG_FILES="$CONFIG_FILES testpar/testph5.sh" ;;
"perform/Makefile") CONFIG_FILES="$CONFIG_FILES perform/Makefile" ;;
"perform/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES perform/H5srcdir.h" ;;
"tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
"tools/h5dump/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5dump/Makefile" ;;
"tools/h5dump/testh5dump.sh") CONFIG_FILES="$CONFIG_FILES tools/h5dump/testh5dump.sh" ;;
@ -29491,6 +29494,7 @@ do
"tools/h5diff/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5diff/Makefile" ;;
"tools/h5jam/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5jam/Makefile" ;;
"tools/h5jam/testh5jam.sh") CONFIG_FILES="$CONFIG_FILES tools/h5jam/testh5jam.sh" ;;
"tools/h5repack/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES tools/h5repack/H5srcdir.h" ;;
"tools/h5repack/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5repack/Makefile" ;;
"tools/h5repack/h5repack.sh") CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack.sh" ;;
"tools/h5ls/Makefile") CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;;
@ -29507,6 +29511,7 @@ do
"c++/src/Makefile") CONFIG_FILES="$CONFIG_FILES c++/src/Makefile" ;;
"c++/src/h5c++") CONFIG_FILES="$CONFIG_FILES c++/src/h5c++" ;;
"c++/test/Makefile") CONFIG_FILES="$CONFIG_FILES c++/test/Makefile" ;;
"c++/test/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES c++/test/H5srcdir.h" ;;
"c++/examples/Makefile") CONFIG_FILES="$CONFIG_FILES c++/examples/Makefile" ;;
"c++/examples/testh5c++.sh") CONFIG_FILES="$CONFIG_FILES c++/examples/testh5c++.sh" ;;
"fortran/Makefile") CONFIG_FILES="$CONFIG_FILES fortran/Makefile" ;;
@ -29519,6 +29524,7 @@ do
"hl/Makefile") CONFIG_FILES="$CONFIG_FILES hl/Makefile" ;;
"hl/src/Makefile") CONFIG_FILES="$CONFIG_FILES hl/src/Makefile" ;;
"hl/test/Makefile") CONFIG_FILES="$CONFIG_FILES hl/test/Makefile" ;;
"hl/test/H5srcdir.h") CONFIG_FILES="$CONFIG_FILES hl/test/H5srcdir.h" ;;
"hl/tools/Makefile") CONFIG_FILES="$CONFIG_FILES hl/tools/Makefile" ;;
"hl/tools/gif2h5/Makefile") CONFIG_FILES="$CONFIG_FILES hl/tools/gif2h5/Makefile" ;;
"hl/examples/Makefile") CONFIG_FILES="$CONFIG_FILES hl/examples/Makefile" ;;

View File

@ -4051,10 +4051,13 @@ AC_CONFIG_FILES([src/libhdf5.settings
test/Makefile
test/testcheck_version.sh
test/testerror.sh
test/H5srcdir.h
test/testlibinfo.sh
testpar/Makefile
testpar/H5srcdir.h
testpar/testph5.sh
perform/Makefile
perform/H5srcdir.h
tools/Makefile
tools/h5dump/Makefile
tools/h5dump/testh5dump.sh
@ -4064,6 +4067,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
tools/h5diff/Makefile
tools/h5jam/Makefile
tools/h5jam/testh5jam.sh
tools/h5repack/H5srcdir.h
tools/h5repack/Makefile
tools/h5repack/h5repack.sh
tools/h5ls/Makefile
@ -4080,6 +4084,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
c++/src/Makefile
c++/src/h5c++
c++/test/Makefile
c++/test/H5srcdir.h
c++/examples/Makefile
c++/examples/testh5c++.sh
fortran/Makefile
@ -4092,6 +4097,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
hl/Makefile
hl/src/Makefile
hl/test/Makefile
hl/test/H5srcdir.h
hl/tools/Makefile
hl/tools/gif2h5/Makefile
hl/examples/Makefile

52
hl/test/H5srcdir.h.in Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -53,8 +53,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1)
@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2)
@ -66,7 +66,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = H5srcdir.h
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = test_lite$(EXEEXT) test_image$(EXEEXT) \
test_table$(EXEEXT) test_ds$(EXEEXT) test_packet$(EXEEXT)
@ -448,6 +448,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \

View File

@ -2143,15 +2143,7 @@ static int test_foreign_scaleattached(const char *fileforeign)
hid_t fid = -1;
hid_t did = -1;
hid_t dsid = -1;
char *srcdir = getenv("srcdir"); /* the source directory */
char filename[512]=""; /* buffer to hold name of existing file */
/* compose the name of the file to open, using the srcdir, if appropriate */
if (srcdir) {
strcpy(filename,srcdir);
strcat(filename,"/");
}
strcat(filename, fileforeign);
const char *filename = H5_get_srcdir_filename(fileforeign);
TESTING2("test_foreign_scaleattached");
@ -4856,19 +4848,9 @@ static int read_data( const char* fname,
size_t nelms;
FILE *f;
float val;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]; /* buffer to hold name of existing data file */
const char *data_file = H5_get_srcdir_filename(fname);
strcpy(data_file, "");
/* compose the name of the file to open, using the srcdir, if appropriate */
if(srcdir)
{
strcpy(data_file, srcdir);
strcat(data_file, "/");
}
/* read first data file */
strcat(data_file,fname);
f = fopen(data_file, "r");
if( f == NULL )
{

View File

@ -510,8 +510,7 @@ static int test_generate(void)
int imax, jmax, kmax;
float valex, xmin, xmax, value;
FILE *f;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing data file */
const char *data_file = H5_get_srcdir_filename(DATA_FILE4);
int i;
/* create a file using default properties */
@ -520,17 +519,6 @@ static int test_generate(void)
printf("Testing read and process data and make indexed images\n");
/*-------------------------------------------------------------------------
* compose the name of the file to open, using the srcdir, if appropriate
*-------------------------------------------------------------------------
*/
if ( srcdir )
{
strcpy(data_file, srcdir);
strcat(data_file, "/");
}
strcat(data_file,DATA_FILE4);
/*-------------------------------------------------------------------------
* read data; the file data format is described below
*-------------------------------------------------------------------------
@ -723,20 +711,7 @@ static int read_data( const char* fname, /*IN*/
char str[20];
FILE *f;
int w, h;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing data file */
/*-------------------------------------------------------------------------
* compose the name of the file to open, using "srcdir", if appropriate
*-------------------------------------------------------------------------
*/
strcpy(data_file, "");
if (srcdir)
{
strcpy(data_file, srcdir);
strcat(data_file, "/");
}
strcat(data_file,fname);
const char *data_file = H5_get_srcdir_filename(fname);
/*-------------------------------------------------------------------------
* read
@ -811,20 +786,7 @@ static int read_palette(const char* fname,
unsigned int green;
unsigned int blue;
unsigned nentries;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]; /* buffer to hold name of existing data file */
/*-------------------------------------------------------------------------
* compose the name of the file to open, using "srcdir", if appropriate
*-------------------------------------------------------------------------
*/
strcpy(data_file, "");
if (srcdir)
{
strcpy(data_file, srcdir);
strcat(data_file, "/");
}
strcat(data_file,fname);
const char *data_file = H5_get_srcdir_filename(fname);
/* ensure the given palette is valid */
if (!palette)

View File

@ -1538,18 +1538,10 @@ static int test_complicated_compound(void)
char *line = NULL;
FILE *fp = NULL;
size_t size = 1024;
char *srcdir = getenv("srcdir"); /* the source directory */
char filename[1024]="";
const char *filename = H5_get_srcdir_filename(INPUT_FILE);
TESTING3(" text for complicated compound types");
/* compose the name of the file to open, using the srcdir, if appropriate */
if(srcdir) {
strcpy(filename, srcdir);
strcat(filename, "/");
}
strcat(filename, INPUT_FILE);
/* Open input file */
fp = fopen(filename, "r");
if(fp == NULL) {

View File

@ -123,16 +123,7 @@ static hid_t h5file_open(const char *fname, unsigned flags)
{
hid_t fid; /* identifier for the file */
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing file */
/* compose the name of the file to open, using the srcdir, if appropriate */
if (srcdir)
{
strcpy(data_file,srcdir);
strcat(data_file,"/");
}
strcat(data_file,fname);
const char *data_file = H5_get_srcdir_filename(fname);
/* open */
if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0)

52
perform/H5srcdir.h.in Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -51,8 +51,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
@BUILD_PARALLEL_CONDITIONAL_FALSE@bin_PROGRAMS = \
@BUILD_PARALLEL_CONDITIONAL_FALSE@ h5perf_serial$(EXEEXT)
@ -66,7 +66,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = H5srcdir.h
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
@BUILD_PARALLEL_CONDITIONAL_TRUE@am__EXEEXT_1 = h5perf$(EXEEXT) \
@ -483,6 +483,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"

View File

@ -20,8 +20,10 @@
* Purpose: Tests performance of metadata
*/
#include "h5test.h"
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include "h5test.h"
#ifdef H5_HAVE_PARALLEL
#define MAINPROCESS (!mpi_rank) /* define process 0 as main process */

View File

@ -18,7 +18,6 @@
#include "sio_timer.h"
#ifndef STANDALONE
#include "H5private.h"
#include "h5test.h"
#include "h5tools_utils.h"
#else
#include "sio_standalone.h"

View File

@ -127,7 +127,7 @@ settings_DATA=libhdf5.settings
# Things should have been all set during H5detect making.
# Remove the generated .c file if errors occur unless HDF5_Make_Ignore
# is set to ignore the error.
H5Tinit.c: H5detect$(EXEEXT)
H5Tinit.c: H5detect$(EXEEXT) libhdf5.settings
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
$(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \

View File

@ -1235,7 +1235,7 @@ help:
# Things should have been all set during H5detect making.
# Remove the generated .c file if errors occur unless HDF5_Make_Ignore
# is set to ignore the error.
H5Tinit.c: H5detect$(EXEEXT)
H5Tinit.c: H5detect$(EXEEXT) libhdf5.settings
LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \
sed -e 's/-L/:/g' -e 's/ //g'`" \
$(RUNSERIAL) ./H5detect$(EXEEXT) > H5Tinit.c || \

52
test/H5srcdir.h.in Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -52,9 +52,10 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/testcheck_version.sh.in $(srcdir)/testerror.sh.in \
$(srcdir)/testlibinfo.sh.in $(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/testcheck_version.sh.in \
$(srcdir)/testerror.sh.in $(srcdir)/testlibinfo.sh.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \
err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT)
@ -67,7 +68,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh testlibinfo.sh
CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir.h \
testlibinfo.sh
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libh5test_la_LIBADD =
@ -799,6 +801,8 @@ testcheck_version.sh: $(top_builddir)/config.status $(srcdir)/testcheck_version.
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testlibinfo.sh: $(top_builddir)/config.status $(srcdir)/testlibinfo.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

View File

@ -37,8 +37,7 @@ const char *FILENAME[] = {
static int read_data(char *fname)
{
char pathname[1024];
char *srcdir = getenv("srcdir"); /*where the src code is located*/
const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */
hid_t file, dataset; /* handles */
hid_t datatype;
hid_t dt;
@ -47,14 +46,6 @@ static int read_data(char *fname)
int i, j;
unsigned nerrors = 0;
pathname[0] = '\0';
/* Generate correct name for test file by prepending the source path */
if(srcdir && ((strlen(srcdir) + strlen(fname) + 1) < sizeof(pathname))) {
strcpy(pathname, srcdir);
strcat(pathname, "/");
}
strcat(pathname, fname);
/*
* Data and output buffer initialization.
*/

View File

@ -2256,8 +2256,7 @@ test_missing_filter(hid_t file)
hsize_t dset_size; /* Dataset size */
size_t i,j; /* Local index variables */
herr_t ret; /* Generic return value */
char testfile[512]=""; /* Buffer to hold name of existing test file */
char *srcdir = HDgetenv("srcdir"); /* The source directory, if we are using the --srcdir configure option */
const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
TESTING("dataset access with missing filter");
@ -2403,13 +2402,6 @@ test_missing_filter(hid_t file)
/* Try reading existing dataset with deflate filter */
/* Compose the name of the file to open, using the srcdir, if appropriate */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_DEFLATE_NAME) + 1) < sizeof(testfile))){
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, FILE_DEFLATE_NAME);
/* Open existing file */
if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
H5_FAILED();
@ -5935,8 +5927,7 @@ test_filters_endianess(void)
hid_t dsid=-1; /* dataset ID */
hid_t sid=-1; /* dataspace ID */
hid_t dcpl=-1; /* dataset creation property list ID */
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing file */
const char *data_file = H5_get_srcdir_filename("test_filters_le.hdf5"); /* Corrected test file name */
TESTING("filters with big-endian/little-endian data");
@ -5946,14 +5937,6 @@ test_filters_endianess(void)
*-------------------------------------------------------------------------
*/
/* compose the name of the file to open, using the srcdir, if appropriate */
HDstrcpy(data_file, "");
if(srcdir) {
HDstrcpy(data_file, srcdir);
HDstrcat(data_file, "/");
}
HDstrcat(data_file, "test_filters_le.hdf5");
/* open */
if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@ -5969,12 +5952,7 @@ test_filters_endianess(void)
*/
/* compose the name of the file to open, using the srcdir, if appropriate */
HDstrcpy(data_file, "");
if(srcdir) {
HDstrcpy(data_file, srcdir);
HDstrcat(data_file, "/");
}
HDstrcat(data_file, "test_filters_be.hdf5");
data_file = H5_get_srcdir_filename("test_filters_be.hdf5"); /* Corrected test file name */
/* open */
if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR

View File

@ -845,8 +845,7 @@ test_4 (hid_t fapl)
hid_t xid = -1;
hid_t xid2 = -1;
char filename[1024]; /*file name */
char pathname[1024];
char *srcdir = getenv("srcdir"); /*where the src code is located*/
const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
TESTING("opening external link twice");
@ -865,14 +864,6 @@ test_4 (hid_t fapl)
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
goto error;
pathname[0] = '\0';
/* Generate correct name for test file by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
HDstrcpy(pathname, srcdir);
HDstrcat(pathname, "/");
}
HDstrcat(pathname, LINKED_FILE);
/* Create an external link to an existing file*/
if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0)
goto error;

View File

@ -1974,19 +1974,10 @@ test_compatible(void)
hsize_t dims[2], one[2]={1,1};
hsize_t hs_offset[2]={3,4};
H5D_fill_value_t status;
char *srcdir = getenv("srcdir"); /*where the src code is located*/
char testfile[512]=""; /* test file name */
const char *testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
TESTING("contiguous dataset compatibility with v. 1.4");
/* Generate correct name for test file by prepending the source path */
if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) <
sizeof(testfile))) {
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, FILE_COMPATIBLE);
if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
printf(" Could not open file %s. Try set $srcdir to point at the "
"source directory of test\n", testfile);

View File

@ -1114,18 +1114,10 @@ getenv_all(MPI_Comm comm, int root, const char* name)
hid_t
h5_make_local_copy(char *origfilename, char *local_copy_name)
{
char filename[FILENAME_BUF_SIZE] = "";
const char *filename = H5_get_srcdir_filename(origfilename); /* Corrected test file name */
int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
ssize_t nread; /* Number of bytes read in */
char buf[READ_BUF_SIZE]; /* Buffer for copying data */
char * srcdir = HDgetenv("srcdir"); /* The source directory */
if(srcdir && ((HDstrlen(srcdir) +
HDstrlen(origfilename) + 6) < FILENAME_BUF_SIZE)) {
HDstrcpy(filename, srcdir);
HDstrcat(filename, "/");
}
HDstrcat(filename, origfilename);
/* Copy old file into temporary file */
if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1;

View File

@ -24,6 +24,7 @@
#include "hdf5.h"
#include "H5private.h"
#include "H5srcdir.h"
#ifdef H5_STDC_HEADERS
# include <signal.h>

View File

@ -6214,34 +6214,19 @@ external_link_endian(hbool_t new_format)
hid_t fid = (-1); /* File ID */
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
hid_t lapl_id = (-1); /* Prop List ID */
char * srcdir = getenv("srcdir"); /* The source directory */
char pathbuf[NAME_BUF_SIZE]; /* Path to the files */
char namebuf[NAME_BUF_SIZE];
const char *pathbuf = H5_get_srcdir(); /* Path to the files */
const char *namebuf;
if(new_format)
TESTING("endianness of external links (w/new group format)")
else
TESTING("endianness of external links")
/*
* Create the name of the file to open (in case we are using the --srcdir
* option and the file is in a different directory from this test).
*/
if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) )
{
HDstrcpy(pathbuf, srcdir);
HDstrcat(pathbuf, "/");
}
else
HDstrcpy(pathbuf, "");
/* Create a link access property list with the path to the srcdir */
if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR
if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
HDstrcpy(namebuf, pathbuf);
HDstrcat(namebuf, LE_FILENAME);
namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */
/* Test LE file; try to open a group through the external link */
if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
@ -6255,9 +6240,7 @@ external_link_endian(hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR
HDstrcpy(namebuf, pathbuf);
HDstrcat(namebuf, BE_FILENAME);
namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */
/* Test BE file; try to open a group through the external link */
if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
@ -8300,8 +8283,7 @@ build_visit_file(hid_t fapl)
hid_t did = (-1); /* Dataset ID */
hid_t tid = (-1); /* Datatype ID */
char filename[NAME_BUF_SIZE];
char pathname[1024]; /* Path of external link file */
char *srcdir = getenv("srcdir"); /* where the src code is located */
const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
@ -8337,14 +8319,6 @@ build_visit_file(hid_t fapl)
if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create external link to existing file */
pathname[0] = '\0';
/* Generate correct name for test file by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) {
HDstrcpy(pathname, srcdir);
HDstrcat(pathname, "/");
}
HDstrcat(pathname, LINKED_FILE);
if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Create dangling external link to non-existent file */

View File

@ -131,14 +131,8 @@ main(void)
TESTING("accessing old modification time messages");
{
char testfile[512]="";
char *srcdir = HDgetenv("srcdir");
const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */
if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE1) + 1) < sizeof(testfile))){
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, TESTFILE1);
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0)
@ -167,14 +161,8 @@ main(void)
TESTING("accessing new modification time messages");
{
char testfile[512]="";
char *srcdir = HDgetenv("srcdir");
const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */
if(srcdir && ((HDstrlen(srcdir) + strlen(TESTFILE2) + 1) < sizeof(testfile))){
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, TESTFILE2);
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0)

View File

@ -6076,19 +6076,11 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl)
{
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
hid_t did = -1, did2 = -1; /* Dataset IDs */
char *srcdir = HDgetenv("srcdir"); /* Where the src code is located */
char src_filename[NAME_BUF_SIZE] = "";
const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */
char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): dataset with old layout format");
/* Generate correct name for source file by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(FILE_OLD_LAYOUT) + 1) < sizeof(src_filename))) {
HDstrcpy(src_filename, srcdir);
HDstrcat(src_filename, "/");
} /* end if */
HDstrcat(src_filename, FILE_OLD_LAYOUT);
/* Initialize the destination filename */
h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);

View File

@ -362,20 +362,7 @@ main(void)
HDputs("Accessing objects with unknown header messages:");
{
hid_t file2; /* File ID for 'bogus' object file */
char testpath[512] = "";
char testfile[512] = "";
char *srcdir = HDgetenv("srcdir");
/* Build path to all test files */
if(srcdir && ((HDstrlen(srcdir) + 2) < sizeof(testpath))) {
HDstrcpy(testpath, srcdir);
HDstrcat(testpath, "/");
} /* end if */
/* Build path to test file */
if(srcdir && ((HDstrlen(testpath) + HDstrlen(FILE_BOGUS) + 1) < sizeof(testfile)))
HDstrcpy(testfile, testpath);
HDstrcat(testfile, FILE_BOGUS);
const char *testfile = H5_get_srcdir_filename(FILE_BOGUS);
TESTING("object with unknown header message and no flags set");

View File

@ -1802,8 +1802,7 @@ test_compat(void)
long l[ARRAY1_DIM1];
double d;
} s3_t;
char testfile[512]=""; /* Character buffer for corrected test file name */
char *srcdir = getenv("srcdir"); /* Pointer to the directory the source code is located within */
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
hid_t tid1; /* Array Datatype ID */
@ -1831,12 +1830,6 @@ test_compat(void)
* changed, follow the instructions in gen_old_array.c for regenerating
* the tarrold.h5 file.
*/
/* Generate the correct name for the test file, by prepending the source path */
if (srcdir && ((strlen(srcdir) + strlen(TESTFILE) + 1) < sizeof(testfile))) {
strcpy(testfile, srcdir);
strcat(testfile, "/");
}
strcat(testfile, TESTFILE);
/* Open the testfile */
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);

View File

@ -2957,7 +2957,6 @@ test_filespace_compatible(void)
int rdbuf[100]; /* Temporary buffer for reading in dataset data */
uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
ssize_t nread; /* Number of bytes read in */
char *srcdir = HDgetenv("srcdir"); /* where the src code is located */
unsigned i, j; /* Local index variable */
hssize_t free_space; /* Amount of free space in the file */
hsize_t threshold; /* Free space section threshold */
@ -2968,14 +2967,7 @@ test_filespace_compatible(void)
MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n"));
for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
char filename[FILENAME_LEN] = ""; /* old test file name */
/* Generate correct name for test file by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(OLD_FILENAME[j]) + 1) < sizeof(filename))) {
HDstrcpy(filename, srcdir);
HDstrcat(filename, "/");
}
HDstrcat(filename, OLD_FILENAME[j]);
const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */
/* Copy old file into test file */
fd_old = HDopen(filename, O_RDONLY, 0666);

View File

@ -173,13 +173,8 @@ test_h5s_basic(void)
* the instructions in space_overflow.c for regenerating the th5s.h5 file.
*/
{
char testfile[512]="";
char *srcdir = HDgetenv("srcdir");
if (srcdir && ((HDstrlen(srcdir) + HDstrlen(TESTFILE) + 1) < sizeof(testfile))){
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, TESTFILE);
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK_I(fid1, "H5Fopen");
if (fid1 >= 0){

View File

@ -1723,20 +1723,12 @@ test_misc10(void)
hid_t dataset, dataset_new; /* Dataset IDs for old & new datasets */
hid_t dcpl; /* Dataset creation property list */
hid_t space, type; /* Old dataset's dataspace & datatype */
char testfile[512]=""; /* Character buffer for corrected test file name */
char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
const char *testfile = H5_get_srcdir_filename(MISC10_FILE_OLD); /* Corrected test file name */
herr_t ret;
/* Output message about test being performed */
MESSAGE(5, ("Testing using old dataset creation property list\n"));
/* Generate the correct name for the test file, by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC10_FILE_OLD) + 1) < sizeof(testfile))) {
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, MISC10_FILE_OLD);
/*
* Open the old file and the dataset and get old settings.
*/
@ -3387,8 +3379,7 @@ test_misc20(void)
hsize_t small_dims[MISC20_SPACE_RANK]={MISC20_SPACE2_DIM0,MISC20_SPACE2_DIM1}; /* Small dimensions */
unsigned version; /* Version of storage layout info */
hsize_t contig_size; /* Size of contiguous storage size from layout into */
char testfile[512]=""; /* Character buffer for corrected test file name */
char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
const char *testfile = H5_get_srcdir_filename(MISC20_FILE_OLD); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@ -3502,13 +3493,6 @@ test_misc20(void)
/* Verify that the storage size is computed correctly for older versions of layout info */
/* Generate the correct name for the test file, by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC20_FILE_OLD) + 1) < sizeof(testfile))) {
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, MISC20_FILE_OLD);
/*
* Open the old file and the dataset and get old settings.
*/
@ -4630,20 +4614,12 @@ test_misc25b(void)
{
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
char testfile[512]="";
char *srcdir = HDgetenv("srcdir");
const char *testfile = H5_get_srcdir_filename(MISC25B_FILE); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Exercise null object header message bug\n"));
/* Build the name of the file, with the source directory */
if (srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC25B_FILE) + 1) < sizeof(testfile))){
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, MISC25B_FILE);
/* Open file */
fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@ -4895,20 +4871,12 @@ test_misc27(void)
{
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
char testfile[512]=""; /* Character buffer for corrected test file name */
char *srcdir = HDgetenv("srcdir"); /* Pointer to the directory the source code is located within */
const char *testfile = H5_get_srcdir_filename(MISC27_FILE); /* Corrected test file name */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Corrupt object header handling\n"));
/* Generate the correct name for the test file, by prepending the source path */
if(srcdir && ((HDstrlen(srcdir) + HDstrlen(MISC27_FILE) + 1) < sizeof(testfile))) {
HDstrcpy(testfile, srcdir);
HDstrcat(testfile, "/");
}
HDstrcat(testfile, MISC27_FILE);
/* Open the file */
fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");

52
testpar/H5srcdir.h.in Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -50,8 +50,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/testph5.sh.in $(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/testph5.sh.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1)
TESTS = $(check_PROGRAMS) $(am__EXEEXT_2)
@ -62,7 +63,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES = testph5.sh
CONFIG_CLEAN_FILES = H5srcdir.h testph5.sh
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = t_mpi$(EXEEXT) t_posix_compliant$(EXEEXT) \
testphdf5$(EXEEXT) t_cache$(EXEEXT) t_pflush1$(EXEEXT) \
@ -444,6 +445,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testph5.sh: $(top_builddir)/config.status $(srcdir)/testph5.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = "@srcdir@";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -51,8 +51,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/h5repack.sh.in $(top_srcdir)/config/commence.am \
DIST_COMMON = $(srcdir)/H5srcdir.h.in $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/h5repack.sh.in \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
noinst_PROGRAMS = testh5repack_detect_szip$(EXEEXT)
check_PROGRAMS = $(am__EXEEXT_1)
@ -65,7 +66,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES = h5repack.sh
CONFIG_CLEAN_FILES = H5srcdir.h h5repack.sh
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
am__EXEEXT_1 = h5repacktst$(EXEEXT)
@ -449,6 +450,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
H5srcdir.h: $(top_builddir)/config.status $(srcdir)/H5srcdir.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
h5repack.sh: $(top_builddir)/config.status $(srcdir)/h5repack.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-binPROGRAMS: $(bin_PROGRAMS)

View File

@ -17,6 +17,8 @@
#ifndef H5REPACK_H__
#define H5REPACK_H__
#include <assert.h>
#include <string.h>
#include "hdf5.h"
#include "h5trav.h"

View File

@ -435,7 +435,7 @@ else
fi
#file
arg="$FILE4 -e $INFO_FILE"
arg="$FILE4 -e $srcdir/$INFO_FILE"
if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
else

View File

@ -14,9 +14,16 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
#include "h5test.h"
#include "h5tools.h"
/* number of members in an array */
#ifndef NELMTS
# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
#endif
/* minimum of two values */
#undef MIN
#define MIN(a,b) (((a)<(b)) ? (a) : (b))
/*-------------------------------------------------------------------------
* Function: aux_find_obj

View File

@ -513,18 +513,8 @@ void read_info(const char *filename,
FILE *fp;
char c;
int i, rc=1;
char *srcdir = getenv("srcdir"); /* the source directory */
char data_file[512]=""; /* buffer to hold name of existing file */
/* compose the name of the file to open, using the srcdir, if appropriate */
if (srcdir){
strcpy(data_file,srcdir);
strcat(data_file,"/");
}
strcat(data_file,filename);
if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
if ((fp = fopen(filename, "r")) == (FILE *)NULL) {
error_msg(progname, "cannot open options file %s\n", filename);
exit(EXIT_FAILURE);
}

View File

@ -14,13 +14,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
#include "h5test.h"
#include "h5tools_utils.h"
extern char *progname;
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
/* number of members in an array */
#ifndef NELMTS
# define NELMTS(X) (sizeof(X)/sizeof(X[0]))
#endif
/*-------------------------------------------------------------------------
* Function: h5repack_verify

View File

@ -16,8 +16,6 @@
#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
#include "h5test.h"
/*-------------------------------------------------------------------------

View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = ".";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -26,5 +26,10 @@ copy /y fortran\src\H5f90i_gen.h ..\fortran\src > nul
copy /y fortran\src\H5fortran_types.f90 ..\fortran\src > nul
xcopy /s /i /y *.bat ..\ > nul
copy /y examples\testExamples_exp_output.txt ..\examples > nul
copy /y c++\test\H5srcdir.h ..\src > nul
copy /y hl\test\H5srcdir.h ..\src > nul
copy /y perform\H5srcdir.h ..\src > nul
copy /y test\H5srcdir.h ..\src > nul
copy /y tools\h5repack\H5srcdir.h ..\src > nul
popd

View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = ".";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = ".";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

52
windows/test/H5srcdir.h Normal file
View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = ".";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}

View File

@ -0,0 +1,52 @@
/* If you are reading this file and it has a '.h' suffix, it was automatically
* generated from the '.in' version. Make changes there.
*/
/* Set the 'srcdir' path from configure time */
static const char *config_srcdir = ".";
/* Buffer to construct path in and return pointer to */
static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
/* Append the test file name to the srcdir path and return the whole string */
static const char *H5_get_srcdir_filename(const char *filename)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to test file */
if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
HDstrcpy(srcdir_testpath, srcdir);
HDstrcat(srcdir_testpath, "/");
HDstrcat(srcdir_testpath, filename);
return(srcdir_testpath);
} /* end if */
else
return(NULL);
}
/* Just return the srcdir path */
static const char *H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
/* Check for using the srcdir from configure time */
if(NULL == srcdir)
srcdir = config_srcdir;
/* Build path to all test files */
if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
HDstrcpy(srcdir_path, srcdir);
HDstrcat(srcdir_path, "/");
return(srcdir_path);
} /* end if */
else
return(NULL);
}