From 2cf4996c5280f93e1ea66b2aceeed848d57fbe01 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 6 Mar 2023 17:15:15 -0500 Subject: [PATCH 1/3] test: make default GC behavior "normal" I'm getting frustrated with long CI run timesxs --- CONTRIBUTING.md | 2 +- test/helper.rb | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 192ddce609..16c854f835 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/test/helper.rb b/test/helper.rb index 0f868fc9e7..957a575430 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -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 @@ -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) From ac83e6ee7011ce9fec24399c759a73fb924a0de6 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 31 Mar 2023 17:41:03 -0400 Subject: [PATCH 2/3] test: update behavior of namespaces in HTML4 libxml 2.11.0 fixes the parser to ignore the namespaces as a namespace, but not to split the QName (see upstream commit d7d0bc65). Fixes #2836 --- test/xml/test_node.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb index 80fb66d37b..137c46d61b 100644 --- a/test/xml/test_node.rb +++ b/test/xml/test_node.rb @@ -1141,7 +1141,10 @@ def test_namespace_without_an_href_on_html_node node = html.at("div").children.first refute_nil(node) - if Nokogiri.uses_libxml?(">= 2.9.12") + if Nokogiri.uses_libxml?(">= 2.11.0") || Nokogiri.jruby? + assert_empty(node.namespaces.keys) + assert_equal("foo", node.to_html) + elsif Nokogiri.uses_libxml?(">= 2.9.12") assert_empty(node.namespaces.keys) assert_equal("

foo

", node.to_html) elsif Nokogiri.uses_libxml? @@ -1149,9 +1152,6 @@ def test_namespace_without_an_href_on_html_node assert(node.namespaces.key?("xmlns:o")) assert_nil(node.namespaces["xmlns:o"]) assert_equal("

foo

", node.to_html) - else # jruby - assert_empty(node.namespaces.keys) - assert_equal("foo", node.to_html) end end From 36b0b3355d6d0d45bfdf1b55012bccfb348a6b4f Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 11 Apr 2023 09:21:15 -0400 Subject: [PATCH 3/3] dep: update libxml2 to 2.10.4 from 2.10.3 and update a test which assumed a behavior change was going to go into 2.11.0 but ended up in this release --- dependencies.yml | 6 +++--- test/xml/test_node.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.yml b/dependencies.yml index 98eccc8984..5b5c9faa4c 100644 --- a/dependencies.yml +++ b/dependencies.yml @@ -1,7 +1,7 @@ libxml2: - version: "2.10.3" - sha256: "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c" - # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.3.sha256sum + version: "2.10.4" + sha256: "ed0c91c5845008f1936739e4eee2035531c1c94742c6541f44ee66d885948d45" + # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.4.sha256sum libxslt: version: "1.1.37" diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb index 137c46d61b..cb6523dd61 100644 --- a/test/xml/test_node.rb +++ b/test/xml/test_node.rb @@ -1141,7 +1141,7 @@ def test_namespace_without_an_href_on_html_node node = html.at("div").children.first refute_nil(node) - if Nokogiri.uses_libxml?(">= 2.11.0") || Nokogiri.jruby? + if Nokogiri.uses_libxml?(">= 2.10.4") || Nokogiri.jruby? assert_empty(node.namespaces.keys) assert_equal("foo", node.to_html) elsif Nokogiri.uses_libxml?(">= 2.9.12")