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
589107d1
Commit
589107d1
authored
Apr 24, 2020
by
Guillaume Huard
Browse files
Bugfix + undefined execute + keep + special override
parent
50e7e01e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Basic_System/ef/vpl_evaluate.pl
View file @
589107d1
...
...
@@ -159,6 +159,11 @@ sub run_special($$$$) {
if
(
ref
(
$special
)
ne
'
HASH
')
{
$special
=
{
content
=>
$content
};
}
else
{
my
$given_test
=
$test
;
$test
=
{};
add_values
(
$test
,
$given_test
);
add_values
(
$test
,
$special
);
}
# generate file if required and populate the 'files' array
if
(
exists
(
$special
->
{
content
}))
{
...
...
@@ -189,8 +194,10 @@ sub run_special($$$$) {
}
my
$result
;
if
(
exists
(
$special
->
{
execute
}))
{
setup_env
(
$name
,
$special
);
$result
=
run_special
(
$test_name
,
'
.execute
',
$special
->
{
execute
},
$test
);
if
(
$special
->
{
execute
})
{
setup_env
(
$name
,
$special
);
$result
=
run_special
(
$test_name
,
'
.execute
',
$special
->
{
execute
},
$test
);
}
}
else
{
debug
("
Executing
$name
\n
");
$result
=
run_command
(
$test_name
,
"
./
$name
",
$test
);
...
...
@@ -199,7 +206,7 @@ sub run_special($$$$) {
}
}
if
(
exists
(
$special
->
{
content
}))
{
remove
("
$name
")
unless
$special
->
{
compiled
};
remove
("
$name
")
unless
$special
->
{
compiled
}
or
$special
->
{
keep
}
;
}
return
$result
;
}
...
...
@@ -213,7 +220,7 @@ sub clean_outputs($$) {
$level
=
2
unless
defined
(
$level
);
foreach
my
$part
('
output
',
'
error
')
{
if
(
$data
->
{
$part
}
=~
m/Grade\s*:=>>/i
)
{
if
(
$data
->
{
$part
}
&&
(
$data
->
{
$part
}
=~
m/Grade\s*:=>>/i
)
)
{
$data
->
{
$part
}
=
"
Pathetic attempt to set the grade detected
\n
"
.
"
Please stop trying to hack the system
";
}
...
...
@@ -315,22 +322,23 @@ sub perform_tests($$) {
my
$answer
=
run_special
(
$test_name
,
'
.solution
',
$test
->
{
solution
},
$test
);
if
(
$answer
->
{
compilation_error
})
{
dispatch_error
("
Cannot compile provided solution
",
$answer
,
0
);
}
clean_outputs
(
$answer
,
$test
);
my
$match
;
if
(
exists
(
$test
->
{
match
}))
{
$match
=
$test
->
{
match
};
}
else
{
$match
=
[
'
output
'
];
}
foreach
my
$part
('
output
',
'
error
',
'
code
')
{
if
(
scalar
(
grep
(
/$part/
,
@$match
)))
{
$test
->
{
$part
}
=
$answer
->
{
$part
};
clean_outputs
(
$answer
,
$test
);
my
$match
;
if
(
exists
(
$test
->
{
match
}))
{
$match
=
$test
->
{
match
};
}
else
{
if
(
$part
eq
'
code
')
{
debug
("
Solution
$part
:
\n
$answer
->{
$part
}
\n
")
if
$answer
->
{
$part
};
$match
=
[
'
output
'
];
}
foreach
my
$part
('
output
',
'
error
',
'
code
')
{
if
(
scalar
(
grep
(
/$part/
,
@$match
)))
{
$test
->
{
$part
}
=
$answer
->
{
$part
};
}
else
{
debug
("
Solution
$part
:
\n
$answer
->{
$part
}
\n
")
if
length
(
$answer
->
{
$part
});
if
(
$part
eq
'
code
')
{
debug
("
Solution
$part
:
\n
$answer
->{
$part
}
\n
")
if
$answer
->
{
$part
};
}
else
{
debug
("
Solution
$part
:
\n
$answer
->{
$part
}
\n
")
if
length
(
$answer
->
{
$part
});
}
}
}
}
...
...
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