ruby-changes:58013
From: Benoit <ko1@a...>
Date: Sun, 29 Sep 2019 20:58:17 +0900 (JST)
Subject: [ruby-changes:58013] 4096e4b08c (master): Move the logic to test bundled gems to Ruby code
https://git.ruby-lang.org/ruby.git/commit/?id=4096e4b08c From 4096e4b08c46dddb8edc9dabf70e737946ac6df8 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Sun, 29 Sep 2019 12:16:10 +0200 Subject: 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. diff --git a/template/Makefile.in b/template/Makefile.in index d7e139c..117c1cd 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -536,15 +536,7 @@ cont.$(OBJEXT): $(COROUTINE_H) https://github.com/ruby/ruby/blob/trunk/template/Makefile.in#L536 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) diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb new file mode 100644 index 0000000..735f7f4 --- /dev/null +++ b/tool/test-bundled-gems.rb @@ -0,0 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L1 +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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/