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
486f8178
Commit
486f8178
authored
May 16, 2020
by
Guillaume Huard
Browse files
Bugfix (empty input !)
parent
935d5c7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Basic_System/ef/vpl_evaluate.pl
View file @
486f8178
...
...
@@ -115,17 +115,17 @@ sub run_command($$$$) {
}
}
my
$data
=
{};
$test
->
{
input
}
=
""
unless
defined
(
$test
->
{
input
}
);
write_file
("
.internal_input.txt
",
$
test
->
{
input
}
)
||
error
("
Cannot write input file
");
my
$
input
=
get_value
(
$test
,
'
input
',
""
);
write_file
("
.internal_input.txt
",
$input
)
||
error
("
Cannot write input file
");
my
$command_line
=
"
$command$arguments
>.internal_output.txt 2>.internal_error.txt <.internal_input.txt
";
if
(
$has_limits
)
{
# We build an execution wrapper to ensure the use of bash instead of /bin/sh (system's default)
# This avoids issues with ulimit
my
$command_script
=
"
#!/bin/bash
\n
";
# $command_script .= "set -x\n";
$command_script
.=
"
ulimit -f
"
.
get_value
(
$test
,
'
IOlimit
',
100
)
.
"
\n
";
$command_script
.=
"
timeout -s9
"
.
get_value
(
$test
,
'
timeout
',
10
)
.
"
";
$command_script
.=
"
exec
timeout -s9
"
.
get_value
(
$test
,
'
timeout
',
10
)
.
"
";
$command_script
.=
$command_line
;
# debug("Command script :\n$command_script\n");
ensure_write
("
.execution_wrapper
",
$command_script
);
chmod
(
0755
,
"
.execution_wrapper
")
||
error
("
Cannot make execution_wrapper executable
");
$command_line
=
"
./.execution_wrapper
";
...
...
@@ -137,6 +137,7 @@ sub run_command($$$$) {
$data
->
{
code
}
=
$data
->
{
failure
}
>>
8
;
$data
->
{
output
}
=
read_file
("
.internal_output.txt
");
$data
->
{
error
}
=
read_file
("
.internal_error.txt
");
# debug("Result : ".Dumper($data));
remove
("
.execution_wrapper
")
if
$has_limits
;
remove
("
.internal_input.txt
",
"
.internal_output.txt
",
"
.internal_error.txt
");
return
$data
;
...
...
@@ -161,9 +162,11 @@ sub dispatch_error($$$) {
my
$data
=
shift
;
my
$soft_fail
=
shift
;
unless
(
$soft_fail
)
{
print
$data
->
{
output
}
if
length
(
$data
->
{
output
});
print
STDERR
$data
->
{
error
}
if
length
(
$data
->
{
error
});
print
$data
->
{
output
}
if
length
(
$data
->
{
output
});
print
STDERR
$data
->
{
error
}
if
length
(
$data
->
{
error
});
if
(
$soft_fail
)
{
print
$message
,
"
\n
";
}
else
{
error
(
$message
);
}
}
...
...
@@ -211,7 +214,6 @@ sub run_special($$$$$) {
setup_env
(
$name
,
$special
);
my
$data
=
run_special
(
$name
,
'
.compile
',
$special
->
{
compile
},
$special
,
0
);
if
(
$data
->
{
failure
})
{
dispatch_error
("
Cannot compile
$name
",
$data
,
1
);
$data
->
{
compilation_error
}
=
1
;
return
$data
;
}
else
{
...
...
@@ -229,9 +231,6 @@ sub run_special($$$$$) {
}
else
{
debug
("
Executing
$name
\n
");
$result
=
run_command
(
$test_name
,
"
./
$name
",
$test
,
$has_limits
);
if
(
$result
->
{
failure
})
{
dispatch_error
("
Cannot execute
$name
",
$result
,
1
);
}
}
if
(
exists
(
$special
->
{
content
}))
{
remove
("
$name
")
unless
$special
->
{
compiled
}
or
$special
->
{
keep
};
...
...
@@ -341,7 +340,7 @@ sub perform_tests($$) {
foreach
my
$part
('
output
',
'
error
')
{
print
STDERR
"
Setup
$part
:
\n
$setup
->{
$part
}
"
if
length
(
$setup
->
{
$part
});
}
print
STDERR
"
*** POSSIBLE ERROR : Setup exited with
"
.
format_error
(
$setup
)
.
"
\n
"
dispatch_error
(
"
*** POSSIBLE ERROR : Setup exited with
"
.
format_error
(
$setup
)
,
$setup
,
1
)
if
$setup
->
{
failure
};
}
...
...
@@ -399,7 +398,7 @@ sub perform_tests($$) {
$details
.=
"
Validator
$part
is:
\n
"
.
preformat
(
$valid
->
{
$part
})
.
"
\n
"
if
length
(
$valid
->
{
$part
});
}
if
(
!
$result
)
{
$details
.=
"
The validator did not validate the test (
code :
$valid
->{code}, signal :
$valid
->{signal}
)
\n
";
$details
.=
"
The validator did not validate the test (
"
.
format_error
(
$valid
)
.
"
)
\n
";
}
debug
"
Done with validator subtest with result
$result
\n
";
remove
("
.program_name.txt
",
"
.arguments.txt
");
...
...
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