Skip to content

Commit

Permalink
Merge pull request #2721 from sparklemotion/flavorjones-fix-ruby-head…
Browse files Browse the repository at this point in the history
…-valgrind-202212

ci: fix ruby-head-valgrind
  • Loading branch information
flavorjones committed Dec 10, 2022
2 parents e58fbae + d0b6994 commit 7b3f40a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
workflow_dispatch:
schedule:
- cron: "0 8 * * 1,3,5" # At 08:00 on Monday, Wednesday, and Friday # https://crontab.guru/#0_8_*_*_1,3,5
pull_request:
types: [opened, synchronize]
branches:
- '*'
paths:
- .github/workflows/upstream.yml # this file

jobs:
xmlsoft-head:
Expand Down Expand Up @@ -94,7 +100,7 @@ jobs:
fail-fast: false
matrix:
sys: ["enable", "disable"]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04 # warning that 22.04 binary has dwarf5 debug info that valgrind can't read
steps:
- uses: actions/checkout@v3
with:
Expand Down
22 changes: 14 additions & 8 deletions test/xml/test_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ def test_nonexistent_attribute

def test_broken_markup_attribute_hash
xml = <<~XML
<root><foo bar="asdf" xmlns:quux="qwer">
<root><foo bar="asdf" xmlns:quux="qwer">#{"x" * 1024}
XML
reader = Nokogiri::XML::Reader(xml)
reader.read # root
Expand All @@ -696,23 +696,26 @@ def test_broken_markup_attribute_hash
if Nokogiri.jruby?
assert_equal({ "bar" => "asdf" }, reader.attribute_hash)

reader.read # text
reader.read # text (xxxxx)
reader.read # text (newline)

assert_raises(Nokogiri::XML::SyntaxError) do
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.read
end
assert_includes(e.message, "XML document structures must start and end")
else
assert_raises(Nokogiri::XML::SyntaxError) do
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.attribute_hash
end
assert_includes(e.message, "FATAL: Extra content at the end of the document")
end

assert_equal(1, reader.errors.length)
end

def test_broken_markup_namespaces
xml = <<~XML
<root><foo bar="asdf" xmlns:quux="qwer">
<root><foo bar="asdf" xmlns:quux="qwer">#{"x" * 1024}
XML
reader = Nokogiri::XML::Reader(xml)
reader.read # root
Expand All @@ -724,15 +727,18 @@ def test_broken_markup_namespaces
if Nokogiri.jruby?
assert_equal({ "xmlns:quux" => "qwer" }, reader.namespaces)

reader.read # text
reader.read # text (xxxxx)
reader.read # text (newline)

assert_raises(Nokogiri::XML::SyntaxError) do
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.read
end
assert_includes(e.message, "XML document structures must start and end")
else
assert_raises(Nokogiri::XML::SyntaxError) do
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.namespaces
end
assert_includes(e.message, "FATAL: Extra content at the end of the document")
end

assert_equal(1, reader.errors.length)
Expand Down

0 comments on commit 7b3f40a

Please sign in to comment.