forked from sergiotarxz/LPSCBuilder
Replacing built in getopt in testrunner for global in build_system.pl
This commit is contained in:
parent
e420cdeaa3
commit
08abaf6e18
@ -8,7 +8,7 @@ use warnings;
|
||||
use DB_File;
|
||||
|
||||
use Params::ValidationCompiler qw/validation_for/;
|
||||
use Types::Standard qw/ArrayRef Str/;
|
||||
use Types::Standard qw/ArrayRef Str Bool/;
|
||||
|
||||
use Getopt::Long::Descriptive;
|
||||
use Path::Tiny qw/path/;
|
||||
@ -26,7 +26,13 @@ my $ERROR_CODE_SOME_TEST_FAILED = 500;
|
||||
params => {
|
||||
test_files => {
|
||||
type => ArrayRef [Str],
|
||||
}
|
||||
},
|
||||
clean => {
|
||||
type => Bool,
|
||||
},
|
||||
halt => {
|
||||
type => Bool,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@ -39,6 +45,8 @@ my $ERROR_CODE_SOME_TEST_FAILED = 500;
|
||||
my $test_files = $params{test_files};
|
||||
|
||||
$self->{test_files} = [@$test_files];
|
||||
$self->_options->{halt} = $params{halt};
|
||||
$self->_options->{clean} = $params{clean};
|
||||
|
||||
return $self;
|
||||
}
|
||||
@ -48,27 +56,10 @@ sub _options {
|
||||
my $self = shift;
|
||||
if ( !defined $self->{options} ) {
|
||||
$self->{options} = {};
|
||||
$self->_getopt;
|
||||
}
|
||||
return $self->{options};
|
||||
}
|
||||
|
||||
sub _getopt {
|
||||
my $self = shift;
|
||||
my ( $opt, $usage ) = describe_options(
|
||||
'./test_runner.pl %o',
|
||||
[ 'clean|c', "Cleans the previously succeded tests", ],
|
||||
[ 'halt|h', "Halts on error", ],
|
||||
[],
|
||||
[ 'help', "print usage message and exit", { shortcircuit => 1 } ],
|
||||
);
|
||||
|
||||
print( $usage->text ), die if $opt->help;
|
||||
my $options = $self->_options;
|
||||
$options->{halt} = $opt->halt;
|
||||
$options->{clean} = $opt->clean;
|
||||
}
|
||||
|
||||
sub run {
|
||||
my $self = shift;
|
||||
if ( $self->_options->{clean} ) {
|
||||
|
Loading…
Reference in New Issue
Block a user