diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/H5srcdir.h | 74 | ||||
-rw-r--r-- | test/H5srcdir_str.h.in (renamed from test/H5srcdir.h.in) | 0 | ||||
-rwxr-xr-x | test/cross_read.c | 1 | ||||
-rw-r--r-- | test/dsets.c | 1 | ||||
-rw-r--r-- | test/external.c | 1 | ||||
-rw-r--r-- | test/fillval.c | 1 | ||||
-rw-r--r-- | test/links.c | 1 | ||||
-rw-r--r-- | test/mtime.c | 1 | ||||
-rwxr-xr-x | test/objcopy.c | 1 | ||||
-rw-r--r-- | test/ohdr.c | 2 | ||||
-rw-r--r-- | test/tarray.c | 1 | ||||
-rw-r--r-- | test/tfile.c | 1 | ||||
-rw-r--r-- | test/th5s.c | 1 | ||||
-rw-r--r-- | test/tmisc.c | 1 |
14 files changed, 87 insertions, 0 deletions
diff --git a/test/H5srcdir.h b/test/H5srcdir.h new file mode 100644 index 0000000..55700cb --- /dev/null +++ b/test/H5srcdir.h @@ -0,0 +1,74 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Wednesday, March 17, 2010 + * + * Purpose: srcdir querying support. + */ +#ifndef _H5SRCDIR_H +#define _H5SRCDIR_H + +/* Include the header file with the correct relative path for the srcdir string */ +#include "H5srcdir_str.h" + +/* 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); +} +#endif /* _H5SRCDIR_H */ + + diff --git a/test/H5srcdir.h.in b/test/H5srcdir_str.h.in index d472124..d472124 100644 --- a/test/H5srcdir.h.in +++ b/test/H5srcdir_str.h.in diff --git a/test/cross_read.c b/test/cross_read.c index 6ce38f2..6b2badf 100755 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -22,6 +22,7 @@ */ #include "h5test.h" +#include "H5srcdir.h" const char *FILENAME[] = { "vms_data", diff --git a/test/dsets.c b/test/dsets.c index c17e90c..0bf237b 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -24,6 +24,7 @@ #include <time.h> #include "h5test.h" +#include "H5srcdir.h" #ifdef H5_HAVE_SZLIB_H # include "szlib.h" #endif diff --git a/test/external.c b/test/external.c index 24cd85b..7fd344e 100644 --- a/test/external.c +++ b/test/external.c @@ -20,6 +20,7 @@ * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" +#include "H5srcdir.h" /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" diff --git a/test/fillval.c b/test/fillval.c index 25c8bd1..81856de 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -20,6 +20,7 @@ * Purpose: Tests dataset fill values. */ #include "h5test.h" +#include "H5srcdir.h" /* * Define NO_FILLING if you want to compare how this test works when there is diff --git a/test/links.c b/test/links.c index 18c4caa..afd5872 100644 --- a/test/links.c +++ b/test/links.c @@ -28,6 +28,7 @@ #define H5G_TESTING #include "h5test.h" +#include "H5srcdir.h" #include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ diff --git a/test/mtime.c b/test/mtime.c index 79c539c..cc04e42 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -23,6 +23,7 @@ * working properly. */ #include "h5test.h" +#include "H5srcdir.h" const char *FILENAME[] = { "mtime", diff --git a/test/objcopy.c b/test/objcopy.c index d540117..439cfb1 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -22,6 +22,7 @@ #include <time.h> #include "h5test.h" +#include "H5srcdir.h" /* * This file needs to access private information from the H5S package. diff --git a/test/ohdr.c b/test/ohdr.c index 69b61ea..5bccf6e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -17,7 +17,9 @@ * Tuesday, November 24, 1998 */ #include "h5test.h" +#include "H5srcdir.h" #include "H5Iprivate.h" + /* * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. diff --git a/test/tarray.c b/test/tarray.c index 83528ff..f191c95 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -22,6 +22,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5srcdir.h" #include "hdf5.h" diff --git a/test/tfile.c b/test/tfile.c index a981720..3a4674f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -23,6 +23,7 @@ #include "hdf5.h" #include "testhdf5.h" +#include "H5srcdir.h" #include "H5Bprivate.h" #include "H5Pprivate.h" diff --git a/test/th5s.c b/test/th5s.c index d999920..2de867b 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -22,6 +22,7 @@ *************************************************************/ #include "testhdf5.h" +#include "H5srcdir.h" #include "H5private.h" #include "H5Bprivate.h" diff --git a/test/tmisc.c b/test/tmisc.c index 728200e..d65f066 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -30,6 +30,7 @@ #include "hdf5.h" #include "testhdf5.h" +#include "H5srcdir.h" #include "H5Dpkg.h" /* Datasets */ /* Definitions for misc. test #1 */ |