From ca8465513df4d24bb4d941c00b2b90d4f592c28e Mon Sep 17 00:00:00 2001
From: Allen Byrne <byrn@hdfgroup.org>
Date: Wed, 4 May 2016 11:29:52 -0500
Subject: [svn-r29882] Convert cache source files to library compatible by
 CMake and Windows

---
 test/CMakeLists.txt   | 129 +++--------
 test/CMakeTests.cmake | 611 +++++++++++++++++++++++++-------------------------
 test/cache.c          |   2 -
 test/cache_api.c      |   2 -
 test/cache_common.h   | 123 +++++-----
 5 files changed, 398 insertions(+), 469 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 338b906..f84ff7e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
 #-----------------------------------------------------------------------------
 # Define Test Library Sources
 #-----------------------------------------------------------------------------
-set (TEST_LIB_SRCS
+set (TEST_LIB_SOURCES
     ${HDF5_TEST_SOURCE_DIR}/h5test.c
     ${HDF5_TEST_SOURCE_DIR}/testframe.c
     ${HDF5_TEST_SOURCE_DIR}/cache_common.c
@@ -24,9 +24,10 @@ set (TEST_LIB_SRCS
 
 set (TEST_LIB_HEADERS
     ${HDF5_TEST_SOURCE_DIR}/h5test.h
+    ${HDF5_TEST_SOURCE_DIR}/cache_common.h
 )
 
-add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS})
+add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
 TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC " " " ")
 if (MSVC)
   target_link_libraries (${HDF5_TEST_LIB_TARGET} "ws2_32.lib")
@@ -42,7 +43,7 @@ set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES
 )
 
 if (BUILD_SHARED_LIBS)
-  add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SRCS} ${TEST_LIB_HEADERS})
+  add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS})
   TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED " " " ")
   if (MSVC)
     target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "ws2_32.lib")
@@ -136,7 +137,7 @@ endif (BUILD_SHARED_LIBS)
     )
   endforeach (test_lib ${TEST2_PLUGIN_LIBS})
 
