Created
February 1, 2011 17:37
-
-
Save thbar/806234 to your computer and use it in GitHub Desktop.
A non-portable, "non-blocking on crash" repro for the segfault hpricot issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'test/unit' | |
require 'hpricot' | |
require 'load_files' | |
require 'neversaydie' | |
class TestSegFaults < Test::Unit::TestCase | |
def test_segfault | |
read, write = IO.pipe | |
Process.fork do | |
15.times do |i| | |
data = "<item>" | |
50000.times do |j| | |
data << "<line>This is line #{j} for turn #{i}</line>" | |
end | |
data << "</item>" | |
# generates a segfault on Hpricot 0.8.3 | |
doc = Hpricot(data) | |
end | |
write.puts "OK" | |
end | |
sleep(5) | |
write.close | |
assert_match read.read, /OK/, "Hpricot crashed!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment