Commit 30e2270c authored by Guillaume Huard's avatar Guillaume Huard
Browse files

Old fixes still not committed

parent d131058e
......@@ -226,7 +226,12 @@ sub run_command($$$$) {
# we use select to perform I/Os with the child (still in order to avoid deadlocks)
my $sets = sets_create();
sets_add($sets, 'write', $child->{input});
if ($remaining->{input}) {
sets_add($sets, 'write', $child->{input});
} else {
close($child->{input});
delete($child->{input});
}
sets_add($sets, 'read', $child->{output});
sets_add($sets, 'read', $child->{error});
......@@ -362,6 +367,9 @@ sub run_special($$$$$) {
$special->{compiled} = $tmp_name;
}
}
if (exists($special->{content})) {
remove("$special->{filename}") unless $special->{keep};
}
}
# Adds limits if any
if (exists($special->{output_limit}) || exists($special->{error_limit}) || exists($special->{timeout})) {
......@@ -376,8 +384,8 @@ sub run_special($$$$$) {
} else {
$result = run_command($test_name, "./$name", $test, $has_limits);
}
if (exists($special->{content})) {
remove("$name") unless $special->{keep};
if (exists($special->{content}) && !exists($special->{compile})) {
remove("$special->{filename}") unless $special->{keep};
}
return $result;
}
......@@ -476,7 +484,8 @@ sub perform_tests($$) {
my $weight = get_value($test, 'weight', 1);
$total += $weight;
my $indication = $test_name.(($weight > 1)?" (weight ".$weight.")":"");
my $indication = $test_name;
$indication .= " (weight ".$weight.")" if exists($test->{weight});
my $result = undef;
my $details = "Test $test_name:\n";
# runs setup, if any
......@@ -500,7 +509,7 @@ sub perform_tests($$) {
$case->{compiled} = $test->{compiled} if exists($test->{compiled});
clean_outputs($data, $test);
$details .= "With the input:\n".preformat($test->{input})."\n" if length($test->{input});
$details .= "With the arguments: '@{$test->{args}}'\n" if $test->{args};
$details .= "With the arguments: ['".join("','", @{$test->{args}})."']\n" if $test->{args};
# runs a provided solution for the testcase
# this will populate test->{output,error,code} for the following test
......@@ -620,7 +629,7 @@ sub evaluate_file($) {
if (-f $file) {
my $description = read_file($file) || error("Cannot read $file");
remove("$file") || error("Unlink of $file resulted in $!");
my $result = eval $description || error($@);
my $result = eval $description || error("$file: $@");
return $result;
} else {
return undef;
......@@ -638,7 +647,7 @@ debug("VPL_SUBFILES : $ENV{VPL_SUBFILES}\n");
# read local setup and testcases to run
evaluate_file("vpl_evaluate_setup.pl");
my $test_cases = evaluate_file("vpl_evaluate.cases") || error("Invalid vpl_evaluate.cases");
my $test_cases = evaluate_file("vpl_evaluate.cases");
debug(Dumper($test_cases));
......@@ -658,7 +667,8 @@ foreach my $name (sort(keys(%$test_cases))) {
my @files;
my $weight = get_value($case, 'case_weight', 1);
my $title = "Test case $name".(($weight > 1)?" (weight ".$weight.")":"");
my $title = "Test case $name";
$title .= " (weight ".$weight.")" if exists($case->{case_weight});
title($title);
# Tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment