Skip to content

Commit

Permalink
qa/1375 & 1376: simplest pmlogextract exerciser for V2 and V3 archives
Browse files Browse the repository at this point in the history
Ensures
	pmlogextract in out
generates an output archive that is (almost) identical to the input
archive.
  • Loading branch information
kmcdonell committed Jan 18, 2022
1 parent 6bc53b9 commit 956b83f
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 17 deletions.
70 changes: 55 additions & 15 deletions qa/1375
Original file line number Diff line number Diff line change
@@ -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.
#
Expand Down Expand Up @@ -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]*/<PID>/' >$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]*/<PID>/' >$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
9 changes: 8 additions & 1 deletion qa/1375.out
Original file line number Diff line number Diff line change
@@ -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 ===
41 changes: 41 additions & 0 deletions qa/1376
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions qa/1376.out
Original file line number Diff line number Diff line change
@@ -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 ===
2 changes: 2 additions & 0 deletions qa/group
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion qa/tmparch/GNUlocaldefs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) \
Expand Down Expand Up @@ -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

0 comments on commit 956b83f

Please sign in to comment.