mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Correct handling of no-output
This commit is contained in:
parent
e0359cba32
commit
1a1f8f8e63
@ -11,7 +11,7 @@ sub initialize {
|
||||
|
||||
$self->{sourcefile} = 'prog.c';
|
||||
$self->{execfile} = 'prog';
|
||||
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=bounds -fsanitize=alignment';
|
||||
$self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=bounds -fsanitize=alignment -fno-diagnostics-show-caret';
|
||||
$self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile';
|
||||
|
||||
$self->{prelude} = <<'END';
|
||||
|
@ -31,6 +31,8 @@ sub postprocess {
|
||||
|
||||
$result =~ s/\s+$//;
|
||||
|
||||
$self->{no_output} = 1 if not length $result;
|
||||
|
||||
$self->{output} .= $result;
|
||||
}
|
||||
|
||||
|
39
modules/compiler_vm/languages/server/_c_base.pm_2015-01-15-01:25:37~
Executable file
39
modules/compiler_vm/languages/server/_c_base.pm_2015-01-15-01:25:37~
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
package _c_base;
|
||||
use parent '_default';
|
||||
|
||||
sub postprocess {
|
||||
my $self = shift;
|
||||
|
||||
print "c11 postprocessing\n";
|
||||
|
||||
# no errors compiling, but if output contains something, it must be diagnostic messages
|
||||
if(length $self->{output}) {
|
||||
$self->{output} =~ s/^\s+//;
|
||||
$self->{output} =~ s/\s+$//;
|
||||
$self->{output} = "[$self->{output}]\n";
|
||||
}
|
||||
|
||||
print "Executing gdb\n";
|
||||
my $input_quoted = quotemeta $self->{input};
|
||||
$input_quoted =~ s/\\"/"'\\"'"/g;
|
||||
my ($retval, $result) = $self->execute(60, "bash -c \"date -s \@$self->{date}; ulimit -t 1; compiler_watchdog.pl $input_quoted > .output\"");
|
||||
|
||||
$result = "";
|
||||
open(FILE, '.output');
|
||||
while(<FILE>) {
|
||||
$result .= $_;
|
||||
last if length $result >= 1024 * 20;
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
$result =~ s/\s+$//;
|
||||
|
||||
$self->{output} .= $result;
|
||||
}
|
||||
|
||||
1;
|
@ -44,7 +44,6 @@ sub preprocess {
|
||||
}
|
||||
|
||||
sub postprocess {
|
||||
print "_default postprocessing\n";
|
||||
}
|
||||
|
||||
sub execute {
|
||||
|
@ -30,6 +30,8 @@ sub postprocess {
|
||||
|
||||
$result =~ s/\s+$//;
|
||||
|
||||
$self->{no_output} = 1 if not length $result;
|
||||
|
||||
$self->{output} .= $result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user