pmrep: fix archive end time reporting
[pcp.git] / qa / 033
blob3694c1c8b7b75596a13331593e5c2a27818472a9
1 #! /bin/sh
2 # PCP QA Test No. 033
3 # check filesys metrics for root fs
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 [ $PCP_PLATFORM = solaris ] && _notrun "No filesys metrics for Solaris"
18 rm -f $seq.out
19 if [ $PCP_PLATFORM = darwin ]
20 then
21 ln $seq.out.4 $seq.out
22 else
23 # assume linux-like
25 if pmprobe filesys.readonly >/dev/null
26 then
27 ln $seq.out.3 $seq.out
28 else
29 ln $seq.out.1 $seq.out
33 status=1 # failure is the default
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35 rm -f $seq.full
37 # real QA test starts here
38 root=`df / | $PCP_AWK_PROG 'NR == 2 { print $1 }'`
39 echo "root=$root" >>$seq.full
40 if [ -z "$root" ]
41 then
42 echo "Arrgh, cannot get device for root fs from df(1) ..."
43 df /
44 exit
46 if [ -L "$root" ]
47 then
48 if which realpath >/dev/null 2>&1
49 then
50 symroot=`realpath $root`
51 else
52 symroot=`ls -l $root | sed -e 's/.*-> //'`
53 if [ -z "$symroot" ]
54 then
55 echo "Arrgh, cannot get symlink for device for root fs ..."
56 ls -l $root
57 exit
59 case "$symroot"
61 ../*)
62 # handle case like ...
63 # /dev/disk/by-uuid/467793a8-5191-4940-90fb-38a6f28b035d -> ../../sda1
64 dir=`dirname $root`
65 while true
67 case "$symroot"
69 ../*)
70 dir=`echo $dir | sed -e 's@/[^/]*$@@'`
71 symroot=`echo $symroot | sed -e 's@\.\./\([^.]\)@\1@'`
74 symroot=${dir}/${symroot}
75 break
77 esac
78 done
80 esac
82 else
83 symroot="$root"
85 echo "symroot=$symroot" >>$seq.full
86 pminfo -f filesys \
87 | egrep "(^filesys)|\"$root\"|/dev/root|$symroot\"" \
88 | _filter_dumpresult 2>&1 > $tmp.out
90 cat $tmp.out
92 status=0
93 exit