Class: Necropsy::Bench::ReleaseAudit::AdversarialRunner
- Inherits:
-
Object
- Object
- Necropsy::Bench::ReleaseAudit::AdversarialRunner
- Defined in:
- lib/necropsy/bench/release_audit/adversarial_runner.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(root:, suites:, clock: Process.method(:clock_gettime)) ⇒ AdversarialRunner
constructor
A new instance of AdversarialRunner.
Constructor Details
#initialize(root:, suites:, clock: Process.method(:clock_gettime)) ⇒ AdversarialRunner
Returns a new instance of AdversarialRunner.
9 10 11 12 13 |
# File 'lib/necropsy/bench/release_audit/adversarial_runner.rb', line 9 def initialize(root:, suites:, clock: Process.method(:clock_gettime)) @root = root @suites = suites @clock = clock end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/necropsy/bench/release_audit/adversarial_runner.rb', line 15 def call suites.sort.map do |name, definition| command = definition.fetch('command').map(&:to_s) started_at = monotonic_time stdout, stderr, status = Open3.capture3(*command, chdir: root) { 'name' => name, 'command' => command, 'passed' => status.success?, 'exit_status' => status.exitstatus, 'duration_seconds' => (monotonic_time - started_at).round(6), 'summary' => result_summary(stdout, stderr) } rescue SystemCallError => e { 'name' => name, 'command' => command, 'passed' => false, 'exit_status' => nil, 'duration_seconds' => (monotonic_time - started_at).round(6), 'summary' => "#{e.class}: #{e.}" } end end |