module RubyMemcheck::TestTaskReporter

Constants

VALGRIND_REPORT_MSG

Attributes

errors[R]

Private Instance Methods

output_valgrind_errors() click to toggle source
# File lib/ruby_memcheck/test_task_reporter.rb, line 50
def output_valgrind_errors
  @errors.each do |error|
    configuration.output_io.puts error
    configuration.output_io.puts
  end
end
parse_valgrind_output(xml_files) click to toggle source
# File lib/ruby_memcheck/test_task_reporter.rb, line 28
def parse_valgrind_output(xml_files)
  require "nokogiri"

  @errors = []

  xml_files.each do |file|
    Nokogiri::XML::Reader(File.open(file)).each do |node|
      next unless node.name == "error" && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
      error_xml = Nokogiri::XML::Document.parse(node.outer_xml).root
      error = ValgrindError.new(configuration, error_xml)
      next if error.skip?
      @errors << error
    end
  end
end
remove_valgrind_xml_files(xml_files) click to toggle source
# File lib/ruby_memcheck/test_task_reporter.rb, line 44
def remove_valgrind_xml_files(xml_files)
  xml_files.each do |file|
    File.delete(file)
  end
end
report_valgrind_errors() click to toggle source
# File lib/ruby_memcheck/test_task_reporter.rb, line 11
def report_valgrind_errors
  if configuration.valgrind_xml_dir
    xml_files = valgrind_xml_files
    parse_valgrind_output(xml_files)
    remove_valgrind_xml_files(xml_files)

    unless errors.empty?
      output_valgrind_errors
      raise VALGRIND_REPORT_MSG
    end
  end
end
valgrind_xml_files() click to toggle source
# File lib/ruby_memcheck/test_task_reporter.rb, line 24
def valgrind_xml_files
  Dir[File.join(configuration.valgrind_xml_dir, "*")]
end