summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST11
-rw-r--r--c++/test/H5srcdir.h.in52
-rw-r--r--c++/test/Makefile.in8
-rw-r--r--c++/test/th5s.cpp9
-rwxr-xr-xconfigure10
-rw-r--r--configure.in6
-rw-r--r--hl/test/H5srcdir.h.in52
-rw-r--r--hl/test/Makefile.in8
-rw-r--r--hl/test/test_ds.c22
-rw-r--r--hl/test/test_image.c44
-rw-r--r--hl/test/test_lite.c10
-rw-r--r--hl/test/test_table.c11
-rw-r--r--perform/H5srcdir.h.in52
-rw-r--r--perform/Makefile.in8
-rw-r--r--perform/perf_meta.c4
-rw-r--r--perform/sio_perf.h1
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in2
-rw-r--r--test/H5srcdir.h.in52
-rw-r--r--test/Makefile.in12
-rwxr-xr-xtest/cross_read.c11
-rw-r--r--test/dsets.c28
-rw-r--r--test/external.c11
-rw-r--r--test/fillval.c11
-rw-r--r--test/h5test.c10
-rw-r--r--test/h5test.h1
-rw-r--r--test/links.c36
-rw-r--r--test/mtime.c16
-rwxr-xr-xtest/objcopy.c10
-rw-r--r--test/ohdr.c15
-rw-r--r--test/tarray.c9
-rw-r--r--test/tfile.c10
-rw-r--r--test/th5s.c9
-rw-r--r--test/tmisc.c40
-rw-r--r--testpar/H5srcdir.h.in52
-rw-r--r--testpar/Makefile.in9
-rw-r--r--tools/h5repack/H5srcdir.h.in52
-rw-r--r--tools/h5repack/Makefile.in9
-rw-r--r--tools/h5repack/h5repack.h2
-rwxr-xr-xtools/h5repack/h5repack.sh.in2
-rw-r--r--tools/h5repack/h5repack_filters.c9
-rw-r--r--tools/h5repack/h5repack_main.c12
-rw-r--r--tools/h5repack/h5repack_verify.c6
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c2
-rw-r--r--windows/c++/test/H5srcdir.h52
-rwxr-xr-xwindows/copy_hdf.bat5
-rw-r--r--windows/hl/test/H5srcdir.h52
-rw-r--r--windows/perform/H5srcdir.h52
-rw-r--r--windows/test/H5srcdir.h52
-rw-r--r--windows/tools/h5repack/H5srcdir.h52
50 files changed, 693 insertions, 320 deletions
diff --git a/MANIFEST b/MANIFEST
index 5d2584c..afad167 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -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
diff --git a/c++/test/H5srcdir.h.in b/c++/test/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/c++/test/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in
index 9598e3c..78439dc 100644
--- a/c++/test/Makefile.in
+++ b/c++/test/Makefile.in
@@ -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; \
diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp
index 58f26f0..a57f231 100644
--- a/c++/test/th5s.cpp
+++ b/c++/test/th5s.cpp
@@ -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);
diff --git a/configure b/configure
index 18a63d4..56aa8d1 100755
--- a/configure
+++ b/configure
@@ -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" ;;
diff --git a/configure.in b/configure.in
index 8d35221..cee2d9d 100644
--- a/configure.in
+++ b/configure.in
@@ -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
diff --git a/hl/test/H5srcdir.h.in b/hl/test/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/hl/test/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index a364c75..a7f118f 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -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; \
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 8576b2a..e3d7fe4 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -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 )
{
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 426ae1d..d87946c 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -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 */
@@ -521,17 +520,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)
diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c
index 2012e8f..27da0ab 100644
--- a/hl/test/test_lite.c
+++ b/hl/test/test_lite.c
@@ -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) {
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index 3438f15..0e87a7f 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -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)
diff --git a/perform/H5srcdir.h.in b/perform/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/perform/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/perform/Makefile.in b/perform/Makefile.in
index a5a28f5..8b05026 100644
--- a/perform/Makefile.in
+++ b/perform/Makefile.in
@@ -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)"
diff --git a/perform/perf_meta.c b/perform/perf_meta.c
index 279c8de..b3966d6 100644
--- a/perform/perf_meta.c
+++ b/perform/perf_meta.c
@@ -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 */
diff --git a/perform/sio_perf.h b/perform/sio_perf.h
index 2417b6f..bd05cfe 100644
--- a/perform/sio_perf.h
+++ b/perform/sio_perf.h
@@ -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"
diff --git a/src/Makefile.am b/src/Makefile.am
index 494f370..da81ee2 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 || \
diff --git a/src/Makefile.in b/src/Makefile.in
index ee4a86b..b1bc85f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -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 || \
diff --git a/test/H5srcdir.h.in b/test/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/test/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/test/Makefile.in b/test/Makefile.in
index 4777bf6..40f2bed 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -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)/$@
diff --git a/test/cross_read.c b/test/cross_read.c
index b036217..6ce38f2 100755
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -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.
*/
diff --git a/test/dsets.c b/test/dsets.c
index 46355c1..c17e90c 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -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
diff --git a/test/external.c b/test/external.c
index 68f81e8..24cd85b 100644
--- a/test/external.c
+++ b/test/external.c
@@ -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;
diff --git a/test/fillval.c b/test/fillval.c
index 2f58380..25c8bd1 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -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);
diff --git a/test/h5test.c b/test/h5test.c
index b9f3221..8e439cd 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -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;
diff --git a/test/h5test.h b/test/h5test.h
index f984751..ed538cf 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -24,6 +24,7 @@
#include "hdf5.h"
#include "H5private.h"
+#include "H5srcdir.h"
#ifdef H5_STDC_HEADERS
# include <signal.h>
diff --git a/test/links.c b/test/links.c
index f636413..18c4caa 100644
--- a/test/links.c
+++ b/test/links.c
@@ -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 */
diff --git a/test/mtime.c b/test/mtime.c
index 741f09a..79c539c 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -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)
diff --git a/test/objcopy.c b/test/objcopy.c
index 854006e..d540117 100755
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -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);
diff --git a/test/ohdr.c b/test/ohdr.c
index c3b8f8b..69b61ea 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -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");
diff --git a/test/tarray.c b/test/tarray.c
index 590d48c..83528ff 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -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);
diff --git a/test/tfile.c b/test/tfile.c
index 1d5cc0e..a981720 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -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);
diff --git a/test/th5s.c b/test/th5s.c
index a38e384..d999920 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -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){
diff --git a/test/tmisc.c b/test/tmisc.c
index 2752f42..728200e 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -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");
diff --git a/testpar/H5srcdir.h.in b/testpar/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/testpar/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 86218ea..1413adc 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -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)/$@
diff --git a/tools/h5repack/H5srcdir.h.in b/tools/h5repack/H5srcdir.h.in
new file mode 100644
index 0000000..b7a75af
--- /dev/null
+++ b/tools/h5repack/H5srcdir.h.in
@@ -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);
+}
+
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index aa7781e..58f5f6d 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -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)
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 4a35dd1..3c3b9b8 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -17,6 +17,8 @@
#ifndef H5REPACK_H__
#define H5REPACK_H__
+#include <assert.h>
+#include <string.h>
#include "hdf5.h"
#include "h5trav.h"
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 69f5059..32622a0 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -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
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 8075a77..c7d8b1e 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -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
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index 03aaa46..78bae25 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -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);
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index 385deee..ac4570b 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -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
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index 906996a..b16e0d4 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,8 +16,6 @@
#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
-#include "h5test.h"
-
/*-------------------------------------------------------------------------
diff --git a/windows/c++/test/H5srcdir.h b/windows/c++/test/H5srcdir.h
new file mode 100644
index 0000000..2d91a59
--- /dev/null
+++ b/windows/c++/test/H5srcdir.h
@@ -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);
+}
+
diff --git a/windows/copy_hdf.bat b/windows/copy_hdf.bat
index 63ca620..6a96263 100755
--- a/windows/copy_hdf.bat
+++ b/windows/copy_hdf.bat
@@ -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
diff --git a/windows/hl/test/H5srcdir.h b/windows/hl/test/H5srcdir.h
new file mode 100644
index 0000000..2d91a59
--- /dev/null
+++ b/windows/hl/test/H5srcdir.h
@@ -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);
+}
+
diff --git a/windows/perform/H5srcdir.h b/windows/perform/H5srcdir.h
new file mode 100644
index 0000000..2d91a59
--- /dev/null
+++ b/windows/perform/H5srcdir.h
@@ -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);
+}
+
diff --git a/windows/test/H5srcdir.h b/windows/test/H5srcdir.h
new file mode 100644
index 0000000..2d91a59
--- /dev/null
+++ b/windows/test/H5srcdir.h
@@ -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);
+}
+
diff --git a/windows/tools/h5repack/H5srcdir.h b/windows/tools/h5repack/H5srcdir.h
new file mode 100644
index 0000000..2d91a59
--- /dev/null
+++ b/windows/tools/h5repack/H5srcdir.h
@@ -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);
+}
+