Class: OrigenTesters::IGXLBasedTester::Parser::Flow
- Inherits:
-
Parser::SearchableArray
- Object
- Parser::SearchableArray
- OrigenTesters::IGXLBasedTester::Parser::Flow
- Defined in:
- lib/origen_testers/igxl_based_tester/parser/flow.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
-
#all_tests ⇒ Object
Returns all tests in the current flow, regardless of context.
- #description ⇒ Object (also: #summary)
-
#filename ⇒ Object
(also: #name)
Returns the filename of the sheet that contained the current flow.
-
#initialize(file, options = {}) ⇒ Flow
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
-
#parse ⇒ Object
:nodoc:.
-
#run_context(context) ⇒ Object
:nodoc:.
-
#tests(context = {}) ⇒ Object
Returns all flow lines that are tests, optionally supply a context to have only the test that will execute in that context returned.
Constructor Details
#initialize(file, options = {}) ⇒ Flow
:nodoc:
9 10 11 12 13 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 9 def initialize(file, = {}) # :nodoc: @parser = [:parser] @file = Pathname.new(file) parse end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 7 def file @file end |
#parser ⇒ Object
Returns the value of attribute parser.
7 8 9 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 7 def parser @parser end |
Instance Method Details
#all_tests ⇒ Object
Returns all tests in the current flow, regardless of context
40 41 42 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 40 def all_tests where(opcode: %w(Test characterize), exact: true) end |
#description ⇒ Object Also known as: summary
15 16 17 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 15 def description @parser.descriptions.flow_summary(file: file) end |
#filename ⇒ Object Also known as: name
Returns the filename of the sheet that contained the current flow
21 22 23 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 21 def filename @file.basename.to_s end |
#inspect ⇒ Object
:nodoc:
103 104 105 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 103 def inspect # :nodoc: "<TestFlow: #{filename}, Lines: #{size}>" end |
#parse ⇒ Object
:nodoc:
96 97 98 99 100 101 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 96 def parse # :nodoc: File.readlines(@file).each do |line| l = FlowLine.new(line, parser: parser, flow: self) self << l if l.valid? end end |
#run_context(context) ⇒ Object
:nodoc:
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 44 def run_context(context) # :nodoc: capture = true waiting_for_label = false select do |line| if capture if !waiting_for_label || waiting_for_label == line.label waiting_for_label = false case line.type when 'Test', 'characterize' line.executes_under_context?(context) when 'set-device', 'stop' capture = false if line.executes_under_context?(context) false when 'enable-flow-word' if line.executes_under_context?(context) context[:enable] = [context[:enable]].flatten context[:enable] << line.parameter end false when 'flag-true' if line.executes_under_context?(context) context[:true_flags] = [context[:true_flags]].flatten context[:true_flags] << line.parameter end false when 'flag-false' if line.executes_under_context?(context) context[:false_flags] = [context[:false_flags]].flatten context[:false_flags] << line.parameter end false when 'disable-flow-word' if line.executes_under_context?(context) context[:enable] = [context[:enable]].flatten context[:enable].delete(line.parameter) end false when 'logprint', 'nop', 'print' false when 'goto' waiting_for_label = line.parameter false else fail "Don't know how to process: #{line.type}, in file #{filename}" end else false end end end end |
#tests(context = {}) ⇒ Object
Returns all flow lines that are tests, optionally supply a context to have only the test that will execute in that context returned
$tester.flow.first.tests.size
=> 20
$tester.flow.first.tests(:job => "P1").size
=> 10
$tester.flow.first.tests(:job => "P1", :enable => "data_collection").size
=> 15
35 36 37 |
# File 'lib/origen_testers/igxl_based_tester/parser/flow.rb', line 35 def tests(context = {}) run_context(context) end |