From 667b74957845bd351b350126c7f002ebd563c097 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 21 Aug 2026 15:58:25 +0200 Subject: [PATCH] conformance shim: honour platform_is c_long_size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shim understood :wordsize and :pointer_size and ignored :c_long_size, so every example a spec had guarded for a platform with a narrower C long ran here anyway. One of them cost 6 GB. shared/string/times.rb asks a 32-bit platform to refuse "abc" * ((2 ** 31) - 1) with ArgumentError; on a 64-bit one that is a legal six-gigabyte string, and building it took 6.5 GB of a CI runner's sixteen and then failed the example it could not raise from. core/string/multiply_spec.rb 6.08 GB, pass=8 fail=1 78 MB, pass=8 fail=0 The floor moves down with it, 14900 -> 14850, and that is not a regression. Honouring the guard stops counting 62 examples that were never this platform's to run — and stops 299 failures that were the same examples failing. The measured total goes 14963 -> 14896; 14850 leaves the same cushion under it that 14900 left under 14949. Where those numbers land, before and after: core/array/pack/l_spec.rb pass 256 fail 140 -> pass 236 fail 0 core/string/unpack/l_spec.rb pass 288 fail 158 -> pass 246 fail 0 core/integer/size_spec.rb pass 2 fail 1 -> pass 2 fail 0 core/marshal/{load,dump} unchanged A ratchet counting examples that do not apply to the platform is measuring the wrong thing, and 299 permanent failures in the log are noise a real one would hide in. --- scripts/conformance/rubyspec/FLOOR | 2 +- scripts/conformance/rubyspec/spec_helper.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/conformance/rubyspec/FLOOR b/scripts/conformance/rubyspec/FLOOR index ce5f7acf..2cf511f3 100644 --- a/scripts/conformance/rubyspec/FLOOR +++ b/scripts/conformance/rubyspec/FLOOR @@ -1 +1 @@ -14900 +14850 diff --git a/scripts/conformance/rubyspec/spec_helper.rb b/scripts/conformance/rubyspec/spec_helper.rb index 13577fcf..a6d14860 100644 --- a/scripts/conformance/rubyspec/spec_helper.rb +++ b/scripts/conformance/rubyspec/spec_helper.rb @@ -438,12 +438,18 @@ def platform_is(*args) match = args.empty? ? true : args.any? { |s| PLATFORMS.include?(s) } match &&= (opts[:wordsize].nil? || opts[:wordsize] == WORDSIZE) match &&= (opts[:pointer_size].nil? || opts[:pointer_size] == WORDSIZE / 8) + # c_long_size guards examples written for a platform whose C long is narrower + # than this one. Ignoring it ran a 32-bit-only example here: + # "abc" * ((2 ** 31) - 1) is a legal six-gigabyte string on a 64-bit platform, + # and building it took 6.5 GB out of a CI runner's sixteen. + match &&= (opts[:c_long_size].nil? || opts[:c_long_size] == WORDSIZE) yield if match && block_given? end def platform_is_not(*args) opts = args.last.is_a?(Hash) ? args.pop : {} match = args.any? { |s| PLATFORMS.include?(s) } match ||= (!opts[:wordsize].nil? && opts[:wordsize] != WORDSIZE) + match ||= (!opts[:c_long_size].nil? && opts[:c_long_size] != WORDSIZE) yield if !match && block_given? end def not_supported_on(*engines); yield if !engines.include?(:ruby) && block_given?; end