Class: Mxrb::Runtime::Executor
- Inherits:
-
Object
- Object
- Mxrb::Runtime::Executor
- Defined in:
- lib/mxrb/runtime/executor.rb
Overview
Builds a disposable project natively and converts the Runtime protocol back into Ruby result objects.
Direct Known Subclasses
Constant Summary collapse
- STARTUP_ALLOWANCE =
120
Instance Method Summary collapse
-
#initialize(project_path, definition, plan: nil, java_home: ENV["JAVA_HOME"], output: nil, clock: Process.method(:clock_gettime)) ⇒ Executor
constructor
A new instance of Executor.
- #run ⇒ Object
Constructor Details
#initialize(project_path, definition, plan: nil, java_home: ENV["JAVA_HOME"], output: nil, clock: Process.method(:clock_gettime)) ⇒ Executor
Returns a new instance of Executor.
20 21 22 23 24 25 26 27 28 |
# File 'lib/mxrb/runtime/executor.rb', line 20 def initialize(project_path, definition, plan: nil, java_home: ENV["JAVA_HOME"], output: nil, clock: Process.method(:clock_gettime)) @project_path = File.(project_path) @definition = definition @plan = plan || Toolchain.new(@project_path).plan @java_home = java_home && File.(java_home) @output = output @clock = clock end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mxrb/runtime/executor.rb', line 30 def run validate_environment! started = monotonic_time Dir.mktmpdir("mxrb-functional-") do |root| project = copy_project(root) Functional::Instrumenter.new(project, @definition).instrument! check_output = check(project, root) package = build(project, root) runtime_output = start_runtime(package, root) result = Functional::LogParser.new.parse(runtime_output) raise FunctionalTestError, "runtime stopped before the test suite completed" unless result.finished? Execution.new( result, check_output, build_output(package), runtime_output, monotonic_time - started ) end end |