Add hello world tests for all languages (enabled when RELEASE_TESTING is true)
[gruntmaster-daemon.git] / t / 01-jobs.t
index a4e0c02..4b76310 100644 (file)
@@ -9,6 +9,7 @@ use Cwd qw/cwd/;
 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;
@@ -17,6 +18,18 @@ use YAML::Any qw/LoadFile/;
 
 ##################################################
 
+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
@@ -41,6 +54,8 @@ sub check_job{
 }
 
 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;
 
@@ -64,15 +79,20 @@ for my $problem (@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;
+                       }
                }
        }
 }
This page took 0.011014 seconds and 4 git commands to generate.