origen_testers 0.5.7 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/config/shared_commands.rb +6 -0
  3. data/config/version.rb +2 -2
  4. data/lib/commands/run.rb +44 -0
  5. data/lib/origen_testers.rb +19 -1
  6. data/lib/origen_testers/flow.rb +382 -0
  7. data/lib/origen_testers/generator.rb +32 -29
  8. data/lib/origen_testers/igxl_based_tester/base/ac_specsets.rb +79 -0
  9. data/lib/origen_testers/igxl_based_tester/base/dc_specsets.rb +98 -0
  10. data/lib/origen_testers/igxl_based_tester/base/edge.rb +60 -0
  11. data/lib/origen_testers/igxl_based_tester/base/edges.rb +24 -0
  12. data/lib/origen_testers/igxl_based_tester/base/edgeset.rb +39 -0
  13. data/lib/origen_testers/igxl_based_tester/base/edgesets.rb +97 -0
  14. data/lib/origen_testers/igxl_based_tester/base/flow.rb +390 -115
  15. data/lib/origen_testers/igxl_based_tester/base/flow_line.rb +4 -54
  16. data/lib/origen_testers/igxl_based_tester/base/generator.rb +257 -11
  17. data/lib/origen_testers/igxl_based_tester/base/level_io_se.rb +59 -0
  18. data/lib/origen_testers/igxl_based_tester/base/level_supply.rb +39 -0
  19. data/lib/origen_testers/igxl_based_tester/base/levels.rb +31 -0
  20. data/lib/origen_testers/igxl_based_tester/base/levelset.rb +109 -0
  21. data/lib/origen_testers/igxl_based_tester/base/pinmap.rb +93 -0
  22. data/lib/origen_testers/igxl_based_tester/base/test_instance.rb +33 -1
  23. data/lib/origen_testers/igxl_based_tester/base/timeset.rb +37 -0
  24. data/lib/origen_testers/igxl_based_tester/base/timesets.rb +47 -0
  25. data/lib/origen_testers/igxl_based_tester/j750/templates/flow.txt.erb +2 -2
  26. data/lib/origen_testers/igxl_based_tester/ultraflex/ac_specsets.rb +10 -0
  27. data/lib/origen_testers/igxl_based_tester/ultraflex/custom_test_instance.rb +4 -0
  28. data/lib/origen_testers/igxl_based_tester/ultraflex/dc_specsets.rb +10 -0
  29. data/lib/origen_testers/igxl_based_tester/ultraflex/edge.rb +9 -0
  30. data/lib/origen_testers/igxl_based_tester/ultraflex/edges.rb +9 -0
  31. data/lib/origen_testers/igxl_based_tester/ultraflex/edgeset.rb +9 -0
  32. data/lib/origen_testers/igxl_based_tester/ultraflex/edgesets.rb +10 -0
  33. data/lib/origen_testers/igxl_based_tester/ultraflex/flow.rb +137 -0
  34. data/lib/origen_testers/igxl_based_tester/ultraflex/level_io_se.rb +9 -0
  35. data/lib/origen_testers/igxl_based_tester/ultraflex/level_supply.rb +9 -0
  36. data/lib/origen_testers/igxl_based_tester/ultraflex/levels.rb +9 -0
  37. data/lib/origen_testers/igxl_based_tester/ultraflex/levelset.rb +10 -0
  38. data/lib/origen_testers/igxl_based_tester/ultraflex/pinmap.rb +10 -0
  39. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/ac_specsets.txt.erb +58 -0
  40. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/dc_specsets.txt.erb +58 -0
  41. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/edgesets.txt.erb +95 -0
  42. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/flow.txt.erb +2 -2
  43. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/levelset.txt.erb +121 -0
  44. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/pinmap.txt.erb +24 -0
  45. data/lib/origen_testers/igxl_based_tester/ultraflex/templates/timesets.txt.erb +137 -0
  46. data/lib/origen_testers/igxl_based_tester/ultraflex/test_instance.rb +4 -0
  47. data/lib/origen_testers/igxl_based_tester/ultraflex/timeset.rb +9 -0
  48. data/lib/origen_testers/igxl_based_tester/ultraflex/timesets.rb +10 -0
  49. data/lib/origen_testers/interface.rb +41 -6
  50. data/lib/origen_testers/no_interface.rb +7 -0
  51. data/lib/origen_testers/origen_ext/application/runner.rb +25 -0
  52. data/lib/origen_testers/origen_ext/generator.rb +37 -0
  53. data/lib/origen_testers/origen_ext/generator/flow.rb +70 -0
  54. data/lib/origen_testers/origen_ext/generator/resources.rb +21 -0
  55. data/lib/origen_testers/program_generators.rb +0 -1
  56. data/lib/origen_testers/smartest_based_tester/base/flow.rb +158 -134
  57. data/lib/origen_testers/smartest_based_tester/base/generator.rb +2 -3
  58. data/lib/origen_testers/smartest_based_tester/base/test_suite.rb +4 -0
  59. data/lib/origen_testers/smartest_based_tester/v93k/templates/template.flow.erb +5 -6
  60. data/lib/origen_testers/test/dut.rb +5 -0
  61. data/lib/origen_testers/test/j750_base_interface.rb +0 -3
  62. data/lib/origen_testers/test/ultraflex_interface.rb +230 -4
  63. data/lib/origen_testers/test/v93k_interface.rb +5 -23
  64. data/program/components/_temp.rb +6 -0
  65. data/program/flow_control.rb +190 -62
  66. data/program/prb1.rb +13 -50
  67. data/program/prb2.rb +0 -16
  68. data/program/test.rb +12 -3
  69. data/program/uflex_resources.rb +159 -0
  70. metadata +66 -16
  71. data/lib/origen_testers/doc.rb +0 -224
  72. data/lib/origen_testers/doc/generator.rb +0 -124
  73. data/lib/origen_testers/doc/generator/flow.rb +0 -69
  74. data/lib/origen_testers/doc/generator/flow_line.rb +0 -201
  75. data/lib/origen_testers/doc/generator/test.rb +0 -66
  76. data/lib/origen_testers/doc/generator/test_group.rb +0 -64
  77. data/lib/origen_testers/doc/generator/tests.rb +0 -45
  78. data/lib/origen_testers/doc/model.rb +0 -160
  79. data/lib/origen_testers/generator/flow_control_api.rb +0 -611
  80. data/lib/origen_testers/smartest_based_tester/base/flow_node.rb +0 -476
  81. data/lib/origen_testers/smartest_based_tester/v93k/flow_node.rb +0 -9
