Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
projet
VPLPP
Commits
362c59a0
Commit
362c59a0
authored
May 18, 2020
by
Guillaume Huard
Browse files
outputs_limits -> output/error_limit
parent
af8f95f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Basic_System/ef/vpl_evaluate.pl
View file @
362c59a0
...
...
@@ -122,14 +122,18 @@ sub run_command($$$$) {
my
$data
=
{};
my
$input
=
get_value
(
$test
,
'
input
',
"");
write_file
("
.internal_input.txt
",
$input
)
||
error
("
Cannot write input file
");
my
$outputs_limit
=
-
1
;
my
$output_limit
=
-
1
;
my
$error_limit
=
-
1
;
my
$command_line
=
"
$command$arguments
>.internal_output.txt 2>.internal_error.txt <.internal_input.txt
";
debug
("
Executing
$command
");
if
(
$has_limits
)
{
$outputs_limit
=
get_value
(
$test
,
'
outputs_limit
',
100
);
$output_limit
=
get_value
(
$test
,
'
output_limit
',
100
*
1024
);
$error_limit
=
get_value
(
$test
,
'
error_limit
',
100
*
1024
);
my
$timeout
=
get_value
(
$test
,
'
timeout
',
10
);
debug
("
with outputs_limit
${outputs_limit}
Kb and timeout
${timeout}
s
");
$outputs_limit
*=
1024
if
$outputs_limit
!=
-
1
;
debug
("
with output limited to
${output_limit}
bytes, error limited to
${error_limit}
bytes
"
.
"
and timeout at
${timeout}
s
");
# $output_limit *= 1024 if $output_limit != -1;
# $error_limit *= 1024 if $error_limit != -1;
$command_line
=
"
exec timeout -s9
$timeout
$command_line
";
}
debug
("
\n
");
...
...
@@ -138,8 +142,8 @@ sub run_command($$$$) {
$data
->
{
failure
}
=
system
(
$command_line
);
$data
->
{
signal
}
=
$data
->
{
failure
}
&
0xFF
;
$data
->
{
code
}
=
$data
->
{
failure
}
>>
8
;
(
$data
->
{
output
},
$data
->
{
output_bounded
})
=
bounded_read_file
("
.internal_output.txt
",
$output
s
_limit
);
(
$data
->
{
error
},
$data
->
{
error_bounded
})
=
bounded_read_file
("
.internal_error.txt
",
$
outputs
_limit
);
(
$data
->
{
output
},
$data
->
{
output_bounded
})
=
bounded_read_file
("
.internal_output.txt
",
$output_limit
);
(
$data
->
{
error
},
$data
->
{
error_bounded
})
=
bounded_read_file
("
.internal_error.txt
",
$
error
_limit
);
# debug("Result : ".Dumper($data));
remove
("
.internal_input.txt
",
"
.internal_output.txt
",
"
.internal_error.txt
");
return
$data
;
...
...
@@ -225,7 +229,7 @@ sub run_special($$$$$) {
$special
->
{
compiled
}
=
1
;
}
# Adds limits if any
if
(
exists
(
$special
->
{
output
s
_limit
})
||
exists
(
$special
->
{
timeout
}))
{
if
(
exists
(
$special
->
{
output
_limit
})
||
exists
(
$special
->
{
error
_limit
})
||
exists
(
$special
->
{
timeout
}))
{
$has_limits
=
1
;
}
my
$result
;
...
...
@@ -422,11 +426,12 @@ sub perform_tests($$) {
if
(
defined
(
$test
->
{
$part
})
||
(
$data
->
{
$part
}))
{
if
(
$data
->
{
$
{
part
}
.
'
_bounded
'})
{
$details
.=
"
Your program standard
$part
has reached the upper limit
";
$details
.=
"
, still testing it
"
if
defined
(
$test
->
{
$part
});
}
else
{
$details
.=
"
Your program
$description
->{
$part
}:
\n
"
.
preformat
(
$data
->
{
$part
});
}
if
(
defined
(
$test
->
{
$part
}))
{
my
$local_result
=
(
$data
->
{
$part
}
eq
$test
->
{
$part
})
&&
!
$data
->
{
$
{
part
}
.
'
_bounded
'}
;
my
$local_result
=
(
$data
->
{
$part
}
eq
$test
->
{
$part
});
if
(
!
$local_result
)
{
$details
.=
"
\n
But the expectation was:
\n
"
.
preformat
(
$test
->
{
$part
})
.
"
\n
";
}
else
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment