summaryrefslogtreecommitdiffstats
path: root/test/testflushrefresh.sh.in
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2010-11-02 19:00:56 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2010-11-02 19:00:56 (GMT)
commita9ca88d1564351db7ca9371eeede12473b26a6a6 (patch)
treecaff74657cad616101e47989359faac2c53dbc26 /test/testflushrefresh.sh.in
parent8e04644abdc73446e85bac72bcced171a927b1f0 (diff)
downloadhdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.zip
hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.gz
hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.bz2
[svn-r19714] Purpose:
Add API and supporting code to allow single object flushes and refreshes. Description: Added the following API calls: H5Dflush / H5Drefresh H5Gflush / H5Grefresh H5Tflush / H5Trefresh H5Oflush / H5Orefresh Each H5*flush API flushes the targeted object's metadata, while each H5*refresh evicts all metadata related to an object and reopens the object (re-loading needed metadata from disk). New files include src/H5Oflush.c, containing new internal H5O_* functions used by the above API calls. Also, a test file and test script template have been added, test/flushrefresh.c and test/testflushrefresh.sh.in. There is not (yet) a corresponding test script for windows as the current one isn't quite portable. Several H5C and H5AC-level functions have been added to support single object flushing and eviction, and the previously committed 'metadata tagging' code has been tweaked slightly to pull H5AC__* macros out of H5C.c and a few other fixes as necessary as well. Tag globality has been added to better encapsulate the meaning of global tags in the H5C layer of the code. Tested: h5committested.
Diffstat (limited to 'test/testflushrefresh.sh.in')
-rwxr-xr-xtest/testflushrefresh.sh.in162
1 files changed, 162 insertions, 0 deletions
diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in
new file mode 100755
index 0000000..ca34ebe
--- /dev/null
+++ b/test/testflushrefresh.sh.in
@@ -0,0 +1,162 @@
+#! /bin/sh
+#
+# 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.
+#
+#
+# Test script for the flush/evict single objects feature.
+#
+# This test file doesn't actually perform any tests, rather, it acts
+# as a process manager for the 'flushrefresh' test file, which is where
+# the tests are actually housed. The reason this script exists is because
+# the verification of this feature needs to occur in separate processes
+# from the one in which the file is being manipulated in. (i.e., we have
+# a single writer process, and various reader processes spawning off
+# and doing the verification that individual objects are being
+# correctly flushed).
+#
+# Programmer:
+# Mike McGreevy
+# Tuesday, July 20, 2010
+
+###############################################################################
+## test variables
+###############################################################################
+
+nerrors=0
+
+###############################################################################
+## Main
+###############################################################################
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# ========================
+# Launch the Test Program.
+# ========================
+./flushrefresh &
+pid_main=$!
+
+# =================================================
+# Set up/initialize some variables to be used later
+# =================================================
+startsignal=flushrefresh_VERIFICATION_START
+endsignal=flushrefresh_VERIFICATION_DONE
+timeout_length=100
+timedout=0
+verification_done=0
+
+# =======================================
+# Run flush verification on test program.
+# =======================================
+
+# start timer
+before=`date +%s`
+until [ $verification_done -eq 1 ]; do
+
+ # Wait for signal from test program that verification routine can run.
+ until [ -f $startsignal ]; do
+ after=`date +%s`
+ timediff=`expr $after - $before`
+ if [ $timediff -gt $timeout_length ]; then
+ nerrors=`expr $nerrors + 1`
+ timedout=1
+ break
+ fi
+ done
+
+ # Check to see if we timed out looking for the signal before continuing.
+ if [ $timedout -gt 0 ]; then
+ echo timed out waiting for signal from test program.
+ break
+ fi
+
+ # Read in test routine parameters from signal file, then delete signal file.
+ param1=`head -n 1 $startsignal`
+ param2=`tail -n 1 $startsignal`
+ rm $startsignal
+
+ # Check if we're done with verifications, otherwise run the specified verification.
+ if [ "$param1" = "VERIFICATION_DONE" ]; then
+ verification_done=1
+ echo "all flush verification complete" > $endsignal
+ else
+ ./flushrefresh $param1 $param2
+ echo "verification flush process done" > $endsignal
+ fi
+
+done
+
+# =========================================
+# Run refresh verification on test program.
+# =========================================
+if [ $timedout -eq 0 ]; then
+ # start timer
+ before=`date +%s`
+ until [ $verification_done -eq 2 ]; do
+
+ # Wait for signal from test program that verification routine can run.
+ until [ -f $startsignal ]; do
+ after=`date +%s`
+ timediff=`expr $after - $before`
+ if [ $timediff -gt $timeout_length ]; then
+ nerrors=`expr $nerrors + 1`
+ timedout=1
+ break
+ fi
+ done
+
+ # Check to see if we timed out looking for the signal before continuing.
+ if [ $timedout -gt 0 ]; then
+ echo timed out waiting for signal from test program.
+ break
+ fi
+
+ # Read in test routine parameter from signal file, then delete signal file.
+ param1=`head -n 1 $startsignal`
+ rm $startsignal
+
+ # Check if we're done with verifications, otherwise run the specified verification.
+ if [ "$param1" = "VERIFICATION_DONE" ]; then
+ verification_done=2
+ echo "all refresh verification complete" > $endsignal
+ else
+ ./flushrefresh $param1
+ echo "refresh verifiction process done" > $endsignal
+ fi
+
+ done
+fi
+
+# ============================================
+# Wait for main to finish up, and end testing.
+# ============================================
+wait $pid_main
+if test $? -ne 0; then
+ echo flushrefresh had error
+ nerrors=`expr $nerrors + 1`
+fi
+
+###############################################################################
+## Report and exit
+###############################################################################
+
+if test $nerrors -eq 0 ; then
+ echo "flush/refresh objects tests passed."
+ exit 0
+else
+ echo "flush/refresh objects tests failed with $nerrors errors."
+ exit 1
+fi