Skip to content

Commit

Permalink
test: make default GC behavior "normal"
Browse files Browse the repository at this point in the history
I'm getting frustrated with long CI run timesxs
  • Loading branch information
flavorjones committed Apr 11, 2023
1 parent 1580121 commit 2cf4996
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bundle exec rake compile test:memcheck
```


Note that by default the test suite will run a major GC after each test completes. This has shown to be useful for localizing some classes of memory bugs, but does slow the suite down. Some variations of the test suite behavior are available (see `test/helper.rb` for more info):
Note that by you can run the test suite with a variety of GC behaviors. For example, running a major after each test completes has, on occasion, been useful for localizing some classes of memory bugs, but does slow the suite down. Some variations of the test suite behavior are available (see `test/helper.rb` for more info):

``` sh
# see failure messages immediately
Expand Down
12 changes: 4 additions & 8 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# Some environment variables that are used to configure the test suite:
# - NOKOGIRI_TEST_FAIL_FAST: if set to anything, emit test failure messages immediately upon failure
# - NOKOGIRI_TEST_GC_LEVEL: (roughly in order of stress)
# - "normal" - normal GC functionality
# - "normal" - normal GC functionality (default)
# - "minor" - force a minor GC cycle after each test
# - "major" (default for Rubies without compaction) - force a major GC cycle after each test
# - "compact" (default for Rubies with compaction) - force a major GC after each test and GC compaction after every 20 tests
# - "major" - force a major GC cycle after each test
# - "compact" - force a major GC after each test and GC compaction after every 20 tests
# - "verify" - force a major GC after each test and verify references-after-compaction after every 20 tests
# - "stress" - run tests with GC.stress set to true
# - NOKOGIRI_GC: read more in test/test_memory_leak.rb
Expand Down Expand Up @@ -144,12 +144,8 @@ def initialize_nokogiri_test_gc_level
"compact"
elsif (ENV["NOKOGIRI_TEST_GC_LEVEL"] == "verify") && defined?(GC.verify_compaction_references)
"verify"
elsif RUBY_ENGINE == "truffleruby"
"normal"
elsif defined?(GC.compact)
"compact"
else
"major"
"normal"
end

if ["compact", "verify"].include?(@@gc_level)
Expand Down

0 comments on commit 2cf4996

Please # to comment.