зеркало из https://github.com/github/ruby.git
Move the logic to test bundled gems to Ruby code
* Writing shell scripts in a Makefile is very error-prone. * TEST_BUNDLED_GEMS_ALLOW_FAILURES seemed to not work before.
This commit is contained in:
Родитель
d090e449ef
Коммит
4096e4b08c
|
@ -536,15 +536,7 @@ cont.$(OBJEXT): $(COROUTINE_H)
|
|||
TEST_BUNDLED_GEMS_ALLOW_FAILURES =
|
||||
|
||||
test-bundled-gems-run:
|
||||
$(Q) fail=0 keep=; case "$(MFLAGS)" in *k*) keep=1;; esac; \
|
||||
while read gem _; do \
|
||||
echo testing $$gem gem; \
|
||||
[ $$keep ] || echo $(TEST_BUNDLED_GEMS_ALLOW_FAILURES) | grep -q $$gem || set -e; \
|
||||
$(XRUBY) -C $(srcdir)/gems/src/$$gem -Ilib ../../../.bundle/bin/rake; \
|
||||
[ $$? = 0 ] || fail=1; \
|
||||
set +e; \
|
||||
done < $(srcdir)/gems/bundled_gems; \
|
||||
exit $$fail
|
||||
$(Q) $(XRUBY) $(srcdir)/tool/test-bundled-gems.rb
|
||||
|
||||
update-src::
|
||||
@$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSUP)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
require 'rbconfig'
|
||||
|
||||
allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || ''
|
||||
allowed_failures = allowed_failures.split(',').reject(&:empty?)
|
||||
|
||||
exit_code = 0
|
||||
File.foreach('gems/bundled_gems') do |line|
|
||||
gem = line.split.first
|
||||
puts "\nTesting the #{gem} gem"
|
||||
|
||||
gem_src_dir = File.expand_path("../../gems/src/#{gem}", __FILE__ )
|
||||
test_command = "#{RbConfig.ruby} -C #{gem_src_dir} -Ilib ../../../.bundle/bin/rake"
|
||||
puts test_command
|
||||
system test_command
|
||||
|
||||
unless $?.success?
|
||||
puts "Tests failed with exit code #{$?.exitstatus}"
|
||||
if allowed_failures.include?(gem)
|
||||
puts "Ignoring test failures for #{gem} due to \$TEST_BUNDLED_GEMS_ALLOW_FAILURES"
|
||||
else
|
||||
exit_code = $?.exitstatus
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
exit exit_code
|
Загрузка…
Ссылка в новой задаче