@@ -1,224 +0,0 @@
1
- module OrigenTesters
2
- # Tester model to generate test program documentation from your pattern sources.
3
- # This is intended to be a drop in replacement for existing testers and instead
4
- # of generating patterns or test program sheets it will generate a document object
5
- # which you can then render out via a template or manually.
6
- class Doc
7
- include VectorBasedTester
8
-
9
- autoload :Generator, 'origen_testers/doc/generator'
10
- autoload :Model, 'origen_testers/doc/model'
11
-
12
- attr_accessor :html_mode
13
-
14
- def generate?
15
- html_mode
16
- end
17
-
18
- def initialize(*_args)
19
- @pat_extension = 'md'
20
- @indent = 0
21
- @snip_counters = []
22
- end
23
-
24
- # Snip the number of comment lines generated by the contained block
25
- # to the number given, this is useful for keeping files sizes down and
26
- # is typically used to snip sections like downloading LRE code.
27
- def snip(number, _options = {})
28
- @snip_counters.push number + 1
29
- yield
30
- @snip_counters.pop
31
- end
32
-
33
- def pc(msg)
34
- if @snip_counters.last
35
- if @snip_counters.last == 1
36
- @snip_counters[@snip_counters.size - 1] = 0
37
- msg = ' ...snipped'
38
- elsif @snip_counters.last == 0
39
- return
40
- else
41
- @snip_counters[@snip_counters.size - 1] -= 1
42
- end
43
- end
44
- if html_mode
45
- push_comment(msg)
46
- else
47
- Origen.log.info((' ' * @indent) + msg)
48
- end
49
- end
50
-
51
- def c1(msg, options = {})
52
- if generating_program?
53
- Origen.interface.doc_comments_capture(msg)
54
- else
55
- unless @inhibit_comments
56
- options = {
57
- prefix: true
58
- }.merge(options)
59
- if @step_comment_on
60
- open_text_block
61
- if options[:prefix]
62
- pc "# #{msg}"
63
- else
64
- pc "#{msg}"
65
- end
66
- end
67
- end
68
- end
69
- end
70
-
71
- def c2(msg, options = {})
72
- unless @inhibit_comments
73
- options = {
74
- prefix: true
75
- }.merge(options)
76
- open_text_block
77
- if options[:prefix]
78
- pc "# #{msg}"
79
- else
80
- pc "#{msg}"
81
- end
82
- end
83
- end
84
-
85
- def annotate(msg, _options)
86
- unless @inhibit_comments
87
- if html_mode
88
- pc ''
89
- lines = msg.split("\n")
90
- leading_spaces = lines.first[/\A */].size
91
- lines.each do |line|
92
- pc line.gsub(/^.{#{leading_spaces}}/, '')
93
- end
94
- pc ''
95
- end
96
- end
97
- end
98
-
99
- def open_text_block
100
- if html_mode
101
- unless @text_block_open
102
- pc ''
103
- pc '~~~text'
104
- @text_block_open = true
105
- end
106
- end
107
- end
108
-
109
- def close_text_block
110
- if html_mode
111
- if @text_block_open
112
- pc '~~~'
113
- pc ''
114
- @text_block_open = false
115
- end
116
- end
117
- end
118
-
119
- def pattern_name
120
- Origen.app.current_job.output_pattern_filename.gsub('.md', '')
121
- end
122
-
123
- def pre_header
124
- # pc "---"
125
- # pc "layout: bootstrap"
126
- # pc "title: #{pattern_name}"
127
- # pc "gzip: false"
128
- # pc "---"
129
- # pc ""
130
- # pc "# #{pattern_name}"
131
- # pc ""
132
- end
133
-
134
- def pattern_section(msg)
135
- unless @inhibit_comments
136
- if generating_program?
137
- Origen.interface.flow.start_section(name: msg)
138
- yield
139
- Origen.interface.flow.stop_section
140
- else
141
- if html_mode
142
- counter = next_accordion_counter
143
- close_text_block
144
- pc ''
145
- pc "<div class=\"accordion-group\">"
146
- pc "<div class=\"accordion-heading\">"
147
- pc "<a class=\"accordion-toggle\" data-toggle=\"collapse\" data-parent=\"#accordion2\" href=\"#collapseComment#{counter}\">"
148
- pc "#{msg}"
149
- pc '</a>'
150
- pc '</div>'
151
- pc "<div id=\"collapseComment#{counter}\" class=\"accordion-body collapse\">"
152
- pc "<div class=\"accordion-inner\" markdown=\"1\">"
153
- yield
154
- close_text_block
155
- pc '</div>'
156
- pc '</div>'
157
- pc '</div>'
158
- else
159
- pc ''
160
- pc "#{msg}"
161
- pc ''
162
- @indent += 4
163
- yield
164
- @indent -= 4
165
- end
166
- end
167
- end
168
- end
169
-
170
- def next_accordion_counter
171
- @accordion_counter ||= 0
172
- @accordion_counter += 1
173
- end
174
-
175
- def ss(msg = nil)
176
- unless @inhibit_comments
177
- @step_comment_on = true
178
- if block_given?
179
- yield
180
- else
181
- c2(msg)
182
- end
183
- @step_comment_on = false
184
- end
185
- end
186
-
187
- def self.generate_program_model(files, options = {})
188
- options = {
189
- action: :program,
190
- return_model: true,
191
- skip_diff: true
192
- }.merge(options)
193
- Origen.app.with_doc_tester do
194
- Origen.target.temporary = options[:target] if options[:target]
195
- Origen.app.load_target!
196
- Origen.interface.reset_globals
197
- options[:files] = files
198
- Origen.file_handler.preserve_and_clear_state do
199
- Origen.app.runner.launch(options)
200
- end
201
- end
202
- model.target = Origen.target.name
203
- model
204
- end
205
-
206
- def self.model
207
- @model ||= Model.new
208
- end
209
-
210
- def doc?
211
- true
212
- end
213
-
214
- def cycle(_options = {})
215
- end
216
-
217
- # Ignore any tester-specific methods
218
- def method_missing(_method, *_args, &_block)
219
- if block_given?
220
- yield
221
- end
222
- end
223
- end
224
- end
@@ -1,124 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- module OrigenTesters
4
- class Doc
5
- module Generator
6
- extend ActiveSupport::Concern
7
-
8
- autoload :Test, 'origen_testers/doc/generator/test'
9
- autoload :TestGroup, 'origen_testers/doc/generator/test_group'
10
- autoload :Tests, 'origen_testers/doc/generator/tests'
11
- autoload :Flow, 'origen_testers/doc/generator/flow'
12
- autoload :FlowLine, 'origen_testers/doc/generator/flow_line'
13
- autoload :Placeholder, 'origen_testers/generator/placeholder'
14
-
15
- included do
16
- include OrigenTesters::Interface # adds the interface helpers/Origen hook-up
17
- include OrigenTesters::Generator::FlowControlAPI::Interface
18
- PLATFORM = OrigenTesters::Doc
19
- end
20
-
21
- # Returns the current flow (as defined by the name of the current top
22
- # level flow source file).
23
- #
24
- # Pass in a filename argument to have a specific flow returned instead.
25
- #
26
- # If the flow does not exist yet it will be created.
27
- def flow(filename = nil)
28
- unless filename
29
- if Origen.file_handler.current_file
30
- filename = Origen.file_handler.current_file.basename('.rb').to_s
31
- else
32
- filename = 'anonymous'
33
- end
34
- end
35
- f = filename.to_sym
36
- return flows[f] if flows[f]
37
- p = Flow.new
38
- p.inhibit_output if Origen.interface.resources_mode?
39
- p.filename = f
40
- flows[f] = p
41
- end
42
-
43
- # @api private
44
- def at_flow_start
45
- end
46
-
47
- # @api private
48
- def at_run_start
49
- flow.at_run_start
50
- @@tests = nil
51
- @@flows = nil
52
- end
53
- alias_method :reset_globals, :at_run_start
54
-
55
- # Returns a container for all generated tests.
56
- def tests
57
- @@tests ||= Tests.new
58
- end
59
- alias_method :test_instances, :tests
60
-
61
- # Returns a hash containing all flows
62
- def flows
63
- @@flows ||= {}
64
- end
65
-
66
- # Returns an array containing all sheet generators where a sheet generator is a flow,
67
- # test instance, patset or pat group sheet.
68
- # All Origen program generators must implement this method
69
- def sheet_generators # :nodoc:
70
- g = []
71
- [flows].each do |sheets|
72
- sheets.each do |_name, sheet|
73
- g << sheet
74
- end
75
- end
76
- g
77
- end
78
-
79
- # Returns an array containing all flow generators.
80
- # All Origen program generators must implement this method
81
- def flow_generators
82
- g = []
83
- flows.each do |_name, sheet|
84
- g << sheet
85
- end
86
- g
87
- end
88
-
89
- # The source of all program files is passed in here before executing.
90
- # This will replace all comments with a method call containing the comment so that
91
- # they can be captured.
92
- def filter_source(source) # :nodoc:
93
- src = ''
94
- source.split(/\r?\n/).each do |line|
95
- if line !~ /^\s*#-/ && line =~ /^\s*#(.*)/
96
- comment = Regexp.last_match[1].gsub("'", "\\\\'")
97
- src << "Origen.interface.doc_comments_capture('#{comment}')\n"
98
- else
99
- src << "#{line}\n"
100
- end
101
- end
102
- src
103
- end
104
-
105
- def doc_comments_capture(comment)
106
- doc_comments << "#{comment}"
107
- end
108
-
109
- def doc_comments
110
- @doc_comments ||= []
111
- end
112
-
113
- def doc_comments_consume
114
- c = doc_comments
115
- doc_comments_discard
116
- c
117
- end
118
-
119
- def doc_comments_discard
120
- @doc_comments = []
121
- end
122
- end
123
- end
124
- end
@@ -1,69 +0,0 @@
1
- module OrigenTesters
2
- class Doc
3
- module Generator
4
- class Flow
5
- include OrigenTesters::Generator
6
- include OrigenTesters::Generator::FlowControlAPI
7
-
8
- OUTPUT_POSTFIX = 'flow'
9
- OUTPUT_EXTENSION = 'yaml'
10
-
11
- def add(type, options = {})
12
- preserve_comments = options.delete(:preserve_comments)
13
- line = track_relationships(options) do |options|
14
- FlowLine.new(type, options)
15
- end
16
- collection << line unless Origen.interface.resources_mode?
17
- if preserve_comments
18
- line.description = Origen.interface.doc_comments
19
- else
20
- line.description = Origen.interface.doc_comments_consume
21
- end
22
- line
23
- end
24
-
25
- def start_section(options = {})
26
- l = FlowLine.new(:section_start, options)
27
- if options[:name]
28
- desc = [options[:name]]
29
- else
30
- desc = []
31
- end
32
- l.description = desc + Origen.interface.doc_comments_consume
33
- collection << l
34
- end
35
-
36
- def stop_section(options = {})
37
- collection << FlowLine.new(:section_stop, options)
38
- end
39
-
40
- def test(instance, options = {})
41
- options = save_context(options)
42
- add(:test, { test: instance }.merge(options))
43
- end
44
-
45
- def set_device(options = {})
46
- add(:set_device, options)
47
- end
48
-
49
- def to_yaml(options = {})
50
- collection.map { |l| l.to_yaml(options) }
51
- end
52
-
53
- def render(file, options = {})
54
- options[:file] = file
55
- add(:render, options)
56
- end
57
-
58
- def skip(identifier = nil, options = {})
59
- identifier, options = nil, identifier if identifier.is_a?(Hash)
60
- identifier = generate_unique_label(identifier)
61
- options[:test] = identifier
62
- add(:branch, options)
63
- yield
64
- add(:label, test: identifier)
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,201 +0,0 @@
1
- module OrigenTesters
2
- class Doc
3
- module Generator
4
- class FlowLine
5
- attr_accessor :type, :id, :test, :context, :attributes, :description
6
-
7
- def initialize(type, attrs = {})
8
- @type = type
9
- @test = attrs.delete(:test)
10
- @context = {}
11
- @attributes = {}
12
- flow_control_options = Origen.interface.extract_flow_control_options!(attrs)
13
- flow_control_options.each do |opt, val|
14
- send("#{opt}=", val)
15
- end
16
- attrs.each do |attribute, val|
17
- @attributes[attribute] = val
18
- end
19
- end
20
-
21
- def to_yaml(options = {})
22
- options = {
23
- include_descriptions: true
24
- }.merge(options)
25
- y = {
26
- 'type' => @type,
27
- 'description' => description,
28
- 'instance' => test_to_yaml(options),
29
- 'flow' => {
30
- 'attributes' => attributes_to_yaml(options),
31
- 'context' => context_to_yaml(options)
32
- }
33
- }
34
- y.delete('description') unless options[:include_descriptions]
35
- y
36
- end
37
-
38
- def attributes_to_yaml(_options = {})
39
- a = {}
40
- @attributes.each do |name, val|
41
- a[name.to_s] = val if val
42
- end
43
- a
44
- end
45
-
46
- def context_to_yaml(_options = {})
47
- # Turn attribute keys into strings for prettier yaml, this includes all
48
- # relationship meta data
49
- c = @context.reduce({}) { |memo, (k, v)| memo[k.to_s] = v; memo }
50
- # Now add job/enable word data
51
- if @enable
52
- c['if_enable'] = @enable
53
- end
54
- if @unless_enable
55
- c['unless_enable'] = @unless_enable
56
- end
57
- unless if_jobs.empty?
58
- c['if_jobs'] = if_jobs
59
- end
60
- unless unless_jobs.empty?
61
- c['unless_jobs'] = unless_jobs
62
- end
63
- c
64
- end
65
-
66
- def test_to_yaml(options = {})
67
- if @test
68
- if @test.is_a?(String) || @test.is_a?(Symbol)
69
- {
70
- 'attributes' => {
71
- 'name' => @test.to_s
72
- }
73
- }
74
- else
75
- @test.to_yaml(options)
76
- end
77
- end
78
- end
79
-
80
- def method_missing(method, *args, &_block)
81
- method = method.to_s
82
- if method.gsub!('=', '')
83
- @attributes[method] = args.first
84
- else
85
- @attributes[method]
86
- end
87
- end
88
-
89
- def job
90
- if !if_jobs.empty? && !unless_jobs.empty?
91
- fail "Both if and unless jobs have been defined for test: #{parameter}"
92
- elsif !if_jobs.empty?
93
- if_jobs.join(',')
94
- elsif !unless_jobs.empty?
95
- unless_jobs.map { |j| "!#{j}" }.join(',')
96
- else
97
- ''
98
- end
99
- end
100
- alias_method :jobs, :job
101
-
102
- def if_jobs
103
- @if_jobs ||= []
104
- end
105
-
106
- def unless_jobs
107
- @unless_jobs ||= []
108
- end
109
-
110
- def if_enable=(val)
111
- @enable = val
112
- end
113
- alias_method :enable=, :if_enable=
114
- alias_method :if_enabled=, :if_enable=
115
-
116
- def unless_enable=(val)
117
- @unless_enable = val
118
- end
119
- alias_method :unless_enabled=, :unless_enable=
120
-
121
- def if_job=(jobs)
122
- [jobs].flatten.compact.each do |job|
123
- job = job.to_s.upcase
124
- if job =~ /!/
125
- self.unless_job = job
126
- else
127
- if_jobs << job unless if_jobs.include?(job)
128
- end
129
- end
130
- end
131
- alias_method :if_jobs=, :if_job=
132
- alias_method :add_if_jobs, :if_job=
133
- alias_method :add_if_job, :if_job=
134
-
135
- def unless_job=(jobs)
136
- [jobs].flatten.compact.each do |job|
137
- job = job.to_s.upcase
138
- job.gsub!('!', '')
139
- unless_jobs << job unless unless_jobs.include?(job)
140
- end
141
- end
142
- alias_method :unless_jobs=, :unless_job=
143
- alias_method :add_unless_jobs, :unless_job=
144
- alias_method :add_unless_job, :unless_job=
145
-
146
- def run_if_failed(id)
147
- @context[:if_failed] = id
148
- end
149
-
150
- def run_if_passed(id)
151
- @context[:if_passed] = id
152
- end
153
-
154
- def run_if_ran(id)
155
- @context[:if_ran] = id
156
- end
157
-
158
- def run_unless_ran(id)
159
- @context[:unless_ran] = id
160
- end
161
-
162
- def run_if_any_passed(parent)
163
- @context[:if_any_passed] = parent.id
164
- end
165
-
166
- def run_if_all_passed(parent)
167
- @context[:if_all_passed] = parent.id
168
- end
169
-
170
- def run_if_any_failed(parent)
171
- @context[:if_any_failed] = parent.id
172
- end
173
-
174
- def run_if_all_failed(parent)
175
- @context[:if_all_failed] = parent.id
176
- end
177
-
178
- def continue_on_fail
179
- @attributes[:continue] = true
180
- end
181
-
182
- def id
183
- @id || "#{parameter}_#{unique_counter}"
184
- end
185
-
186
- def unique_counter
187
- @unique_counter ||= self.class.unique_counter
188
- end
189
-
190
- def self.unique_counter
191
- @ix ||= -1
192
- @ix += 1
193
- end
194
-
195
- def test?
196
- @type == :test
197
- end
198
- end
199
- end
200
- end
201
- end