-set (testhdf5_SRCS
+set (testhdf5_SOURCES
     ${HDF5_TEST_SOURCE_DIR}/testhdf5.c
     ${HDF5_TEST_SOURCE_DIR}/tarray.c
     ${HDF5_TEST_SOURCE_DIR}/tattr.c
@@ -165,13 +166,13 @@ set (testhdf5_SRCS
 )
 
 #-- Adding test for testhdf5
-add_executable (testhdf5 ${testhdf5_SRCS})
+add_executable (testhdf5 ${testhdf5_SOURCES})
 TARGET_NAMING (testhdf5 STATIC)
 TARGET_C_PROPERTIES (testhdf5 STATIC " " " ")
 target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
 set_target_properties (testhdf5 PROPERTIES FOLDER test)
 if (BUILD_SHARED_LIBS)
-  add_executable (testhdf5-shared ${testhdf5_SRCS})
+  add_executable (testhdf5-shared ${testhdf5_SOURCES})
   TARGET_NAMING (testhdf5-shared SHARED)
   TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ")
   target_link_libraries (testhdf5-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
@@ -194,12 +195,21 @@ MACRO (ADD_H5_EXE file)
 ENDMACRO (ADD_H5_EXE file)
 
 set (H5_TESTS
-    accum
+    #testhdf5
+    cache
+    cache_api
+    cache_tagging
     lheap
     ohdr
     stab
     gheap
+    farray
+    earray
+    btree2
+    fheap
     pool
+    accum
+    #hyperslab
     istore
     bittests
     dt_arith
@@ -222,6 +232,9 @@ set (H5_TESTS
     app_ref
     enum
     set_extent
+    #ttsafe
+    enc_dec_plist
+    enc_dec_plist_cross_platform
     getname
     vfd
     ntypes
@@ -232,15 +245,7 @@ set (H5_TESTS
     freespace
     mf
     vds
-    farray
-    earray
-    btree2
-    fheap
-    tcheck_version
-    testmeta
     file_image
-    enc_dec_plist
-    enc_dec_plist_cross_platform
     unregister
 )
 
@@ -254,48 +259,6 @@ endforeach (test ${H5_TESTS})
 ##############################################################################
 ##############################################################################
 
-#-- Adding test for cache
-add_executable (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache STATIC)
-TARGET_C_PROPERTIES (cache STATIC " " " ")
-target_link_libraries (cache ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
-  add_executable (cache-shared ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-  TARGET_NAMING (cache-shared SHARED)
-  TARGET_C_PROPERTIES (cache-shared SHARED " " " ")
-  target_link_libraries (cache-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-  set_target_properties (cache-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
-#-- Adding test for cache_api
-add_executable (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache_api STATIC)
-TARGET_C_PROPERTIES (cache_api STATIC " " " ")
-target_link_libraries (cache_api ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_api PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
-  add_executable (cache_api-shared ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-  TARGET_NAMING (cache_api-shared SHARED)
-  TARGET_C_PROPERTIES (cache_api-shared SHARED " " " ")
-  target_link_libraries (cache_api-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-  set_target_properties (cache_api-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
-#-- Adding test for cache_tagging
-add_executable (cache_tagging ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-TARGET_NAMING (cache_tagging STATIC)
-TARGET_C_PROPERTIES (cache_tagging STATIC " " " ")
-target_link_libraries (cache_tagging ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (cache_tagging PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
-  add_executable (cache_tagging-shared ${HDF5_TEST_SOURCE_DIR}/cache_tagging.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c)
-  TARGET_NAMING (cache_tagging-shared SHARED)
-  TARGET_C_PROPERTIES (cache_tagging-shared SHARED " " " ")
-  target_link_libraries (cache_tagging-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-  set_target_properties (cache_tagging-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
-
 #-- Adding test for hyperslab
 add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c)
 TARGET_NAMING (hyperslab STATIC)
@@ -348,49 +311,17 @@ if (BUILD_SHARED_LIBS)
   endif (HDF5_ENABLE_THREADSAFE)
 endif (BUILD_SHARED_LIBS)
 
-#-- Adding test for err_compat
-if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-  add_executable (err_compat ${HDF5_TEST_SOURCE_DIR}/err_compat.c)
-  TARGET_NAMING (err_compat STATIC)
-  TARGET_C_PROPERTIES (err_compat STATIC " " " ")
-  target_link_libraries (err_compat ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-  set_target_properties (err_compat PROPERTIES FOLDER test)
-  if (BUILD_SHARED_LIBS)
-    add_executable (err_compat-shared ${HDF5_TEST_SOURCE_DIR}/err_compat.c)
-    TARGET_NAMING (err_compat-shared SHARED)
-    TARGET_C_PROPERTIES (err_compat-shared SHARED " " " ")
-    target_link_libraries (err_compat-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-    set_target_properties (err_compat-shared PROPERTIES FOLDER test)
-  endif (BUILD_SHARED_LIBS)
-endif (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-
-#-- Adding test for error_test
-add_executable (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c)
-TARGET_NAMING (error_test STATIC)
-TARGET_C_PROPERTIES (error_test STATIC " " " ")
-target_link_libraries (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (error_test PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
-  add_executable (error_test-shared ${HDF5_TEST_SOURCE_DIR}/error_test.c)
-  TARGET_NAMING (error_test-shared SHARED)
-  TARGET_C_PROPERTIES (error_test-shared SHARED " " " ")
-  target_link_libraries (error_test-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-  set_target_properties (error_test-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
+set (H5_CHECK_TESTS
+    error_test
+    err_compat
+    tcheck_version
+    testmeta
+    links_env
+)
 
-#-- Adding test for links_env
-add_executable (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c)
-TARGET_NAMING (links_env STATIC)
-TARGET_C_PROPERTIES (links_env STATIC " " " ")
-target_link_libraries (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
-set_target_properties (links_env PROPERTIES FOLDER test)
-if (BUILD_SHARED_LIBS)
-  add_executable (links_env-shared ${HDF5_TEST_SOURCE_DIR}/links_env.c)
-  TARGET_NAMING (links_env-shared SHARED)
-  TARGET_C_PROPERTIES (links_env-shared SHARED " " " ")
-  target_link_libraries (links_env-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
-  set_target_properties (links_env-shared PROPERTIES FOLDER test)
-endif (BUILD_SHARED_LIBS)
+foreach (test ${H5_CHECK_TESTS})
+  ADD_H5_EXE(${test})
+endforeach (test ${H5_CHECK_TESTS})
 
 #-- Adding test for libinfo
 set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake)
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 0612049..9e83ecb 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -49,7 +49,7 @@ foreach (h5_tfile ${HDF5_TEST_FILES})
       TARGET     ${HDF5_TEST_LIB_TARGET}
       POST_BUILD
       COMMAND    ${CMAKE_COMMAND}
-      ARGS       -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+      ARGS       -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
   )
   if (BUILD_SHARED_LIBS)
     set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}")
@@ -57,7 +57,7 @@ foreach (h5_tfile ${HDF5_TEST_FILES})
         TARGET     ${HDF5_TEST_LIBSH_TARGET}
         POST_BUILD
         COMMAND    ${CMAKE_COMMAND}
-        ARGS       -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+        ARGS       -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
     )
   endif (BUILD_SHARED_LIBS)
 endforeach (h5_tfile ${HDF5_TEST_FILES})
@@ -69,7 +69,7 @@ if (HDF5_TEST_VFD)
           TARGET     ${HDF5_TEST_LIB_TARGET}
           POST_BUILD
           COMMAND    ${CMAKE_COMMAND}
-          ARGS       -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+          ARGS       -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
       )
       if (BUILD_SHARED_LIBS)
         set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}")
@@ -77,7 +77,7 @@ if (HDF5_TEST_VFD)
             TARGET     ${HDF5_TEST_LIBSH_TARGET}
             POST_BUILD
             COMMAND    ${CMAKE_COMMAND}
-            ARGS       -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest}
+            ARGS       -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
         )
       endif (BUILD_SHARED_LIBS)
     endforeach (h5_tfile ${HDF5_TEST_FILES})
@@ -237,9 +237,9 @@ set (HDF5_REFERENCE_TEST_FILES
     family_v16_00001.h5
     family_v16_00002.h5
     family_v16_00003.h5
+    file_image_core_test.h5
     filespace_1_6.h5
     filespace_1_8.h5
-    file_image_core_test.h5
     fill_old.h5
     filter_error.h5
     group_old.h5
@@ -305,8 +305,7 @@ if (HDF5_TEST_VFD)
 endif (HDF5_TEST_VFD)
 
 # Remove any output file left over from previous test run
-add_test (
-    NAME H5TEST-clear-testhdf5-objects
+add_test (NAME H5TEST-clear-testhdf5-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove
         coord.h5
@@ -363,8 +362,7 @@ else (HDF5_ENABLE_USING_MEMCHECKER)
       WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
   )
   if (BUILD_SHARED_LIBS)
-    add_test (
-        NAME H5TEST-shared-clear-testhdf5-objects
+    add_test (NAME H5TEST-shared-clear-testhdf5-objects
         COMMAND    ${CMAKE_COMMAND}
             -E remove
             coord.h5
@@ -402,79 +400,258 @@ endif (HDF5_ENABLE_USING_MEMCHECKER)
 ##############################################################################
 ##############################################################################
 
+set (test_CLEANFILES
+    accum.h5
+    cmpd_dset.h5
+    compact_dataset.h5
+    dataset.h5
+    dset_offset.h5
+    max_compact_dataset.h5
+    simple.h5
+    set_local.h5
+    random_chunks.h5
+    huge_chunks.h5
+    chunk_cache.h5
+    big_chunk.h5
+    chunk_fast.h5
+    chunk_expand.h5
+    chunk_fixed.h5
+    copy_dcpl_newfile.h5
+    partial_chunks.h5
+    layout_extend.h5
+    zero_chunk.h5
+    chunk_single.h5
+    storage_size.h5
+    dls_01_strings.h5
+    extend.h5
+    istore.h5
+    extlinks*.h5
+    frspace.h5
+    links*.h5
+    sys_file1
+    tfile*.h5
+    th5s*.h5
+    lheap.h5
+    fheap.h5
+    ohdr.h5
+    stab.h5
+    extern_*.h5
+    extern_*.raw
+    gheap*.h5
+    dt_arith1
+    dt_arith2
+    links.h5
+    links*.h5
+    extlinks16A00000.h5
+    extlinks16A00001.h5
+    extlinks16A00002.h5
+    extlinks16B-b.h5
+    extlinks16B-g.h5
+    extlinks16B-l.h5
+    extlinks16B-r.h5
+    extlinks16B-s.h5
+    extlinks19B00000.h5
+    extlinks19B00001.h5
+    extlinks19B00002.h5
+    extlinks19B00003.h5
+    extlinks19B00004.h5
+    extlinks19B00005.h5
+    extlinks19B00006.h5
+    extlinks19B00007.h5
+    extlinks19B00008.h5
+    extlinks19B00009.h5
+    extlinks19B00010.h5
+    extlinks19B00011.h5
+    extlinks19B00012.h5
+    extlinks19B00013.h5
+    extlinks19B00014.h5
+    extlinks19B00015.h5
+    extlinks19B00016.h5
+    extlinks19B00017.h5
+    extlinks19B00018.h5
+    extlinks19B00019.h5
+    extlinks19B00020.h5
+    extlinks19B00021.h5
+    extlinks19B00022.h5
+    extlinks19B00023.h5
+    extlinks19B00024.h5
+    extlinks19B00025.h5
+    extlinks19B00026.h5
+    extlinks19B00027.h5
+    extlinks19B00028.h5
+    tmp
+    big.data
+    big*.h5
+    stdio.h5
+    sec2.h5
+    dtypes0.h5
+    dtypes1.h5
+    dtypes2.h5
+    dtypes3.h5
+    dtypes4.h5
+    dtypes5.h5
+    dtypes6.h5
+    dtypes7.h5
+    dtypes8.h5
+    dtypes9.h5
+    dtypes10.h5
+    dt_arith1.h5
+    dt_arith2.h5
+    tattr.h5
+    tselect.h5
+    mtime.h5
+    unlink.h5
+    unicode.h5
+    coord.h5
+    fillval_*.h5
+    fillval.raw
+    mount_*.h5
+    testmeta.h5
+    ttime.h5
+    trefer1.h5
+    trefer2.h5
+    trefer3.h5
+    tvltypes.h5
+    tvlstr.h5
+    tvlstr2.h5
+    flush.h5
+    enum1.h5
+    titerate.h5
+    ttsafe.h5
+    tarray1.h5
+    tgenprop.h5
+    tmisc*.h5
+    set_extent1.h5
+    set_extent2.h5
+    set_extent3.h5
+    set_extent4.h5
+    set_extent5.h5
+    ext1.bin
+    ext2.bin
+    getname.h5
+    getname1.h5
+    getname2.h5
+    getname3.h5
+    sec2_file.h5
+    direct_file.h5
+    family_file000*.h5
+    new_family_v16_000*.h5
+    multi_file-r.h5
+    multi_file-s.h5
+    core_file
+    plugin.h5
+    new_move_a.h5
+    new_move_b.h5
+    ntypes.h5
+    dangle.h5
+    error_test.h5
+    err_compat.h5
+    dtransform.h5
+    test_filters.h5
+    get_file_name.h5
+    tstint1.h5
+    tstint2.h5
+    unlink_chunked.h5
+    btree2.h5
+    btree2_tmp.h5
+    objcopy_src.h5
+    objcopy_dst.h5
+    objcopy_ext.dat
+    trefer1.h5
+    trefer2.h5
+    app_ref.h5
+    farray.h5
+    farray_tmp.h5
+    earray.h5
+    earray_tmp.h5
+    efc0.h5
+    efc1.h5
+    efc2.h5
+    efc3.h5
+    efc4.h5
+    efc5.h5
+    log_vfd_out.log
+    new_multi_file_v16-r.h5
+    new_multi_file_v16-s.h5
+    split_get_file_image_test-m.h5
+    split_get_file_image_test-r.h5
+    file_image_core_test.h5.copy
+    unregister_filter_1.h5
+    unregister_filter_2.h5
+    vds_virt.h5
+    vds_dapl.h5
+    vds_src_0.h5
+    vds_src_1.h5
+    tbogus.h5.copy
+)
+
 # Remove any output file left over from previous test run
-add_test (
-    NAME H5TEST-clear-objects
+add_test (NAME H5TEST-clear-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove
-        dt_arith1.h5
-        dt_arith2.h5
-        dtransform.h5
-        dtypes3.h5
-        dtypes4.h5
-        dtypes5.h5
-        efc0.h5
-        efc1.h5
-        efc2.h5
-        efc3.h5
-        efc4.h5
-        efc5.h5
-        extlinks16A00000.h5
-        extlinks16A00001.h5
-        extlinks16A00002.h5
-        extlinks16B-b.h5
-        extlinks16B-g.h5
-        extlinks16B-l.h5
-        extlinks16B-r.h5
-        extlinks16B-s.h5
-        extlinks19B00000.h5
-        extlinks19B00001.h5
-        extlinks19B00002.h5
-        extlinks19B00003.h5
-        extlinks19B00004.h5
-        extlinks19B00005.h5
-        extlinks19B00006.h5
-        extlinks19B00007.h5
-        extlinks19B00008.h5
-        extlinks19B00009.h5
-        extlinks19B00010.h5
-        extlinks19B00011.h5
-        extlinks19B00012.h5
-        extlinks19B00013.h5
-        extlinks19B00014.h5
-        extlinks19B00015.h5
-        extlinks19B00016.h5
-        extlinks19B00017.h5
-        extlinks19B00018.h5
-        extlinks19B00019.h5
-        extlinks19B00020.h5
-        extlinks19B00021.h5
-        extlinks19B00022.h5
-        extlinks19B00023.h5
-        extlinks19B00024.h5
-        extlinks19B00025.h5
-        extlinks19B00026.h5
-        extlinks19B00027.h5
-        extlinks19B00028.h5
-        fheap.h5
-        log_vfd_out.log
-        new_multi_file_v16-r.h5
-        new_multi_file_v16-s.h5
-        objcopy_ext.dat
-        testmeta.h5
-        tstint1.h5
-        tstint2.h5
-        unregister_filter_1.h5
-        unregister_filter_2.h5
-        vds_1.h5
+        ${test_CLEANFILES}
     WORKING_DIRECTORY
         ${HDF5_TEST_BINARY_DIR}/H5TEST
 )
 
-foreach (test ${H5_TESTS})
+set (H5TEST_TESTS
+    #testhdf5
+    #cache
+    cache_api
+    cache_tagging
+    lheap
+    ohdr
+    stab
+    gheap
+    farray
+    earray
+    btree2
+    fheap
+    pool
+    accum
+    #hyperslab
+    istore
+    bittests
+    dt_arith
+    dtypes
+    dsets
+    cmpd_dset
+    filter_fail
+    extend
+    external
+    efc
+    objcopy
+    links
+    unlink
+    big
+    mtime
+    fillval
+    mount
+    flush1
+    flush2
+    app_ref
+    enum
+    set_extent
+    ttsafe
+    enc_dec_plist
+    enc_dec_plist_cross_platform
+    getname
+    vfd
+    ntypes
+    dangle
+    dtransform
+    reserved
+    cross_read
+    freespace
+    mf
+    vds
+    file_image
+    unregister
+)
+
+foreach (test ${H5TEST_TESTS})
   if (${test} STREQUAL "big" AND CYGWIN)
-    add_test (
-        NAME H5TEST-${test}
+    add_test (NAME H5TEST-${test}
         COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}"
     )
   else (${test} STREQUAL "big" AND CYGWIN)
@@ -485,87 +662,27 @@ foreach (test ${H5_TESTS})
       ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
       WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
   )
-endforeach (test ${H5_TESTS})
+endforeach (test ${H5TEST_TESTS})
 
 set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1)
 set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800)
-set_tests_properties (H5TEST-testmeta PROPERTIES TIMEOUT 1800)
 set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800)
+set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800)
 set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 2400)
 
 if (BUILD_SHARED_LIBS)
   # Remove any output file left over from previous test run
-  add_test (
-      NAME H5TEST-shared-clear-objects
+  add_test (NAME H5TEST-shared-clear-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove
-          dt_arith1.h5
-          dt_arith2.h5
-          dtransform.h5
-          dtypes3.h5
-          dtypes4.h5
-          dtypes5.h5
-          efc0.h5
-          efc1.h5
-          efc2.h5
-          efc3.h5
-          efc4.h5
-          efc5.h5
-          extlinks16A00000.h5
-          extlinks16A00001.h5
-          extlinks16A00002.h5
-          extlinks16B-b.h5
-          extlinks16B-g.h5
-          extlinks16B-l.h5
-          extlinks16B-r.h5
-          extlinks16B-s.h5
-          extlinks19B00000.h5
-          extlinks19B00001.h5
-          extlinks19B00002.h5
-          extlinks19B00003.h5
-          extlinks19B00004.h5
-          extlinks19B00005.h5
-          extlinks19B00006.h5
-          extlinks19B00007.h5
-          extlinks19B00008.h5
-          extlinks19B00009.h5
-          extlinks19B00010.h5
-          extlinks19B00011.h5
-          extlinks19B00012.h5
-          extlinks19B00013.h5
-          extlinks19B00014.h5
-          extlinks19B00015.h5
-          extlinks19B00016.h5
-          extlinks19B00017.h5
-          extlinks19B00018.h5
-          extlinks19B00019.h5
-          extlinks19B00020.h5
-          extlinks19B00021.h5
-          extlinks19B00022.h5
-          extlinks19B00023.h5
-          extlinks19B00024.h5
-          extlinks19B00025.h5
-          extlinks19B00026.h5
-          extlinks19B00027.h5
-          extlinks19B00028.h5
-          fheap.h5
-          log_vfd_out.log
-          new_multi_file_v16-r.h5
-          new_multi_file_v16-s.h5
-          objcopy_ext.dat
-          testmeta.h5
-          tstint1.h5
-          tstint2.h5
-          unregister_filter_1.h5
-          unregister_filter_2.h5
+          ${test_CLEANFILES}
       WORKING_DIRECTORY
           ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
   )
 
-  foreach (test ${H5_TESTS})
+  foreach (test ${H5TEST_TESTS})
     if (${test} STREQUAL "big" AND CYGWIN)
-      add_test (
-          NAME H5TEST-shared-${test}
+      add_test (NAME H5TEST-shared-${test}
           COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared"
       )
     else (${test} STREQUAL "big" AND CYGWIN)
@@ -576,12 +693,12 @@ if (BUILD_SHARED_LIBS)
         ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
         WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
     )
-  endforeach (test ${H5_TESTS})
+  endforeach (test ${H5TEST_TESTS})
 
   set_tests_properties (H5TEST-shared-flush2 PROPERTIES DEPENDS H5TEST-shared-flush1)
   set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800)
-  set_tests_properties (H5TEST-shared-testmeta PROPERTIES TIMEOUT 1800)
   set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800)
+  set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800)
   set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 2400)
 endif (BUILD_SHARED_LIBS)
 
@@ -593,8 +710,7 @@ endif (BUILD_SHARED_LIBS)
 
 #-- Adding test for cache
 if (NOT CYGWIN)
-  add_test (
-      NAME H5TEST-clear-cache-objects
+  add_test (NAME H5TEST-clear-cache-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove
           cache_test.h5
@@ -610,62 +726,9 @@ if (NOT CYGWIN)
   set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 2400)
 endif (NOT CYGWIN)
 
-#-- Adding test for cache_api
-add_test (
-    NAME H5TEST-clear-cache_api-objects
-    COMMAND    ${CMAKE_COMMAND}
-        -E remove
-        cache_api_test.h5
-    WORKING_DIRECTORY
-        ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-cache_api COMMAND $<TARGET_FILE:cache_api>)
-set_tests_properties (H5TEST-cache_api PROPERTIES
-    DEPENDS H5TEST-clear-cache_api-objects
-    ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
-    WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-#-- Adding test for cache_tagging
-add_test (
-    NAME H5TEST-clear-cache_tagging-objects
-    COMMAND    ${CMAKE_COMMAND}
-        -E remove
-        tagging_test.h5
-        tagging_ext_test.h5
-    WORKING_DIRECTORY
-        ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-cache_tagging COMMAND $<TARGET_FILE:cache_tagging>)
-set_tests_properties (H5TEST-cache_tagging PROPERTIES
-    DEPENDS H5TEST-clear-cache_tagging-objects
-    ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
-    WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
-#-- Adding test for ttsafe
-add_test (
-    NAME H5TEST-clear-ttsafe-objects
-    COMMAND    ${CMAKE_COMMAND}
-        -E remove
-        ttsafe_error.h5
-        ttsafe_dcreate.h5
-        ttsafe_cancel.h5
-        ttsafe_acreate.h5
-    WORKING_DIRECTORY
-        ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-add_test (NAME H5TEST-ttsafe COMMAND $<TARGET_FILE:ttsafe>)
-set_tests_properties (H5TEST-ttsafe PROPERTIES
-    DEPENDS H5TEST-clear-ttsafe-objects
-    ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
-    WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
-)
-
 #-- Adding test for err_compat
 if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-  add_test (
-      NAME H5TEST-clear-err_compat-objects
+  add_test (NAME H5TEST-clear-err_compat-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove
           err_compat.txt
@@ -691,8 +754,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
 endif (HDF5_ENABLE_DEPRECATED_SYMBOLS)
 
 #-- Adding test for error_test
-add_test (
-    NAME H5TEST-clear-error_test-objects
+add_test (NAME H5TEST-clear-error_test-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove
         error_test.txt
@@ -717,8 +779,7 @@ set_tests_properties (H5TEST-error_test PROPERTIES
 )
 
 #-- Adding test for links_env
-add_test (
-    NAME H5TEST-clear-links_env-objects
+add_test (NAME H5TEST-clear-links_env-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove
         links_env.txt
@@ -747,8 +808,7 @@ set_tests_properties (H5TEST-links_env PROPERTIES
 )
 
 #-- Adding test for libinfo
-add_test (
-    NAME H5TEST-testlibinfo
+add_test (NAME H5TEST-testlibinfo
     COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIB_TARGET}>" -P "${GREP_RUNNER}"
     WORKING_DIRECTORY
         ${HDF5_TEST_BINARY_DIR}/H5TEST
@@ -757,8 +817,7 @@ add_test (
 if (BUILD_SHARED_LIBS)
   #-- Adding test for cache
   if (NOT CYGWIN)
-    add_test (
-        NAME H5TEST-shared-clear-cache-objects
+    add_test (NAME H5TEST-shared-clear-cache-objects
         COMMAND    ${CMAKE_COMMAND}
             -E remove
             cache_test.h5
@@ -774,62 +833,9 @@ if (BUILD_SHARED_LIBS)
     set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 2400)
   endif (NOT CYGWIN)
 
-  #-- Adding test for cache_api
-  add_test (
-      NAME H5TEST-shared-clear-cache_api-objects
-      COMMAND    ${CMAKE_COMMAND}
-          -E remove
-          cache_api_test.h5
-      WORKING_DIRECTORY
-          ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-  add_test (NAME H5TEST-shared-cache_api COMMAND $<TARGET_FILE:cache_api-shared>)
-  set_tests_properties (H5TEST-shared-cache_api PROPERTIES
-      DEPENDS H5TEST-shared-clear-cache_api-objects
-      ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
-      WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-
-  #-- Adding test for cache_tagging
-  add_test (
-      NAME H5TEST-shared-clear-cache_tagging-objects
-      COMMAND    ${CMAKE_COMMAND}
-          -E remove
-          tagging_test.h5
-          tagging_ext_test.h5
-      WORKING_DIRECTORY
-          ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-  add_test (NAME H5TEST-shared-cache_tagging COMMAND $<TARGET_FILE:cache_tagging-shared>)
-  set_tests_properties (H5TEST-shared-cache_tagging PROPERTIES
-      DEPENDS H5TEST-shared-clear-cache_tagging-objects
-      ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
-      WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-
-  #-- Adding test for ttsafe
-  add_test (
-      NAME H5TEST-shared-clear-ttsafe-objects
-      COMMAND    ${CMAKE_COMMAND}
-          -E remove
-          ttsafe_error.h5
-          ttsafe_dcreate.h5
-          ttsafe_cancel.h5
-          ttsafe_acreate.h5
-      WORKING_DIRECTORY
-          ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-  add_test (NAME H5TEST-shared-ttsafe COMMAND $<TARGET_FILE:ttsafe-shared>)
-  set_tests_properties (H5TEST-shared-ttsafe PROPERTIES
-      DEPENDS H5TEST-shared-clear-ttsafe-objects
-      ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
-      WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
-  )
-
   #-- Adding test for err_compat
   if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-    add_test (
-        NAME H5TEST-shared-clear-err_compat-objects
+    add_test (NAME H5TEST-shared-clear-err_compat-objects
         COMMAND    ${CMAKE_COMMAND}
             -E remove
             err_compat.txt
@@ -855,8 +861,7 @@ if (BUILD_SHARED_LIBS)
   endif (HDF5_ENABLE_DEPRECATED_SYMBOLS)
 
   #-- Adding test for error_test
-  add_test (
-      NAME H5TEST-shared-clear-error_test-objects
+  add_test (NAME H5TEST-shared-clear-error_test-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove
           error_test.txt
@@ -881,8 +886,7 @@ if (BUILD_SHARED_LIBS)
   )
 
   #-- Adding test for links_env
-  add_test (
-      NAME H5TEST-shared-clear-links_env-objects
+  add_test (NAME H5TEST-shared-clear-links_env-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove
           links_env.txt
@@ -911,8 +915,7 @@ if (BUILD_SHARED_LIBS)
   )
 
   #-- Adding test for libinfo
-  add_test (
-      NAME H5TEST-shared-testlibinfo
+  add_test (NAME H5TEST-shared-testlibinfo
       COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$<TARGET_FILE:${HDF5_LIBSH_TARGET}>" -P "${GREP_RUNNER}"
       WORKING_DIRECTORY
           ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
@@ -944,15 +947,19 @@ if (HDF5_TEST_VFD)
 
   set (H5_VFD_TESTS
       testhdf5
-      accum
+#      cache
+      cache_api
+      cache_tagging
       lheap
       ohdr
       stab
       gheap
-#      cache
-      cache_api
-      cache_tagging
       pool
+#      accum
+      farray
+      earray
+      btree2
+      #fheap
       hyperslab
       istore
       bittests
@@ -978,7 +985,7 @@ if (HDF5_TEST_VFD)
       set_extent
       ttsafe
       getname
-      vfd
+#      vfd
       ntypes
       dangle
       dtransform
@@ -986,15 +993,11 @@ if (HDF5_TEST_VFD)
       cross_read
       freespace
       mf
-      farray
-      earray
-      btree2
-      #fheap
-      error_test
-      err_compat
-      tcheck_version
-      testmeta
-      links_env
+#      error_test
+#      err_compat
+      #tcheck_version
+#      testmeta
+#      links_env
       unregister
   )
   if (NOT CYGWIN)
@@ -1005,8 +1008,7 @@ if (HDF5_TEST_VFD)
     if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2")
       if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split")
         if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
-          add_test (
-              NAME VFD-${vfdname}-${vfdtest}
+          add_test (NAME VFD-${vfdname}-${vfdtest}
               COMMAND "${CMAKE_COMMAND}"
                   -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
                   -D "TEST_ARGS:STRING="
@@ -1021,8 +1023,7 @@ if (HDF5_TEST_VFD)
               WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
           )
           if (BUILD_SHARED_LIBS)
-            add_test (
-                NAME VFD-${vfdname}-${test}-shared
+            add_test (NAME VFD-${vfdname}-${test}-shared
                 COMMAND "${CMAKE_COMMAND}"
                     -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
                     -D "TEST_ARGS:STRING="
@@ -1038,20 +1039,17 @@ if (HDF5_TEST_VFD)
             )
           endif (BUILD_SHARED_LIBS)
         else (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
-          add_test (
-              NAME VFD-${vfdname}-${vfdtest}
+          add_test (NAME VFD-${vfdname}-${vfdtest}
               COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}"
           )
           if (BUILD_SHARED_LIBS)
-            add_test (
-                NAME VFD-${vfdname}-${test}-shared
+            add_test (NAME VFD-${vfdname}-${test}-shared
                 COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared"
             )
           endif (BUILD_SHARED_LIBS)
         endif(NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug)
       else (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split")
-        add_test (
-            NAME VFD-${vfdname}-${vfdtest}
+        add_test (NAME VFD-${vfdname}-${vfdtest}
             COMMAND "${CMAKE_COMMAND}"
                 -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
                 -D "TEST_ARGS:STRING="
@@ -1066,8 +1064,7 @@ if (HDF5_TEST_VFD)
             WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
         )
         if (BUILD_SHARED_LIBS)
-          add_test (
-            NAME VFD-${vfdname}-${test}-shared
+          add_test (NAME VFD-${vfdname}-${test}-shared
               COMMAND "${CMAKE_COMMAND}"
                 -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
                 -D "TEST_ARGS:STRING="
@@ -1084,8 +1081,7 @@ if (HDF5_TEST_VFD)
         endif (BUILD_SHARED_LIBS)
       endif (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split")
     else (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2")
-      add_test (
-          NAME VFD-${vfdname}-${vfdtest}
+      add_test (NAME VFD-${vfdname}-${vfdtest}
           COMMAND "${CMAKE_COMMAND}"
               -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
               -D "TEST_ARGS:STRING="
@@ -1100,8 +1096,7 @@ if (HDF5_TEST_VFD)
           WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
       )
       if (BUILD_SHARED_LIBS)
-        add_test (
-            NAME VFD-${vfdname}-${vfdtest}-shared
+        add_test (NAME VFD-${vfdname}-${vfdtest}-shared
             COMMAND "${CMAKE_COMMAND}"
                 -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
                 -D "TEST_ARGS:STRING="
@@ -1124,8 +1119,7 @@ if (HDF5_TEST_VFD)
       if (WIN32)
         CHECK_VFD_TEST (${test} ${vfdname} ${resultcode})
       else (WIN32)
-        add_test (
-            NAME VFD-${vfdname}-${test}
+        add_test (NAME VFD-${vfdname}-${test}
             COMMAND "${CMAKE_COMMAND}"
                 -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
                 -D "TEST_ARGS:STRING="
@@ -1140,8 +1134,7 @@ if (HDF5_TEST_VFD)
             WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
         )
         if (BUILD_SHARED_LIBS)
-          add_test (
-              NAME VFD-${vfdname}-${test}-shared
+          add_test (NAME VFD-${vfdname}-${test}-shared
               COMMAND "${CMAKE_COMMAND}"
                   -D "TEST_PROGRAM=$<TARGET_FILE:${test}-shared>"
                   -D "TEST_ARGS:STRING="
@@ -1162,21 +1155,20 @@ if (HDF5_TEST_VFD)
     set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
     set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
     set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
-    if (NOT CYGWIN)
-      set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
-    endif (NOT CYGWIN)
+#    if (NOT CYGWIN)
+#      set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
+#    endif (NOT CYGWIN)
     if (BUILD_SHARED_LIBS)
       set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
       set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
       set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
       set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
-      if (NOT CYGWIN)
-        set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
-      endif (NOT CYGWIN)
+#      if (NOT CYGWIN)
+#        set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
+#      endif (NOT CYGWIN)
     endif (BUILD_SHARED_LIBS)
     if (HDF5_TEST_FHEAP_VFD)
-      add_test (
-          NAME VFD-${vfdname}-fheap
+      add_test (NAME VFD-${vfdname}-fheap
           COMMAND "${CMAKE_COMMAND}"
               -D "TEST_PROGRAM=$<TARGET_FILE:fheap>"
               -D "TEST_ARGS:STRING="
@@ -1192,8 +1184,7 @@ if (HDF5_TEST_VFD)
           WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
       )
       if (BUILD_SHARED_LIBS)
-        add_test (
-            NAME VFD-${vfdname}-fheap-shared
+        add_test (NAME VFD-${vfdname}-fheap-shared
             COMMAND "${CMAKE_COMMAND}"
                 -D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>"
                 -D "TEST_ARGS:STRING="
diff --git a/test/cache.c b/test/cache.c
index d533045..88077e4 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -15858,8 +15858,6 @@ check_flush_protected_err(void)
  *-------------------------------------------------------------------------
  */
 
-extern H5C_t * saved_cache;
-
 static unsigned
 check_destroy_pinned_err(void)
 {
diff --git a/test/cache_api.c b/test/cache_api.c
index bebb828..eb4a7cc 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -27,8 +27,6 @@
 
 /* extern declarations */
 
-extern const char *FILENAME[];
-
 /* global variable declarations: */
 
 /* macro definitions */
diff --git a/test/cache_common.h b/test/cache_common.h
index c07ab25..655e17e 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -532,27 +532,34 @@ struct expected_entry_status
 
 
 /* global variable externs: */
+H5TEST_DLLVAR H5C_t * saved_cache;
 
-extern haddr_t saved_actual_base_addr;
-extern hbool_t write_permitted;
-extern hbool_t pass; /* set to false on error */
-extern const char *failure_mssg;
+H5TEST_DLLVAR const char *FILENAME[];
 
-extern test_entry_t * entries[NUMBER_OF_ENTRY_TYPES];
-extern const int32_t max_indices[NUMBER_OF_ENTRY_TYPES];
-extern const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES];
-extern const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES];
-extern const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES];
-extern const char * entry_type_names[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR haddr_t saved_actual_base_addr;
+H5TEST_DLLVAR hbool_t write_permitted;
+H5TEST_DLLVAR hbool_t pass; /* set to false on error */
+H5TEST_DLLVAR const char *failure_mssg;
+
+H5TEST_DLLVAR test_entry_t * entries[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const int32_t max_indices[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const char * entry_type_names[NUMBER_OF_ENTRY_TYPES];
 
 /* callback table extern */
 
-extern const H5C_class_t types[NUMBER_OF_ENTRY_TYPES];
+H5TEST_DLLVAR const H5C_class_t types[NUMBER_OF_ENTRY_TYPES];
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* function declarations: */
 
-void add_flush_op(int target_type,
+H5TEST_DLL void add_flush_op(int target_type,
                   int target_idx,
                   int op_code,
                   int type,
@@ -562,69 +569,69 @@ void add_flush_op(int target_type,
                   unsigned * order);
 
 
-void addr_to_type_and_index(haddr_t addr,
+H5TEST_DLL void addr_to_type_and_index(haddr_t addr,
                             int32_t * type_ptr,
                             int32_t * index_ptr);
 
 #if 0 /* keep this for a while -- it may be useful */
-haddr_t type_and_index_to_addr(int32_t type,
+H5TEST_DLL haddr_t type_and_index_to_addr(int32_t type,
                                int32_t idx);
 #endif
 
-void dirty_entry(H5F_t * file_ptr,
+H5TEST_DLL void dirty_entry(H5F_t * file_ptr,
                  int32_t type,
                  int32_t idx,
                  hbool_t dirty_pin);
 
-void expunge_entry(H5F_t * file_ptr,
+H5TEST_DLL void expunge_entry(H5F_t * file_ptr,
                    int32_t type,
                    int32_t idx);
 
-void insert_entry(H5F_t * file_ptr,
+H5TEST_DLL void insert_entry(H5F_t * file_ptr,
                   int32_t type,
                   int32_t idx,
                   unsigned int flags);
 
-void mark_entry_dirty(int32_t type,
-		      int32_t idx);
+H5TEST_DLL void mark_entry_dirty(int32_t type,
+            int32_t idx);
 
-void move_entry(H5C_t * cache_ptr,
+H5TEST_DLL void move_entry(H5C_t * cache_ptr,
                 int32_t type,
                 int32_t idx,
                 hbool_t main_addr);
 
-void protect_entry(H5F_t * file_ptr,
+H5TEST_DLL void protect_entry(H5F_t * file_ptr,
                    int32_t type,
                    int32_t idx);
 
-void protect_entry_ro(H5F_t * file_ptr,
+H5TEST_DLL void protect_entry_ro(H5F_t * file_ptr,
                       int32_t type,
                       int32_t idx);
 
-void pin_entry(int32_t type,
+H5TEST_DLL void pin_entry(int32_t type,
                  int32_t idx);
 
-hbool_t entry_in_cache(H5C_t * cache_ptr,
+H5TEST_DLL hbool_t entry_in_cache(H5C_t * cache_ptr,
                        int32_t type,
                        int32_t idx);
 
-void create_pinned_entry_dependency(H5F_t * file_ptr,
-		                    int pinning_type,
-		                    int pinning_idx,
-		                    int pinned_type,
-		                    int pinned_idx);
+H5TEST_DLL void create_pinned_entry_dependency(H5F_t * file_ptr,
+                            int pinning_type,
+                            int pinning_idx,
+                            int pinned_type,
+                            int pinned_idx);
 
-void reset_entries(void);
+H5TEST_DLL void reset_entries(void);
 
-void resize_entry(H5F_t * file_ptr,
+H5TEST_DLL void resize_entry(H5F_t * file_ptr,
                   int32_t type,
                   int32_t idx,
                   size_t new_size,
                   hbool_t in_cache);
 
-H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
+H5TEST_DLL H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size);
 
-void row_major_scan_forward(H5F_t * file_ptr,
+H5TEST_DLL void row_major_scan_forward(H5F_t * file_ptr,
                             int32_t max_index,
                             int32_t lag,
                             hbool_t verbose,
@@ -639,7 +646,7 @@ void row_major_scan_forward(H5F_t * file_ptr,
                             int dirty_destroys,
                             int dirty_unprotects);
 
-void hl_row_major_scan_forward(H5F_t * file_ptr,
+H5TEST_DLL void hl_row_major_scan_forward(H5F_t * file_ptr,
                                int32_t max_index,
                                hbool_t verbose,
                                hbool_t reset_stats,
@@ -647,7 +654,7 @@ void hl_row_major_scan_forward(H5F_t * file_ptr,
                                hbool_t display_detailed_stats,
                                hbool_t do_inserts);
 
-void row_major_scan_backward(H5F_t * file_ptr,
+H5TEST_DLL void row_major_scan_backward(H5F_t * file_ptr,
                              int32_t max_index,
                              int32_t lag,
                              hbool_t verbose,
@@ -662,7 +669,7 @@ void row_major_scan_backward(H5F_t * file_ptr,
                              int dirty_destroys,
                              int dirty_unprotects);
 
-void hl_row_major_scan_backward(H5F_t * file_ptr,
+H5TEST_DLL void hl_row_major_scan_backward(H5F_t * file_ptr,
                                 int32_t max_index,
                                 hbool_t verbose,
                                 hbool_t reset_stats,
@@ -670,7 +677,7 @@ void hl_row_major_scan_backward(H5F_t * file_ptr,
                                 hbool_t display_detailed_stats,
                                 hbool_t do_inserts);
 
-void col_major_scan_forward(H5F_t * file_ptr,
+H5TEST_DLL void col_major_scan_forward(H5F_t * file_ptr,
                             int32_t max_index,
                             int32_t lag,
                             hbool_t verbose,
@@ -680,7 +687,7 @@ void col_major_scan_forward(H5F_t * file_ptr,
                             hbool_t do_inserts,
                             int dirty_unprotects);
 
-void hl_col_major_scan_forward(H5F_t * file_ptr,
+H5TEST_DLL void hl_col_major_scan_forward(H5F_t * file_ptr,
                                int32_t max_index,
                                hbool_t verbose,
                                hbool_t reset_stats,
@@ -689,7 +696,7 @@ void hl_col_major_scan_forward(H5F_t * file_ptr,
                                hbool_t do_inserts,
                                int dirty_unprotects);
 
-void col_major_scan_backward(H5F_t * file_ptr,
+H5TEST_DLL void col_major_scan_backward(H5F_t * file_ptr,
                              int32_t max_index,
                              int32_t lag,
                              hbool_t verbose,
@@ -699,7 +706,7 @@ void col_major_scan_backward(H5F_t * file_ptr,
                              hbool_t do_inserts,
                              int dirty_unprotects);
 
-void hl_col_major_scan_backward(H5F_t * file_ptr,
+H5TEST_DLL void hl_col_major_scan_backward(H5F_t * file_ptr,
                                 int32_t max_index,
                                 hbool_t verbose,
                                 hbool_t reset_stats,
@@ -708,69 +715,73 @@ void hl_col_major_scan_backward(H5F_t * file_ptr,
                                 hbool_t do_inserts,
                                 int dirty_unprotects);
 
-void takedown_cache(H5F_t * file_ptr,
+H5TEST_DLL void takedown_cache(H5F_t * file_ptr,
                     hbool_t dump_stats,
                     hbool_t dump_detailed_stats);
 
-void flush_cache(H5F_t * file_ptr,
+H5TEST_DLL void flush_cache(H5F_t * file_ptr,
                  hbool_t destroy_entries,
                  hbool_t dump_stats,
                  hbool_t dump_detailed_stats);
 
-void unpin_entry(int32_t type,
+H5TEST_DLL void unpin_entry(int32_t type,
                  int32_t idx);
 
-void unprotect_entry(H5F_t * file_ptr,
+H5TEST_DLL void unprotect_entry(H5F_t * file_ptr,
                      int32_t type,
                      int32_t idx,
                      unsigned int flags);
 
-void verify_clean(void);
+H5TEST_DLL void verify_clean(void);
 
-void verify_entry_status(H5C_t * cache_ptr,
-		         int tag,
+H5TEST_DLL void verify_entry_status(H5C_t * cache_ptr,
+                int tag,
                          int num_entries,
                          struct expected_entry_status expected[]);
 
-void verify_unprotected(void);
+H5TEST_DLL void verify_unprotected(void);
 
-void create_flush_dependency(int32_t parent_type,
+H5TEST_DLL void create_flush_dependency(int32_t parent_type,
              int32_t parent_idx,
              int32_t child_type,
              int32_t child_idx);
 
-void destroy_flush_dependency(int32_t parent_type,
+H5TEST_DLL void destroy_flush_dependency(int32_t parent_type,
              int32_t parent_idx,
              int32_t child_type,
              int32_t child_idx);
 
 /*** H5AC level utility functions ***/
 
-hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
+H5TEST_DLL hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a,
     const H5C_auto_size_ctl_t *b, hbool_t compare_init);
 
-void check_and_validate_cache_hit_rate(hid_t file_id,
+H5TEST_DLL void check_and_validate_cache_hit_rate(hid_t file_id,
                                        double * hit_rate_ptr,
                                        hbool_t dump_data,
                                        int64_t min_accesses,
                                        double min_hit_rate);
 
-void check_and_validate_cache_size(hid_t file_id,
+H5TEST_DLL void check_and_validate_cache_size(hid_t file_id,
                                    size_t * max_size_ptr,
                                    size_t * min_clean_size_ptr,
                                    size_t * cur_size_ptr,
                                    int32_t * cur_num_entries_ptr,
                                    hbool_t dump_data);
 
-void validate_mdc_config(hid_t file_id,
+H5TEST_DLL void validate_mdc_config(hid_t file_id,
                          H5AC_cache_config_t * ext_config_ptr,
                          hbool_t compare_init,
                          int test_num);
 
 /** Debugging functions -- normally commented out ***/
 #if 0
-void dump_LRU(H5F_t * file_ptr);
-#endif 
+H5TEST_DLL void dump_LRU(H5F_t * file_ptr);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _CACHE_COMMON_H */
 
-- 
cgit v0.12