5
TMPFILE="$TEST_TMPDIR/parse-opts-output"
7
PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin"
9
mkdir "$TMPDIR/collect" 2>/dev/null
11
source "$LIB_DIR/log_warn_die.sh"
12
source "$LIB_DIR/parse_options.sh"
13
source "$LIB_DIR/safeguards.sh"
14
source "$LIB_DIR/alt_cmds.sh"
15
source "$LIB_DIR/collect.sh"
17
parse_options "$T_LIB_DIR/samples/bash/po002.sh" --run-time 1 -- --defaults-file=/tmp/12345/my.sandbox.cnf
19
# Prefix (with path) for the collect files.
20
local p="$TMPDIR/collect/2011_12_05"
22
# Default collect, no extras like gdb, tcpdump, etc.
23
collect "$TMPDIR/collect" "2011_12_05" > $p-output 2>&1
25
# Even if this system doesn't have all the cmds, collect should still
26
# create all the default files.
27
ls -1 $TMPDIR/collect | sort > $TMPDIR/collect-files
29
$TMPDIR/collect-files \
30
$T_LIB_DIR/samples/bash/collect001.txt \
31
"Default collect files"
34
"grep -q 'Avail' $p-df" \
37
# hostname is the last thing collected, so if it's ok,
38
# then the sub reached its end.
45
"grep -q -i 'buffer pool' $p-innodbstatus1" \
49
"grep -q -i 'buffer pool' $p-innodbstatus2" \
53
"grep -q 'error log seems to be /tmp/12345/data/mysqld.log' $p-output" \
54
"Finds MySQL error log"
57
"grep -q 'Status information:' $p-log_error" \
61
"grep -q 'COMMAND[ ]\+PID[ ]\+USER' $p-lsof" \
65
"grep -q 'buf0buf.c' $p-mutex-status1" \
69
"grep -q 'buf0buf.c' $p-mutex-status2" \
73
"grep -q '^| Uptime' $p-mysqladmin" \
77
"grep -qP 'Database\tTable\tIn_use' $p-opentables1" \
81
"grep -qP 'Database\tTable\t\In_use' $p-opentables2" \
85
"grep -q '1. row' $p-processlist" \
89
"grep -q 'mysqld' $p-ps" \
93
"grep -qP '^wait_timeout\t\d' $p-variables" \
96
local iters=$(cat $p-df | grep -c '^TS ')
97
is "$iters" "1" "1 iteration/1s run time"
99
# ###########################################################################
100
# Try longer run time.
101
# ###########################################################################
103
parse_options "$T_LIB_DIR/samples/bash/po002.sh" --run-time 2 -- --defaults-file=/tmp/12345/my.sandbox.cnf
107
collect "$TMPDIR/collect" "2011_12_05" > $p-output 2>&1
109
local iters=$(cat $p-df | grep -c '^TS ')
110
is "$iters" "2" "2 iteration/2s run time"
112
# ############################################################################
114
# ############################################################################