diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index e9bf7a96..539b7c78 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -71,7 +71,7 @@ PO_DIR="" # Directory with program option spec files usage() { local file="$1" - local usage=$(grep '^Usage: ' "$file") + local usage="$(grep '^Usage: ' "$file")" echo $usage echo echo "For more information, 'man $TOOL' or 'perldoc $file'." diff --git a/lib/bash/parse_options.sh b/lib/bash/parse_options.sh index 13df9c43..e479ad66 100644 --- a/lib/bash/parse_options.sh +++ b/lib/bash/parse_options.sh @@ -68,7 +68,7 @@ PO_DIR="" # Directory with program option spec files usage() { local file="$1" - local usage=$(grep '^Usage: ' "$file") + local usage="$(grep '^Usage: ' "$file")" echo $usage echo echo "For more information, 'man $TOOL' or 'perldoc $file'." diff --git a/t/pt-mysql-summary/pt-mysql-summary.t b/t/pt-mysql-summary/pt-mysql-summary.t index 8898d2d9..6633e383 100644 --- a/t/pt-mysql-summary/pt-mysql-summary.t +++ b/t/pt-mysql-summary/pt-mysql-summary.t @@ -14,7 +14,7 @@ use PerconaTest; my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/; -use Test::More tests => 7; +use Test::More; use File::Temp qw( tempdir ); local $ENV{PTDEBUG} = ""; @@ -61,7 +61,8 @@ for my $i (2..5) { no_diff( sub { local $ENV{_NO_FALSE_NEGATIVES} = 1; - print `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'` + my $out = `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`; + print $out; }, "t/pt-mysql-summary/samples/expected_output_temp00$i.txt", ), @@ -69,4 +70,16 @@ for my $i (2..5) { ); } +# Test that --help works under sh + +my $sh = `sh $trunk/bin/$tool --help`; +my $bash = `bash $trunk/bin/$tool --help`; + +is( + $sh, + $bash, + "--help works under sh and bash" +); + +done_testing; exit;