Class: Evilution::Isolation::InProcess Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/isolation/in_process.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.null_errObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/evilution/isolation/in_process.rb', line 16

def null_err
  @null_err
end

.null_outObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/evilution/isolation/in_process.rb', line 16

def null_out
  @null_out
end

Instance Method Details

#call(mutation:, test_command:, timeout:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/evilution/isolation/in_process.rb', line 19

def call(mutation:, test_command:, timeout:)
  start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  rss_before = Evilution::Memory.rss_kb
  sandbox_dir = Dir.mktmpdir("evilution-run")
  result = execute_with_timeout(mutation, test_command, timeout, sandbox_dir)
  rss_after = Evilution::Memory.rss_kb
  duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time
  delta = compute_memory_delta(rss_before, rss_after, result)

  build_mutation_result(mutation, result, duration, rss_before, rss_after, delta)
ensure
  FileUtils.rm_rf(sandbox_dir) if sandbox_dir
end