From bc8f5a610c35bd00c9f4f7ac191fc5f7580618d0 Mon Sep 17 00:00:00 2001 From: "Brian Fraser fraserb@gmail.com" <> Date: Mon, 11 Jun 2012 17:51:43 -0300 Subject: [PATCH] Change TMPDIR to PT_TMPDIR --- bin/pt-ioprofile | 45 +++-- bin/pt-mext | 15 +- bin/pt-mysql-summary | 35 ++-- bin/pt-pmp | 19 +- bin/pt-sift | 35 ++-- bin/pt-stalk | 23 ++- bin/pt-summary | 53 +++-- lib/bash/collect_mysql_info.sh | 4 +- lib/bash/collect_system_info.sh | 10 +- lib/bash/parse_options.sh | 14 +- lib/bash/report_mysql_info.sh | 4 +- lib/bash/report_system_info.sh | 22 +-- lib/bash/summary_common.sh | 6 +- lib/bash/tmpdir.sh | 22 +-- t/lib/bash/alt_cmds.sh | 4 +- t/lib/bash/collect.sh | 22 +-- t/lib/bash/collect_mysql_info.sh | 66 +++---- t/lib/bash/collect_system_info.sh | 136 ++++++------- t/lib/bash/daemon.sh | 18 +- t/lib/bash/log_warn_die.sh | 16 +- t/lib/bash/parse_options.sh | 4 +- t/lib/bash/report_mysql_info.sh | 188 +++++++++--------- t/lib/bash/report_system_info.sh | 302 ++++++++++++++--------------- t/lib/bash/safeguards.sh | 24 +-- t/lib/bash/summary_common.sh | 4 +- t/lib/bash/tmpdir.sh | 16 +- t/pt-ioprofile/summarize_strace.sh | 10 +- t/pt-ioprofile/tabulate_strace.sh | 10 +- t/pt-pmp/aggregate_stacktrace.sh | 38 ++-- util/test-bash-functions | 18 +- 30 files changed, 588 insertions(+), 595 deletions(-) diff --git a/bin/pt-ioprofile b/bin/pt-ioprofile index 04e1f8b4..8b925ab2 100755 --- a/bin/pt-ioprofile +++ b/bin/pt-ioprofile @@ -153,7 +153,7 @@ parse_options() { OPT_ERRS=0 OPT_VERSION="" OPT_HELP="" - PO_DIR="$TMPDIR/po" + PO_DIR="$PT_TMPDIR/po" if [ ! -d "$PO_DIR" ]; then mkdir "$PO_DIR" @@ -357,10 +357,10 @@ _parse_command_line() { opt="$(echo $opt | awk -F= '{print $1}')" fi - if [ -f "$TMPDIR/po/$opt" ]; then - spec="$TMPDIR/po/$opt" + if [ -f "$PT_TMPDIR/po/$opt" ]; then + spec="$PT_TMPDIR/po/$opt" else - spec=$(grep "^short form:-$opt\$" "$TMPDIR"/po/* | cut -d ':' -f 1) + spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1) if [ -z "$spec" ]; then option_error "Unknown option: $real_opt" continue @@ -430,7 +430,7 @@ size_to_bytes() { set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -439,21 +439,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -520,7 +519,7 @@ TOOL="pt-ioprofile" # pid function fd_no size timing filename # The arguments are the files to summarize. tabulate_strace() { - cat > $TMPDIR/tabulate_strace.awk < $PT_TMPDIR/tabulate_strace.awk < "$TMPDIR/summarize_strace.awk" < "$PT_TMPDIR/summarize_strace.awk" < $TMPDIR/summarized_samples + awk -f $PT_TMPDIR/summarize_strace.awk "$file" > $PT_TMPDIR/summarized_samples if [ "$group_by" != "all" ]; then - head -n1 $TMPDIR/summarized_samples - tail -n +2 $TMPDIR/summarized_samples | sort -rn -k1 + head -n1 $PT_TMPDIR/summarized_samples + tail -n +2 $PT_TMPDIR/summarized_samples | sort -rn -k1 else - grep TOTAL $TMPDIR/summarized_samples - grep -v TOTAL $TMPDIR/summarized_samples | sort -rn -k1 + grep TOTAL $PT_TMPDIR/summarized_samples + grep -v TOTAL $PT_TMPDIR/summarized_samples | sort -rn -k1 fi } main() { if [ $# -gt 0 ]; then # Summarize the files the user passed in. - tabulate_strace "$@" > $TMPDIR/tabulated_samples + tabulate_strace "$@" > $PT_TMPDIR/tabulated_samples else # There's no file to analyze, so we'll make one. if which strace > /dev/null 2>&1; then - local samples=${OPT_SAVE_SAMPLES:-"$TMPDIR/samples"} + local samples=${OPT_SAVE_SAMPLES:-"$PT_TMPDIR/samples"} # Get the PID of the process to profile, unless the user # gave us it explicitly with --profile-pid. @@ -808,7 +807,7 @@ main() { kill -s 18 $proc_pid # Summarize the output we just generated. - tabulate_strace "$samples" > $TMPDIR/tabulated_samples + tabulate_strace "$samples" > $PT_TMPDIR/tabulated_samples else echo "Cannot determine PID of $OPT_PROFILE_PROCESS process" >&2 exit 1 @@ -823,7 +822,7 @@ main() { $OPT_AGGREGATE \ $OPT_CELL \ $OPT_GROUP_BY \ - "$TMPDIR/tabulated_samples" + "$PT_TMPDIR/tabulated_samples" } # Execute the program if it was not included from another file. diff --git a/bin/pt-mext b/bin/pt-mext index 2c9ce515..32eb2abb 100755 --- a/bin/pt-mext +++ b/bin/pt-mext @@ -29,7 +29,7 @@ fi set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -38,21 +38,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -61,7 +60,7 @@ rm_tmpdir() { mk_tmpdir -FILE="$TMPDIR/mext_temp_file"; +FILE="$PT_TMPDIR/mext_temp_file"; NUM=0; REL=0; diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index 577a8c4b..ebeee818 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -155,7 +155,7 @@ parse_options() { OPT_ERRS=0 OPT_VERSION="" OPT_HELP="" - PO_DIR="$TMPDIR/po" + PO_DIR="$PT_TMPDIR/po" if [ ! -d "$PO_DIR" ]; then mkdir "$PO_DIR" @@ -359,10 +359,10 @@ _parse_command_line() { opt="$(echo $opt | awk -F= '{print $1}')" fi - if [ -f "$TMPDIR/po/$opt" ]; then - spec="$TMPDIR/po/$opt" + if [ -f "$PT_TMPDIR/po/$opt" ]; then + spec="$PT_TMPDIR/po/$opt" else - spec=$(grep "^short form:-$opt\$" "$TMPDIR"/po/* | cut -d ':' -f 1) + spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1) if [ -z "$spec" ]; then option_error "Unknown option: $real_opt" continue @@ -432,7 +432,7 @@ size_to_bytes() { set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -441,21 +441,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -624,7 +623,7 @@ get_nice_of_pid () { if [ -n "${niceness}" ]; then echo $niceness else - local tmpfile="$TMPDIR/nice_through_c.tmp.c" + local tmpfile="$PT_TMPDIR/nice_through_c.tmp.c" _d "Getting the niceness from ps failed, somehow. We are about to try this:" cat < "$tmpfile" @@ -706,8 +705,8 @@ setup_data_dir () { local existing_dir="$1" local data_dir="" if [ -z "$existing_dir" ]; then - mkdir "$TMPDIR/data" || die "Cannot mkdir $TMPDIR/data" - data_dir="$TMPDIR/data" + mkdir "$PT_TMPDIR/data" || die "Cannot mkdir $PT_TMPDIR/data" + data_dir="$PT_TMPDIR/data" else if [ ! -d "$existing_dir" ]; then mkdir "$existing_dir" || die "Cannot mkdir $existing_dir" @@ -837,8 +836,8 @@ collect_master_logs_status () { collect_mysql_deferred_status () { local status_file="$1" - collect_mysql_status > "$TMPDIR/defer_gatherer" - join "$status_file" "$TMPDIR/defer_gatherer" + collect_mysql_status > "$PT_TMPDIR/defer_gatherer" + join "$status_file" "$PT_TMPDIR/defer_gatherer" } collect_internal_vars () { @@ -1388,7 +1387,7 @@ find_max_trx_time() { find_transation_states () { local file="$1" - local tmpfile="$TMPDIR/find_transation_states.tmp" + local tmpfile="$PT_TMPDIR/find_transation_states.tmp" [ -e "$file" ] || return @@ -1439,7 +1438,7 @@ format_innodb_status () { format_overall_db_stats () { local file="$1" - local tmpfile="$TMPDIR/format_overall_db_stats.tmp" + local tmpfile="$PT_TMPDIR/format_overall_db_stats.tmp" [ -e "$file" ] || return diff --git a/bin/pt-pmp b/bin/pt-pmp index 783a21b5..7e8a9e16 100755 --- a/bin/pt-pmp +++ b/bin/pt-pmp @@ -18,7 +18,7 @@ TOOL="pt-pmp" set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -27,21 +27,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -200,14 +199,14 @@ main() { fi date; for x in $(seq 1 $OPT_i); do - gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $OPT_p >> "${OPT_k:-$TMPDIR/percona-toolkit}" - date +'TS %N.%s %F %T' >> "${OPT_k:-$TMPDIR/percona-toolkit}" + gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $OPT_p >> "${OPT_k:-$PT_TMPDIR/percona-toolkit}" + date +'TS %N.%s %F %T' >> "${OPT_k:-$PT_TMPDIR/percona-toolkit}" sleep $OPT_s done fi if [ $# -eq 0 ]; then - aggregate_stacktrace "${OPT_l}" "${OPT_k:-$TMPDIR/percona-toolkit}" + aggregate_stacktrace "${OPT_l}" "${OPT_k:-$PT_TMPDIR/percona-toolkit}" else aggregate_stacktrace "${OPT_l}" "$@" fi diff --git a/bin/pt-sift b/bin/pt-sift index 86ba7f59..f13786c7 100755 --- a/bin/pt-sift +++ b/bin/pt-sift @@ -27,7 +27,7 @@ usage() { set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -36,21 +36,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -121,17 +120,17 @@ main() { # We need to generate a list of timestamps, and ask the user to choose one if # there is no PREFIX yet. NOTE: we rely on the "-df" files here. - ls "${BASEDIR}" | grep -- '-df$' | cut -d- -f1 | sort > $TMPDIR/pt-sift.prefixes + ls "${BASEDIR}" | grep -- '-df$' | cut -d- -f1 | sort > $PT_TMPDIR/pt-sift.prefixes if [ -z "${PREFIX}" ]; then - if [ "$(grep -c . $TMPDIR/pt-sift.prefixes)" = "1" ]; then + if [ "$(grep -c . $PT_TMPDIR/pt-sift.prefixes)" = "1" ]; then # If there is only one sample, we use it as the prefix. - PREFIX="$(cat $TMPDIR/pt-sift.prefixes)" + PREFIX="$(cat $PT_TMPDIR/pt-sift.prefixes)" fi fi if [ -z "${PREFIX}" ]; then echo i=0 - cat $TMPDIR/pt-sift.prefixes | while read line; do + cat $PT_TMPDIR/pt-sift.prefixes | while read line; do i=$(($i + 1)) echo -n " $line" if [ "${i}" = "3" ]; then @@ -141,14 +140,14 @@ main() { done # We might have ended mid-line or we might have printed a newline; print a # newline if required to end the list of timestamp prefixes. - awk 'BEGIN { i = 0 } { i++ } END { if ( i % 3 != 0 ) { print "" } }' $TMPDIR/pt-sift.prefixes + awk 'BEGIN { i = 0 } { i++ } END { if ( i % 3 != 0 ) { print "" } }' $PT_TMPDIR/pt-sift.prefixes echo - while [ -z "${PREFIX}" -o "$(grep -c "${PREFIX}" $TMPDIR/pt-sift.prefixes)" -ne 1 ]; do - DEFAULT="$(tail -1 $TMPDIR/pt-sift.prefixes)" + while [ -z "${PREFIX}" -o "$(grep -c "${PREFIX}" $PT_TMPDIR/pt-sift.prefixes)" -ne 1 ]; do + DEFAULT="$(tail -1 $PT_TMPDIR/pt-sift.prefixes)" read -e -p "Select a timestamp from the list [${DEFAULT}] " ARG ARG="${ARG:-${DEFAULT}}" - if [ "$(grep -c "${ARG}" $TMPDIR/pt-sift.prefixes)" -eq 1 ]; then - PREFIX="$(grep "${ARG}" $TMPDIR/pt-sift.prefixes)" + if [ "$(grep -c "${ARG}" $PT_TMPDIR/pt-sift.prefixes)" -eq 1 ]; then + PREFIX="$(grep "${ARG}" $PT_TMPDIR/pt-sift.prefixes)" fi done fi @@ -160,7 +159,7 @@ main() { if [ "${ACTION}" != "INVALID" ]; then # Print the current host, timestamp and action. Figure out if we're at # the first or last sample, to make it easy to navigate. - PAGE="$(awk "/./{i++} /${PREFIX}/{c=i} END{print c, \"of\", i}" $TMPDIR/pt-sift.prefixes)" + PAGE="$(awk "/./{i++} /${PREFIX}/{c=i} END{print c, \"of\", i}" $PT_TMPDIR/pt-sift.prefixes)" HOST="$(cat "${BASEDIR}/${PREFIX}-hostname" 2>/dev/null)" echo -e "======== ${HOST:-unknown} at \033[34m${PREFIX} \033[31m${ACTION}\033[0m (${PAGE}) ========" fi @@ -497,7 +496,7 @@ main() { if ( printed == 0 ) { print \"${PREFIX}\"; } - }" $TMPDIR/pt-sift.prefixes)" + }" $PT_TMPDIR/pt-sift.prefixes)" ;; 1) ACTION="DEFAULT" diff --git a/bin/pt-stalk b/bin/pt-stalk index c5e2c2a7..46e42a7c 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -155,7 +155,7 @@ parse_options() { OPT_ERRS=0 OPT_VERSION="" OPT_HELP="" - PO_DIR="$TMPDIR/po" + PO_DIR="$PT_TMPDIR/po" if [ ! -d "$PO_DIR" ]; then mkdir "$PO_DIR" @@ -359,10 +359,10 @@ _parse_command_line() { opt="$(echo $opt | awk -F= '{print $1}')" fi - if [ -f "$TMPDIR/po/$opt" ]; then - spec="$TMPDIR/po/$opt" + if [ -f "$PT_TMPDIR/po/$opt" ]; then + spec="$PT_TMPDIR/po/$opt" else - spec=$(grep "^short form:-$opt\$" "$TMPDIR"/po/* | cut -d ':' -f 1) + spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1) if [ -z "$spec" ]; then option_error "Unknown option: $real_opt" continue @@ -432,7 +432,7 @@ size_to_bytes() { set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -441,21 +441,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -980,7 +979,7 @@ trg_status() { trg_processlist() { local var="$1" - local tmpfile="$TMPDIR/processlist" + local tmpfile="$PT_TMPDIR/processlist" mysqladmin $EXT_ARGV processlist > "$tmpfile-1" grep_processlist "$tmpfile-1" "$var" "$OPT_MATCH" 0 0 > "$tmpfile-2" wc -l "$tmpfile-2" | awk '{print $1}' diff --git a/bin/pt-summary b/bin/pt-summary index 11504bc7..acbee0b6 100755 --- a/bin/pt-summary +++ b/bin/pt-summary @@ -162,7 +162,7 @@ parse_options() { OPT_ERRS=0 OPT_VERSION="" OPT_HELP="" - PO_DIR="$TMPDIR/po" + PO_DIR="$PT_TMPDIR/po" if [ ! -d "$PO_DIR" ]; then mkdir "$PO_DIR" @@ -366,10 +366,10 @@ _parse_command_line() { opt="$(echo $opt | awk -F= '{print $1}')" fi - if [ -f "$TMPDIR/po/$opt" ]; then - spec="$TMPDIR/po/$opt" + if [ -f "$PT_TMPDIR/po/$opt" ]; then + spec="$PT_TMPDIR/po/$opt" else - spec=$(grep "^short form:-$opt\$" "$TMPDIR"/po/* | cut -d ':' -f 1) + spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1) if [ -z "$spec" ]; then option_error "Unknown option: $real_opt" continue @@ -439,7 +439,7 @@ size_to_bytes() { set -u -TMPDIR="" +PT_TMPDIR="" mk_tmpdir() { local dir="${1:-""}" @@ -448,21 +448,20 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - local x="$TMPDIR" - TMPDIR=`TMPDIR="$x" mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### @@ -539,7 +538,7 @@ get_nice_of_pid () { if [ -n "${niceness}" ]; then echo $niceness else - local tmpfile="$TMPDIR/nice_through_c.tmp.c" + local tmpfile="$PT_TMPDIR/nice_through_c.tmp.c" _d "Getting the niceness from ps failed, somehow. We are about to try this:" cat < "$tmpfile" @@ -621,8 +620,8 @@ setup_data_dir () { local existing_dir="$1" local data_dir="" if [ -z "$existing_dir" ]; then - mkdir "$TMPDIR/data" || die "Cannot mkdir $TMPDIR/data" - data_dir="$TMPDIR/data" + mkdir "$PT_TMPDIR/data" || die "Cannot mkdir $PT_TMPDIR/data" + data_dir="$PT_TMPDIR/data" else if [ ! -d "$existing_dir" ]; then mkdir "$existing_dir" || die "Cannot mkdir $existing_dir" @@ -894,7 +893,7 @@ network_device_info () { local ip_minus_s_file="$1" if [ "$CMD_ETHTOOL" ]; then - local tempfile="$TMPDIR/ethtool_output_temp" + local tempfile="$PT_TMPDIR/ethtool_output_temp" for device in $( awk '/^[1-9]/{ print $2 }' "$ip_minus_s_file" \ | awk -F: '{print $1}' \ | grep -v '^lo\|^in\|^gr' \ @@ -997,7 +996,7 @@ find_virtualization () { local PTFUNCNAME=find_virtualization; local dmesg_file="$2" local lspci_file="$3" - local tempfile="$TMPDIR/find_virtualziation.tmp" + local tempfile="$PT_TMPDIR/find_virtualziation.tmp" local virt="" if [ -s "$dmesg_file" ]; then @@ -1087,8 +1086,8 @@ mounted_fs_info () { local PTFUNCNAME=mounted_fs_info; if [ "${platform}" = "Linux" ]; then cmd="df -h -P" fi - $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" - mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - + $cmd | sort > "$PT_TMPDIR/mounted_fs_info.tmp" + mount | sort | join "$PT_TMPDIR/mounted_fs_info.tmp" - fi } @@ -1096,7 +1095,7 @@ raid_controller () { local PTFUNCNAME=raid_controller; local dmesg_file="$1" local lspci_file="$2" - local tempfile="$TMPDIR/raid_controller.tmp" + local tempfile="$PT_TMPDIR/raid_controller.tmp" local controller="" if [ -s "$lspci_file" ]; then @@ -1274,16 +1273,16 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; name_val "Processors" "physical = ${physical}, cores = ${cores}, virtual = ${virtual}, hyperthreading = ${htt}" awk -F: '/cpu MHz/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_cpu.unq" - name_val "Speeds" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_cpu.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_cpu.unq" + name_val "Speeds" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_cpu.unq")" awk -F: '/model name/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_model.unq" - name_val "Models" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_model.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_model.unq" + name_val "Models" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_model.unq")" awk -F: '/cache size/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_cache.unq" - name_val "Caches" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_cache.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_cache.unq" + name_val "Caches" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_cache.unq")" } parse_sysctl_cpu_freebsd() { local PTFUNCNAME=parse_sysctl_cpu_freebsd; @@ -1325,8 +1324,8 @@ parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; start = index($0, " at ") + 4; end = length($0) - start - 4 print substr($0, start, end); - }' "$file" | sort | uniq -c > "$TMPDIR/parse_psrinfo_cpus.tmp" - name_val "Speeds" "$(group_concat "$TMPDIR/parse_psrinfo_cpus.tmp")" + }' "$file" | sort | uniq -c > "$PT_TMPDIR/parse_psrinfo_cpus.tmp" + name_val "Speeds" "$(group_concat "$PT_TMPDIR/parse_psrinfo_cpus.tmp")" } parse_free_minus_b () { local PTFUNCNAME=parse_free_minus_b; diff --git a/lib/bash/collect_mysql_info.sh b/lib/bash/collect_mysql_info.sh index 27b30757..f4dd7337 100644 --- a/lib/bash/collect_mysql_info.sh +++ b/lib/bash/collect_mysql_info.sh @@ -126,8 +126,8 @@ collect_master_logs_status () { # Somewhat different from the others, this one joins the status we got earlier collect_mysql_deferred_status () { local status_file="$1" - collect_mysql_status > "$TMPDIR/defer_gatherer" - join "$status_file" "$TMPDIR/defer_gatherer" + collect_mysql_status > "$PT_TMPDIR/defer_gatherer" + join "$status_file" "$PT_TMPDIR/defer_gatherer" } collect_internal_vars () { diff --git a/lib/bash/collect_system_info.sh b/lib/bash/collect_system_info.sh index 0cf5cd32..726b4e18 100644 --- a/lib/bash/collect_system_info.sh +++ b/lib/bash/collect_system_info.sh @@ -183,7 +183,7 @@ network_device_info () { local ip_minus_s_file="$1" if [ "$CMD_ETHTOOL" ]; then - local tempfile="$TMPDIR/ethtool_output_temp" + local tempfile="$PT_TMPDIR/ethtool_output_temp" # For each entry in the ip -s link dump, check if itu starts with a number. # If it does, print the second field. Then remove the colon and everything # following that. Then skip what are usually interfaces. @@ -298,7 +298,7 @@ find_virtualization () { local PTFUNCNAME=find_virtualization; local dmesg_file="$2" local lspci_file="$3" - local tempfile="$TMPDIR/find_virtualziation.tmp" + local tempfile="$PT_TMPDIR/find_virtualziation.tmp" local virt="" if [ -s "$dmesg_file" ]; then @@ -395,8 +395,8 @@ mounted_fs_info () { local PTFUNCNAME=mounted_fs_info; if [ "${platform}" = "Linux" ]; then cmd="df -h -P" fi - $cmd | sort > "$TMPDIR/mounted_fs_info.tmp" - mount | sort | join "$TMPDIR/mounted_fs_info.tmp" - + $cmd | sort > "$PT_TMPDIR/mounted_fs_info.tmp" + mount | sort | join "$PT_TMPDIR/mounted_fs_info.tmp" - fi } @@ -409,7 +409,7 @@ raid_controller () { local PTFUNCNAME=raid_controller; local dmesg_file="$1" local lspci_file="$2" - local tempfile="$TMPDIR/raid_controller.tmp" + local tempfile="$PT_TMPDIR/raid_controller.tmp" local controller="" if [ -s "$lspci_file" ]; then diff --git a/lib/bash/parse_options.sh b/lib/bash/parse_options.sh index 3bb2762f..5ac93665 100644 --- a/lib/bash/parse_options.sh +++ b/lib/bash/parse_options.sh @@ -23,7 +23,7 @@ # global variables for each option. # XXX -# GLOBAL $TMPDIR AND $TOOL MUST BE SET BEFORE USING THIS LIB! +# GLOBAL $PT_TMPDIR AND $TOOL MUST BE SET BEFORE USING THIS LIB! # XXX # Parsing command line options with Bash is easy until we have to dealt @@ -63,7 +63,7 @@ PO_DIR="" # Directory with program option spec files # file - Program file with Perl POD which has usage and options. # # Required Global Variables: -# TIMDIR - Temp directory set by . +# TIMDIR - Temp directory set by . # TOOL - Tool's name. usage() { local file="$1" @@ -150,7 +150,7 @@ option_error() { # file - Program file with Perl POD options. # # Required Global Variables: -# TIMDIR - Temp directory set by . +# TIMDIR - Temp directory set by . # # Set Global Variables: # This sub decalres a global var for each option by uppercasing the @@ -169,7 +169,7 @@ parse_options() { OPT_ERRS=0 OPT_VERSION="" OPT_HELP="" - PO_DIR="$TMPDIR/po" + PO_DIR="$PT_TMPDIR/po" # Ready the directory for the program option (po) spec files. if [ ! -d "$PO_DIR" ]; then @@ -422,10 +422,10 @@ _parse_command_line() { fi # Find the option's spec file. - if [ -f "$TMPDIR/po/$opt" ]; then - spec="$TMPDIR/po/$opt" + if [ -f "$PT_TMPDIR/po/$opt" ]; then + spec="$PT_TMPDIR/po/$opt" else - spec=$(grep "^short form:-$opt\$" "$TMPDIR"/po/* | cut -d ':' -f 1) + spec=$(grep "^short form:-$opt\$" "$PT_TMPDIR"/po/* | cut -d ':' -f 1) if [ -z "$spec" ]; then option_error "Unknown option: $real_opt" continue diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 4a869ba1..c939bb9d 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -476,7 +476,7 @@ find_max_trx_time() { find_transation_states () { local file="$1" - local tmpfile="$TMPDIR/find_transation_states.tmp" + local tmpfile="$PT_TMPDIR/find_transation_states.tmp" [ -e "$file" ] || return @@ -531,7 +531,7 @@ format_innodb_status () { # then there should be multiple databases. format_overall_db_stats () { local file="$1" - local tmpfile="$TMPDIR/format_overall_db_stats.tmp" + local tmpfile="$PT_TMPDIR/format_overall_db_stats.tmp" [ -e "$file" ] || return diff --git a/lib/bash/report_system_info.sh b/lib/bash/report_system_info.sh index aa60fc62..09b9646c 100644 --- a/lib/bash/report_system_info.sh +++ b/lib/bash/report_system_info.sh @@ -55,16 +55,16 @@ parse_proc_cpuinfo () { local PTFUNCNAME=parse_proc_cpuinfo; name_val "Processors" "physical = ${physical}, cores = ${cores}, virtual = ${virtual}, hyperthreading = ${htt}" awk -F: '/cpu MHz/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_cpu.unq" - name_val "Speeds" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_cpu.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_cpu.unq" + name_val "Speeds" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_cpu.unq")" awk -F: '/model name/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_model.unq" - name_val "Models" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_model.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_model.unq" + name_val "Models" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_model.unq")" awk -F: '/cache size/{print $2}' "${file}" \ - | sort | uniq -c > "$TMPDIR/parse_proc_cpuinfo_cache.unq" - name_val "Caches" "$(group_concat "$TMPDIR/parse_proc_cpuinfo_cache.unq")" + | sort | uniq -c > "$PT_TMPDIR/parse_proc_cpuinfo_cache.unq" + name_val "Caches" "$(group_concat "$PT_TMPDIR/parse_proc_cpuinfo_cache.unq")" } # ############################################################################## @@ -121,8 +121,8 @@ parse_psrinfo_cpus() { local PTFUNCNAME=parse_psrinfo_cpus; start = index($0, " at ") + 4; end = length($0) - start - 4 print substr($0, start, end); - }' "$file" | sort | uniq -c > "$TMPDIR/parse_psrinfo_cpus.tmp" - name_val "Speeds" "$(group_concat "$TMPDIR/parse_psrinfo_cpus.tmp")" + }' "$file" | sort | uniq -c > "$PT_TMPDIR/parse_psrinfo_cpus.tmp" + name_val "Speeds" "$(group_concat "$PT_TMPDIR/parse_psrinfo_cpus.tmp")" } # ############################################################################## @@ -409,7 +409,7 @@ parse_filesystems () { local PTFUNCNAME=parse_filesystems; } # ############################################################################## -# Parse the output of fdisk -l, which should be in $TMPDIR/percona-toolkit; there might be +# Parse the output of fdisk -l, which should be in $PT_TMPDIR/percona-toolkit; there might be # multiple fdisk -l outputs in the file. # ############################################################################## parse_fdisk () { local PTFUNCNAME=parse_fdisk; @@ -460,7 +460,7 @@ parse_ethernet_controller_lspci () { local PTFUNCNAME=parse_ethernet_controller_ # ############################################################################## # Parse the output of "hpacucli ctrl all show config", which should be stored in -# $TMPDIR/percona-toolkit +# $PT_TMPDIR/percona-toolkit # ############################################################################## parse_hpacucli () { local PTFUNCNAME=parse_hpacucli; local file="$1" @@ -469,7 +469,7 @@ parse_hpacucli () { local PTFUNCNAME=parse_hpacucli; } # ############################################################################## -# Parse the output of arcconf, which should be stored in $TMPDIR/percona-toolkit +# Parse the output of arcconf, which should be stored in $PT_TMPDIR/percona-toolkit # ############################################################################## parse_arcconf () { local PTFUNCNAME=parse_arcconf; local file="$1" diff --git a/lib/bash/summary_common.sh b/lib/bash/summary_common.sh index fa7fd88d..d6c7399b 100644 --- a/lib/bash/summary_common.sh +++ b/lib/bash/summary_common.sh @@ -37,7 +37,7 @@ get_nice_of_pid () { if [ -n "${niceness}" ]; then echo $niceness else - local tmpfile="$TMPDIR/nice_through_c.tmp.c" + local tmpfile="$PT_TMPDIR/nice_through_c.tmp.c" _d "Getting the niceness from ps failed, somehow. We are about to try this:" cat < "$tmpfile" #include @@ -127,8 +127,8 @@ setup_data_dir () { local data_dir="" if [ -z "$existing_dir" ]; then # User didn't specify a --save-data dir, so use a sub-dir in our tmpdir. - mkdir "$TMPDIR/data" || die "Cannot mkdir $TMPDIR/data" - data_dir="$TMPDIR/data" + mkdir "$PT_TMPDIR/data" || die "Cannot mkdir $PT_TMPDIR/data" + data_dir="$PT_TMPDIR/data" else # Check the user's --save-data dir. if [ ! -d "$existing_dir" ]; then diff --git a/lib/bash/tmpdir.sh b/lib/bash/tmpdir.sh index e573ffe5..b9acb186 100644 --- a/lib/bash/tmpdir.sh +++ b/lib/bash/tmpdir.sh @@ -24,16 +24,16 @@ set -u # Global variables. -TMPDIR="" +PT_TMPDIR="" # Sub: mk_tmpdir -# Create a secure tmpdir and set TMPDIR. +# Create a secure tmpdir and set PT_TMPDIR. # # Optional Arguments: # dir - User-specified tmpdir (default none). # # Set Global Variables: -# TMPDIR - Absolute path of secure temp directory. +# PT_TMPDIR - Absolute path of secure temp directory. mk_tmpdir() { local dir="${1:-""}" @@ -41,28 +41,28 @@ mk_tmpdir() { if [ ! -d "$dir" ]; then mkdir "$dir" || die "Cannot make tmpdir $dir" fi - TMPDIR="$dir" + PT_TMPDIR="$dir" else local tool="${0##*/}" local pid="$$" - TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ + PT_TMPDIR=`mktemp -d -t "${tool}.${pid}.XXXXXX"` \ || die "Cannot make secure tmpdir" fi } # Sub: rm_tmpdir -# Remove the tmpdir and unset TMPDIR. +# Remove the tmpdir and unset PT_TMPDIR. # # Optional Global Variables: -# TMPDIR - TMPDIR set by . +# PT_TMPDIR - PT_TMPDIR set by . # # Set Global Variables: -# TMPDIR - Set to "". +# PT_TMPDIR - Set to "". rm_tmpdir() { - if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then - rm -rf "$TMPDIR" + if [ -n "$PT_TMPDIR" ] && [ -d "$PT_TMPDIR" ]; then + rm -rf "$PT_TMPDIR" fi - TMPDIR="" + PT_TMPDIR="" } # ########################################################################### diff --git a/t/lib/bash/alt_cmds.sh b/t/lib/bash/alt_cmds.sh index b37e7321..6161c26b 100644 --- a/t/lib/bash/alt_cmds.sh +++ b/t/lib/bash/alt_cmds.sh @@ -4,9 +4,9 @@ plan 1 source "$LIB_DIR/alt_cmds.sh" -_seq 5 > $TEST_TMPDIR/out +_seq 5 > $TEST_PT_TMPDIR/out no_diff \ - $TEST_TMPDIR/out \ + $TEST_PT_TMPDIR/out \ $T_LIB_DIR/samples/bash/seq1.txt \ "_seq 5" diff --git a/t/lib/bash/collect.sh b/t/lib/bash/collect.sh index 1492b628..b7e4fe88 100644 --- a/t/lib/bash/collect.sh +++ b/t/lib/bash/collect.sh @@ -2,12 +2,12 @@ plan 21 -TMPFILE="$TEST_TMPDIR/parse-opts-output" -TMPDIR="$TEST_TMPDIR" +TMPFILE="$TEST_PT_TMPDIR/parse-opts-output" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" TOOL="pt-stalk" -mkdir "$TMPDIR/collect" 2>/dev/null +mkdir "$PT_TMPDIR/collect" 2>/dev/null source "$LIB_DIR/log_warn_die.sh" source "$LIB_DIR/parse_options.sh" @@ -18,28 +18,28 @@ source "$LIB_DIR/collect.sh" parse_options "$BIN_DIR/pt-stalk" --run-time 1 -- --defaults-file=/tmp/12345/my.sandbox.cnf # Prefix (with path) for the collect files. -p="$TMPDIR/collect/2011_12_05" +p="$PT_TMPDIR/collect/2011_12_05" # Default collect, no extras like gdb, tcpdump, etc. -collect "$TMPDIR/collect" "2011_12_05" > $p-output 2>&1 +collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1 # 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 $TMPDIR/collect | sort > $TMPDIR/collect-files +ls -1 $PT_TMPDIR/collect | sort > $PT_TMPDIR/collect-files # If this system has /proc, then some files should be collected. # Else, those files should not exist. if [ -f /proc/diskstats ]; then cmd_ok \ - "grep -q '[0-9]' $TMPDIR/collect/2011_12_05-diskstats" \ + "grep -q '[0-9]' $PT_TMPDIR/collect/2011_12_05-diskstats" \ "/proc/diskstats" else - test -f $TMPDIR/collect/2011_12_05-diskstats + test -f $PT_TMPDIR/collect/2011_12_05-diskstats is "$?" "1" "No /proc/diskstats" fi cmd_ok \ - "grep -q '\-hostname\$' $TMPDIR/collect-files" \ + "grep -q '\-hostname\$' $PT_TMPDIR/collect-files" \ "Collected hostname" cmd_ok \ @@ -136,9 +136,9 @@ is "$empty_files" "0" "No empty files" parse_options "$BIN_DIR/pt-stalk" --run-time 2 -- --defaults-file=/tmp/12345/my.sandbox.cnf -rm $TMPDIR/collect/* +rm $PT_TMPDIR/collect/* -collect "$TMPDIR/collect" "2011_12_05" > $p-output 2>&1 +collect "$PT_TMPDIR/collect" "2011_12_05" > $p-output 2>&1 iters=$(cat $p-df | grep -c '^TS ') is "$iters" "2" "2 iteration/2s run time" diff --git a/t/lib/bash/collect_mysql_info.sh b/t/lib/bash/collect_mysql_info.sh index 5cf8a84b..4bb4557d 100644 --- a/t/lib/bash/collect_mysql_info.sh +++ b/t/lib/bash/collect_mysql_info.sh @@ -2,7 +2,7 @@ plan 20 -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" TOOL="pt-mysql-summary" @@ -13,7 +13,7 @@ TOOL="pt-mysql-summary" . "$LIB_DIR/collect_mysql_info.sh" # Prefix (with path) for the collect files. -p="$TMPDIR/collect_mysql_info" +p="$PT_TMPDIR/collect_mysql_info" samples="$PERCONA_TOOLKIT_BRANCH/t/pt-mysql-summary/samples" mkdir "$p" @@ -30,36 +30,36 @@ file_count=$(ls "$p" | wc -l) is $file_count 14 "Creates the correct number of files (without --databases)" -awk '{print $1}' "$p/mysqld-instances" > "$TMPDIR/collect_mysqld_instances1.test" +awk '{print $1}' "$p/mysqld-instances" > "$PT_TMPDIR/collect_mysqld_instances1.test" pids="$(_pidof mysqld)" pids="$(echo $pids | sed -e "s/[ \n]/,/g")" -ps ww -p "$pids" | awk '{print $1}' > "$TMPDIR/collect_mysqld_instances2.test" +ps ww -p "$pids" | awk '{print $1}' > "$PT_TMPDIR/collect_mysqld_instances2.test" no_diff \ - "$TMPDIR/collect_mysqld_instances1.test" \ - "$TMPDIR/collect_mysqld_instances2.test" \ + "$PT_TMPDIR/collect_mysqld_instances1.test" \ + "$PT_TMPDIR/collect_mysqld_instances2.test" \ "collect_mysql_info() finds the correct instances" -collect_mysqld_instances /dev/null > "$TMPDIR/collect_mysqld_instances3.test" +collect_mysqld_instances /dev/null > "$PT_TMPDIR/collect_mysqld_instances3.test" -awk '{print $1}' "$TMPDIR/collect_mysqld_instances3.test"> "$TMPDIR/collect_mysqld_instances4.test" +awk '{print $1}' "$PT_TMPDIR/collect_mysqld_instances3.test"> "$PT_TMPDIR/collect_mysqld_instances4.test" no_diff \ - "$TMPDIR/collect_mysqld_instances4.test" \ - "$TMPDIR/collect_mysqld_instances2.test" \ + "$PT_TMPDIR/collect_mysqld_instances4.test" \ + "$PT_TMPDIR/collect_mysqld_instances2.test" \ "(sanity check) which are the same that collect_mysqld_instances() does" # collect_mysql_status -$CMD_MYSQL $EXT_ARGV -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' > "$TMPDIR/collect_mysql_status" +$CMD_MYSQL $EXT_ARGV -ss -e 'SHOW /*!50000 GLOBAL*/ STATUS' > "$PT_TMPDIR/collect_mysql_status" # TODO This is still pretty fragile. -awk '{print $1}' "$p/mysql-status" | sort > "$TMPDIR/collect_mysql_status_collect" -awk '{print $1}' "$TMPDIR/collect_mysql_status" | sort > "$TMPDIR/collect_mysql_status_manual" +awk '{print $1}' "$p/mysql-status" | sort > "$PT_TMPDIR/collect_mysql_status_collect" +awk '{print $1}' "$PT_TMPDIR/collect_mysql_status" | sort > "$PT_TMPDIR/collect_mysql_status_manual" no_diff \ - "$TMPDIR/collect_mysql_status_collect" \ - "$TMPDIR/collect_mysql_status_manual" \ + "$PT_TMPDIR/collect_mysql_status_collect" \ + "$PT_TMPDIR/collect_mysql_status_manual" \ "collect_mysql_status works the same than if done manually" port="$(get_var port "$p/mysql-variables")" @@ -72,10 +72,10 @@ is \ # collect_internal_vars pat='pt-summary-internal-user\|pt-summary-internal-FNV_64\|pt-summary-internal-trigger_count\|pt-summary-internal-symbols' -collect_internal_vars > "$TMPDIR/collect_internal_vars" +collect_internal_vars > "$PT_TMPDIR/collect_internal_vars" is \ "$( grep $pat "$p/mysql-variables" )" \ - "$( grep $pat "$TMPDIR/collect_internal_vars" )" \ + "$( grep $pat "$PT_TMPDIR/collect_internal_vars" )" \ "collect_internal_vars works" # find_my_cnf_file @@ -100,21 +100,21 @@ is "$res" "/var/lib/mysql/my.cnf" "ps-mysqld-004.txt with port" # collect_mysql_databases -$CMD_MYSQL $EXT_ARGV -ss -e 'SHOW DATABASES' > "$TMPDIR/mysql_collect_databases" 2>/dev/null +$CMD_MYSQL $EXT_ARGV -ss -e 'SHOW DATABASES' > "$PT_TMPDIR/mysql_collect_databases" 2>/dev/null no_diff \ "$p/mysql-databases" \ - "$TMPDIR/mysql_collect_databases" \ + "$PT_TMPDIR/mysql_collect_databases" \ "collect_mysql_databases works" $CMD_MYSQL $EXT_ARGV -ss -e 'CREATE DATABASE collect_mysql_databases_test;' 1>/dev/null 2>&1 -collect_mysql_databases > "$TMPDIR/mysql_collect_databases" +collect_mysql_databases > "$PT_TMPDIR/mysql_collect_databases" $CMD_MYSQL $EXT_ARGV -ss -e 'DROP DATABASE collect_mysql_databases_test;' cmd_ok \ - "grep collect_mysql_databases_test '$TMPDIR/mysql_collect_databases' 1>/dev/null 2>&1" \ + "grep collect_mysql_databases_test '$PT_TMPDIR/mysql_collect_databases' 1>/dev/null 2>&1" \ "...and finds new dbs when we add them" # collect_master_logs_status @@ -136,42 +136,42 @@ test_get_mysqldump_for () { local dir="$1" # Let's fake mysqldump - printf '#!/usr/bin/env bash\necho $@\n' > "$TMPDIR/mysqldump_fake.sh" - chmod +x "$TMPDIR/mysqldump_fake.sh" + printf '#!/usr/bin/env bash\necho $@\n' > "$PT_TMPDIR/mysqldump_fake.sh" + chmod +x "$PT_TMPDIR/mysqldump_fake.sh" local orig_mysqldump="$CMD_MYSQLDUMP" - local CMD_MYSQLDUMP="$TMPDIR/mysqldump_fake.sh" + local CMD_MYSQLDUMP="$PT_TMPDIR/mysqldump_fake.sh" - cat < "$TMPDIR/expected" + cat < "$PT_TMPDIR/expected" --defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases --all-databases EOF get_mysqldump_for '' > "$dir/mysqldump_test_1" no_diff \ "$dir/mysqldump_test_1" \ - "$TMPDIR/expected" \ + "$PT_TMPDIR/expected" \ "get_mysqldump_for picks a name default" get_mysqldump_for '' '--all-databases' > "$dir/mysqldump_test_2" no_diff \ "$dir/mysqldump_test_2" \ - "$TMPDIR/expected" \ + "$PT_TMPDIR/expected" \ "..which is the same as if we explicitly set --all-databases" - cat < "$TMPDIR/expected" + cat < "$PT_TMPDIR/expected" --defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases a EOF get_mysqldump_for '' 'a' > "$dir/mysqldump_test_3" no_diff \ "$dir/mysqldump_test_3" \ - "$TMPDIR/expected" \ + "$PT_TMPDIR/expected" \ "get_mysqldump_for: Explicitly setting a database works" - cat < "$TMPDIR/expected" + cat < "$PT_TMPDIR/expected" --defaults-file=/tmp/12345/my.sandbox.cnf --no-data --skip-comments --skip-add-locks --skip-add-drop-table --compact --skip-lock-all-tables --skip-lock-tables --skip-set-charset --databases a b EOF get_mysqldump_for '' 'a,b' > "$dir/mysqldump_test_4" no_diff \ "$dir/mysqldump_test_4" \ - "$TMPDIR/expected" \ + "$PT_TMPDIR/expected" \ "get_mysqldump_for: Two databases separated by a comma are interpreted correctly" if [ -n "$orig_mysqldump" ]; then @@ -195,5 +195,5 @@ EOF } -mkdir "$TMPDIR/mysqldump" -test_get_mysqldump_for "$TMPDIR/mysqldump" +mkdir "$PT_TMPDIR/mysqldump" +test_get_mysqldump_for "$PT_TMPDIR/mysqldump" diff --git a/t/lib/bash/collect_system_info.sh b/t/lib/bash/collect_system_info.sh index 448f35f5..90248ad8 100644 --- a/t/lib/bash/collect_system_info.sh +++ b/t/lib/bash/collect_system_info.sh @@ -2,7 +2,7 @@ plan 40 -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" TOOL="pt-summary" @@ -14,7 +14,7 @@ TOOL="pt-summary" . "$LIB_DIR/collect_system_info.sh" # Prefix (with path) for the collect files. -p="$TMPDIR/collect_mysql_info" +p="$PT_TMPDIR/collect_mysql_info" samples="$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples" mkdir "$p" @@ -25,116 +25,116 @@ setup_commands collect_system_data "$p" -p2="$TMPDIR/collect_mysql_info2" +p2="$PT_TMPDIR/collect_mysql_info2" mkdir "$p2" touch "$p2/some_empty_file" collect_system_data "$p2" cmd_ok "test ! -e \"$p2/some_empty_file\"" "collect_system_data removes empty files before exiting" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Fusion-MPT SAS EOF -find_raid_controller_lspci "$samples/lspci-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-001.txt" +find_raid_controller_lspci "$samples/lspci-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" LSI Logic Unknown EOF -find_raid_controller_lspci "$samples/lspci-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-002.txt" +find_raid_controller_lspci "$samples/lspci-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-002.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" AACRAID EOF -find_raid_controller_lspci "$samples/lspci-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-003.txt" +find_raid_controller_lspci "$samples/lspci-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-003.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" LSI Logic MegaRAID SAS EOF -find_raid_controller_lspci "$samples/lspci-004.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-004.txt" +find_raid_controller_lspci "$samples/lspci-004.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-004.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Fusion-MPT SAS EOF -find_raid_controller_lspci "$samples/lspci-005.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-005.txt" +find_raid_controller_lspci "$samples/lspci-005.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-005.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" HP Smart Array EOF -find_raid_controller_lspci "$samples/lspci-006.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lspci-006.txt" +find_raid_controller_lspci "$samples/lspci-006.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lspci-006.txt" # find_raid_controller_dmesg -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Fusion-MPT SAS EOF -find_raid_controller_dmesg "$samples/dmesg-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-001.txt" +find_raid_controller_dmesg "$samples/dmesg-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" AACRAID EOF -find_raid_controller_dmesg "$samples/dmesg-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-002.txt" +find_raid_controller_dmesg "$samples/dmesg-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-002.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" LSI Logic MegaRAID SAS EOF -find_raid_controller_dmesg "$samples/dmesg-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-003.txt" +find_raid_controller_dmesg "$samples/dmesg-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-003.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" AACRAID EOF -find_raid_controller_dmesg "$samples/dmesg-004.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-004.txt" +find_raid_controller_dmesg "$samples/dmesg-004.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-004.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Fusion-MPT SAS EOF -find_raid_controller_dmesg "$samples/dmesg-005.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-005.txt" +find_raid_controller_dmesg "$samples/dmesg-005.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-005.txt" # TODO is this right? -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" EOF -find_raid_controller_dmesg "$samples/dmesg-006.txt" > "$TMPDIR/got" -cat "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-006.txt" +find_raid_controller_dmesg "$samples/dmesg-006.txt" > "$PT_TMPDIR/got" +cat "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-006.txt" # TODO is this right? -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" EOF -find_raid_controller_dmesg "$samples/dmesg-007.txt" > "$TMPDIR/got" -cat "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmesg-007.txt" +find_raid_controller_dmesg "$samples/dmesg-007.txt" > "$PT_TMPDIR/got" +cat "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmesg-007.txt" # raid_controller -rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "" "" > "$TMPDIR/raid_controller_outfile.tmp" +rm "$PT_TMPDIR/raid_controller_outfile.tmp" 2>/dev/null +raid_controller "" "" > "$PT_TMPDIR/raid_controller_outfile.tmp" is \ - "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ + "$(get_var raid_controller "$PT_TMPDIR/raid_controller_outfile.tmp")" \ "No RAID controller detected" \ "raid_controller has a sane default" -rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "" "$samples/lspci-001.txt" > "$TMPDIR/raid_controller_outfile.tmp" +rm "$PT_TMPDIR/raid_controller_outfile.tmp" 2>/dev/null +raid_controller "" "$samples/lspci-001.txt" > "$PT_TMPDIR/raid_controller_outfile.tmp" is \ - "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ + "$(get_var raid_controller "$PT_TMPDIR/raid_controller_outfile.tmp")" \ "Fusion-MPT SAS" \ "raid_controller gets the correct result from an lspci file" -rm "$TMPDIR/raid_controller_outfile.tmp" 2>/dev/null -raid_controller "$samples/dmesg-004.txt" "" > "$TMPDIR/raid_controller_outfile.tmp" +rm "$PT_TMPDIR/raid_controller_outfile.tmp" 2>/dev/null +raid_controller "$samples/dmesg-004.txt" "" > "$PT_TMPDIR/raid_controller_outfile.tmp" is \ - "$(get_var raid_controller "$TMPDIR/raid_controller_outfile.tmp")" \ + "$(get_var raid_controller "$PT_TMPDIR/raid_controller_outfile.tmp")" \ "AACRAID" \ "...Or from a dmseg file" @@ -142,8 +142,8 @@ is \ i=1 for expected in "" "" "" "" "" "Xen" "VirtualBox"; do - find_virtualization_dmesg "$samples/dmesg-00$i.txt" > "$TMPDIR/got" - is "$(cat "$TMPDIR/got")" "$expected" "dmesg-00$i.txt" + find_virtualization_dmesg "$samples/dmesg-00$i.txt" > "$PT_TMPDIR/got" + is "$(cat "$PT_TMPDIR/got")" "$expected" "dmesg-00$i.txt" i=$(($i + 1)) done @@ -153,9 +153,9 @@ fake_command () { local cmd="$1" local output="$2" - printf "#!/usr/bin/env bash\necho \"${output}\"\n" > "$TMPDIR/${cmd}_replacement" - chmod +x "$TMPDIR/${cmd}_replacement" - eval "CMD_$(echo $cmd | tr '[a-z]' '[A-Z]')=\"$TMPDIR/${cmd}_replacement\"" + printf "#!/usr/bin/env bash\necho \"${output}\"\n" > "$PT_TMPDIR/${cmd}_replacement" + chmod +x "$PT_TMPDIR/${cmd}_replacement" + eval "CMD_$(echo $cmd | tr '[a-z]' '[A-Z]')=\"$PT_TMPDIR/${cmd}_replacement\"" } test_linux_exclusive_collection () { @@ -208,12 +208,12 @@ test_linux_exclusive_collection () { platform="$(get_var platform "$p/summary")" if [ "$platform" = "Linux" ]; then - mkdir "$TMPDIR/linux_data" + mkdir "$PT_TMPDIR/linux_data" if [ -e "$p/sysctl" ]; then - cp "$p/sysctl" "$TMPDIR/linux_data/sysctl" + cp "$p/sysctl" "$PT_TMPDIR/linux_data/sysctl" fi - test_linux_exclusive_collection "$TMPDIR/linux_data" - rm -rf "$TMPDIR/linux_data" + test_linux_exclusive_collection "$PT_TMPDIR/linux_data" + rm -rf "$PT_TMPDIR/linux_data" else skip 1 5 "Tests exclusive for Linux" fi @@ -257,8 +257,8 @@ test_propietary_raid_controller () { "AACRAID calls arcconf" } -mkdir "$TMPDIR/raid_controller" -test_propietary_raid_controller "$TMPDIR/raid_controller" +mkdir "$PT_TMPDIR/raid_controller" +test_propietary_raid_controller "$PT_TMPDIR/raid_controller" # notable_processes_info @@ -270,9 +270,9 @@ forked_pid="$!" if [ -e /proc/$forked_pid/oom_adj ] \ && echo "-17" > /proc/$forked_pid/oom_adj 2>/dev/null; then - notable_processes_info > "$TMPDIR/notable_procs" + notable_processes_info > "$PT_TMPDIR/notable_procs" like \ - "$(cat "$TMPDIR/notable_procs")" \ + "$(cat "$PT_TMPDIR/notable_procs")" \ "${forked_pid}\\s+-17" \ "notable_proccesses_info finds the process we manually changed earlier" @@ -309,6 +309,6 @@ EOF "..but if it's there, it gets called with the expected parameters " } -mkdir "$TMPDIR/dmidecode_system_info" -test_dmidecode_system_info "$TMPDIR/dmidecode_system_info" +mkdir "$PT_TMPDIR/dmidecode_system_info" +test_dmidecode_system_info "$PT_TMPDIR/dmidecode_system_info" diff --git a/t/lib/bash/daemon.sh b/t/lib/bash/daemon.sh index c46d560f..61af5cb3 100644 --- a/t/lib/bash/daemon.sh +++ b/t/lib/bash/daemon.sh @@ -2,8 +2,8 @@ plan 9 -TMPDIR="$TEST_TMPDIR" -file="$TMPDIR/pid-file" +PT_TMPDIR="$TEST_PT_TMPDIR" +file="$PT_TMPDIR/pid-file" source "$LIB_DIR/log_warn_die.sh" source "$LIB_DIR/daemon.sh" @@ -36,19 +36,19 @@ cmd_ok \ echo $$ > $file ( - make_pid_file $file $$ >$TMPDIR/output 2>&1 + make_pid_file $file $$ >$PT_TMPDIR/output 2>&1 ) cmd_ok \ - "grep -q \"PID file /tmp/percona-toolkit.test/pid-file already exists and its PID ($$) is running\" $TMPDIR/output" \ + "grep -q \"PID file /tmp/percona-toolkit.test/pid-file already exists and its PID ($$) is running\" $PT_TMPDIR/output" \ "Does not overwrite PID file is PID is running" echo 999999 > $file -make_pid_file $file $$ >$TMPDIR/output 2>&1 +make_pid_file $file $$ >$PT_TMPDIR/output 2>&1 cmd_ok \ - "grep -q 'Overwriting PID file /tmp/percona-toolkit.test/pid-file because its PID (999999) is not running' $TMPDIR/output" \ + "grep -q 'Overwriting PID file /tmp/percona-toolkit.test/pid-file because its PID (999999) is not running' $PT_TMPDIR/output" \ "Overwrites PID file if PID is not running" pid=`cat $file` @@ -58,13 +58,13 @@ is \ "Correct PID" rm $file -rm $TMPDIR/output +rm $PT_TMPDIR/output # ########################################################################### # Die if pid file can't be created. # ########################################################################### ( - make_pid_file "/root/pid" $$ >$TMPDIR/output 2>&1 + make_pid_file "/root/pid" $$ >$PT_TMPDIR/output 2>&1 ) is \ @@ -73,7 +73,7 @@ is \ "Exit 1 if PID file can't be created" cmd_ok \ - "grep -q 'Cannot create or write PID file /root/pid' $TMPDIR/output" \ + "grep -q 'Cannot create or write PID file /root/pid' $PT_TMPDIR/output" \ "Error that PID file can't be created" # ########################################################################### diff --git a/t/lib/bash/log_warn_die.sh b/t/lib/bash/log_warn_die.sh index b31c1308..8d71d089 100644 --- a/t/lib/bash/log_warn_die.sh +++ b/t/lib/bash/log_warn_die.sh @@ -4,14 +4,14 @@ plan 6 source "$LIB_DIR/log_warn_die.sh" -log "Hello world!" > $TEST_TMPDIR/log +log "Hello world!" > $TEST_PT_TMPDIR/log cmd_ok \ - "grep -q 'Hello world!' $TEST_TMPDIR/log" \ + "grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \ "log msg" -log "Hello" "world!" > $TEST_TMPDIR/log +log "Hello" "world!" > $TEST_PT_TMPDIR/log cmd_ok \ - "grep -q 'Hello world!' $TEST_TMPDIR/log" \ + "grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \ "log msg msg" is \ @@ -19,14 +19,14 @@ is \ "0" \ "Exit status 0" -warn "Hello world!" 2> $TEST_TMPDIR/log +warn "Hello world!" 2> $TEST_PT_TMPDIR/log cmd_ok \ - "grep -q 'Hello world!' $TEST_TMPDIR/log" \ + "grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \ "warn msg" -warn "Hello" "world!" 2> $TEST_TMPDIR/log +warn "Hello" "world!" 2> $TEST_PT_TMPDIR/log cmd_ok \ - "grep -q 'Hello world!' $TEST_TMPDIR/log" \ + "grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \ "warn msg msg" is \ diff --git a/t/lib/bash/parse_options.sh b/t/lib/bash/parse_options.sh index f9536d65..2d709008 100644 --- a/t/lib/bash/parse_options.sh +++ b/t/lib/bash/parse_options.sh @@ -2,9 +2,9 @@ plan 78 -TMPFILE="$TEST_TMPDIR/parse-opts-output" +TMPFILE="$TEST_PT_TMPDIR/parse-opts-output" TOOL="pt-stalk" -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" source "$LIB_DIR/log_warn_die.sh" source "$LIB_DIR/parse_options.sh" diff --git a/t/lib/bash/report_mysql_info.sh b/t/lib/bash/report_mysql_info.sh index 00b4e294..e3c260f2 100644 --- a/t/lib/bash/report_mysql_info.sh +++ b/t/lib/bash/report_mysql_info.sh @@ -8,7 +8,7 @@ plan 32 . "$LIB_DIR/report_formatting.sh" . "$LIB_DIR/report_mysql_info.sh" -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" TOOL="pt-mysql-summary" @@ -18,30 +18,30 @@ NAME_VAL_LEN=20 # table_cache # ########################################################################### -rm $TMPDIR/table_cache_tests 2>/dev/null -touch $TMPDIR/table_cache_tests +rm $PT_TMPDIR/table_cache_tests 2>/dev/null +touch $PT_TMPDIR/table_cache_tests is \ - $(get_table_cache "$TMPDIR/table_cache_tests") \ + $(get_table_cache "$PT_TMPDIR/table_cache_tests") \ 0 \ "0 if neither table_cache nor table_open_cache are present" -cat < $TMPDIR/table_cache_tests +cat < $PT_TMPDIR/table_cache_tests table_cache 5 table_open_cache 4 EOF is \ - $(get_table_cache "$TMPDIR/table_cache_tests") \ + $(get_table_cache "$PT_TMPDIR/table_cache_tests") \ 4 \ "If there's a table_open_cache present, uses that" -cat < $TMPDIR/table_cache_tests +cat < $PT_TMPDIR/table_cache_tests table_cache 5 EOF is \ - $(get_table_cache "$TMPDIR/table_cache_tests") \ + $(get_table_cache "$PT_TMPDIR/table_cache_tests") \ 5 \ "Otherwise, defaults to table_cache" @@ -49,7 +49,7 @@ is \ # summarize_processlist # ########################################################################### -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Command COUNT(*) Working SUM(Time) MAX(Time) ------------------------------ -------- ------- --------- --------- @@ -106,28 +106,28 @@ cat < $TMPDIR/expected EOF -summarize_processlist "$samples/processlist-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "summarize_processlist" +summarize_processlist "$samples/processlist-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "summarize_processlist" # ########################################################################### # summarize_binlogs # ########################################################################### NAME_VAL_LEN=25 -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Binlogs | 20 Zero-Sized | 3 Total Size | 6.5G EOF -summarize_binlogs "$samples/mysql-master-logs-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/expected" "$TMPDIR/got" "summarize_binlogs" +summarize_binlogs "$samples/mysql-master-logs-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/expected" "$PT_TMPDIR/got" "summarize_binlogs" # ########################################################################### # Reporting semisync replication # ########################################################################### -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" master semisync status | master trace level | 32, net wait (more information about network waits) master timeout in milliseconds | 10000 @@ -147,14 +147,14 @@ master wait_pos_backtraverse | master yes_tx | EOF -_semi_sync_stats_for "master" "$samples/mysql-variables-with-semisync.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/expected" "$TMPDIR/got" "semisync replication" +_semi_sync_stats_for "master" "$samples/mysql-variables-with-semisync.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/expected" "$PT_TMPDIR/got" "semisync replication" # ########################################################################### # pretty_print_cnf_file # ########################################################################### -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected [mysqld] datadir = /mnt/data/mysql @@ -187,24 +187,24 @@ pid-file = /var/run/mysqld/mysqld.pid target-dir = /data/backup EOF -pretty_print_cnf_file "$samples/my.cnf-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "pretty_print_cnf_file" +pretty_print_cnf_file "$samples/my.cnf-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "pretty_print_cnf_file" # TODO BUG NUMBER# -cp "$samples/my.cnf-001.txt" "$TMPDIR/test_pretty_print_cnf_file" -echo "some_var_yadda=0" >> "$TMPDIR/test_pretty_print_cnf_file" -echo "some_var_yadda = 0" >> "$TMPDIR/expected" +cp "$samples/my.cnf-001.txt" "$PT_TMPDIR/test_pretty_print_cnf_file" +echo "some_var_yadda=0" >> "$PT_TMPDIR/test_pretty_print_cnf_file" +echo "some_var_yadda = 0" >> "$PT_TMPDIR/expected" -pretty_print_cnf_file "$TMPDIR/test_pretty_print_cnf_file" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "pretty_print_cnf_file, bug XXXXXX" +pretty_print_cnf_file "$PT_TMPDIR/test_pretty_print_cnf_file" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "pretty_print_cnf_file, bug XXXXXX" # ########################################################################### # plugin_status # ########################################################################### -cat < $TMPDIR/plugins +cat < $PT_TMPDIR/plugins binlog ACTIVE STORAGE ENGINE NULL GPL partition ACTIVE STORAGE ENGINE NULL GPL ARCHIVE ACTIVE STORAGE ENGINE NULL GPL @@ -218,21 +218,21 @@ MRG_MYISAM ACTIVE STORAGE ENGINE NULL GPL EOF is \ - "$(get_plugin_status $TMPDIR/plugins InnoDB )" \ + "$(get_plugin_status $PT_TMPDIR/plugins InnoDB )" \ "ACTIVE" \ "Sanity test, finds InnoDB as active" is \ - "$(get_plugin_status $TMPDIR/plugins some_plugin_that_doesnt_exist )" \ + "$(get_plugin_status $PT_TMPDIR/plugins some_plugin_that_doesnt_exist )" \ "Not found" \ "Doesn't find a nonexistent plugin" -echo "INNODB_CMP ACTIVE" >> $TMPDIR/plugins +echo "INNODB_CMP ACTIVE" >> $PT_TMPDIR/plugins is \ - "$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )" \ + "$(get_plugin_status $PT_TMPDIR/plugins "INNODB_CMP" )" \ "ACTIVE" -cat < $TMPDIR/plugins +cat < $PT_TMPDIR/plugins binlog ACTIVE STORAGE ENGINE NULL GPL mysql_native_password ACTIVE AUTHENTICATION NULL GPL mysql_old_password ACTIVE AUTHENTICATION NULL GPL @@ -256,7 +256,7 @@ partition ACTIVE STORAGE ENGINE NULL GPL EOF is \ - "$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )" \ + "$(get_plugin_status $PT_TMPDIR/plugins "INNODB_CMP" )" \ "ACTIVE" \ "Multiple plugins with the same prefix" @@ -266,80 +266,80 @@ is \ _NO_FALSE_NEGATIVES=1 -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== 3306 /var/lib/mysql ? ? /var/run/mysqld/mysqld.sock 12345 /tmp/12345/data ? ? /tmp/12345/mysql_sandbox12345.sock 12346 /tmp/12346/data ? ? /tmp/12346/mysql_sandbox12346.sock EOF -touch "$TMPDIR/empty" -parse_mysqld_instances "$samples/ps-mysqld-001.txt" "$TMPDIR/empty" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-001.txt" +touch "$PT_TMPDIR/empty" +parse_mysqld_instances "$samples/ps-mysqld-001.txt" "$PT_TMPDIR/empty" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ps-mysqld-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== /var/lib/mysql ? ? /var/lib/mysql/mysql.sock EOF -parse_mysqld_instances "$samples/ps-mysqld-002.txt" "$TMPDIR/empty" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-002.txt" +parse_mysqld_instances "$samples/ps-mysqld-002.txt" "$PT_TMPDIR/empty" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ps-mysqld-002.txt" #parse_mysqld_instances -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== 3306 /mnt/data-store/mysql/data ? ? /tmp/mysql.sock EOF -parse_mysqld_instances "$samples/ps-mysqld-003.txt" "$TMPDIR/empty" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ps-mysqld-003.txt" +parse_mysqld_instances "$samples/ps-mysqld-003.txt" "$PT_TMPDIR/empty" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ps-mysqld-003.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== /var/db/mysql ? ? EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" mysql 767 0.0 0.9 3492 1100 v0 I 3:01PM 0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/var/db/mysql --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid mysql 818 0.0 17.4 45292 20584 v0 I 3:01PM 0:02.28 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --user=mysql --log-error=/var/db/mysql/freebsd.hsd1.va.comcast.net..err --pid-file=/var/db/mysql/freebsd.hsd1.va.comcast.net..pid EOF -parse_mysqld_instances "$TMPDIR/in" "$TMPDIR/empty" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_mysqld_instances" +parse_mysqld_instances "$PT_TMPDIR/in" "$PT_TMPDIR/empty" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_mysqld_instances" # ########################################################################### # get_mysql_* # ########################################################################### NAME_VAL_LEN=20 -cp $samples/mysql-variables-001.txt $TMPDIR/mysql-variables +cp $samples/mysql-variables-001.txt $PT_TMPDIR/mysql-variables is \ - $(get_mysql_timezone "$TMPDIR/mysql-variables") \ + $(get_mysql_timezone "$PT_TMPDIR/mysql-variables") \ "EDT" \ "get_mysql_timezone" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected 2010-05-27 11:38 (up 0+02:08:52) EOF -cp $samples/mysql-status-001.txt $TMPDIR/mysql-status -uptime="$(get_var Uptime $TMPDIR/mysql-status)" +cp $samples/mysql-status-001.txt $PT_TMPDIR/mysql-status +uptime="$(get_var Uptime $PT_TMPDIR/mysql-status)" current_time="$(echo -e "2010-05-27 11:38\n")" -get_mysql_uptime "${uptime}" "${current_time}" > $TMPDIR/got -no_diff "$TMPDIR/got" "$TMPDIR/expected" "get_mysql_uptime" +get_mysql_uptime "${uptime}" "${current_time}" > $PT_TMPDIR/got +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "get_mysql_uptime" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Version | 5.0.51a-24+lenny2 (Debian) Built On | debian-linux-gnu i486 EOF -cp "$samples/mysql-variables-001.txt" "$TMPDIR/mysql-variables" -get_mysql_version "$TMPDIR/mysql-variables" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "get_mysql_version" +cp "$samples/mysql-variables-001.txt" "$PT_TMPDIR/mysql-variables" +get_mysql_version "$PT_TMPDIR/mysql-variables" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "get_mysql_version" # ########################################################################### # format_status_variables # ########################################################################### -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Variable Per day Per second 5 secs Bytes_received 8000000 100 Bytes_sent 35000000 400 @@ -428,15 +428,15 @@ Uptime 90000 1 1 Uptime_since_flush_status 90000 1 EOF -join "$samples/mysql-status-001.txt" "$samples/mysql-status-002.txt" > "$TMPDIR/in" -format_status_variables "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "format_status_variables" +join "$samples/mysql-status-001.txt" "$samples/mysql-status-002.txt" > "$PT_TMPDIR/in" +format_status_variables "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "format_status_variables" # ########################################################################### # format_overall_db_stats # ########################################################################### -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Database Tables Views SPs Trigs Funcs FKs Partn mysql 17 @@ -464,10 +464,10 @@ cat < "$TMPDIR/expected" sakila 1 15 1 3 19 26 3 4 1 45 4 1 7 2 EOF -format_overall_db_stats "$samples/mysql-schema-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +format_overall_db_stats "$samples/mysql-schema-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Database Tables Views SPs Trigs Funcs FKs Partn {chosen} 1 @@ -489,17 +489,17 @@ cat < $TMPDIR/expected {chosen} 1 1 EOF -format_overall_db_stats "$samples/mysql-schema-002.txt" > "$TMPDIR/got" +format_overall_db_stats "$samples/mysql-schema-002.txt" > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/got" \ - "$TMPDIR/expected" \ + "$PT_TMPDIR/got" \ + "$PT_TMPDIR/expected" \ "format_overall_db_stats: single DB without CREATE DATABASE nor USE db defaults to {chosen}" # ########################################################################### # format_innodb_status # ########################################################################### -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Checkpoint Age | 619k InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue Oldest Transaction | 3 Seconds @@ -547,10 +547,10 @@ Mutexes/Locks Waited For 1 lock on RW-latch at 0x7f4bd0a8c8d0 '&block->lock' EOF -format_innodb_status $samples/innodb-status.001.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.001.txt" +format_innodb_status $samples/innodb-status.001.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.001.txt" -cat <<'EOF' > $TMPDIR/expected +cat <<'EOF' > $PT_TMPDIR/expected Checkpoint Age | 348M InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue Oldest Transaction | 4 Seconds @@ -581,10 +581,10 @@ Mutexes/Locks Waited For 1 Mutex at 0x2abf68b6c0d0 '&log_sys->mutex' EOF -format_innodb_status $samples/innodb-status.002.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.002.txt" +format_innodb_status $samples/innodb-status.002.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.002.txt" -cat <<'EOF' > $TMPDIR/expected +cat <<'EOF' > $PT_TMPDIR/expected Checkpoint Age | 0 InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue Oldest Transaction | 35 Seconds @@ -599,10 +599,10 @@ Tables Locked 1 `test`.`t` EOF -format_innodb_status $samples/innodb-status.003.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.003.txt" +format_innodb_status $samples/innodb-status.003.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.003.txt" -cat <<'EOF' > $TMPDIR/expected +cat <<'EOF' > $PT_TMPDIR/expected Checkpoint Age | 93M InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue Oldest Transaction | 263 Seconds @@ -627,8 +627,8 @@ Mutexes/Locks Waited For 1 lock on RW-latch at 0x2ab2c679a550 created in file buf/buf0buf.c line 550 EOF -format_innodb_status $samples/innodb-status.004.txt > $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.004.txt" +format_innodb_status $samples/innodb-status.004.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected "innodb-status.004.txt" # ########################################################################### # section_innodb @@ -636,7 +636,7 @@ no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.004.txt" test_format_innodb () { local NAME_VAL_LEN=25 - cat < $TMPDIR/expected + cat < $PT_TMPDIR/expected Version | 1.0.17-13.2 Buffer Pool Size | 128.0M Buffer Pool Fill | 1% @@ -660,8 +660,8 @@ test_format_innodb () { Adaptive Checkpoint | estimate EOF - section_innodb "$samples/temp001/mysql-variables" "$samples/temp001/mysql-status" > "$TMPDIR/got" - no_diff "$TMPDIR/got" "$TMPDIR/expected" "Format InnoDB" + section_innodb "$samples/temp001/mysql-variables" "$samples/temp001/mysql-status" > "$PT_TMPDIR/got" + no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Format InnoDB" } test_format_innodb @@ -673,13 +673,13 @@ test_format_innodb test_format_innodb_filters () { local NAME_VAL_LEN=20 - cat < $TMPDIR/expected + cat < $PT_TMPDIR/expected binlog_do_db | foo binlog_ignore_db | mysql,test EOF - format_binlog_filters "$samples/mysql-show-master-status-001.txt" > "$TMPDIR/got" - no_diff "$TMPDIR/got" "$TMPDIR/expected" "Format InnoDB filters" + format_binlog_filters "$samples/mysql-show-master-status-001.txt" > "$PT_TMPDIR/got" + no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Format InnoDB filters" } test_format_innodb_filters @@ -692,26 +692,26 @@ OPT_SLEEP=1 OPT_DATABASES="" OPT_READ_SAMPLES="" NAME_VAL_LEN=25 -report_mysql_summary "$samples/tempdir" | tail -n+3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$samples/expected_result_report_summary.txt" +report_mysql_summary "$samples/tempdir" | tail -n+3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$samples/expected_result_report_summary.txt" _NO_FALSE_NEGATIVES="" OPT_SLEEP=10 -report_mysql_summary "$samples/temp002" 2>/dev/null | tail -n+3 > "$TMPDIR/got" +report_mysql_summary "$samples/temp002" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/got" \ + "$PT_TMPDIR/got" \ "$samples/expected_output_temp002.txt" \ "report_mysql_summary, dir: temp002" -report_mysql_summary "$samples/temp003" 2>/dev/null | tail -n+3 > "$TMPDIR/got" +report_mysql_summary "$samples/temp003" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/got" \ + "$PT_TMPDIR/got" \ "$samples/expected_output_temp003.txt" \ "report_mysql_summary, dir: temp003" -report_mysql_summary "$samples/temp004" 2>/dev/null | tail -n+3 > "$TMPDIR/got" +report_mysql_summary "$samples/temp004" 2>/dev/null | tail -n+3 > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/got" \ + "$PT_TMPDIR/got" \ "$samples/expected_output_temp004.txt" \ "report_mysql_summary, dir: temp004" diff --git a/t/lib/bash/report_system_info.sh b/t/lib/bash/report_system_info.sh index 05e1238b..a5a29a8a 100644 --- a/t/lib/bash/report_system_info.sh +++ b/t/lib/bash/report_system_info.sh @@ -9,7 +9,7 @@ plan 49 . "$LIB_DIR/report_formatting.sh" . "$LIB_DIR/report_system_info.sh" -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" TOOL="pt-summary" @@ -18,28 +18,28 @@ NAME_VAL_LEN=12 # parse_proc_cpuinfo -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Processors | physical = 1, cores = 2, virtual = 2, hyperthreading = no Speeds | 2x1300.000 Models | 2xGenuine Intel(R) CPU U7300 @ 1.30GHz Caches | 2x3072 KB EOF -parse_proc_cpuinfo "$samples/proc_cpuinfo001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo001.txt" +parse_proc_cpuinfo "$samples/proc_cpuinfo001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Processors | physical = 1, cores = 1, virtual = 2, hyperthreading = yes Speeds | 2x1000.000 Models | 2xIntel(R) Atom(TM) CPU N455 @ 1.66GHz Caches | 2x512 KB EOF -parse_proc_cpuinfo "$samples/proc_cpuinfo002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo002.txt" +parse_proc_cpuinfo "$samples/proc_cpuinfo002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_proc_cpuinfo, proc_cpuinfo002.txt" # parse_ethtool -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full @@ -62,19 +62,19 @@ Settings for eth0: Link detected: no EOF -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Device Speed Duplex ========= ========= ========= eth0 10Mb/s Half EOF -parse_ethtool "$TMPDIR/in" > "$TMPDIR/got" +parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/expected" \ - "$TMPDIR/got" \ + "$PT_TMPDIR/expected" \ + "$PT_TMPDIR/got" \ "parse_ethtool works" -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full @@ -117,22 +117,22 @@ Settings for eth4: Link detected: no EOF -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Device Speed Duplex ========= ========= ========= eth0 10Mb/s Half eth4 100Mb/s Full EOF -parse_ethtool "$TMPDIR/in" > "$TMPDIR/got" +parse_ethtool "$PT_TMPDIR/in" > "$PT_TMPDIR/got" no_diff \ - "$TMPDIR/expected" \ - "$TMPDIR/got" \ + "$PT_TMPDIR/expected" \ + "$PT_TMPDIR/got" \ "parse_ethtool works if there are multiple devices" # parse_netstat -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Connections from remote IP addresses 192.168.243.72 1 192.168.243.81 2 @@ -144,10 +144,10 @@ cat < $TMPDIR/expected ESTABLISHED 4 LISTEN 15 EOF -parse_netstat "$samples/netstat-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-001.txt" +parse_netstat "$samples/netstat-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Connections from remote IP addresses 10.14.82.196 175 10.14.82.200 10 @@ -181,10 +181,10 @@ cat < "$TMPDIR/expected" LISTEN 15 TIME_WAIT 1250 EOF -parse_netstat "$samples/netstat-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-002.txt" +parse_netstat "$samples/netstat-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-002.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Connections from remote IP addresses 10.8.0.12 6 10.8.0.14 2 @@ -210,16 +210,16 @@ cat < "$TMPDIR/expected" TIME_WAIT 3 EOF -parse_netstat "$samples/netstat-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_netstat, netstat-003.txt" +parse_netstat "$samples/netstat-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_netstat, netstat-003.txt" # parse_lsi_megaraid -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" BBU | 100% Charged, Temperature 18C, isSOHGood=Yes EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" BBU status for Adapter: 0 BatteryType: BBU @@ -250,11 +250,11 @@ isSOHGood: Yes Exit Code: 0x00 EOF -parse_lsi_megaraid_bbu_status "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_bbu_status "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # ############################################################################ -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" PhysiclDev Type State Errors Vendor Model Size ========== ==== ======= ====== ======= ============ =========== @@ -264,7 +264,7 @@ cat < "$TMPDIR/expected" Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" Adapter #0 @@ -351,12 +351,12 @@ Media Type: Hard Disk Device Exit Code: 0x00 EOF -parse_lsi_megaraid_devices "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # ############################################################################ -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" PhysiclDev Type State Errors Vendor Model Size ========== ==== ======= ====== ======= ============ =========== @@ -366,7 +366,7 @@ cat < "$TMPDIR/expected" Hard Disk SAS Online 0/0/0 SEAGATE ST373455SS 70007MB EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" [root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL Adapter #0 @@ -487,11 +487,11 @@ Media Type: Hard Disk Device Exit Code: 0x00 EOF -parse_lsi_megaraid_devices "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # ############################################################################ -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache ========== ========= ========== ===== ======= ====== ======= ========= @@ -499,7 +499,7 @@ cat < "$TMPDIR/expected" 1(no name) 69376MB 1 (1-0-0) 2 1-1 64kB Optimal WB, no RA EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" [root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LdPdInfo -aALL Adapter #0 @@ -620,11 +620,11 @@ Media Type: Hard Disk Device Exit Code: 0x00 EOF -parse_lsi_megaraid_virtual_devices "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # ############################################################################ -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache ========== ========= ========== ===== ======= ====== ======= ========= @@ -632,7 +632,7 @@ cat < "$TMPDIR/expected" 1(no name) 69376MB 1 (1-0-0) 2 1- 64kB Optimal WB, no RA EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" [root@pc-db1 ~]# /opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll @@ -664,38 +664,38 @@ Disk Cache Policy: Disk's Default Exit Code: 0x00 EOF -parse_lsi_megaraid_virtual_devices "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_virtual_devices "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # ############################################################################ -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Model | PERC 6/i Integrated, PCIE interface, 8 ports Cache | 256MB Memory, BBU Present EOF -parse_lsi_megaraid_adapter_info "$samples/MegaCli64_AdpAllInfo_aALL001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_lsi_megaraid_adapter_info "$samples/MegaCli64_AdpAllInfo_aALL001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # Launchpad 886223 -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" VirtualDev Size RAID Level Disks SpnDpth Stripe Status Cache ========== ========= ========== ===== ======= ====== ======= ========= 0(no name) 135.5 GB 0 (:-1-0) 2 Depth-2 64 KB Optimal WB, no RA EOF -parse_lsi_megaraid_virtual_devices "$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples/MegaCli64_LdPdInfo_aALL_886223" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 886223" +parse_lsi_megaraid_virtual_devices "$PERCONA_TOOLKIT_BRANCH/t/pt-summary/samples/MegaCli64_LdPdInfo_aALL_886223" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 886223" # parse_hpacucli -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" logicaldrive 1 (136.7 GB, RAID 1, OK) physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK) EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" Smart Array P400i in Slot 0 (Embedded) (sn: PH73MU7325 ) @@ -708,18 +708,18 @@ Smart Array P400i in Slot 0 (Embedded) (sn: PH73MU7325 ) physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK) EOF -parse_hpacucli "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_hpacucli "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" -parse_hpacucli "$samples/hpaculi-003.txt" > "$TMPDIR/got" +parse_hpacucli "$samples/hpaculi-003.txt" > "$PT_TMPDIR/got" is \ - "$(cat "$TMPDIR/got")" \ + "$(cat "$PT_TMPDIR/got")" \ "" \ "parse_hpacucli, hpaculi-003.txt" # parse_fusionmpt_lsiutil -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" /proc/mpt/ioc0 LSI Logic SAS1068E B3 MPT 105 Firmware 00192f00 IOC 0 B___T___L Type Vendor Product Rev SASAddress PhyNum @@ -733,10 +733,10 @@ cat < "$TMPDIR/expected" 0 3 PhysDisk 2 SEAGATE ST3146855SS S52A 5000c500130fcaed 3 0 10 PhysDisk 3 SEAGATE ST3146855SS S52A 5000c500131093f5 2 EOF -parse_fusionmpt_lsiutil "$samples/lsiutil-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-001.txt" +parse_fusionmpt_lsiutil "$samples/lsiutil-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" /proc/mpt/ioc0 LSI Logic SAS1064E B3 MPT 105 Firmware 011e0000 IOC 0 B___T___L Type Vendor Product Rev SASAddress PhyNum @@ -746,10 +746,10 @@ cat < "$TMPDIR/expected" 0 2 PhysDisk 0 IBM-ESXS ST9300603SS F B536 5000c5001d784329 1 0 3 PhysDisk 1 IBM-ESXS MBD2300RC SB17 500000e113c17152 0 EOF -parse_fusionmpt_lsiutil "$samples/lsiutil-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-002.txt" +parse_fusionmpt_lsiutil "$samples/lsiutil-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-002.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" /proc/mpt/ioc0 LSI Logic SAS1064E B3 MPT 105 Firmware 011e0000 IOC 0 B___T___L Type Vendor Product Rev SASAddress PhyNum @@ -759,12 +759,12 @@ cat < "$TMPDIR/expected" 0 2 PhysDisk 0 IBM-ESXS MBD2300RC SB17 500000e113c00ed2 1 0 3 PhysDisk 1 IBM-ESXS MBD2300RC SB17 500000e113c17ee2 0 EOF -parse_fusionmpt_lsiutil "$samples/lsiutil-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "lsiutil-003.txt" +parse_fusionmpt_lsiutil "$samples/lsiutil-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "lsiutil-003.txt" # parse_free_minus_b -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Total | 3.9G Free | 1.4G Used | physical = 2.5G, swap allocated = 4.9G, swap used = 0.0, virtual = 2.5G @@ -773,7 +773,7 @@ cat < "$TMPDIR/expected" Dirty | 60 kB EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" total used free shared buffers cached Mem: 4182048768 2653696000 1528352768 0 138240000 2060787712 -/+ buffers/cache: 454668288 3727380480 @@ -824,11 +824,11 @@ Hugepagesize: 2048 kB DirectMap4k: 10232 kB DirectMap2M: 897024 kB EOF -parse_free_minus_b "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_free_minus_b" +parse_free_minus_b "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b" # Bug 993436: Memory: Total reports M when it should say G -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Total | 1010.5M Free | 784.4M Used | physical = 226.1M, swap allocated = 2.0G, swap used = 0.0, virtual = 226.1M @@ -836,21 +836,21 @@ cat < "$TMPDIR/expected" Caches | 122.2M Dirty | 152 kB EOF -parse_free_minus_b "$T_DIR/pt-summary/samples/Linux/002/memory" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_free_minus_b (bug 993436)" +parse_free_minus_b "$T_DIR/pt-summary/samples/Linux/002/memory" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_free_minus_b (bug 993436)" # parse_filesystems -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Filesystem Size Used Type Opts Mountpoint /dev/sda1 99M 13% ext3 rw /boot /dev/sda2 540G 89% ext3 rw / tmpfs 48G 0% tmpfs rw /dev/shm EOF -parse_filesystems "$samples/df-mount-003.txt" "Linux" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-003.txt Linux" +parse_filesystems "$samples/df-mount-003.txt" "Linux" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-003.txt Linux" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Filesystem Size Used Type Opts Mountpoint /dev/sda1 9.9G 34% ext3 rw / /dev/sdb 414G 1% ext3 rw /mnt @@ -860,10 +860,10 @@ cat < $TMPDIR/expected none 7.6G 0% proc rw /dev/shm none 7.6G 0% sysfs rw /dev/shm EOF -parse_filesystems "$samples/df-mount-004.txt" "Linux" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-004.txt Linux" +parse_filesystems "$samples/df-mount-004.txt" "Linux" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-004.txt Linux" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Filesystem Size Used Type Opts Mountpoint /dev/cciss/c0d0p1 99M 24% ext3 rw /boot /dev/mapper/VolGroup00-LogVol00 194G 58% ext3 rw / @@ -871,10 +871,10 @@ cat < $TMPDIR/expected /dev/mapper/VolGroup01-mysql_data 1008G 44% ext3 rw,noatime /data/mysql-data tmpfs 48G 0% tmpfs rw /dev/shm EOF -parse_filesystems "$samples/df-mount-005.txt" "Linux" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-005.txt Linux" +parse_filesystems "$samples/df-mount-005.txt" "Linux" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-005.txt Linux" -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Filesystem Size Used Type Opts Mountpoint /dev/ad0s1a 496M 32% ufs local / /dev/ad0s1d 1.1G 1% ufs local, soft-updates /var @@ -882,12 +882,12 @@ cat < $TMPDIR/expected /dev/ad0s1f 17G 9% ufs local, soft-updates /usr devfs 1.0K 100% devfs local /dev EOF -parse_filesystems "$samples/df-mount-006.txt" "FreeBSD" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "df-mount-006.txt FreeBSD" +parse_filesystems "$samples/df-mount-006.txt" "FreeBSD" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "df-mount-006.txt FreeBSD" # parse_ip_s_link -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors ========= ========= ========== ========== ========== ========== ========== lo 3000000 25000 0 3000000 25000 0 @@ -895,10 +895,10 @@ cat < "$TMPDIR/expected" wlan0 50000000 80000 0 20000000 90000 0 vboxnet0 0 0 0 0 0 0 EOF -parse_ip_s_link "$samples/ip-s-link-001.txt" > $TMPDIR/got -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-001.txt" +parse_ip_s_link "$samples/ip-s-link-001.txt" > $PT_TMPDIR/got +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-001.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors ========= ========= ========== ========== ========== ========== ========== lo 3500000000 350000000 0 3500000000 350000000 0 @@ -906,10 +906,10 @@ cat < "$TMPDIR/expected" eth1 1250000000 60000000 0 900000000 50000000 0 sit0 0 0 0 0 0 0 EOF -parse_ip_s_link "$samples/ip-s-link-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-002.txt" +parse_ip_s_link "$samples/ip-s-link-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-002.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" interface rx_bytes rx_packets rx_errors tx_bytes tx_packets tx_errors ========= ========= ========== ========== ========== ========== ========== lo 25000000 300000 0 25000000 300000 0 @@ -917,12 +917,12 @@ cat < "$TMPDIR/expected" wlan0 0 0 0 0 0 0 virbr0 0 0 0 0 0 0 EOF -parse_ip_s_link "$samples/ip-s-link-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "ip-s-link-003.txt" +parse_ip_s_link "$samples/ip-s-link-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "ip-s-link-003.txt" # parse_fdisk -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Device Type Start End Size ============ ==== ========== ========== ================== /dev/dm-0 Disk 494609104896 @@ -931,30 +931,30 @@ Device Type Start End Size /dev/sda1 Part 1 26 205632000 /dev/sda2 Part 26 60801 499891392000 EOF -parse_fdisk "$samples/fdisk-01.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "parse_fdisk" +parse_fdisk "$samples/fdisk-01.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "parse_fdisk" # parse_ethernet_controller_lspci -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12) Controller | Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12) EOF -parse_ethernet_controller_lspci "$samples/lspci-001.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_ethernet_controller_lspci "$samples/lspci-001.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" # parse_dmidecode_mem_devices -cat < $TMPDIR/expected +cat < $PT_TMPDIR/expected Locator Size Speed Form Factor Type Type Detail ========= ======== ================= ============= ============= =========== SODIMM0 2048 MB 800 MHz SODIMM Other Synchronous SODIMM1 2048 MB 800 MHz SODIMM Other Synchronous EOF -parse_dmidecode_mem_devices "$samples/dmidecode-001.txt" > $TMPDIR/got -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-001.tx" +parse_dmidecode_mem_devices "$samples/dmidecode-001.txt" > $PT_TMPDIR/got +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-001.tx" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Locator Size Speed Form Factor Type Type Detail ========= ======== ================= ============= ============= =========== DIMM1 2048 MB 667 MHz (1.5 ns) {OUT OF SPEC} {OUT OF SPEC} Synchronous @@ -966,10 +966,10 @@ cat < "$TMPDIR/expected" DIMM7 2048 MB 667 MHz (1.5 ns) {OUT OF SPEC} {OUT OF SPEC} Synchronous DIMM8 2048 MB 667 MHz (1.5 ns) {OUT OF SPEC} {OUT OF SPEC} Synchronous EOF -parse_dmidecode_mem_devices "$samples/dmidecode-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-002.tx" +parse_dmidecode_mem_devices "$samples/dmidecode-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-002.tx" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Locator Size Speed Form Factor Type Type Detail ========= ======== ================= ============= ============= =========== 1024 kB 33 MHz Other Flash Non-Volatile @@ -992,10 +992,10 @@ cat < "$TMPDIR/expected" D7 {EMPTY} 1333 MHz DIMM Other Other D8 {EMPTY} 1333 MHz DIMM Other Other EOF -parse_dmidecode_mem_devices "$samples/dmidecode-003.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-003.txt" +parse_dmidecode_mem_devices "$samples/dmidecode-003.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-003.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Locator Size Speed Form Factor Type Type Detail ========= ======== ================= ============= ============= =========== DIMM_A2 4096 MB 1066 MHz (0.9 ns) DIMM {OUT OF SPEC} Synchronous @@ -1011,10 +1011,10 @@ cat < "$TMPDIR/expected" DIMM_B1 {EMPTY} Unknown DIMM {OUT OF SPEC} Synchronous DIMM_B4 {EMPTY} Unknown DIMM {OUT OF SPEC} Synchronous EOF -parse_dmidecode_mem_devices "$samples/dmidecode-004.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-004.txt" +parse_dmidecode_mem_devices "$samples/dmidecode-004.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-004.txt" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Locator Size Speed Form Factor Type Type Detail ========= ======== ================= ============= ============= =========== P1-DIMM1A 16384 MB 1066 MHz (0.9 ns) DIMM {OUT OF SPEC} Other @@ -1037,12 +1037,12 @@ cat < "$TMPDIR/expected" P2-DIMM3B {EMPTY} Unknown DIMM {OUT OF SPEC} Other P2-DIMM3C {EMPTY} Unknown DIMM {OUT OF SPEC} Other EOF -parse_dmidecode_mem_devices "$samples/dmidecode-005.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "dmidecode-005.txt" +parse_dmidecode_mem_devices "$samples/dmidecode-005.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "dmidecode-005.txt" # parse_arcconf -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal Battery | 99%, 3d1h11m remaining, Optimal @@ -1058,7 +1058,7 @@ cat < "$TMPDIR/expected" Hard drive Online SAS 3.0 Gb/s SEAGATE ST3146855SS 140014 MB On (WB) EOF -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" # /usr/StorMan/arcconf getconfig 1 Controllers found: 1 ---------------------------------------------------------------------- @@ -1193,10 +1193,10 @@ Physical Device information Command completed successfully. EOF -parse_arcconf "$TMPDIR/in" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" +parse_arcconf "$PT_TMPDIR/in" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Specs | Adaptec 3405, SAS/SATA, 128 MB cache, Optimal Battery | 99%, 3d1h11m remaining, Optimal @@ -1211,12 +1211,12 @@ cat < "$TMPDIR/expected" Hard drive Online SAS 3.0 Gb/s SEAGATE ST3300655SS 286102 MB On (WB) Hard drive Online SAS 3.0 Gb/s SEAGATE ST3300655SS 286102 MB On (WB) EOF -parse_arcconf "$samples/arcconf-002.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "arcconf-002.txt" +parse_arcconf "$samples/arcconf-002.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "arcconf-002.txt" # Launchpad 917781, parse_arcconf doesn't work with ZMM # https://bugs.launchpad.net/percona-toolkit/+bug/917781 -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Specs | Adaptec 5405Z, SAS/SATA, 512 MB cache, Optimal Battery | ZMM Optimal @@ -1232,12 +1232,12 @@ cat < "$TMPDIR/expected" Hard drive Full rpm,Powered off SATA 3.0 Gb/s WDC WD3000HLFS-0 286168 MB On (WB) EOF -parse_arcconf "$samples/arcconf-004_917781.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 917781" +parse_arcconf "$samples/arcconf-004_917781.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 917781" # Launchpad 900285, ${var/ /} doesn't work in sh # https://bugs.launchpad.net/percona-toolkit/+bug/900285 -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Specs | Adaptec 5805Z, SAS/SATA, 512 MB cache, Optimal Battery | ZMM Optimal @@ -1255,24 +1255,24 @@ cat < "$TMPDIR/expected" Hard drive Full rpm,Powered off SAS 3.0 Gb/s SEAGATE ST3300657SS 286102 MB On (WB) Hard drive Full rpm,Powered off SAS 3.0 Gb/s SEAGATE ST3300657SS 286102 MB On (WB) EOF -parse_arcconf "$samples/arcconf-003_900285.txt" > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "Bug 900285" +parse_arcconf "$samples/arcconf-003_900285.txt" > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Bug 900285" # parse_uptime -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" 15:10:14 up 1 day, 15:08, 11 users, load average: 0.18, 0.09, 0.08 EOF is \ - "$( parse_uptime "$TMPDIR/in" )" \ + "$( parse_uptime "$PT_TMPDIR/in" )" \ "1 day, 15:08, 11 users, load average: 0.18, 0.09, 0.08" \ "parse_uptime works with Ubuntu's uptime" -cat < "$TMPDIR/in" +cat < "$PT_TMPDIR/in" some weird format etc 1 day, 15:08, 11 users, load average: 0.18, 0.09, 0.08 EOF is \ - "$( parse_uptime "$TMPDIR/in" )" \ + "$( parse_uptime "$PT_TMPDIR/in" )" \ " some weird format etc 1 day, 15:08, 11 users, load average: 0.18, 0.09, 0.08" \ "parse_uptime returns uptime as-if if it doesn't contain an 'up'" @@ -1284,16 +1284,16 @@ is \ "format_lvs has a meaningful error message if all goes wrong" -echo "Pretending to be an lvs dump" > "$TMPDIR/in" +echo "Pretending to be an lvs dump" > "$PT_TMPDIR/in" is \ - "$(format_lvs "$TMPDIR/in" "")" \ + "$(format_lvs "$PT_TMPDIR/in" "")" \ "Pretending to be an lvs dump" \ "format_lvs dumps the file passed in" # report_system_summary parse_options "$BIN_DIR/pt-summary" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Hostname | Uptime | 57 mins, 1 user, load averages: 0.16, 0.03, 0.07 Platform | FreeBSD @@ -1345,10 +1345,10 @@ Architecture | CPU = 32-bit, OS = 32-bit 0 0 0 58164 339792 0 0 0 0 0 0 0 0 231 115 229 0 5 95 # The End #################################################### EOF -report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from a FreeBSD box" +report_system_summary "$samples/BSD/freebsd_001" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "report_system_summary works with samples from a FreeBSD box" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Hostname | Uptime | 43 mins, 2 users, load averages: 0.00, 0.00, 0.00 Platform | NetBSD @@ -1399,10 +1399,10 @@ Architecture | CPU = 32-bit, OS = 32-bit 0 0 0 78564 21364 0 0 0 0 0 0 0 0 101 11 10 0 0 100 # The End #################################################### EOF -report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "netbsd_001" +report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "netbsd_001" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Hostname | openbsd.my.domain Uptime | 1:14, 1 user, load averages: 0.44, 0.20, 0.16 Platform | OpenBSD @@ -1451,10 +1451,10 @@ Architecture | CPU = 32-bit, OS = 32-bit 0 0 0 7496 191456 11 0 0 0 0 0 0 0 230 23 12 0 0 100 # The End #################################################### EOF -report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "openbsd_001" +report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "openbsd_001" -cat < "$TMPDIR/expected" +cat < "$PT_TMPDIR/expected" Hostname | hugmeir Uptime | 1 day, 15:14, 5 users, load average: 0.00, 0.06, 0.07 System | Quanta; UW3; vTBD (Other) @@ -1570,11 +1570,11 @@ Unable to collect information # The End #################################################### EOF -report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$TMPDIR/expected" "Linux/001 (Ubuntu)" +report_system_summary "$samples/Linux/001" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$PT_TMPDIR/expected" "Linux/001 (Ubuntu)" -report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)" +report_system_summary "$samples/Linux/002" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)" -report_system_summary "$samples/Linux/003" | tail -n +3 > "$TMPDIR/got" -no_diff "$TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)" +report_system_summary "$samples/Linux/003" | tail -n +3 > "$PT_TMPDIR/got" +no_diff "$PT_TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)" diff --git a/t/lib/bash/safeguards.sh b/t/lib/bash/safeguards.sh index adcd3b62..22033e03 100644 --- a/t/lib/bash/safeguards.sh +++ b/t/lib/bash/safeguards.sh @@ -5,16 +5,16 @@ plan 11 source "$LIB_DIR/log_warn_die.sh" source "$LIB_DIR/safeguards.sh" -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" SAMPLE="$T_LIB_DIR/samples/bash" -disk_space "/" > $TMPDIR/df-out +disk_space "/" > $PT_TMPDIR/df-out cmd_ok \ - "grep -q Avail $TMPDIR/df-out" \ + "grep -q Avail $PT_TMPDIR/df-out" \ "disk_space()" is \ - "`wc -l $TMPDIR/df-out | awk '{print $1}'`" \ + "`wc -l $PT_TMPDIR/df-out | awk '{print $1}'`" \ "2" \ "2-line df output" @@ -27,23 +27,23 @@ is \ # pct free = 100 - 81 = 19 % # want free - 100, 18 < 19, so this should be ok. -check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 18 >$TMPDIR/out 2>&1 +check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 18 >$PT_TMPDIR/out 2>&1 is "$?" "0" "Enough disk space" is \ - "`cat $TMPDIR/out`" \ + "`cat $PT_TMPDIR/out`" \ "" \ "No output if enough disk space" # want free - 100 is ok, but 20 < 19 is not. -check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 20 >$TMPDIR/out 2>&1 +check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 20 >$PT_TMPDIR/out 2>&1 is "$?" "1" "Not enough % free" # want free + 100, so this should fail # (real free is 100 bytes under what we want) -check_disk_space "$SAMPLE/diskspace001.txt" 24051212388 18 >$TMPDIR/out 2>&1 +check_disk_space "$SAMPLE/diskspace001.txt" 24051212388 18 >$PT_TMPDIR/out 2>&1 is "$?" "1" "Not enough MB free" cmd_ok \ - "grep -q 'Actual: 19% free, 24051212288 bytes free (- 0 bytes margin)' $TMPDIR/out" \ + "grep -q 'Actual: 19% free, 24051212288 bytes free (- 0 bytes margin)' $PT_TMPDIR/out" \ "Warning if not enough disk space" # ########################################################################### @@ -55,14 +55,14 @@ check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 18 50 is "$?" "0" "Enough disk space with margin" # want free - 100 + 101 margin, so real free is 1 byte under what we want. -check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 18 101 >$TMPDIR/out 2>&1 +check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 18 101 >$PT_TMPDIR/out 2>&1 is "$?" "1" "Not enough MB free with margin" # want free - 100 + 50 margin ok but %free will be 19 which is < 25. -check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 25 50 >$TMPDIR/out 2>&1 +check_disk_space "$SAMPLE/diskspace001.txt" 24051212188 25 50 >$PT_TMPDIR/out 2>&1 is "$?" "1" "Not enough % free with margin" cmd_ok \ - "grep -q 'Actual:[ ]*19% free,' $TMPDIR/out" \ + "grep -q 'Actual:[ ]*19% free,' $PT_TMPDIR/out" \ "Calculates % free with margin" # ########################################################################### diff --git a/t/lib/bash/summary_common.sh b/t/lib/bash/summary_common.sh index b63fa24e..20c39451 100644 --- a/t/lib/bash/summary_common.sh +++ b/t/lib/bash/summary_common.sh @@ -2,12 +2,12 @@ plan 10 -TMPDIR="$TEST_TMPDIR" +PT_TMPDIR="$TEST_PT_TMPDIR" PATH="$PATH:$PERCONA_TOOLKIT_SANDBOX/bin" . "$LIB_DIR/summary_common.sh" -p="$TMPDIR/get_var_samples" +p="$PT_TMPDIR/get_var_samples" echo "test1 abcdef" > "$p" is \ diff --git a/t/lib/bash/tmpdir.sh b/t/lib/bash/tmpdir.sh index e8e6eb67..5dad5590 100644 --- a/t/lib/bash/tmpdir.sh +++ b/t/lib/bash/tmpdir.sh @@ -5,17 +5,17 @@ plan 10 source "$LIB_DIR/log_warn_die.sh" source "$LIB_DIR/tmpdir.sh" -is "$TMPDIR" "" "TMPDIR not defined" +is "$PT_TMPDIR" "" "PT_TMPDIR not defined" mk_tmpdir -cmd_ok "test -d $TMPDIR" "mk_tmpdir makes secure tmpdir" +cmd_ok "test -d $PT_TMPDIR" "mk_tmpdir makes secure tmpdir" -tmpdir=$TMPDIR; +tmpdir="$PT_TMPDIR"; rm_tmpdir cmd_ok "test ! -d $tmpdir" "rm_tmpdir" -is "$TMPDIR" "" "rm_tmpdir resets TMPDIR" +is "$PT_TMPDIR" "" "rm_tmpdir resets PT_TMPDIR" # ########################################################################### # User-specified tmpdir. @@ -23,12 +23,12 @@ is "$TMPDIR" "" "rm_tmpdir resets TMPDIR" dir="/tmp/use--tmpdir" -is "$TMPDIR" "" "TMPDIR not defined" +is "$PT_TMPDIR" "" "PT_TMPDIR not defined" cmd_ok "test ! -d $dir" "--tmpdir does not exist yet" mk_tmpdir $dir -is "$TMPDIR" "$dir" "mk_tmpdir uses --tmpdir" +is "$PT_TMPDIR" "$dir" "mk_tmpdir uses --tmpdir" cmd_ok "test -d $dir" "mk_tmpdir creates --tmpdir" @@ -47,9 +47,9 @@ tempdir_test () { mk_tmpdir - is "$(dirname "$TMPDIR")" \ + is "$(dirname "$PT_TMPDIR")" \ "$new_TEMP" \ - 'mk_tmpdir respects $TMPDIR' + 'mk_tmpdir respects $PT_TMPDIR' rm_tmpdir diff --git a/t/pt-ioprofile/summarize_strace.sh b/t/pt-ioprofile/summarize_strace.sh index 40f9589e..86b111c7 100644 --- a/t/pt-ioprofile/summarize_strace.sh +++ b/t/pt-ioprofile/summarize_strace.sh @@ -4,7 +4,7 @@ TESTS=2 source "$BIN_DIR/pt-ioprofile" SAMPLES="$T_DIR/samples" -TMPDIR=$TEST_TMPDIR +PT_TMPDIR=$TEST_PT_TMPDIR # ########################################################################### # summarize_strace sum times filename @@ -15,10 +15,10 @@ summarize_strace \ "times" \ "filename" \ "$SAMPLES/001-tab.txt" \ -> $TEST_TMPDIR/got +> $TEST_PT_TMPDIR/got no_diff \ - $TEST_TMPDIR/got \ + $TEST_PT_TMPDIR/got \ $SAMPLES/001-summarized-sum-times-filename.txt \ "summarize_strace sum times filename" @@ -31,10 +31,10 @@ summarize_strace \ "times" \ "all" \ "$SAMPLES/002-tab.txt" \ -> $TEST_TMPDIR/got +> $TEST_PT_TMPDIR/got no_diff \ - $TEST_TMPDIR/got \ + $TEST_PT_TMPDIR/got \ $SAMPLES/002-summarized-sum-times-all.txt \ "summarize_strace sum times all" diff --git a/t/pt-ioprofile/tabulate_strace.sh b/t/pt-ioprofile/tabulate_strace.sh index ec80e11d..285ae626 100644 --- a/t/pt-ioprofile/tabulate_strace.sh +++ b/t/pt-ioprofile/tabulate_strace.sh @@ -4,17 +4,17 @@ TESTS=2 source "$BIN_DIR/pt-ioprofile" SAMPLES="$T_DIR/samples" -TMPDIR=$TEST_TMPDIR +PT_TMPDIR=$TEST_PT_TMPDIR -tabulate_strace $SAMPLES/003-samples.txt > $TEST_TMPDIR/got +tabulate_strace $SAMPLES/003-samples.txt > $TEST_PT_TMPDIR/got no_diff \ - $TEST_TMPDIR/got \ + $TEST_PT_TMPDIR/got \ $SAMPLES/003-tab.txt \ "tabulate 003-samples.txt" -tabulate_strace $SAMPLES/004-samples.txt > $TEST_TMPDIR/got +tabulate_strace $SAMPLES/004-samples.txt > $TEST_PT_TMPDIR/got no_diff \ - $TEST_TMPDIR/got \ + $TEST_PT_TMPDIR/got \ $SAMPLES/004-tab.txt \ "tabulate 004-samples.txt" diff --git a/t/pt-pmp/aggregate_stacktrace.sh b/t/pt-pmp/aggregate_stacktrace.sh index 80e68bff..62dbb549 100644 --- a/t/pt-pmp/aggregate_stacktrace.sh +++ b/t/pt-pmp/aggregate_stacktrace.sh @@ -3,12 +3,12 @@ # This test file must be ran by util/test-bash-functions. TESTS=6 -TMPDIR=$TEST_TMPDIR +PT_TMPDIR=$TEST_PT_TMPDIR # ############################################################################ TEST_NAME="stacktrace-001.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 0 samples/stacktrace-001.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected # ############################################################################ TEST_NAME="stacktrace-002.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 0 samples/stacktrace-002.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected # ############################################################################ TEST_NAME="stacktrace-003.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 0 samples/stacktrace-003.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected # ############################################################################ TEST_NAME="stacktrace-003-b.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 2 samples/stacktrace-003.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected # ############################################################################ TEST_NAME="stacktrace-004.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 0 samples/stacktrace-004.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected # ############################################################################ TEST_NAME="stacktrace-005.txt" # ############################################################################ -cat > $TMPDIR/expected < $PT_TMPDIR/expected < $TMPDIR/expected < $TMPDIR/got -no_diff $TMPDIR/got $TMPDIR/expected +aggregate_stacktrace 0 samples/stacktrace-005.txt > $PT_TMPDIR/got +no_diff $PT_TMPDIR/got $PT_TMPDIR/expected diff --git a/util/test-bash-functions b/util/test-bash-functions index b689f9f0..0e715522 100755 --- a/util/test-bash-functions +++ b/util/test-bash-functions @@ -40,10 +40,10 @@ SANDBOX_VERSION="$($BRANCH/sandbox/test-env version)" # Paths # ############################################################################ -# Do not use TMPDIR because the tools use it for their own secure tmpdir. -TEST_TMPDIR="/tmp/percona-toolkit.test" -if [ ! -d $TEST_TMPDIR ]; then - mkdir $TEST_TMPDIR +# Do not use PT_TMPDIR because the tools use it for their own secure tmpdir. +TEST_PT_TMPDIR="/tmp/percona-toolkit.test" +if [ ! -d $TEST_PT_TMPDIR ]; then + mkdir $TEST_PT_TMPDIR fi # ############################################################################ @@ -79,7 +79,7 @@ load_tests() { # Source a test file to run whatever it contains (hopefully tests!). run_test() { local t=$1 # test file name, e.g. "group-by-all-01" for pt-diskstats - rm -rf $TEST_TMPDIR/* >/dev/null 2>&1 + rm -rf $TEST_PT_TMPDIR/* >/dev/null 2>&1 # Tests assume that they're being ran from their own dir, so they access # sample files like "samples/foo.txt". So cd to the dir of the test file @@ -106,8 +106,8 @@ result() { echo "not ok $testno - $TEST_FILE $test_name" failed_tests=$(( failed_tests + 1)) echo "# Failed '$test_command'" >&2 - if [ -f $TEST_TMPDIR/failed_result ]; then - cat $TEST_TMPDIR/failed_result | sed -e 's/^/# /' -e '30q' >&2 + if [ -f $TEST_PT_TMPDIR/failed_result ]; then + cat $TEST_PT_TMPDIR/failed_result | sed -e 's/^/# /' -e '30q' >&2 fi fi testno=$((testno + 1)) @@ -164,7 +164,7 @@ no_diff() { local expected=$2 local test_name=${3:-""} test_command="diff $got $expected" - eval $test_command > $TEST_TMPDIR/failed_result 2>&1 + eval $test_command > $TEST_PT_TMPDIR/failed_result 2>&1 result $? "$test_name" } @@ -235,5 +235,5 @@ else done fi -rm -rf $TEST_TMPDIR +rm -rf $TEST_PT_TMPDIR exit $failed_tests