<commit_before># encoding: ASCII-8BIT
require 'test_helper'
require 'pwnlib/memleak'
require 'open3'

class MemLeakTest < MiniTest::Test
  def setup
    @binsh = File.binread('/bin/sh')
    @leak = Pwnlib::MemLeak.new { |addr| @binsh[addr] }
  end

  def test_find_elf_base
    assert_equal(0, @leak.find_elf_base(@binsh.length * 2 / 3))
    [32, 64].each do |b|
      # TODO(hh): Use process instead of popen3
      Open3.popen3(File.expand_path("../data/victim#{b}", __FILE__)) do |i, o, _e, t|
        main_ra = o.readline[2...-1].to_i(16)<commit_msg>Fix travis CI build fail<commit_after># encoding: ASCII-8BIT
require 'test_helper'
require 'pwnlib/memleak'
require 'open3'

class MemLeakTest < MiniTest::Test
  def setup
    @binsh = File.binread('/bin/sh')
    @leak = Pwnlib::MemLeak.new { |addr| @binsh[addr] }
  end

  def test_find_elf_base
    assert_equal(0, @leak.find_elf_base(@binsh.length * 2 / 3))
    [64].each do |b|
      # TODO(hh): Use process instead of popen3
      Open3.popen3(File.expand_path("../data/victim#{b}", __FILE__)) do |i, o, _e, t|
        main_ra = o.readline[2...-1].to_i(16)
{'fraction_non_alphanumeric': 0.16053811659192826, 'fraction_numerical': 0.026905829596412557, 'mean_word_length': 3.5737704918032787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1737834', 'n_tokens_mistral': 467, 'n_tokens_neox': 448, 'n_words': 94}