Skip JAVA/GOLANG/GCCGO if sudo is not used and improve TODO handling
[gruntmaster-daemon.git] / t / 01-jobs.t
index aa715e14fd8028a4e81de5c5a24df7a5d961562f..78dc416cb5a7b4acd20e8f8002ab8fbe990c563f 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Gruntmaster::Daemon;
 
-use Cwd qw/cwd/;
+use Cwd qw/getcwd/;
 use File::Basename qw/fileparse/;
 use File::Slurp qw/read_file/;
 use File::Temp qw/tempdir/;
@@ -40,7 +40,7 @@ log4perl.appender.stderr.layout.ConversionPattern = [\%d] [\%F{1}:\%M{1}:\%L] [\
 CONF
 Log::Log4perl->init(\$log_conf);
 
-$ENV{PATH} = cwd . ':' . $ENV{PATH};
+$ENV{PATH} = getcwd . ':' . $ENV{PATH};
 umask 0022;
 
 sub check_job{
@@ -59,7 +59,7 @@ my @problems = exists $ENV{TEST_PROBLEMS} ? map {"t/problems/$_"} split ' ', $EN
 plan tests => 3 * sum map { my @temp = <$_/tests/*>; scalar @temp } @problems;
 note "Problems to be tested: " . join ', ', @problems;
 
-my $tempdir = tempdir "gruntmaster-daemon-testingXXXX", TMPDIR => 1, CLEANUP => 1;
+my $tempdir = tempdir "gruntmasterd-testingXXXX", TMPDIR => 1, CLEANUP => 1;
 chmod 0777, $tempdir;
 
 my $job = 0;
@@ -75,19 +75,22 @@ for my $problem (@problems) {
        }
 
   TODO: {
-               local $TODO = $pbmeta->{todo} if exists $pbmeta->{todo};
                note "Now testing problem $pbmeta->{name} ($pbmeta->{description})";
 
                for my $source (<$problem/tests/*>) {
                  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}";
+                               if ($meta->{files}{prog}) {
+                                       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';
+                                       $meta->{files}{prog}{content} = read_file "$source/$meta->{files}{prog}{name}";
+                               }
                                $meta = merge $meta, $pbmeta;
+                               local $TODO = $meta->{todo} if exists $meta->{todo};
                                note "Running $meta->{test_name} ($meta->{test_description})...";
-                               my $savedcwd = cwd;
+                               my $savedcwd = getcwd;
                                chdir $tempdir;
                                Gruntmaster::Daemon::process $meta;
                                chdir $savedcwd;
This page took 0.010881 seconds and 4 git commands to generate.