2 # Script to test the attribute cache behavior of the local OS client.
3 # If this script fails, it means that Amd cannot turn off the attrcache
4 # reliably on this host, and Amd therefore may not run reliably. See
5 # the README.attrcache file distributed with this am-utils.
6 # -Erez Zadok, September 29, 2005
8 # set PATH (must install am-utils first)
10 exec_prefix=@exec_prefix@
11 PATH=@sbindir@:@bindir@:/usr/ucb:/usr/bin:/bin:${PATH}
14 # test if amd is running
15 amq -p > /dev/null 2>&1
18 echo "### Amd already running... please shutdown Amd first"
22 mapfile="/tmp/amd.testmap.$$"
23 logfile="/var/log/amd"
28 echo "### Creating correct map"
30 a type:=link;fs:=/tmp/a
35 echo "### Creating weird map"
37 a type:=link;fs:=/tmp/b
43 # do not delete files we may need to use to debug Amd
44 # rm -f /tmp/a /tmp/b $mapfile $logfile
51 echo amd -x all -D all -r -l $logfile $a $mapfile -cache:=mapdefault,sync
52 amd -x all -D all -r -l $logfile $a $mapfile -cache:=mapdefault,sync
53 sleep 3 # give amd chance to start properly
55 inode_a=`ls -lLi /tmp/a | awk '{print $1}'`
56 inode_b=`ls -lLi /tmp/b | awk '{print $1}'`
61 # how many times to try until we call it a success...
63 while test $maxtry -gt 0
65 echo "$maxtry tries left ..."
72 echo "### looking at a... should get a"
73 ino=`ls -lLi $a/a | awk '{print $1}'`
80 echo "a link does not exist!"
84 if test $ino -ne $inode_a
90 echo "a link does not point to A!"
95 # Here is the main trick we try: force amd to flush one entry, then
96 # change the amd map on disk, and then see if the kernel will have
97 # flushed the attribute cache; if it did, then Amd will see the
98 # correctly changed map entry.
108 echo "### looking at a... should get b"
109 ino=`ls -lLi $a/a | awk '{print $1}'`
116 echo "a link does not exist!"
120 if test $ino -ne $inode_b
126 echo "a link does not point to B!"