Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 827
blob159fad858fbf5487e7e0475c83b635febcf275c0
1 #!/bin/sh
2 # PCP QA Test No. 827
3 # Check log rewriting of Linux /proc/net/snmp metric types
5 # Copyright (c) 2013, 2015 Red Hat.
8 # get standard environment, filters and checks
9 . ./common.product
10 . ./common.filter
11 . ./common.check
13 seq=`basename $0`
14 echo "QA output created by $seq"
16 [ -f ${PCP_PMDAS_DIR}/snmp/pmdasnmp.pl ] || _notrun "snmp pmda not installed"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 migrate=$PCP_VAR_DIR/config/pmlogrewrite/linux_proc_net_snmp_migrate.conf
23 [ -f "$migrate" ] || _notrun "$migrate not installed"
25 # real QA test starts here
26 cat >$tmp.config <<End-of-File
27 metric 60.14.* { type -> U32 }
28 End-of-File
30 pmlogrewrite -c $tmp.config -w archives/new_snmp $tmp.old
32 pmlogrewrite -c $migrate -w $tmp.old $tmp.new
34 pmdumplog -z -a $tmp.old >$tmp.old.dump
35 pmdumplog -z -a $tmp.new >$tmp.new.dump
36 pmdumplog -z -a archives/new_snmp >$tmp.ref.dump
38 echo "old -> new changes"
39 diff -u $tmp.old.dump $tmp.new.dump | sed -e '/^---/d' -e '/^+++/d'
41 echo
42 echo "new -> ref changes ... expect none"
43 diff -u $tmp.new.dump $tmp.ref.dump | sed -e '/^---/d' -e '/^+++/d'
45 # success, all done
46 status=0
48 exit