From 956b83fc774dcb9ba23722dd0769112dcb7d435b Mon Sep 17 00:00:00 2001 From: Ken McDonell Date: Wed, 19 Jan 2022 08:58:40 +1100 Subject: [PATCH] qa/1375 & 1376: simplest pmlogextract exerciser for V2 and V3 archives Ensures pmlogextract in out generates an output archive that is (almost) identical to the input archive. --- qa/1375 | 70 ++++++++++++++++++++++++++++++++--------- qa/1375.out | 9 +++++- qa/1376 | 41 ++++++++++++++++++++++++ qa/1376.out | 26 +++++++++++++++ qa/group | 2 ++ qa/tmparch/GNUlocaldefs | 12 ++++++- 6 files changed, 143 insertions(+), 17 deletions(-) create mode 100755 qa/1376 create mode 100644 qa/1376.out diff --git a/qa/1375 b/qa/1375 index 4cd703c5d3..ed25d73619 100755 --- a/qa/1375 +++ b/qa/1375 @@ -1,6 +1,10 @@ #!/bin/sh # PCP QA Test No. 1375 -# simplest pmlogextract test for V3 archives ... no delta indoms +# simplest pmlogextract test for V3 (and V2) archives ... no +# delta indoms, so output archive should be the same as the +# input archive +# +# non-valgrind variant, see qa/1376 for the valgrind variant # # Copyright (c) 2022 Ken McDonell. All Rights Reserved. # @@ -46,24 +50,60 @@ _filter() # real QA test starts here -if $do_valgrind -then - _run_valgrind ...your test goes here... -else - pmlogextract tmparch/sampledso-no-delta_v3 -Dlogmeta $tmp 2>&1 -fi \ -| sed -e "s@$tmp@TMP@g" \ -| _filter +for version in 2 3 +do + echo + echo "--- Version $version archive ---" + case $version + in + 2) suff='' + ;; + 3) suff='_v3' + ;; + esac + + rm -f $tmp.0 $tmp.meta $tmp.index + + if $do_valgrind + then + _run_valgrind pmlogextract tmparch/sampledso-no-delta$suff $tmp + else + pmlogextract tmparch/sampledso-no-delta$suff $tmp 2>&1 + fi \ + | sed -e "s@$tmp@TMP@g" \ + | _filter + + echo "=== scanmeta for input ===" >>$seq.full + src/scanmeta -a tmparch/sampledso-no-delta$suff.meta 2>&1 \ + | tee -a $seq.full \ + | sed -e 's/^\[[0-9][0-9]*/[NN/' \ + | LC_COLLATE=POSIX sort >$tmp.input + + echo >>$seq.full + echo "=== scanmeta for output ===" >>$seq.full + src/scanmeta -a $tmp.meta 2>&1 \ + | tee -a $seq.full \ + | sed -e 's/^\[[0-9][0-9]*/[NN/' \ + | LC_COLLATE=POSIX sort >$tmp.output + + echo "=== scanmeta diffs ===" + diff $tmp.input $tmp.output -src/scanmeta -a tmparch/sampledso-no-delta_v3.meta >$tmp.input -src/scanmeta -a $tmp.meta >$tmp.output + echo "=== dumplog for input ===" >>$seq.full + pmdumplog -aI tmparch/sampledso-no-delta$suff 2>&1 \ + | tee -a $seq.full \ + | sed -e '/^PID for pmlogger:/s/[0-9][0-9]*//' >$tmp.input -meld $tmp.input $tmp.output + echo >>$seq.full + echo "=== dumplog for output ===" >>$seq.full + pmdumplog -aI $tmp 2>&1 \ + | tee -a $seq.full \ + | sed -e '/^PID for pmlogger:/s/[0-9][0-9]*//' >$tmp.output -pmdumplog -aI tmparch/sampledso-no-delta_v3 >$tmp.input -pmdumplog -aI $tmp >$tmp.output + echo "=== pmdumplog diffs ===" + diff $tmp.input $tmp.output -meld $tmp.input $tmp.output +done # success, all done exit diff --git a/qa/1375.out b/qa/1375.out index afbfcd231c..3f8ce75a7e 100644 --- a/qa/1375.out +++ b/qa/1375.out @@ -1,2 +1,9 @@ QA output created by 1375 -[skeleton from qa/new, replace me] + +--- Version 2 archive --- +=== scanmeta diffs === +=== pmdumplog diffs === + +--- Version 3 archive --- +=== scanmeta diffs === +=== pmdumplog diffs === diff --git a/qa/1376 b/qa/1376 new file mode 100755 index 0000000000..1a05008055 --- /dev/null +++ b/qa/1376 @@ -0,0 +1,41 @@ +#!/bin/sh +# PCP QA Test No. 1376 +# simplest pmlogextract test for V3 (and V2) archives ... no +# delta indoms, so output archive should be the same as the +# input archive +# +# valgrind variant, see qa/1375 for the non-valgrind variant +# +# Copyright (c) 2022 Ken McDonell. All Rights Reserved. +# + +seq=`basename $0` +echo "QA output created by $seq" + +# get standard environment, filters and checks +. ./common.product +. ./common.filter +. ./common.check + +_check_valgrind + +_cleanup() +{ + cd $here + $sudo rm -rf $tmp $tmp.* +} + +status=0 # success is the default! +$sudo rm -rf $tmp $tmp.* $seq.full +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# real QA test starts here +export seq +./1375 --valgrind | $PCP_AWK_PROG ' +skip == 1 && $1 == "===" { skip = 0 } +/^=== std err ===/ { skip = 1 } +skip == 0 { print } +skip == 1 { print >>"'$here/$seq.full'" }' + +# success, all done +exit diff --git a/qa/1376.out b/qa/1376.out new file mode 100644 index 0000000000..a8867920c1 --- /dev/null +++ b/qa/1376.out @@ -0,0 +1,26 @@ +QA output created by 1376 +QA output created by 1375 --valgrind + +--- Version 2 archive --- +=== std out === +=== filtered valgrind report === +Memcheck, a memory error detector +Command: pmlogextract tmparch/sampledso-no-delta TMP +LEAK SUMMARY: +definitely lost: 0 bytes in 0 blocks +indirectly lost: 0 bytes in 0 blocks +ERROR SUMMARY: 0 errors from 0 contexts ... +=== scanmeta diffs === +=== pmdumplog diffs === + +--- Version 3 archive --- +=== std out === +=== filtered valgrind report === +Memcheck, a memory error detector +Command: pmlogextract tmparch/sampledso-no-delta_v3 TMP +LEAK SUMMARY: +definitely lost: 0 bytes in 0 blocks +indirectly lost: 0 bytes in 0 blocks +ERROR SUMMARY: 0 errors from 0 contexts ... +=== scanmeta diffs === +=== pmdumplog diffs === diff --git a/qa/group b/qa/group index 745822fa20..6551e02367 100644 --- a/qa/group +++ b/qa/group @@ -1821,6 +1821,8 @@ x11 1372 pmie local 1373 pmlogsize archive_v3 local 1374 pmlogsize archive_v3 local valgrind +1375 pmlogextract pmdumplog archive_v3 local +1376 pmlogextract pmdumplog archive_v3 local valgrind 1379 pmproxy local 1383 pmlogrewrite labels pmdumplog local 1385 pmda.openmetrics local python diff --git a/qa/tmparch/GNUlocaldefs b/qa/tmparch/GNUlocaldefs index f0bb6f6d8f..922f380c89 100644 --- a/qa/tmparch/GNUlocaldefs +++ b/qa/tmparch/GNUlocaldefs @@ -11,7 +11,8 @@ MKARCH = foo.0 mv-foo.0 noti-foo.0 noti-ok-foo.0 null.0 \ interp.0 mv-interp.0 noti-interp.0 \ gap.0 gap2.0 reduce-gap.0 \ dodgey-some.0 dodgey-all.0 dodgey-mixed.0 bad-1.0 \ - sample-proc.0 sample-proc_v3.0 + sample-proc.0 sample-proc_v3.0 \ + sampledso-no-delta.0 sampledso-no-delta_v3.0 LDIRT = $(MKARCH) \ $(patsubst %.0,%.meta,$(MKARCH)) $(patsubst %.0,%.index,$(MKARCH)) \ @@ -161,3 +162,12 @@ dodgey-mixed.0: make.dodgey config.dodgey-mixed sample-proc.0 sample-proc_v3.0: make.sample-proc ./make.sample-proc + +sampledso-no-delta.0 sampledso-no-delta_v3.0: + rm -f sampledso-no-delta.* sampledso-no-delta_v3.* + rm -rf tmp + mkdir tmp + echo "log mandatory on 250msec { sampledso.long.ten sampledso.longlong.ten sampledso.bin }" >tmp/config + pmlogger -s 3 -c tmp/config -V2 sampledso-no-delta + pmlogger -s 3 -c tmp/config -V3 sampledso-no-delta_v3 + rm -rf tmp