Class: Henitai::Integration::Base
- Inherits:
-
Object
- Object
- Henitai::Integration::Base
- Defined in:
- lib/henitai/integration.rb
Overview
Base class for all integrations.
Direct Known Subclasses
Instance Method Summary collapse
- #cleanup_process_group(pid) ⇒ Object
- #per_test_coverage_supported? ⇒ Boolean
- #reap_child(pid) ⇒ Object
-
#run_mutant(mutant:, test_files:, timeout:) ⇒ ScenarioExecutionResult
Run test files in a child process with the mutant active.
-
#select_tests(subject) ⇒ Array<String>
Paths to test files that cover this subject.
-
#test_files ⇒ Array<String>
All test files for the configured framework.
- #wait_with_timeout(pid, timeout) ⇒ Object
Instance Method Details
#cleanup_process_group(pid) ⇒ Object
180 181 182 183 184 185 186 187 188 |
# File 'lib/henitai/integration.rb', line 180 def cleanup_process_group(pid) Process.kill(:SIGTERM, -pid) pause(2.0) Process.kill(:SIGKILL, -pid) rescue Errno::EPERM cleanup_child_process(pid) rescue Errno::ESRCH nil end |
#per_test_coverage_supported? ⇒ Boolean
152 153 154 |
# File 'lib/henitai/integration.rb', line 152 def per_test_coverage_supported? false end |
#reap_child(pid) ⇒ Object
174 175 176 177 178 |
# File 'lib/henitai/integration.rb', line 174 def reap_child(pid) Process.wait(pid) rescue Errno::ECHILD, Errno::ESRCH nil end |
#run_mutant(mutant:, test_files:, timeout:) ⇒ ScenarioExecutionResult
Run test files in a child process with the mutant active.
148 149 150 |
# File 'lib/henitai/integration.rb', line 148 def run_mutant(mutant:, test_files:, timeout:) raise NotImplementedError end |
#select_tests(subject) ⇒ Array<String>
Returns paths to test files that cover this subject.
133 134 135 |
# File 'lib/henitai/integration.rb', line 133 def select_tests(subject) raise NotImplementedError end |
#test_files ⇒ Array<String>
Returns all test files for the configured framework.
138 139 140 |
# File 'lib/henitai/integration.rb', line 138 def test_files raise NotImplementedError end |
#wait_with_timeout(pid, timeout) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/henitai/integration.rb', line 156 def wait_with_timeout(pid, timeout) deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout loop do wait_result = Process.wait(pid, Process::WNOHANG) return Process.last_status if wait_result if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline final_wait_result = Process.wait(pid, Process::WNOHANG) return Process.last_status if final_wait_result return handle_timeout(pid) end pause(0.01) end end |