diff --git a/bin/pt-archiver b/bin/pt-archiver index cbaa77b8..9f5ed755 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -524,7 +524,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -779,7 +779,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-config-diff b/bin/pt-config-diff index 6d2ea8a2..5a8f7896 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -523,7 +523,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -778,7 +778,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index 7646f7a5..9613fffc 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -521,7 +521,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -776,7 +776,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-diskstats b/bin/pt-diskstats index 03757817..f67fc4a6 100755 --- a/bin/pt-diskstats +++ b/bin/pt-diskstats @@ -523,7 +523,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -778,7 +778,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index 03451991..1d3f9866 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -1425,7 +1425,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1680,7 +1680,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-fifo-split b/bin/pt-fifo-split index e8e34d9d..1f33b3e9 100755 --- a/bin/pt-fifo-split +++ b/bin/pt-fifo-split @@ -495,7 +495,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -750,7 +750,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-find b/bin/pt-find index fe934e76..41770b2d 100755 --- a/bin/pt-find +++ b/bin/pt-find @@ -893,7 +893,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1148,7 +1148,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-fingerprint b/bin/pt-fingerprint index f5c5b765..1b975c28 100755 --- a/bin/pt-fingerprint +++ b/bin/pt-fingerprint @@ -496,7 +496,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -751,7 +751,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-fk-error-logger b/bin/pt-fk-error-logger index b9671e71..42a3719f 100755 --- a/bin/pt-fk-error-logger +++ b/bin/pt-fk-error-logger @@ -520,7 +520,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -775,7 +775,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-heartbeat b/bin/pt-heartbeat index 6017cd95..c281e30c 100755 --- a/bin/pt-heartbeat +++ b/bin/pt-heartbeat @@ -1256,7 +1256,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1511,7 +1511,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-index-usage b/bin/pt-index-usage index 24d3d8b8..0cae8d67 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -1023,7 +1023,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1278,7 +1278,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-kill b/bin/pt-kill index 60f1996d..8fecada9 100755 --- a/bin/pt-kill +++ b/bin/pt-kill @@ -528,7 +528,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -783,7 +783,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-log-player b/bin/pt-log-player index 2d7606e9..d831aec4 100755 --- a/bin/pt-log-player +++ b/bin/pt-log-player @@ -500,7 +500,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -755,7 +755,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index b541cd7c..0035e00c 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -534,7 +534,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -789,7 +789,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-query-advisor b/bin/pt-query-advisor index 14fdb6d6..770324b2 100755 --- a/bin/pt-query-advisor +++ b/bin/pt-query-advisor @@ -904,7 +904,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1159,7 +1159,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-query-digest b/bin/pt-query-digest index 96e7e0cd..2c3fe96e 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -1042,7 +1042,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1297,7 +1297,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-show-grants b/bin/pt-show-grants index 36ea83af..c3420870 100755 --- a/bin/pt-show-grants +++ b/bin/pt-show-grants @@ -496,7 +496,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -751,7 +751,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay index 14682dd1..6d7921bd 100755 --- a/bin/pt-slave-delay +++ b/bin/pt-slave-delay @@ -521,7 +521,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -776,7 +776,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-slave-find b/bin/pt-slave-find index d427c845..e6868b13 100755 --- a/bin/pt-slave-find +++ b/bin/pt-slave-find @@ -500,7 +500,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -755,7 +755,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-slave-restart b/bin/pt-slave-restart index c215fd80..ee47ba94 100755 --- a/bin/pt-slave-restart +++ b/bin/pt-slave-restart @@ -642,7 +642,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -897,7 +897,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index f4adcfa6..e4330eba 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -2190,7 +2190,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -2445,7 +2445,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-table-sync b/bin/pt-table-sync index d123b2a8..972fde5f 100755 --- a/bin/pt-table-sync +++ b/bin/pt-table-sync @@ -537,7 +537,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -792,7 +792,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-table-usage b/bin/pt-table-usage index ac048827..8646ae02 100755 --- a/bin/pt-table-usage +++ b/bin/pt-table-usage @@ -445,6 +445,7 @@ sub new { 'default' => 1, 'cumulative' => 1, 'negatable' => 1, + 'value_is_optional' => 1, ); my $self = { @@ -686,9 +687,10 @@ sub _parse_specs { $opt->{short} = undef; } - $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; - $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; - $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; + $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; + $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; + $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0; + $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; $opt->{group} ||= 'default'; $self->{groups}->{ $opt->{group} }->{$long} = 1; @@ -824,7 +826,7 @@ sub _set_option { if ( $opt->{is_cumulative} ) { $opt->{value}++; } - else { + elsif ( !($opt->{optional_value} && !$val) ) { $opt->{value} = $val; } $opt->{got} = 1; @@ -881,7 +883,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1136,7 +1138,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; @@ -1365,11 +1367,12 @@ sub _parse_size { sub _parse_attribs { my ( $self, $option, $attribs ) = @_; my $types = $self->{types}; + my $eq = $attribs->{'value_is_optional'} ? ':' : '='; return $option . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) . ($attribs->{'negatable'} ? '!' : '' ) . ($attribs->{'cumulative'} ? '+' : '' ) - . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' ); + . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' ); } sub _parse_synopsis { diff --git a/bin/pt-tcp-model b/bin/pt-tcp-model index 402ed35f..8161b265 100755 --- a/bin/pt-tcp-model +++ b/bin/pt-tcp-model @@ -499,7 +499,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -754,7 +754,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-trend b/bin/pt-trend index 4d28603a..10f1946f 100755 --- a/bin/pt-trend +++ b/bin/pt-trend @@ -499,7 +499,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -754,7 +754,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 2840e327..42e8042e 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -1444,7 +1444,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1699,7 +1699,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-variable-advisor b/bin/pt-variable-advisor index ae1410dd..a78295a9 100755 --- a/bin/pt-variable-advisor +++ b/bin/pt-variable-advisor @@ -525,7 +525,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -780,7 +780,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/bin/pt-visual-explain b/bin/pt-visual-explain index 1f020b26..817b0cab 100755 --- a/bin/pt-visual-explain +++ b/bin/pt-visual-explain @@ -6,7 +6,20 @@ use strict; use warnings FATAL => 'all'; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; + +# This tool is "fat-packed": most of its dependent modules are embedded +# in this file. Setting %INC to this file for each module makes Perl aware +# of this so it will not try to load the module from @INC. See the tool's +# documentation for a full list of dependencies. +BEGIN { + $INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw( + ExplainParser + ExplainTree + OptionParser + DSNParser + Daemon + )); +} # ########################################################################### # Converts text (e.g. saved output) to a "recordset" -- an array of hashrefs @@ -719,6 +732,7 @@ sub new { 'default' => 1, 'cumulative' => 1, 'negatable' => 1, + 'value_is_optional' => 1, ); my $self = { @@ -960,9 +974,10 @@ sub _parse_specs { $opt->{short} = undef; } - $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; - $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; - $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; + $opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0; + $opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0; + $opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0; + $opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0; $opt->{group} ||= 'default'; $self->{groups}->{ $opt->{group} }->{$long} = 1; @@ -1098,7 +1113,7 @@ sub _set_option { if ( $opt->{is_cumulative} ) { $opt->{value}++; } - else { + elsif ( !($opt->{optional_value} && !$val) ) { $opt->{value} = $val; } $opt->{got} = 1; @@ -1155,7 +1170,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -1410,7 +1425,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; @@ -1639,11 +1654,12 @@ sub _parse_size { sub _parse_attribs { my ( $self, $option, $attribs ) = @_; my $types = $self->{types}; + my $eq = $attribs->{'value_is_optional'} ? ':' : '='; return $option . ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' ) . ($attribs->{'negatable'} ? '!' : '' ) . ($attribs->{'cumulative'} ? '+' : '' ) - . ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' ); + . ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' ); } sub _parse_synopsis { diff --git a/lib/OptionParser.pm b/lib/OptionParser.pm index b9423602..c61ab321 100644 --- a/lib/OptionParser.pm +++ b/lib/OptionParser.pm @@ -669,7 +669,7 @@ sub get_opts { else { print "Error parsing version. See the VERSION section of the tool's documentation.\n"; } - exit 0; + exit 1; } if ( @ARGV && $self->{strict} ) { @@ -988,7 +988,7 @@ sub usage_or_errors { } elsif ( scalar @{$self->{errors}} ) { print $self->print_errors() or die "Cannot print errors: $OS_ERROR"; - exit 0 unless $return; + exit 1 unless $return; } return; diff --git a/t/lib/OptionParser.t b/t/lib/OptionParser.t index 34268222..303e07ce 100644 --- a/t/lib/OptionParser.t +++ b/t/lib/OptionParser.t @@ -2057,6 +2057,28 @@ is( "..and has the specified value", ); +# ############################################################################# +# Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero +# ############################################################################# + +# pt-archiver requires at least one of --dest, --file or --purge, as well as +# --where and --source. So specifying no options should cause errors. +@ARGV = qw(); +$o = new OptionParser(file => "$trunk/bin/pt-archiver"); +$o->get_specs(); +$o->get_opts(); + +my $exit_status = 0; +($output, $exit_status) = full_output( + sub { $o->usage_or_errors("$trunk/bin/pt-archiver"); }, +); + +is( + $exit_status, + 1, + "Non-zero exit status on error parsing options (bug 1039074)" +); + # ############################################################################# # Done. # ############################################################################# diff --git a/t/pt-deadlock-logger/option_sanity.t b/t/pt-deadlock-logger/option_sanity.t index 64149763..ce75689c 100644 --- a/t/pt-deadlock-logger/option_sanity.t +++ b/t/pt-deadlock-logger/option_sanity.t @@ -9,7 +9,7 @@ BEGIN { use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); -use Test::More tests => 3; +use Test::More tests => 4; use PerconaTest; @@ -39,6 +39,19 @@ like( 'Dest DSN requires t' ); +# ############################################################################# +# Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero +# ############################################################################# + +system("$trunk/bin/pt-deadlock-logger --i-am-the-error >/dev/null 2>&1"); +my $exit_status = $CHILD_ERROR >> 8; + +is( + $exit_status, + 1, + "Non-zero exit on option error (bug 1039074)" +); + # ############################################################################# # Done. # #############################################################################