Merge more-test-errors

This commit is contained in:
Daniel Nichter
2012-08-22 14:56:54 -06:00
4 changed files with 24 additions and 10 deletions

View File

@@ -23,7 +23,7 @@ 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" "$p-df"
wait_for_files "$p-hostname" "$p-opentables2" "$p-variables" "$p-df" "$p-innodbstatus2"
# Even if this system doesn't have all the cmds, collect should still
# have created some files for cmds that (hopefully) all systems have.
@@ -68,6 +68,7 @@ cmd_ok \
"Finds MySQL error log"
if [[ "$SANDBOX_VERSION" > "5.0" ]]; then
wait_for_files "$p-log_error"
cmd_ok \
"grep -qE 'Memory status|Open streams|Begin safemalloc' $p-log_error" \
"debug"

View File

@@ -85,6 +85,7 @@ is \
"$cnf_file" \
"/tmp/12345/my.sandbox.cnf" \
"find_my_cnf_file gets the correct file"
[ $? -ne 0 ] && diag "$p/mysqld-instances"
res=$(find_my_cnf_file "$samples/ps-mysqld-001.txt")
is "$res" "/tmp/12345/my.sandbox.cnf" "ps-mysqld-001.txt"

View File

@@ -21,8 +21,9 @@ use POSIX qw(mkfifo);
# #########################################################################
my $pid_file = '/tmp/mqd.pid';
my $fifo = '/tmp/mqd.fifo';
unlink $pid_file and diag("Unlinking existing $pid_file");
unlink $fifo and diag("Unlinking existing $fifo");
unlink $pid_file if $pid_file;
unlink $fifo if $fifo;
my ($start, $end, $waited, $timeout);
SKIP: {
@@ -40,7 +41,7 @@ SKIP: {
);
$end = time;
$waited = $end - $start;
if ( $timeout ) {
if ( $timeout && -f $pid_file ) {
# mqd ran longer than --read-timeout
chomp(my $pid = slurp_file($pid_file));
kill SIGTERM => $pid if $pid;
@@ -52,7 +53,7 @@ SKIP: {
);
}
unlink $pid_file;
unlink $pid_file if $pid_file;
mkfifo $fifo, 0700;
system("$trunk/t/pt-query-digest/samples/write-to-fifo.pl $fifo 4 &");
@@ -66,7 +67,7 @@ $timeout = wait_for(
);
$end = time;
$waited = $end - $start;
if ( $timeout ) {
if ( $timeout && $pid_file ) {
# mqd ran longer than --read-timeout
chomp(my $pid = slurp_file($pid_file));
kill SIGTERM => $pid if $pid;
@@ -77,8 +78,8 @@ ok(
sprintf("--read-timeout waited %.1f seconds reading a file", $waited)
);
unlink $pid_file;
unlink $fifo;
unlink $pid_file if $pid_file;
unlink $fifo if $fifo;
# #############################################################################
# Done.

View File

@@ -204,13 +204,24 @@ wait_for_files() {
for file in "$@"; do
local slept=0
while ! [ -f $file ]; do
sleep 0.1;
sleep 0.2;
slept=$((slept + 1))
[ $slept -ge 50 ] && break # 5s
[ $slept -ge 150 ] && break # 30s
done
done
}
diag() {
if [ $# -eq 1 -a -f "$1" ]; then
echo "# $1:"
awk '{print "# " $0}' "$1"
else
for line in "$@"; do
echo "# $line"
done
fi
}
# ############################################################################
# Script starts here
# ############################################################################