Hide some warnings

This commit is contained in:
Xavier Guimard 2017-01-27 09:39:58 +00:00
parent abb49f7b39
commit f7df1db206
6 changed files with 36 additions and 24 deletions

View File

@ -44,7 +44,7 @@ sub types {
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -833,7 +833,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval $s;
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -914,7 +914,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -949,7 +949,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -1273,7 +1273,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval $s;
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -1319,7 +1319,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : 1;
@ -1957,7 +1957,7 @@ qr/^(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-
BEGIN {
${^WARNING_BITS} =
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
"\x54\x55\x55\x55\x15\x55\x55\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55";
}
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : 1;

View File

@ -25,7 +25,7 @@ my $perlExpr = sub {
foreach my $f (@cf) {
$s = "sub $f {1} $s";
}
no warnings 'redefine';
no warnings( 'redefine', 'uninitialized' );
eval "$s $val";
return $@ ? ( 1, "__badExpression__: $@" ) : (1);
};
@ -426,13 +426,13 @@ sub attributes {
# Security
formTimeout => {
default => 120,
type => 'int',
default => 120,
type => 'int',
documentation => 'Token timeout for forms',
},
requireToken => {
default => 1,
type => 'bool',
default => 1,
type => 'bool',
documentation => 'Enable token for forms',
},
cda => {
@ -1041,7 +1041,7 @@ sub attributes {
foreach my $f (@cf) {
$s = "sub $f {1} $s";
}
no warnings 'redefine';
no warnings( 'redefine', 'uninitialized' );
eval $s;
return $@ ? ( 1, "__badExpression__: $@" ) : (1);
},
@ -1075,7 +1075,7 @@ sub attributes {
foreach my $f (@cf) {
$s = "sub $f {1} $s";
}
no warnings 'redefine';
no warnings( 'redefine', 'uninitialized' );
eval $s;
return $@ ? ( 1, "__badExpression__: $@" ) : (1);
}

View File

@ -186,13 +186,16 @@ sub tests {
$Lemonldap::NG::Handler::PSGI::API::tsv->{sessionStorageModule};
return 1
if ( ( $gc and $gc eq $conf->{globalStorage} )
or $conf->{globalStorage} eq
'Lemonldap::NG::Common::Apache::Session::SOAP' );
or $conf->{globalStorage} =~
/^Lemonldap::NG::Common::Apache::Session::/ );
eval "use $conf->{globalStorage}";
return ( -1, "Unknown package $conf->{globalStorage}" ) if ($@);
eval {
tie %h, $conf->{globalStorage}, undef,
$conf->{globalStorageOptions};
tie %h, 'Lemonldap::NG::Common::Apache::Session', undef,
{
%{ $conf->{globalStorageOptions} },
backend => $conf->{globalStorage}
};
};
return ( -1, "Unable to create a session ($@)" )
if ( $@ or not tied(%h) );
@ -200,8 +203,11 @@ sub tests {
$h{a} = 1;
$id = $h{_session_id} or return ( -1, 'No _session_id' );
untie(%h);
tie %h, $conf->{globalStorage}, $id,
$conf->{globalStorageOptions};
tie %h, 'Lemonldap::NG::Common::Apache::Session', $id,
{
%{ $conf->{globalStorageOptions} },
backend => $conf->{globalStorage}
};
};
return ( -1, "Unable to insert datas ($@)" ) if ($@);
return ( -1, "Unable to recover data stored" )
@ -210,7 +216,7 @@ sub tests {
return ( -1, "Unable to delete session ($@)" ) if ($@);
return ( -1,
'All sessions may be lost and you must restart all your Apache servers'
) if ( $conf->{globalStorage} ne $gc );
) if ( $gc and $conf->{globalStorage} ne $gc );
return 1;
},

View File

@ -21,6 +21,7 @@ sub body {
# Delete lmConf-2.js if exists
eval { unlink $confFiles->[1]; };
mkdir 't/sessions';
# Try to save an unmodified conf
while ( my $body = &body() ) {
@ -48,6 +49,7 @@ while ( my $body = &body() ) {
#print STDERR Dumper($resBody);
count(6);
}
eval { unlink $confFiles->[1]; };
eval { unlink $confFiles->[1]; rmdir 't/sessions'; };
done_testing( count() );

View File

@ -18,6 +18,7 @@ sub body {
# Delete lmConf-2.js if exists
eval { unlink $confFiles->[1]; };
mkdir 't/sessions';
my ( $res, $resBody );
ok( $res = &client->_post( '/confs/', 'cfgNum=1', &body, 'application/json' ),
@ -76,6 +77,7 @@ ok( @c2 == 13, '13 keys changed or created in conf 2' )
count(5);
unlink $confFiles->[1];
eval { rmdir 't/sessions'; };
done_testing( count() );
sub changes {

View File

@ -24,8 +24,10 @@ ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
ok( $resBody->{result} == 0, "JSON response contains \"result:0\"" )
or print STDERR Dumper($res);
ok(
$resBody->{details}->{__errors__}
and @{ $resBody->{details}->{__errors__} } == 1,
(
$resBody->{details}->{__errors__}
and @{ $resBody->{details}->{__errors__} } == 1
),
'1 error detected'
) or print STDERR Dumper($resBody);