]> mj.ucw.cz Git - eval.git/blobdiff - submit/contest
Logfile of submit and check renamed to `check-log' to prevent collisions.
[eval.git] / submit / contest
index 0c2e0227a98528727a41b675f90ea7fdc67fcae6..3f9e6c39af4936fe5035dbded64bfe43894d0950 100755 (executable)
@@ -8,7 +8,7 @@ use warnings;
 BEGIN {
        defined $ENV{"MO_ROOT"} or die "Please set MO_ROOT to the contest root directory first.\n";
 }
-use lib $ENV{"MO_ROOT"} . "/submit";
+use lib $ENV{"MO_ROOT"} . "/lib/perl5";
 use lib $ENV{"MO_ROOT"} . "/submit/lib/perl5";
 
 use MO::Submit;
@@ -159,7 +159,7 @@ sub start_refresh_timer($) {
        my ($go) = @_;
        stop_refresh_timer();
        refresh() if $go;
-       $refresh_timer_id = Glib::Timeout->add($conn->{"RefreshTimer}, \&timed_refresh);
+       $refresh_timer_id = Glib::Timeout->add($conn->{"RefreshTimer"}, \&timed_refresh);
 }
 
 sub stop_refresh_timer() {
@@ -312,7 +312,7 @@ sub run_submit() {
        defined $part or $part = $task;
 
        if (defined $conn->{"History"}) {
-               busy("Submitting locally");
+               busy("Submitting locally to " . $conn->{"History"});
                my $err = $conn->local_submit($task, $part, $submit_extension, $submit_filename);
                if (defined $err) {
                        submit_failed("Recording to local history failed\n($err)");
@@ -382,8 +382,15 @@ sub checks_failed($) {
        $text_view->set_editable(0);
        $text_view->set_cursor_visible(0);
 
+       my $text_scroll = Gtk2::ScrolledWindow->new;
+       $text_scroll->set_policy("automatic", "automatic");
+       $text_scroll->add($text_view);
+
+       my $text_frame = Gtk2::Frame->new("Checker log");
+       $text_frame->add($text_scroll);
+
        $submitting_label->destroy;
-       $subwin_vbox->pack_start_defaults($text_view);
+       $subwin_vbox->pack_start_defaults($text_frame);
 
        finish_submit();
 }
@@ -415,9 +422,19 @@ sub run_checks() {
                checks_failed("The filename does not have a valid extension");
                return;
        }
-       sleep 1;
-       #checks_failed("One\nTwo\nThree...\n");
-       checks_ok();
+       if (!$conn->{"Checks"}) {
+               checks_ok();
+               return;
+       }
+       my $root = $conn->{"root"};
+       my ($task, $part) = split /\//, $selected_task;
+       defined $part or $part = "";
+       my $verdict = `$root/bin/check -s "$submit_filename" $task $part 2>&1`;
+       if ($?) {
+               checks_failed($verdict);
+       } else {
+               checks_ok();
+       }
 }
 
 sub do_submit() {