Sha256: cdbec729f87935756dbeb13837bb79e9659637ba8607ec91ae69da0eb33a638f

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require File.join(File.dirname(__FILE__), "setup.rb")

# Run memory tests
# TODO: Ensure compile first (but only if needed) with make?

desc "Run memory leak test."
task :memtest do

  live = ENV['live']

  unless live
    $LOAD_PATH.unshift(File.expand_path('ext/libxml'))
    $LOAD_PATH.unshift(File.expand_path('lib'))
  end
  $LOAD_PATH.unshift('test')  # NEEDED?

  glob = 'test/ets_*.rb'

  Dir[glob].each do |fn|
    next if File.directory?(fn)
    puts "test #{fn}"
    f=Process.fork
    if f.nil?
      require fn
      exit
    end
    rss_k=0
    while (px=Process.wait2(f,Process::WNOHANG)).nil?
      sleep 2
      rss_k2=`ps -o rss= -p #{f}`.to_i
      rss_k=(rss_k2>rss_k) ? rss_k2 : rss_k
    end
    pid,status=px
    puts "\nProcess #{pid} exited status #{status.exitstatus}, max rss(k) #{rss_k}"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libxml-ruby-0.5.4 Rakefile
libxml-ruby-0.5.3 Rakefile