Commit d3b8ea6e

d3b8ea6ed04aMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 241 files · +28 added · -213 deleted

Description

test: bundle 99 small tests into 14 bundle_*.rb files (-26.9%)

Each per-test cc invocation pays the full sp_runtime.h header cost (~88% of per-test wall time per b676017's measurement). Bundling collision-free tests into a single binary amortizes the cc/link/spawn fixed cost across many tests in one go.

Pattern (per b676017 / current redo.rb): wrap each original test body in def t_<name>; ...; end; t_<name> for local-variable scope isolation, concatenate bodies + corresponding .expected files, and delete the originals.

Eligibility filter: no top-level class/module/CONST/@ivar/def/ARGV/ require/LINE/regex-backref. The wrapping does NOT support tests whose top-level structure must run AT top level (e.g. constant assignment H = {...} becomes dynamic constant assignment inside a method, and Spinel's tuple-from-partition inference miscounts the result type when wrapped). Three eligible-by-shape tests (array_partition_gc, hash_shorthand_str, poly_hash_with_time) hit those wrap-only codegen issues and stay individual.

Bundles created (each at test/bundle_.rb):

bundle_array_a 9 tests bundle_array_b 10 tests bundle_array_c 5 tests bundle_array_d 5 tests bundle_hash 7 tests bundle_int_array 6 tests bundle_integer 8 tests bundle_io_sys 8 tests bundle_misc_a 10 tests bundle_misc_b 10 tests bundle_poly 4 tests bundle_string_a 10 tests bundle_string_b 5 tests bundle_sym 10 tests

Net: 346 -> 253 test files, all passing on a clean run.

Also regenerates test/array_slice_assign.rb.expected (was ungenerated) into bundle_array_b's expected output.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
d3b8ea6ed04a
Parent
bae7b5d85265

test/array2.rbdeleted

1-# Test additional Array methods
2-
3-arr = (1..10).to_a
4-
5-# reject
6-odds = arr.reject do |x|
7- x % 2 == 0
8-end
9-puts odds.length # 5
10-
11-# reduce/inject via each
12-total = 0
13-arr.each do |x|
14- total += x
15-end
16-puts total # 55
17-
18-# reverse
19-nums = (1..10).to_a
20-nums.reverse!
21-puts nums[0] # 10
22-puts nums[9] # 1
23-
24-# Array#first / Array#last
25-puts nums.first # 10
26-puts nums.last # 1
27-
28-# Array#min / Array#max
29-mn = nums[0]
30-mx = nums[0]
31-nums.each do |x|
32- if x < mn
33- mn = x
34- end
35- if x > mx
36- mx = x
37- end
38-end
39-puts mn # 1
40-puts mx # 10
41-
42-# Array#include?
43-if nums.include?(5)
44- puts "true"
45-else
46- puts "false"
47-end # true
48-if nums.include?(11)
49- puts "true"
50-else
51- puts "false"
52-end # false
53-
54-# Array#compact (remove nils) - simplified: just test count
55-puts nums.length # 10