3 # mmv pmda exerciser ... Martin's test case that was failing
4 # mmv install/cleanup borrowed from 647
6 # Copyright (c) 2009 Silicon Graphics, Inc. All Rights Reserved.
7 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
11 echo "QA output created by $seq"
13 # get standard filters
18 perl
-e "use PCP::MMV" >/dev
/null
2>&1
19 [ $?
-eq 0 ] || _notrun
"perl PCP::MMV module not installed"
22 if [ $PCP_VER -lt 30600 ]
24 ln $seq.out
.1 $seq.out ||
exit 1
26 ln $seq.out
.2 $seq.out ||
exit 1
29 status
=0 # success is the default!
31 MMV_STATS_DIR
="$PCP_TMP_DIR/mmv"
35 # for QA the default install for mmv PMDA is as a dso, not a daemon
37 cat <<End-of-File >$tmp.input
48 _restore_config
$PCP_PMCDCONF_PATH
49 [ -d $MMV_STATS_DIR.
$seq ] && _restore_config
$MMV_STATS_DIR
50 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
53 if $install_on_cleanup
55 ( cd $PCP_PMDAS_DIR/mmv
; $sudo .
/Install
<$tmp.input
>/dev
/null
2>&1 )
57 ( cd $PCP_PMDAS_DIR/mmv
; $sudo .
/Remove
</dev
/null
>/dev
/null
2>&1 )
65 install_on_cleanup
=false
66 pminfo mmv
>/dev
/null
2>&1 && install_on_cleanup
=true
68 trap "_cleanup" 0 1 2 3 15
72 if [ ! -d "$home/$iam" ]
74 echo "Where is $home/$iam?"
80 # copy the pmcd config file to restore state later.
81 _save_config
$PCP_PMCDCONF_PATH
82 # move the MMV directory to restore contents later.
83 [ -d $MMV_STATS_DIR ] && _save_config
$MMV_STATS_DIR
85 # start from a known starting point
86 $sudo .
/Remove
>/dev
/null
2>&1
88 $sudo rm -rf $MMV_STATS_DIR
89 $sudo mkdir
$MMV_STATS_DIR 2>/dev
/null
90 $sudo chmod 1777 $MMV_STATS_DIR 2>/dev
/null
92 cat <<'End-of-File' >$tmp.perl
100 1, MMV_TYPE_U64, MMV_INDOM_NULL,
101 mmv_units(0,0,0,0,0,0), MMV_SEM_INSTANT,
102 'A counter of some value', ''
106 my $handle = mmv_stats_init('mymmv', 0, MMV_FLAG_PROCESS, \@metrics, \@indoms);
107 die ("mmv_stats_init failed\n") unless (defined($handle));
109 while (my $line = <STDIN>) {
111 next if not $line =~ /^new value:/;
114 ($val = $line) =~ s/^new value: (\d+)/$1/;
116 mmv_stats_set($handle, 'export_value', '', $val);
120 # real QA test starts here
123 echo "=== $iam agent installation ==="
124 $sudo .
/Install
-e <$tmp.input
>$tmp.out
2>&1
125 _filter_pmda_install
<$tmp.out
130 echo "new value: $value"
131 value
=`expr $value + 1`
133 [ "$i" = 1 ] && pmval
-t 0.5sec
-s 20 mmv.mymmv.export_value
>$tmp.out
2>&1 &
141 echo "Filtered pmval output ..."
142 grep '^[a-z]' $tmp.out |
sed -e '/^host:.*$/s/.*/HOST/'
143 grep '^[^a-z]' $tmp.out | LC_COLLATE
=POSIX
sort -u