Tweak t/lib/bash/collect.sh and t/lib/bash/report_mysql_info.sh and add wait_for_files() to util/test-bash-functions so hopefully they'll be more stable.

This commit is contained in:
Daniel Nichter
2012-07-10 16:33:00 -06:00
parent 1b87b207bb
commit 6269b196a3
3 changed files with 23 additions and 5 deletions

View File

@@ -23,6 +23,8 @@ p="$PT_TMPDIR/collect/2011_12_05"
# Default collect, no extras like gdb, tcpdump, etc.
collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1
wait_for_files "$p-hostname" "$p-opentables2" "$p-variables"
# Even if this system doesn't have all the cmds, collect should still
# have created some files for cmds that (hopefully) all systems have.
ls -1 $PT_TMPDIR/collect | sort > $PT_TMPDIR/collect-files

View File

@@ -107,8 +107,8 @@ cat <<EOF > $PT_TMPDIR/expected
EOF
summarize_processlist "$samples/processlist-001.txt" > "$PT_TMPDIR/got"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "summarize_processlist"
no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "summarize_processlist" \
|| cat "$PT_TMPDIR/got" "$PT_TMPDIR/expected" >&2
# ###########################################################################
# summarize_binlogs
@@ -548,7 +548,8 @@ Mutexes/Locks Waited For
EOF
format_innodb_status $samples/innodb-status.001.txt > $PT_TMPDIR/got
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.001.txt"
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.001.txt" \
|| cat "$PT_TMPDIR/got" "$PT_TMPDIR/expected" >&2
cat <<'EOF' > $PT_TMPDIR/expected
Checkpoint Age | 348M
@@ -600,7 +601,8 @@ Tables Locked
EOF
format_innodb_status $samples/innodb-status.003.txt > $PT_TMPDIR/got
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.003.txt"
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.003.txt" \
|| cat "$PT_TMPDIR/got" "$PT_TMPDIR/expected" >&2
cat <<'EOF' > $PT_TMPDIR/expected
Checkpoint Age | 93M
@@ -628,7 +630,8 @@ Mutexes/Locks Waited For
EOF
format_innodb_status $samples/innodb-status.004.txt > $PT_TMPDIR/got
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.004.txt"
no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.004.txt" \
|| cat "$PT_TMPDIR/got" "$PT_TMPDIR/expected" >&2
# ###########################################################################
# section_innodb

View File

@@ -198,6 +198,19 @@ dies_ok() {
result $result "$test_name"
}
# Helper subs for slow boxes
wait_for_files() {
for file in "$@"; do
local slept=0
while ! [ -f $file ]; do
sleep 0.1;
slept=$((slept + 1))
[ $slept -ge 50 ] && break # 5s
done
done
}
# ############################################################################
# Script starts here
# ############################################################################