Remove old .ft
This commit is contained in:
parent
f02f484cb8
commit
49e5dcddf4
@ -7,6 +7,7 @@ use threads;
|
||||
use threads::shared;
|
||||
use Carp;
|
||||
use File::Basename;
|
||||
use File::Compare;
|
||||
use File::Copy;
|
||||
use File::Path qw(remove_tree mkpath);
|
||||
use File::Temp qw/tempfile tempdir/;
|
||||
@ -153,11 +154,35 @@ sub create_testsuite
|
||||
jail_exec("gmake -C $tempdir/tests/");
|
||||
croak "An error occurs while making the testsuite" if ($?);
|
||||
|
||||
my $destdir = ( prepare_dir($year, $project_id, $rendu) )[2];
|
||||
my ($workdir, $outputdir, $destdir) = prepare_dir($year, $project_id, $rendu);
|
||||
copy("$tempdir/tests/tests.ff", "$destdir/tests.ff") or croak "An error occurs while coping the testsuite: $!";
|
||||
copy("$tempdir/tests/test.ft", "$destdir/test.ft") or croak "An error occurs while coping test.ft: $!";
|
||||
chmod 0660, "$destdir/tests.ff";
|
||||
chmod 0660, "$destdir/test.ft";
|
||||
|
||||
# Check if test.ft has changed
|
||||
if (-f "$tempdir/tests/test.ft")
|
||||
{
|
||||
if (! -f "$destdir/test.ft" || ! compare("$tempdir/tests/test.ft", "$destdir/test.ft"))
|
||||
{
|
||||
log DEBUG, "test.ft has changed, update students ones.";
|
||||
copy("$tempdir/tests/test.ft", "$destdir/test.ft") or croak "An error occurs while coping test.ft: $!";
|
||||
chmod 0660, "$destdir/test.ft";
|
||||
|
||||
opendir(my $dh, $workdir) or die "Can't list files in $workdir: $!";
|
||||
while (readdir($dh))
|
||||
{
|
||||
if (/([a-zA-Z0-9_-]+).ft$/)
|
||||
{
|
||||
log DEBUG, "Remove $1.ft";
|
||||
unlink "$workdir/$1.ft";
|
||||
}
|
||||
}
|
||||
closedir $dh;
|
||||
}
|
||||
}
|
||||
else {
|
||||
remove_tree($tempdir);
|
||||
croak "tests/test.ft not found.";
|
||||
}
|
||||
|
||||
# Clean
|
||||
remove_tree($tempdir);
|
||||
@ -210,7 +235,7 @@ sub run_moulette
|
||||
close $fhout;
|
||||
}
|
||||
|
||||
copy("$filesdir/$login.ff", "$workdir/$login.ff") or croak "Cannont copy $login.ff";
|
||||
copy("$filesdir/$login.ff", "$workdir/$login.ff") or croak "Cannot copy $login.ff";
|
||||
|
||||
next if ($login eq "ref" && ! -f "$workdir/$login.ft");
|
||||
croak "Unable to find a relevant $login.ft, abort moulette start." if (! -f "$workdir/$login.ft");
|
||||
|
Reference in New Issue
Block a user