From f8b954a9c19fd5449b244cb15663ca6226806328 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 22 Mar 2015 23:19:05 +0200 Subject: [PATCH] Add GolfScript --- MANIFEST | 2 ++ gruntmaster-compile | 3 ++- lib/Gruntmaster/Daemon.pm | 1 + t/01-jobs.t | 5 ++++- t/problems/hello/tests/golfscript/meta.yml | 7 +++++++ t/problems/hello/tests/golfscript/prog.gs | 1 + 6 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 t/problems/hello/tests/golfscript/meta.yml create mode 100644 t/problems/hello/tests/golfscript/prog.gs diff --git a/MANIFEST b/MANIFEST index 74bd5a2..fdf6826 100644 --- 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 diff --git a/gruntmaster-compile b/gruntmaster-compile index ee80c40..89b10c5 100755 --- a/gruntmaster-compile +++ b/gruntmaster-compile @@ -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'; diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index a0ab122..fe252f7 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -22,6 +22,7 @@ use constant FORMAT_EXTENSION => { CPP => 'cpp', GCCGO => 'go', GOLANG => 'go', + GOLFSCRIPT => 'gs', HASKELL => 'hs', MONO => 'cs', JAVA => 'java', diff --git a/t/01-jobs.t b/t/01-jobs.t index 44fa9cc..bda315a 100644 --- a/t/01-jobs.t +++ b/t/01-jobs.t @@ -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 = <{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 index 0000000..b39eb67 --- /dev/null +++ b/t/problems/hello/tests/golfscript/meta.yml @@ -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 index 0000000..7bc507a --- /dev/null +++ b/t/problems/hello/tests/golfscript/prog.gs @@ -0,0 +1 @@ +'Hello World!' -- 2.39.2