Class: Origen::Tester::Ultraflex::Parser::Flow
- Inherits:
-
Parser::SearchableArray
- Object
- Array
- Parser::SearchableArray
- Origen::Tester::Ultraflex::Parser::Flow
- Defined in:
- lib/origen/tester/ultraflex/parser/flow.rb
Instance Attribute Summary (collapse)
-
- (Object) file
Returns the value of attribute file.
-
- (Object) parser
Returns the value of attribute parser.
Instance Method Summary (collapse)
-
- (Object) all_tests
Returns all tests in the current flow, regardless of context.
- - (Object) description (also: #summary)
-
- (Object) filename
(also: #name)
Returns the filename of the sheet that contained the current flow.
-
- (Flow) initialize(file, options = {})
constructor
:nodoc:.
-
- (Object) inspect
:nodoc:.
-
- (Object) parse
:nodoc:.
-
- (Object) run_context(context)
:nodoc:.
-
- (Object) tests(context = {})
Returns all flow lines that are tests, optionally supply a context to have only the test that will execute in that context returned.
Methods inherited from Parser::SearchableArray
Methods inherited from Array
#dups, #dups?, #dups_with_index, #ids
Constructor Details
- (Flow) initialize(file, options = {})
:nodoc:
10 11 12 13 14 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 10 def initialize(file, = {}) # :nodoc: @parser = [:parser] @file = Pathname.new(file) parse end |
Instance Attribute Details
- (Object) file
Returns the value of attribute file
8 9 10 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 8 def file @file end |
- (Object) parser
Returns the value of attribute parser
8 9 10 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 8 def parser @parser end |
Instance Method Details
- (Object) all_tests
Returns all tests in the current flow, regardless of context
41 42 43 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 41 def all_tests where(opcode: %w(Test characterize), exact: true) end |
- (Object) description Also known as: summary
16 17 18 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 16 def description @parser.descriptions.flow_summary(file: file) end |
- (Object) filename Also known as: name
Returns the filename of the sheet that contained the current flow
22 23 24 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 22 def filename @file.basename.to_s end |
- (Object) inspect
:nodoc:
104 105 106 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 104 def inspect # :nodoc: "<TestFlow: #{filename}, Lines: #{size}>" end |
- (Object) parse
:nodoc:
97 98 99 100 101 102 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 97 def parse # :nodoc: File.readlines(@file).each do |line| l = FlowLine.new(line, parser: parser, flow: self) self << l if l.valid? end end |
- (Object) run_context(context)
:nodoc:
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 95 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 45 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 |
- (Object) tests(context = {})
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
36 37 38 |
# File 'lib/origen/tester/ultraflex/parser/flow.rb', line 36 def tests(context = {}) run_context(context) end |