#!/bin/csh -f -b
# This file should be tailored to the environment that it's running in.
#    It's purpose is the flush the client (and server) cache of data so
#    that each test cold-starts with an empty cache.  This script gets called
#    by a routine in adaptWl with a single argument, ie. the directory that
#    the test is being run in.  Under most Unix's, this script should umount
#    the file system that the directory is in, then remount it.  This may mean
#    giving this script setuid privileges, or running as root.

# These next two lines are the variables that must be tailored to the test
#    environment.  TEMPFILESYSTEM is the file system that the test directory
#    resides in.  DEVICE is the device the file system is mounted on.

set TEMPFILESYSTEM = /test
set DEVICE = /dev/sd1c

# $1 is the name of the directory

echo "flushing file cache for" $1

#
# first unmount the disk
#

umount $TEMPFILESYSTEM
if ($status) then
    echo "unable to run umount"
    exit(1)
endif

#
# then re-mount the disk
#

mount $DEVICE $TEMPFILESYSTEM
if ($status) then
    echo "unable to run mount"
    exit(1)
endif

exit(0)
