t/problems/double/meta.yml
t/problems/double/tests/wa/meta.yml
t/problems/double/tests/wa/prog.c
+t/problems/hello/1.in
+t/problems/hello/1.ok
+t/problems/hello/meta.yml
+t/problems/hello/tests/c/meta.yml
+t/problems/hello/tests/cpp/meta.yml
+t/problems/hello/tests/cpp/prog.cpp
+t/problems/hello/tests/c/prog.c
+t/problems/hello/tests/gccgo/meta.yml
+t/problems/hello/tests/gccgo/prog.go
+t/problems/hello/tests/golang/meta.yml
+t/problems/hello/tests/golang/prog.go
+t/problems/hello/tests/haskell/meta.yml
+t/problems/hello/tests/haskell/prog.hs
+t/problems/hello/tests/java/meta.yml
+t/problems/hello/tests/java/prog.java
+t/problems/hello/tests/mono/meta.yml
+t/problems/hello/tests/mono/prog.cs
+t/problems/hello/tests/mono/prog.exe
+t/problems/hello/tests/pascal/meta.yml
+t/problems/hello/tests/pascal/prog.pas
+t/problems/hello/tests/perl/meta.yml
+t/problems/hello/tests/perl/prog.pl
+t/problems/hello/tests/python/meta.yml
+t/problems/hello/tests/python/prog.py
t/problems/increment/ver.c
t/problems/increment/meta.yml
t/problems/increment/tests/ac/meta.yml
File::Basename 0
File::Slurp 0
File::Temp 0
+ File::Which 0
Hash::Merge 0
List::Util 0
Log::Log4perl 0
use File::Basename qw/fileparse/;
use File::Slurp qw/read_file/;
use File::Temp qw/tempdir/;
+use File::Which qw/which/;
use Hash::Merge qw/merge/;
use List::Util qw/sum/;
use Log::Log4perl;
##################################################
+use constant COMPILER => {
+ qw/C gcc
+ CPP g++
+ MONO gmcs
+ JAVA javac
+ PASCAL fpc
+ GOLANG go
+ GCCGO gccgo
+ HASKELL ghc
+ PERL perl
+ PYTHON python/};
+
my $loglevel = $ENV{TEST_LOG_LEVEL} // ($ENV{TEST_VERBOSE} ? 'TRACE' : 'OFF');
my $log_conf = <<CONF;
log4perl.category.Gruntmaster.Daemon = $loglevel, stderr
}
my @problems = exists $ENV{TEST_PROBLEMS} ? map {"t/problems/$_"} split ' ', $ENV{TEST_PROBLEMS} : <t/problems/*>;
+@problems = grep { $_ !~ /hello/ } @problems unless $ENV{RELEASE_TESTING} || $ENV{TEST_PROBLEMS};
+
plan tests => 3 * sum map { my @temp = <$_/tests/*>; scalar @temp } @problems;
note "Problems to be tested: " . join ', ', @problems;
note "Now testing problem $pbmeta->{name} ($pbmeta->{description})";
for my $source (<$problem/tests/*>) {
- my $meta = LoadFile "$source/meta.yml";
- $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}";
- $meta = merge $meta, $pbmeta;
- note "Running $meta->{test_name} ($meta->{test_description})...";
- my $savedcwd = cwd;
- chdir $tempdir;
- Gruntmaster::Daemon::process $meta;
- chdir $savedcwd;
- check_job $meta;
+ SKIP: {
+ my $meta = LoadFile "$source/meta.yml";
+ my $compiler = COMPILER->{$meta->{files}{prog}{format}};
+ skip "$compiler not found in path", 3 unless $ENV{GRUNTMASTER_VM} || which $compiler;
+ local $TODO = $meta->{todo} if exists $meta->{todo};
+ $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}";
+ $meta = merge $meta, $pbmeta;
+ note "Running $meta->{test_name} ($meta->{test_description})...";
+ my $savedcwd = cwd;
+ chdir $tempdir;
+ Gruntmaster::Daemon::process $meta;
+ chdir $savedcwd;
+ check_job $meta;
+ }
}
}
}
--- /dev/null
+Hello World!
--- /dev/null
+name: Hello World
+generator: File
+judge: Absolute
+runner: File
+testcnt: 1
+timeout: 1
+# mlimit: 20971520 # Python does not like memory limits
+olimit: 100
+description: Print "Hello World!"
+expected_result: 0
+expected_result_text: Accepted
+expected_results:
+- id: 1
+ result: 0
+ result_text: 0
--- /dev/null
+test_name: C
+test_description: Hello world in C
+problem: hello
+files:
+ prog:
+ format: C
+ name: prog.c
--- /dev/null
+#include<stdio.h>
+
+int main(void){
+ puts("Hello World!");
+ return 0;
+}
--- /dev/null
+test_name: C++
+test_description: Hello world in C++
+problem: hello
+files:
+ prog:
+ format: CPP
+ name: prog.cpp
--- /dev/null
+#include<cstdio>
+
+int main(void){
+ puts("Hello World!");
+ return 0;
+}
--- /dev/null
+test_name: Go (gccgo)
+test_description: Hello world in Go (using gccgo)
+problem: hello
+files:
+ prog:
+ format: GCCGO
+ name: prog.go
--- /dev/null
+package main
+import "fmt"
+func main() {
+ fmt.Println("Hello World!")
+}
\ No newline at end of file
--- /dev/null
+test_name: Go (golang)
+test_description: Hello world in Go (using golang)
+problem: hello
+files:
+ prog:
+ format: GOLANG
+ name: prog.go
--- /dev/null
+package main
+import "fmt"
+func main() {
+ fmt.Println("Hello World!")
+}
\ No newline at end of file
--- /dev/null
+test_name: Haskell
+test_description: Hello world in Haskell
+problem: hello
+files:
+ prog:
+ format: HASKELL
+ name: prog.hs
--- /dev/null
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello World!"
--- /dev/null
+test_name: Java
+test_description: Hello world in Java
+problem: hello
+files:
+ prog:
+ format: JAVA
+ name: prog.java
--- /dev/null
+public class prog {
+ public static void main(final String[] args){
+ System.out.println("Hello World!");
+ }
+}
--- /dev/null
+test_name: C#
+test_description: Hello world in C#
+problem: hello
+todo: C# does not work with low output limits
+files:
+ prog:
+ format: MONO
+ name: prog.cs
--- /dev/null
+using System;
+class prog {
+ static void Main() {
+ Console.WriteLine("Hello World!");
+ }
+}
\ No newline at end of file
--- /dev/null
+test_name: Pascal
+test_description: Hello world in Pascal
+problem: hello
+files:
+ prog:
+ format: PASCAL
+ name: prog.pas
--- /dev/null
+program HelloWorld;
+begin
+ writeln('Hello World!')
+end.
--- /dev/null
+test_name: Perl
+test_description: Hello world in Perl
+problem: hello
+files:
+ prog:
+ format: PERL
+ name: prog.pl
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+print 'Hello World!';
--- /dev/null
+test_name: Python
+test_description: Hello world in Python
+problem: hello
+files:
+ prog:
+ format: PYTHON
+ name: prog.py
--- /dev/null
+#!/usr/bin/python
+print 'Hello World!';