mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-19 10:34:01 +00:00
parse_options.sh: Make sure that --help works under sh
This commit is contained in:
@@ -71,7 +71,7 @@ PO_DIR="" # Directory with program option spec files
|
|||||||
usage() {
|
usage() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
|
|
||||||
local usage=$(grep '^Usage: ' "$file")
|
local usage="$(grep '^Usage: ' "$file")"
|
||||||
echo $usage
|
echo $usage
|
||||||
echo
|
echo
|
||||||
echo "For more information, 'man $TOOL' or 'perldoc $file'."
|
echo "For more information, 'man $TOOL' or 'perldoc $file'."
|
||||||
|
@@ -68,7 +68,7 @@ PO_DIR="" # Directory with program option spec files
|
|||||||
usage() {
|
usage() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
|
|
||||||
local usage=$(grep '^Usage: ' "$file")
|
local usage="$(grep '^Usage: ' "$file")"
|
||||||
echo $usage
|
echo $usage
|
||||||
echo
|
echo
|
||||||
echo "For more information, 'man $TOOL' or 'perldoc $file'."
|
echo "For more information, 'man $TOOL' or 'perldoc $file'."
|
||||||
|
@@ -14,7 +14,7 @@ use PerconaTest;
|
|||||||
|
|
||||||
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
my ($tool) = $PROGRAM_NAME =~ m/([\w-]+)\.t$/;
|
||||||
|
|
||||||
use Test::More tests => 7;
|
use Test::More;
|
||||||
use File::Temp qw( tempdir );
|
use File::Temp qw( tempdir );
|
||||||
|
|
||||||
local $ENV{PTDEBUG} = "";
|
local $ENV{PTDEBUG} = "";
|
||||||
@@ -61,7 +61,8 @@ for my $i (2..5) {
|
|||||||
no_diff(
|
no_diff(
|
||||||
sub {
|
sub {
|
||||||
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
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",
|
"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;
|
exit;
|
||||||
|
Reference in New Issue
Block a user