Merged experimental-fix-986847-pt-stalk-set-command

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-12-05 21:15:20 -03:00
3 changed files with 90 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
plan 21
plan 22
TMPFILE="$TEST_PT_TMPDIR/parse-opts-output"
PT_TMPDIR="$TEST_PT_TMPDIR"
@@ -141,11 +141,33 @@ parse_options "$BIN_DIR/pt-stalk" --run-time 2 -- --defaults-file=/tmp/12345/my.
rm $PT_TMPDIR/collect/*
fake_opcontrol="$PT_TMPDIR/collect/fake_opcontrol"
fake_out="$PT_TMPDIR/collect/pt-faked-opcontrol-out"
cat <<FAKE_EXEC > "$fake_opcontrol"
#!/bin/sh
echo "Faked opcontrol: \$@" > "$fake_out"
exit 1
FAKE_EXEC
chmod +x "$fake_opcontrol"
CMD_OPCONTROL="$fake_opcontrol"
OPT_COLLECT_OPROFILE=1
collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1
CMD_OPCONTROL=""
OPT_COLLECT_OPROFILE=""
iters=$(cat $p-df | grep -c '^TS ')
is "$iters" "2" "2 iteration/2s run time"
is \
"$(cat "$fake_out")" \
"Faked opcontrol: --init" \
"Bug 986847: Can manually set which commands pt-stalk uses"
if [ -f "$p-vmstat" ]; then
n=$(awk '/[ ]*[0-9]/ { n += 1 } END { print n }' "$p-vmstat")
is \