diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-06 17:53:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-01-06 17:53:13 (GMT) |
commit | ce2b03097bbf2fb80db60673610e707a028645d0 (patch) | |
tree | 20178d40250fff3696bfff8b6864c011e8018562 /test/ttsafe.h | |
parent | 68607efcd10222ed1b1d19308d3586eb65fe3644 (diff) | |
download | hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.zip hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.tar.gz hdf5-ce2b03097bbf2fb80db60673610e707a028645d0.tar.bz2 |
[svn-r8022] Purpose:
Code cleanup
Description:
Refactor library testing framework (used for the testhdf5 & ttsafe tests)
to remove almost all of the duplicated code, moving the common code into a
new 'testframe.c' source file.
Platforms tested:
FreeBSD 4.9 (sleipnir) w & w/o thread-safety
h5committest
Diffstat (limited to 'test/ttsafe.h')
-rw-r--r-- | test/ttsafe.h | 98 |
1 files changed, 4 insertions, 94 deletions
diff --git a/test/ttsafe.h b/test/ttsafe.h index ce763db..ace54b7 100644 --- a/test/ttsafe.h +++ b/test/ttsafe.h @@ -12,14 +12,12 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /* * This header file contains information required for testing the HDF5 library. */ -#ifndef HDF5TEST_H -#define HDF5TEST_H +#ifndef TTSAFE_H +#define TTSAFE_H #include <string.h> @@ -30,102 +28,14 @@ #include "hdf5.h" #include "H5private.h" #include "H5Eprivate.h" +#include "testhdf5.h" #ifdef H5_HAVE_THREADSAFE /* Include pthread library for threadsafe tests */ #include <pthread.h> -extern int num_errs; -extern int Verbosity; - -/* Use %ld to print the value because long should cover most cases. */ -/* Used to make certain a return value _is_not_ a value */ -#define CHECK(ret, val, where) do { \ - if (Verbosity>9) print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, \ - (long)ret); \ - if (ret == val) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", where, (long)ret, (int)__LINE__, __FILE__); \ - num_errs++; \ - H5Eprint (stdout); \ - } \ - H5Eclear(H5E_DEFAULT); \ -} while(0) - -#define CHECK_I(ret,where) { \ - if (Verbosity>9) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ - (where), (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if ((ret)<0) { \ - print_func ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ - num_errs++; \ - } \ - H5Eclear(H5E_DEFAULT); \ -} - -#define CHECK_PTR(ret,where) { \ - if (Verbosity>9) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (!(ret)) { \ - print_func ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ - num_errs++; \ - } \ - H5Eclear(H5E_DEFAULT); \ -} - -/* Used to make certain a return value _is_ a value */ -#define VERIFY(x, val, where) do { \ - if (Verbosity>9) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", where, (int)__LINE__, __FILE__, (long)x); \ - } \ - if (x != val) { \ - print_func("*** UNEXPECTED VALUE from %s is %ld at line %4d " \ - "in %s\n", where, (long)x, (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ - num_errs++; \ - } \ - H5Eclear(H5E_DEFAULT); \ -} while(0) - -/* Used to document process through a test and to check for errors */ -#define RESULT(ret,func) do { \ - if (Verbosity>8) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", func, (int)__LINE__, __FILE__, (long)ret); \ - } \ - if (Verbosity>9) HEprint(stdout, 0); \ - if (ret == FAIL) { \ - print_func("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", func, (long)ret, (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ - num_errs++; \ - } \ - H5Eclear(H5E_DEFAULT); \ -} while(0) - -/* Used to document process through a test */ -#define MESSAGE(V,A) {if (Verbosity>(V)) print_func A;} - -/* definitions for command strings */ -#define VERBOSITY_STR "Verbosity" -#define SKIP_STR "Skip" -#define TEST_STR "Test" -#define CLEAN_STR "Cleanup" - /* Prototypes for the support routines */ -int print_func(const char *,...); extern char* gen_name(int); -extern int num_digits(int); /* Prototypes for the test routines */ void tts_dcreate(void); @@ -140,4 +50,4 @@ void cleanup_cancel(void); void cleanup_acreate(void); #endif /* H5_HAVE_THREADSAFE */ -#endif /* HDF5_TESTH */ +#endif /* TTSAFE_H */ |