From 497f969891d5bbdc6768707f59bdb55f7f26d955 Mon Sep 17 00:00:00 2001 From: Watson Date: Sat, 12 Apr 2014 00:44:00 +0900 Subject: [PATCH] [test] display the iOS result of `rake spec:all' on Jenkins CI console --- test/test/Rakefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/test/Rakefile b/test/test/Rakefile index d75c5356..9f100949 100644 --- a/test/test/Rakefile +++ b/test/test/Rakefile @@ -107,6 +107,9 @@ namespace :spec do rescue RuntimeError test_fail_count << $?.exitstatus end + + # for Jenkins CI + sh "rake spec:ci_output" if ENV['JENKINS_HOME'] && ENV['PLATFORM'] == 'ios' end end @@ -126,11 +129,11 @@ end # files. So we modify the `spec` task to do this and then print the results. # # Detect Jenkins CI with env var from: -# https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables +# https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins # -if ENV['JENKINS_URL'] && ENV['PLATFORM'] == 'ios' +if ENV['JENKINS_HOME'] && ENV['PLATFORM'] == 'ios' + stdout, stderr = '/tmp/sim-stdout.log', '/tmp/sim-stderr.log' task :create_ci_output_files do - stdout, stderr = '/tmp/sim-stdout.log', '/tmp/sim-stderr.log' [stdout, stderr].each do |file| FileUtils.rm(file) if File.exist?(file) FileUtils.touch(file) @@ -138,11 +141,12 @@ if ENV['JENKINS_URL'] && ENV['PLATFORM'] == 'ios' ENV['SIM_STDOUT_PATH'] = stdout ENV['SIM_STDERR_PATH'] = stderr end + task 'spec:simulator' => :create_ci_output_files do; end - task 'spec:simulator' => :create_ci_output_files do + task "spec:ci_output" do { - ENV['SIM_STDOUT_PATH'] => $stdout, - ENV['SIM_STDERR_PATH'] => $stderr, + stdout => $stdout, + stderr => $stderr, }.each do |path, io| File.open(path, 'r') do |file| file.each_line do |line|