Add GolfScript
authorMarius Gavrilescu <marius@ieval.ro>
Sun, 22 Mar 2015 21:19:05 +0000 (23:19 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Sun, 22 Mar 2015 21:23:17 +0000 (23:23 +0200)
MANIFEST
gruntmaster-compile
lib/Gruntmaster/Daemon.pm
t/01-jobs.t
t/problems/hello/tests/golfscript/meta.yml [new file with mode: 0644]
t/problems/hello/tests/golfscript/prog.gs [new file with mode: 0644]

index 74bd5a2..fdf6826 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -104,6 +104,8 @@ 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/golfscript/meta.yml
+t/problems/hello/tests/golfscript/prog.gs
 t/problems/hello/tests/haskell/meta.yml
 t/problems/hello/tests/haskell/prog.hs
 t/problems/hello/tests/java/meta.yml
index ee80c40..89b10c5 100755 (executable)
@@ -29,9 +29,10 @@ given ($format){
        exec 'go', qw/build -compiler gccgo/, $name, when 'GCCGO';
        exec 'ghc', qw/-DONLINE_JUDGE -Wall -O2 -o/, $basename, $name when 'HASKELL';
 
-       when ([qw/PERL PYTHON RUBY SBCL/]){
+       when ([qw/GOLFSCRIPT PERL PYTHON RUBY SBCL/]){
                open IN, '<', $name;
                open OUT, '>', $basename;
+               print OUT "#!/usr/bin/golfscript\n"    if $_ eq 'GOLFSCRIPT';
                print OUT "#!/usr/bin/perl\n"          if $_ eq 'PERL';
                print OUT "#!/usr/bin/python\n"        if $_ eq 'PYTHON';
                print OUT "#!/usr/bin/ruby\n"          if $_ eq 'RUBY';
index a0ab122..fe252f7 100644 (file)
@@ -22,6 +22,7 @@ use constant FORMAT_EXTENSION => {
        CPP => 'cpp',
        GCCGO => 'go',
        GOLANG => 'go',
+       GOLFSCRIPT => 'gs',
        HASKELL => 'hs',
        MONO => 'cs',
        JAVA => 'java',
index 44fa9cc..bda315a 100644 (file)
@@ -21,6 +21,7 @@ use YAML::Tiny qw/LoadFile/;
 use constant COMPILER => {
        qw/C gcc
           CPP g++
+          GOLFSCRIPT golfscript
           MONO gmcs
           JAVA javac
           PASCAL fpc
@@ -32,6 +33,8 @@ use constant COMPILER => {
           RUBY ruby
           SBCL sbcl/};
 
+my %needs_fork = map { $_ => 1 } qw/GOLANG GOLFSCRIPT GCCGO JAVA RUBY/;
+
 my $loglevel = $ENV{TEST_LOG_LEVEL} // ($ENV{TEST_VERBOSE} ? 'TRACE' : 'OFF');
 my $log_conf = <<CONF;
 log4perl.category.Gruntmaster.Daemon = $loglevel, stderr
@@ -87,7 +90,7 @@ for my $problem (@problems) {
                                        my $format = $meta->{files}{prog}{format};
                                        my $compiler = COMPILER->{$format};
                                        skip "$compiler not found in path", 3 unless $ENV{GRUNTMASTER_VM} || which $compiler;
-                                       skip "$format requires multiple processes. Set GRUNTMASTER_KILL_USER and GRUNTMASTER_SUDO to allow multiple processes.", 3 if !$ENV{GRUNTMASTER_KILL_USER} && ($format eq 'JAVA' || $format eq 'GOLANG' || $format eq 'GCCGO' || $format eq 'RUBY');
+                                       skip "$format requires multiple processes. Set GRUNTMASTER_KILL_USER and GRUNTMASTER_SUDO to allow multiple processes.", 3 if !$ENV{GRUNTMASTER_KILL_USER} && $needs_fork{$format};
                                        $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}";
                                }
                                $meta = merge $meta, $pbmeta;
diff --git a/t/problems/hello/tests/golfscript/meta.yml b/t/problems/hello/tests/golfscript/meta.yml
new file mode 100644 (file)
index 0000000..b39eb67
--- /dev/null
@@ -0,0 +1,7 @@
+test_name: GolfScript
+test_description: Hello world in GolfScript
+problem: hello
+files:
+  prog:
+    format: GOLFSCRIPT
+    name: prog.gs
diff --git a/t/problems/hello/tests/golfscript/prog.gs b/t/problems/hello/tests/golfscript/prog.gs
new file mode 100644 (file)
index 0000000..7bc507a
--- /dev/null
@@ -0,0 +1 @@
+'Hello World!'
This page took 0.035596 seconds and 4 git commands to generate.