Skip to content

Commit

Permalink
Better logging for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Dec 14, 2015
1 parent bacdc16 commit cba113c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions test/helpers.rb
Expand Up @@ -6,6 +6,8 @@
# when all other unit tests are included.
# To work aroung this bug, we run some files separately

@@startTime ||= Time.now

ENV['TZ'] = 'UTC'

USE_SIMPLECOV = false
Expand Down Expand Up @@ -48,7 +50,8 @@ def run_isolated_tests
else
result = system(cmd)
puts "#{Time.now}: OddbTestRunner::Running #{path} failed " unless result
end
end

@@directories[path] = result
}
end
Expand Down Expand Up @@ -82,8 +85,10 @@ def show_results_and_exit
problems << path
end
}
diffSeconds = (Time.now - @@startTime).to_i
puts "#{Time.now}: OddbTestRunner::Overall result for #{@rootDir} is #{okay}"
puts "#{Time.now}: OddbTestRunner::Overall failing test_suites were #{problems.join(',')}"
puts "#{Time.now}: OddbTestRunner::Overall failing test_suites were #{problems.join(',')}" if problems.size > 0
puts " Took #{(diffSeconds/60).to_i} minutes and #{diffSeconds % 60} seconds to run"
exit 2 unless okay
okay
end
Expand Down
6 changes: 5 additions & 1 deletion xvfb_rspec.sh
@@ -1,6 +1,10 @@
#!/bin/bash
spec_file=(${1//:/ })
log_file=rspec_`basename -s .rb $spec_file`.log
if [ -z $1 ]; then
log_file=rspec.log
else
log_file=rspec_`basename -s .rb $spec_file`.log
fi
Xvfb :1 -screen 5 1280x1024x24 -nolisten tcp 2>/dev/null &
export DISPLAY=:1.5
bundle exec rspec $1 2>&1 | tee $log_file
Expand Down

0 comments on commit cba113c

Please sign in to comment.