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 74bd5a2255a28678e33c0f4032f6de991d61c656..fdf68267fc3b79e4cdf47bcd3db72bb5f6161c4b 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/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
 t/problems/hello/tests/haskell/meta.yml
 t/problems/hello/tests/haskell/prog.hs
 t/problems/hello/tests/java/meta.yml
index ee80c409ace3a3b010018ffb91c6e7ec6184f151..89b10c526117e4d1a454fb52408175adafd04031 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';
 
        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;
                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';
                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 a0ab1223e32ad3a88e8ae5414657485212ca419c..fe252f786251c9ccf51350adb4df439323c47aa2 100644 (file)
@@ -22,6 +22,7 @@ use constant FORMAT_EXTENSION => {
        CPP => 'cpp',
        GCCGO => 'go',
        GOLANG => 'go',
        CPP => 'cpp',
        GCCGO => 'go',
        GOLANG => 'go',
+       GOLFSCRIPT => 'gs',
        HASKELL => 'hs',
        MONO => 'cs',
        JAVA => 'java',
        HASKELL => 'hs',
        MONO => 'cs',
        JAVA => 'java',
index 44fa9cc166a93b055d2ea7887a8484bba0127347..bda315a1636ed78c89900cd68be769885ff27656 100644 (file)
@@ -21,6 +21,7 @@ use YAML::Tiny qw/LoadFile/;
 use constant COMPILER => {
        qw/C gcc
           CPP g++
 use constant COMPILER => {
        qw/C gcc
           CPP g++
+          GOLFSCRIPT golfscript
           MONO gmcs
           JAVA javac
           PASCAL fpc
           MONO gmcs
           JAVA javac
           PASCAL fpc
@@ -32,6 +33,8 @@ use constant COMPILER => {
           RUBY ruby
           SBCL sbcl/};
 
           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
 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;
                                        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;
                                        $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.014711 seconds and 4 git commands to generate.