about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/jitterbug/Builder.pm7
-rwxr-xr-xscripts/capsule.sh8
-rw-r--r--t/008_git_clone.t12
3 files changed, 20 insertions, 7 deletions
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index 256d3d5..eb9f924 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -124,7 +124,7 @@ sub run_task {
             debug("Checking out correct commit");
 
             # TODO: this may fail on non-unixy systems
-            system("git checkout " . $task->commit->sha256 . " &>/dev/null" );
+            system("git checkout " . $task->commit->sha256 . "&>/dev/null" );
             chdir $pwd;
         } else {
             debug("Creating new repo");
@@ -138,10 +138,11 @@ sub run_task {
     $self->sleep(1); # avoid race conditions
 
     debug("Checking out " . $task->commit->sha256 . " from $repo into $build_dir\n");
-    # $r->run( 'checkout', $task->commit->sha256 );
     my $pwd = getcwd;
     chdir $build_dir;
-    system("git checkout " . $task->commit->sha256 );
+
+    # TODO: this may fail on non-unixy systems
+    system("git checkout " . $task->commit->sha256 . "&>/dev/null");
     chdir $pwd;
 
     my $builder       =    $conf->{'jitterbug'}{'projects'}{$project->name}{'builder'}
diff --git a/scripts/capsule.sh b/scripts/capsule.sh
index 9fca79e..e6a5036 100755
--- a/scripts/capsule.sh
+++ b/scripts/capsule.sh
@@ -47,7 +47,6 @@ function jitterbug_build () {
     fi
 }
 
-
 echo "Creating report_path=$report_path"
 mkdir -p $report_path
 
@@ -60,6 +59,9 @@ if [ $use_perlbrew ]; then
         theperl=$(perl -e 'print $^V')
         logfile="$report_path/perl-$theperl.txt"
 
+        mkdir -p $report_path
+        touch $logfile
+
         echo ">perlbrew switch $theperl"
         perlbrew switch $theperl
         # TODO: check error condition
@@ -69,5 +71,9 @@ if [ $use_perlbrew ]; then
 else
         theperl=$(perl -e 'print $^V')
         logfile="$report_path/perl-$theperl.txt"
+
+        mkdir -p $report_path
+        touch $logfile
+
         jitterbug_build
 fi
diff --git a/t/008_git_clone.t b/t/008_git_clone.t
index 6e33018..5a7f915 100644
--- a/t/008_git_clone.t
+++ b/t/008_git_clone.t
@@ -1,4 +1,4 @@
-use Test::More tests => 3;
+use Test::More tests => 4;
 use Test::Exception;
 use strict;
 use warnings;
@@ -49,11 +49,17 @@ if (can_run('git')){
     my $gitrepo = "t/data/testing";
     dircopy "$gitrepo/._git_", "$gitrepo/.git" unless -e "$gitrepo/.git";
 
-    lives_ok sub { system("$^X scripts/post_to_hook.pl") }, 'post_to_hook.pl lives';
+    lives_ok sub { system("$^X -Ilib scripts/post_to_hook.pl") }, 'post_to_hook.pl lives';
 
-    lives_ok sub { system("$^X scripts/builder.pl -c t/data/test.yml -C") }, 'builder.pl lives';
+
+    lives_ok sub { # $ENV{DEBUG} = 1;
+        system("$^X -Ilib scripts/builder.pl -c t/data/test.yml -C")
+    }, 'builder.pl lives';
 
     ok(-e "t/tmp/build/testing/.git", 'found a testing git repo');
+    chdir "t/tmp/build/testing";
+    chomp( my $sha1 = qx{git rev-parse HEAD} );
+    is($sha1,"3ab75b9a29e09bf027f64250b44cab19b316c128", "got expected sha1 in repo");
 } else {
     skip "Git not available, skipping tests", 3;
 }