origen_testers 0.13.1 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/application.rb +151 -151
- data/config/boot.rb +13 -13
- data/config/commands.rb +85 -86
- data/config/users.rb +18 -18
- data/config/version.rb +8 -8
- data/lib/commands/build.rb +69 -69
- data/lib/commands/run.rb +48 -48
- data/lib/origen_testers.rb +47 -47
- data/lib/origen_testers/api.rb +381 -381
- data/lib/origen_testers/basic_test_setups.rb +105 -105
- data/lib/origen_testers/callback_handlers.rb +59 -59
- data/lib/origen_testers/command_based_tester.rb +45 -45
- data/lib/origen_testers/flow.rb +382 -382
- data/lib/origen_testers/generator.rb +283 -283
- data/lib/origen_testers/generator/identity_map.rb +23 -23
- data/lib/origen_testers/generator/placeholder.rb +11 -11
- data/lib/origen_testers/generator/test_numberer.rb +23 -23
- data/lib/origen_testers/igxl_based_tester.rb +12 -12
- data/lib/origen_testers/igxl_based_tester/base.rb +1100 -1099
- data/lib/origen_testers/igxl_based_tester/base/ac_specsets.rb +79 -79
- data/lib/origen_testers/igxl_based_tester/base/custom_test_instance.rb +169 -169
- data/lib/origen_testers/igxl_based_tester/base/dc_specsets.rb +98 -98
- data/lib/origen_testers/igxl_based_tester/base/edge.rb +60 -60
- data/lib/origen_testers/igxl_based_tester/base/edges.rb +24 -24
- data/lib/origen_testers/igxl_based_tester/base/edgeset.rb +39 -39
- data/lib/origen_testers/igxl_based_tester/base/edgesets.rb +130 -130
- data/lib/origen_testers/igxl_based_tester/base/flow.rb +460 -460
- data/lib/origen_testers/igxl_based_tester/base/flow_line.rb +276 -276
- data/lib/origen_testers/igxl_based_tester/base/generator.rb +607 -607
- data/lib/origen_testers/igxl_based_tester/base/global_specs.rb +83 -83
- data/lib/origen_testers/igxl_based_tester/base/job.rb +75 -75
- data/lib/origen_testers/igxl_based_tester/base/jobs.rb +44 -44
- data/lib/origen_testers/igxl_based_tester/base/level_io_se.rb +59 -59
- data/lib/origen_testers/igxl_based_tester/base/level_supply.rb +39 -39
- data/lib/origen_testers/igxl_based_tester/base/levels.rb +31 -31
- data/lib/origen_testers/igxl_based_tester/base/levelset.rb +110 -110
- data/lib/origen_testers/igxl_based_tester/base/patgroup.rb +109 -109
- data/lib/origen_testers/igxl_based_tester/base/patgroups.rb +38 -38
- data/lib/origen_testers/igxl_based_tester/base/patset.rb +68 -68
- data/lib/origen_testers/igxl_based_tester/base/patset_pattern.rb +56 -56
- data/lib/origen_testers/igxl_based_tester/base/patsets.rb +38 -38
- data/lib/origen_testers/igxl_based_tester/base/patsubr.rb +68 -68
- data/lib/origen_testers/igxl_based_tester/base/patsubr_pattern.rb +56 -56
- data/lib/origen_testers/igxl_based_tester/base/patsubrs.rb +38 -38
- data/lib/origen_testers/igxl_based_tester/base/pinmap.rb +93 -93
- data/lib/origen_testers/igxl_based_tester/base/references.rb +25 -25
- data/lib/origen_testers/igxl_based_tester/base/test_instance.rb +322 -322
- data/lib/origen_testers/igxl_based_tester/base/test_instance_group.rb +66 -66
- data/lib/origen_testers/igxl_based_tester/base/test_instances.rb +212 -212
- data/lib/origen_testers/igxl_based_tester/base/test_instances/custom_til.rb +37 -37
- data/lib/origen_testers/igxl_based_tester/base/timeset.rb +37 -37
- data/lib/origen_testers/igxl_based_tester/base/timesets.rb +49 -49
- data/lib/origen_testers/igxl_based_tester/base/timesets_basic.rb +49 -49
- data/lib/origen_testers/igxl_based_tester/files.rb +43 -43
- data/lib/origen_testers/igxl_based_tester/j750.rb +269 -269
- data/lib/origen_testers/igxl_based_tester/j750/custom_test_instance.rb +32 -32
- data/lib/origen_testers/igxl_based_tester/j750/flow.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/j750/flow_line.rb +19 -19
- data/lib/origen_testers/igxl_based_tester/j750/generator.rb +19 -19
- data/lib/origen_testers/igxl_based_tester/j750/patgroup.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750/patgroups.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/j750/patset.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750/patset_pattern.rb +18 -18
- data/lib/origen_testers/igxl_based_tester/j750/patsets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/j750/patsubr.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750/patsubr_pattern.rb +18 -18
- data/lib/origen_testers/igxl_based_tester/j750/patsubrs.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/j750/test_instance.rb +746 -746
- data/lib/origen_testers/igxl_based_tester/j750/test_instance_group.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750/test_instances.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/j750_hpt.rb +34 -34
- data/lib/origen_testers/igxl_based_tester/j750_hpt/custom_test_instance.rb +32 -32
- data/lib/origen_testers/igxl_based_tester/j750_hpt/flow.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/flow_line.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/generator.rb +19 -19
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patgroup.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patgroups.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patset.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patset_pattern.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patsets.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubr.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubr_pattern.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/patsubrs.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instance.rb +599 -599
- data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instance_group.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/j750_hpt/test_instances.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/parser.rb +102 -102
- data/lib/origen_testers/igxl_based_tester/parser/ac_spec.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/parser/dc_spec.rb +33 -33
- data/lib/origen_testers/igxl_based_tester/parser/dc_specs.rb +48 -48
- data/lib/origen_testers/igxl_based_tester/parser/descriptions.rb +339 -339
- data/lib/origen_testers/igxl_based_tester/parser/flow.rb +109 -109
- data/lib/origen_testers/igxl_based_tester/parser/flow_line.rb +203 -203
- data/lib/origen_testers/igxl_based_tester/parser/flows.rb +21 -21
- data/lib/origen_testers/igxl_based_tester/parser/pattern_set.rb +92 -92
- data/lib/origen_testers/igxl_based_tester/parser/pattern_sets.rb +31 -31
- data/lib/origen_testers/igxl_based_tester/parser/test_instance.rb +420 -420
- data/lib/origen_testers/igxl_based_tester/parser/test_instances.rb +24 -24
- data/lib/origen_testers/igxl_based_tester/parser/timeset.rb +13 -13
- data/lib/origen_testers/igxl_based_tester/ultraflex.rb +798 -798
- data/lib/origen_testers/igxl_based_tester/ultraflex/ac_specsets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/ate_hardware.rb +949 -949
- data/lib/origen_testers/igxl_based_tester/ultraflex/custom_test_instance.rb +36 -36
- data/lib/origen_testers/igxl_based_tester/ultraflex/dc_specsets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/edge.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/edges.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/edgeset.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/edgesets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/flow.rb +158 -158
- data/lib/origen_testers/igxl_based_tester/ultraflex/flow_line.rb +19 -19
- data/lib/origen_testers/igxl_based_tester/ultraflex/generator.rb +19 -19
- data/lib/origen_testers/igxl_based_tester/ultraflex/global_specs.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/job.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/jobs.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/level_io_se.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/level_supply.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/levels.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/levelset.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/patgroup.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/patgroups.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/patset.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/patset_pattern.rb +18 -18
- data/lib/origen_testers/igxl_based_tester/ultraflex/patsets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/patsubr.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/patsubr_pattern.rb +18 -18
- data/lib/origen_testers/igxl_based_tester/ultraflex/patsubrs.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/pinmap.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/references.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/ac_specsets.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/dc_specsets.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/edgesets.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/global_specs.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/jobs.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/levelset.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/pinmap.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/references.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/timesets.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/templates/timesets_basic.txt.erb +0 -0
- data/lib/origen_testers/igxl_based_tester/ultraflex/test_instance.rb +315 -315
- data/lib/origen_testers/igxl_based_tester/ultraflex/test_instance_group.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/test_instances.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/timeset.rb +9 -9
- data/lib/origen_testers/igxl_based_tester/ultraflex/timesets.rb +10 -10
- data/lib/origen_testers/igxl_based_tester/ultraflex/timesets_basic.rb +10 -10
- data/lib/origen_testers/interface.rb +345 -324
- data/lib/origen_testers/memory_style.rb +77 -77
- data/lib/origen_testers/no_interface.rb +7 -7
- data/lib/origen_testers/origen_ext/application/runner.rb +25 -25
- data/lib/origen_testers/origen_ext/generator.rb +54 -54
- data/lib/origen_testers/origen_ext/generator/flow.rb +91 -77
- data/lib/origen_testers/origen_ext/generator/resources.rb +21 -21
- data/lib/origen_testers/origen_ext/pins/pin.rb +78 -78
- data/lib/origen_testers/origen_ext/pins/pin_collection.rb +84 -84
- data/lib/origen_testers/parser.rb +22 -22
- data/lib/origen_testers/parser/description_lookup.rb +62 -62
- data/lib/origen_testers/parser/searchable_array.rb +30 -30
- data/lib/origen_testers/parser/searchable_hash.rb +30 -30
- data/lib/origen_testers/pattern_compilers.rb +116 -116
- data/lib/origen_testers/pattern_compilers/assembler.rb +88 -88
- data/lib/origen_testers/pattern_compilers/job.rb +96 -96
- data/lib/origen_testers/pattern_compilers/ultraflex_pattern_compiler.rb +599 -599
- data/lib/origen_testers/program_generators.rb +62 -62
- data/lib/origen_testers/smartest_based_tester.rb +8 -8
- data/lib/origen_testers/smartest_based_tester/base.rb +576 -567
- data/lib/origen_testers/smartest_based_tester/base/flow.rb +296 -291
- data/lib/origen_testers/smartest_based_tester/base/generator.rb +207 -194
- data/lib/origen_testers/smartest_based_tester/base/pattern_compiler.rb +32 -32
- data/lib/origen_testers/smartest_based_tester/base/pattern_master.rb +69 -69
- data/lib/origen_testers/smartest_based_tester/base/processors.rb +16 -16
- data/lib/origen_testers/smartest_based_tester/base/processors/adjacent_if_combiner.rb +106 -106
- data/lib/origen_testers/smartest_based_tester/base/processors/continue_implementer.rb +39 -39
- data/lib/origen_testers/smartest_based_tester/base/processors/empty_branch_cleaner.rb +21 -21
- data/lib/origen_testers/smartest_based_tester/base/processors/extract_run_flag_table.rb +33 -33
- data/lib/origen_testers/smartest_based_tester/base/processors/extract_set_variables.rb +22 -22
- data/lib/origen_testers/smartest_based_tester/base/processors/flag_optimizer.rb +188 -188
- data/lib/origen_testers/smartest_based_tester/base/processors/if_ran_cleaner.rb +34 -34
- data/lib/origen_testers/smartest_based_tester/base/test_method.rb +178 -164
- data/lib/origen_testers/smartest_based_tester/base/test_methods.rb +77 -73
- data/lib/origen_testers/smartest_based_tester/base/test_methods/ac_tml.rb +33 -33
- data/lib/origen_testers/smartest_based_tester/base/test_methods/base_tml.rb +38 -38
- data/lib/origen_testers/smartest_based_tester/base/test_methods/custom_tml.rb +19 -19
- data/lib/origen_testers/smartest_based_tester/base/test_methods/dc_tml.rb +147 -147
- data/lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb +65 -65
- data/lib/origen_testers/smartest_based_tester/base/test_suite.rb +208 -193
- data/lib/origen_testers/smartest_based_tester/base/test_suites.rb +58 -54
- data/lib/origen_testers/smartest_based_tester/base/variables_file.rb +38 -38
- data/lib/origen_testers/smartest_based_tester/v93k.rb +8 -8
- data/lib/origen_testers/smartest_based_tester/v93k/builder.rb +89 -89
- data/lib/origen_testers/smartest_based_tester/v93k/builder/flow.rb +181 -181
- data/lib/origen_testers/smartest_based_tester/v93k/builder/pattern_master.rb +54 -54
- data/lib/origen_testers/smartest_based_tester/v93k/flow.rb +10 -10
- data/lib/origen_testers/smartest_based_tester/v93k/generator.rb +19 -19
- data/lib/origen_testers/smartest_based_tester/v93k/pattern_compiler.rb +10 -10
- data/lib/origen_testers/smartest_based_tester/v93k/pattern_master.rb +10 -10
- data/lib/origen_testers/smartest_based_tester/v93k/templates/template.aiv.erb +17 -17
- data/lib/origen_testers/smartest_based_tester/v93k/templates/template.pmfl.erb +13 -13
- data/lib/origen_testers/smartest_based_tester/v93k/templates/template.tf.erb +236 -214
- data/lib/origen_testers/smartest_based_tester/v93k/templates/vars.tf.erb +48 -48
- data/lib/origen_testers/smartest_based_tester/v93k/test_method.rb +9 -9
- data/lib/origen_testers/smartest_based_tester/v93k/test_methods.rb +9 -9
- data/lib/origen_testers/smartest_based_tester/v93k/test_suite.rb +9 -9
- data/lib/origen_testers/smartest_based_tester/v93k/test_suites.rb +9 -9
- data/lib/origen_testers/smartest_based_tester/v93k/variables_file.rb +10 -10
- data/lib/origen_testers/test/basic_interface.rb +17 -17
- data/lib/origen_testers/test/block.rb +21 -21
- data/lib/origen_testers/test/custom_test_interface.rb +111 -111
- data/lib/origen_testers/test/dut.rb +295 -295
- data/lib/origen_testers/test/dut2.rb +76 -76
- data/lib/origen_testers/test/dut3.rb +244 -244
- data/lib/origen_testers/test/interface.rb +503 -503
- data/lib/origen_testers/test/nvm.rb +94 -94
- data/lib/origen_testers/timing.rb +368 -368
- data/lib/origen_testers/vector.rb +207 -207
- data/lib/origen_testers/vector_based_tester.rb +41 -41
- data/lib/origen_testers/vector_generator.rb +655 -655
- data/lib/origen_testers/vector_pipeline.rb +302 -302
- data/pattern/bitmap.rb +7 -7
- data/pattern/dc_instr.rb +7 -7
- data/pattern/delay.rb +7 -7
- data/pattern/freq_counter.rb +6 -6
- data/pattern/mem_test.rb +8 -8
- data/pattern/multi_vector.rb +122 -122
- data/pattern/multi_vector_plus1.rb +125 -125
- data/pattern/nvm/j750/add_late_pins.rb +3 -3
- data/pattern/nvm/j750/iterator_postfix_test_x_bx.rb +8 -8
- data/pattern/nvm/j750/iterator_test_x_bx.rb +8 -8
- data/pattern/nvm/j750/j750_halt.rb +159 -159
- data/pattern/nvm/j750/j750_workout.rb +209 -209
- data/pattern/nvm/j750/timing.rb +73 -73
- data/pattern/read_write_reg.rb +61 -61
- data/pattern/reset.rb +4 -4
- data/pattern/subroutines.rb +69 -69
- data/pattern/tester_overlay.rb +61 -52
- data/pattern/tester_store.rb +28 -28
- data/program/_additional_erase.rb +7 -7
- data/program/_efa_resources.rb +7 -7
- data/program/_erase.rb +25 -25
- data/program/_erase_vfy.rb +5 -5
- data/program/_iv_resources.rb +10 -10
- data/program/basic_interface.rb +5 -5
- data/program/components/_prb1_main.rb +222 -222
- data/program/components/_temp.rb +6 -6
- data/program/custom_tests.rb +10 -10
- data/program/flow_control.rb +422 -422
- data/program/prb1.rb +11 -11
- data/program/prb1_resources.rb +28 -28
- data/program/prb2.rb +27 -27
- data/program/test.rb +29 -29
- data/program/uflex_resources.rb +199 -199
- data/templates/example.txt.erb +53 -53
- data/templates/j750/program_sheet.txt.erb +9 -9
- data/templates/manifest/v93k.yaml.erb +22 -22
- data/templates/web/index.md.erb +51 -51
- data/templates/web/layouts/_basic.html.erb +15 -15
- data/templates/web/partials/_navbar.html.erb +22 -22
- data/templates/web/release_notes.md.erb +5 -5
- metadata +2 -2
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
module OrigenTesters
|
|
2
|
-
# Including this module in a class will create a basic test program interface that
|
|
3
|
-
# can generate programs for all ATE platforms supported by the Testers plugin.
|
|
4
|
-
#
|
|
5
|
-
# It provides a number of methods that can be called from a test program flow file
|
|
6
|
-
# to do basic things like a functional test.
|
|
7
|
-
#
|
|
8
|
-
# @example How to setup and use
|
|
9
|
-
# # lib/myapp/program_interface.rb
|
|
10
|
-
# module MyApp
|
|
11
|
-
# class Interface
|
|
12
|
-
# include OrigenTesters::BasicTestSetups
|
|
13
|
-
# end
|
|
14
|
-
# end
|
|
15
|
-
#
|
|
16
|
-
# # program/prb1.rb
|
|
17
|
-
# Flow.create interface: 'MyApp::Interface' do
|
|
18
|
-
#
|
|
19
|
-
# functional :my_pattern_1, bin: 10
|
|
20
|
-
# functional :my_pattern_2, bin: 11
|
|
21
|
-
#
|
|
22
|
-
# end
|
|
23
|
-
module BasicTestSetups
|
|
24
|
-
include OrigenTesters::ProgramGenerators
|
|
25
|
-
|
|
26
|
-
# Execute a functional test
|
|
27
|
-
#
|
|
28
|
-
# @param [Symbol, String] name the name of the test.
|
|
29
|
-
# @param [Hash] options the options to customize the test.
|
|
30
|
-
# @option options [Integer] :bin The bin number
|
|
31
|
-
# @option options [Integer] :sbin The soft bin number
|
|
32
|
-
# @option options [String] :pattern The pattern name, if not specified the test
|
|
33
|
-
# name will be used
|
|
34
|
-
# @option options [String] :pin_levels ('Lvl') The name of the pin levels
|
|
35
|
-
# @option options [String] :time_set ('Tim') The name of the time set
|
|
36
|
-
#
|
|
37
|
-
# @see http://origen.freescale.net/origen/latest/guides/program/flowapi/ The options associated with the flow control API are fully supported
|
|
38
|
-
#
|
|
39
|
-
# @example Customizing a test from the flow
|
|
40
|
-
# functional :erase, pattern: 'erase_all_nosrc', sbin: 150
|
|
41
|
-
#
|
|
42
|
-
# @example Applying global customization from the interface
|
|
43
|
-
# include OrigenTesters::BasicTestSetups
|
|
44
|
-
#
|
|
45
|
-
# def functional(name, options = {})
|
|
46
|
-
# # Apply custom defaults before calling
|
|
47
|
-
# options = {
|
|
48
|
-
# bin: 3,
|
|
49
|
-
# levels: 'nvm',
|
|
50
|
-
# }.merge(options)
|
|
51
|
-
# # Now call the generator
|
|
52
|
-
# super
|
|
53
|
-
# end
|
|
54
|
-
#
|
|
55
|
-
# @return [Hash] all generated components of the test will be returned. The key
|
|
56
|
-
# naming will depend on what platform the test has been generated for, but for
|
|
57
|
-
# example this will contain :flow_line, :test_instance and :patset objects in
|
|
58
|
-
# the case of an IG-XL-based platform.
|
|
59
|
-
#
|
|
60
|
-
# @example Adding a custom interpose function for J750
|
|
61
|
-
# include OrigenTesters::BasicTestSetups
|
|
62
|
-
#
|
|
63
|
-
# # Override the default J750 test instance to add an interpose function
|
|
64
|
-
# def functional(name, options = {})
|
|
65
|
-
# components = super
|
|
66
|
-
# if tester.j750?
|
|
67
|
-
# components[:test_instance].post_test_func = 'delayedBinning'
|
|
68
|
-
# end
|
|
69
|
-
# end
|
|
70
|
-
def functional(name, options = {})
|
|
71
|
-
options = {
|
|
72
|
-
pin_levels: 'Lvl',
|
|
73
|
-
time_set: 'Tim'
|
|
74
|
-
}.merge(options)
|
|
75
|
-
pattern = extract_pattern(name, options)
|
|
76
|
-
if tester.j750? || tester.j750_hpt? || tester.ultraflex?
|
|
77
|
-
ins = test_instances.functional(name, options)
|
|
78
|
-
pname = "#{pattern}_pset"
|
|
79
|
-
pset = patsets.add(pname, [{ pattern: "#{pattern}.PAT" }])
|
|
80
|
-
ins.pattern = pname
|
|
81
|
-
line = flow.test(ins, options)
|
|
82
|
-
{ test_instance: ins, flow_line: line, patset: pset }
|
|
83
|
-
elsif tester.v93k?
|
|
84
|
-
tm = test_methods.ac_tml.ac_test.functional_test
|
|
85
|
-
ts = test_suites.run(name, options)
|
|
86
|
-
ts.test_method = tm
|
|
87
|
-
ts.pattern = pattern
|
|
88
|
-
node = flow.test(ts, options)
|
|
89
|
-
{ test_method: tm, test_suite: ts, node: node }
|
|
90
|
-
else
|
|
91
|
-
fail "Unsupported tester: #{tester.class}"
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Extract the pattern name from the given options, falling back to the given
|
|
96
|
-
# test name if a :pattern option is not present.
|
|
97
|
-
#
|
|
98
|
-
# It will also strip any extension if one is present.
|
|
99
|
-
def extract_pattern(name, options = {})
|
|
100
|
-
p = options[:pattern] || name
|
|
101
|
-
p = p.to_s.sub(/\..*$/, '')
|
|
102
|
-
p
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
1
|
+
module OrigenTesters
|
|
2
|
+
# Including this module in a class will create a basic test program interface that
|
|
3
|
+
# can generate programs for all ATE platforms supported by the Testers plugin.
|
|
4
|
+
#
|
|
5
|
+
# It provides a number of methods that can be called from a test program flow file
|
|
6
|
+
# to do basic things like a functional test.
|
|
7
|
+
#
|
|
8
|
+
# @example How to setup and use
|
|
9
|
+
# # lib/myapp/program_interface.rb
|
|
10
|
+
# module MyApp
|
|
11
|
+
# class Interface
|
|
12
|
+
# include OrigenTesters::BasicTestSetups
|
|
13
|
+
# end
|
|
14
|
+
# end
|
|
15
|
+
#
|
|
16
|
+
# # program/prb1.rb
|
|
17
|
+
# Flow.create interface: 'MyApp::Interface' do
|
|
18
|
+
#
|
|
19
|
+
# functional :my_pattern_1, bin: 10
|
|
20
|
+
# functional :my_pattern_2, bin: 11
|
|
21
|
+
#
|
|
22
|
+
# end
|
|
23
|
+
module BasicTestSetups
|
|
24
|
+
include OrigenTesters::ProgramGenerators
|
|
25
|
+
|
|
26
|
+
# Execute a functional test
|
|
27
|
+
#
|
|
28
|
+
# @param [Symbol, String] name the name of the test.
|
|
29
|
+
# @param [Hash] options the options to customize the test.
|
|
30
|
+
# @option options [Integer] :bin The bin number
|
|
31
|
+
# @option options [Integer] :sbin The soft bin number
|
|
32
|
+
# @option options [String] :pattern The pattern name, if not specified the test
|
|
33
|
+
# name will be used
|
|
34
|
+
# @option options [String] :pin_levels ('Lvl') The name of the pin levels
|
|
35
|
+
# @option options [String] :time_set ('Tim') The name of the time set
|
|
36
|
+
#
|
|
37
|
+
# @see http://origen.freescale.net/origen/latest/guides/program/flowapi/ The options associated with the flow control API are fully supported
|
|
38
|
+
#
|
|
39
|
+
# @example Customizing a test from the flow
|
|
40
|
+
# functional :erase, pattern: 'erase_all_nosrc', sbin: 150
|
|
41
|
+
#
|
|
42
|
+
# @example Applying global customization from the interface
|
|
43
|
+
# include OrigenTesters::BasicTestSetups
|
|
44
|
+
#
|
|
45
|
+
# def functional(name, options = {})
|
|
46
|
+
# # Apply custom defaults before calling
|
|
47
|
+
# options = {
|
|
48
|
+
# bin: 3,
|
|
49
|
+
# levels: 'nvm',
|
|
50
|
+
# }.merge(options)
|
|
51
|
+
# # Now call the generator
|
|
52
|
+
# super
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# @return [Hash] all generated components of the test will be returned. The key
|
|
56
|
+
# naming will depend on what platform the test has been generated for, but for
|
|
57
|
+
# example this will contain :flow_line, :test_instance and :patset objects in
|
|
58
|
+
# the case of an IG-XL-based platform.
|
|
59
|
+
#
|
|
60
|
+
# @example Adding a custom interpose function for J750
|
|
61
|
+
# include OrigenTesters::BasicTestSetups
|
|
62
|
+
#
|
|
63
|
+
# # Override the default J750 test instance to add an interpose function
|
|
64
|
+
# def functional(name, options = {})
|
|
65
|
+
# components = super
|
|
66
|
+
# if tester.j750?
|
|
67
|
+
# components[:test_instance].post_test_func = 'delayedBinning'
|
|
68
|
+
# end
|
|
69
|
+
# end
|
|
70
|
+
def functional(name, options = {})
|
|
71
|
+
options = {
|
|
72
|
+
pin_levels: 'Lvl',
|
|
73
|
+
time_set: 'Tim'
|
|
74
|
+
}.merge(options)
|
|
75
|
+
pattern = extract_pattern(name, options)
|
|
76
|
+
if tester.j750? || tester.j750_hpt? || tester.ultraflex?
|
|
77
|
+
ins = test_instances.functional(name, options)
|
|
78
|
+
pname = "#{pattern}_pset"
|
|
79
|
+
pset = patsets.add(pname, [{ pattern: "#{pattern}.PAT" }])
|
|
80
|
+
ins.pattern = pname
|
|
81
|
+
line = flow.test(ins, options)
|
|
82
|
+
{ test_instance: ins, flow_line: line, patset: pset }
|
|
83
|
+
elsif tester.v93k?
|
|
84
|
+
tm = test_methods.ac_tml.ac_test.functional_test
|
|
85
|
+
ts = test_suites.run(name, options)
|
|
86
|
+
ts.test_method = tm
|
|
87
|
+
ts.pattern = pattern
|
|
88
|
+
node = flow.test(ts, options)
|
|
89
|
+
{ test_method: tm, test_suite: ts, node: node }
|
|
90
|
+
else
|
|
91
|
+
fail "Unsupported tester: #{tester.class}"
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Extract the pattern name from the given options, falling back to the given
|
|
96
|
+
# test name if a :pattern option is not present.
|
|
97
|
+
#
|
|
98
|
+
# It will also strip any extension if one is present.
|
|
99
|
+
def extract_pattern(name, options = {})
|
|
100
|
+
p = options[:pattern] || name
|
|
101
|
+
p = p.to_s.sub(/\..*$/, '')
|
|
102
|
+
p
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
module OrigenTesters
|
|
2
|
-
class CallbackHandlers
|
|
3
|
-
include Origen::PersistentCallbacks
|
|
4
|
-
|
|
5
|
-
# Snoop the pattern path that was just created and then compile it
|
|
6
|
-
# if the compiler was passed on the command line
|
|
7
|
-
def pattern_generated(path_to_generated_pattern)
|
|
8
|
-
current_compiler = select_compiler
|
|
9
|
-
run_compiler(current_compiler, path_to_generated_pattern)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Listen for a pattern with .atp or .atp.gz extension. If found then compile the fileand kill the 'origen g' command
|
|
13
|
-
def before_pattern_lookup(requested_pattern)
|
|
14
|
-
path = Pathname.new(requested_pattern)
|
|
15
|
-
patname = path.basename
|
|
16
|
-
dir = path.dirname
|
|
17
|
-
if patname.to_s.match(/.atp/)
|
|
18
|
-
if patname.extname == '.atp' || patname.extname == '.gz'
|
|
19
|
-
# Found a .atp or .atp.gz file so we should compile it
|
|
20
|
-
matches = Dir.glob("#{Origen.root}/**/#{patname}")
|
|
21
|
-
fail "Found multiple locations for #{patname}, exiting...\n\t#{matches}" if matches.size > 1
|
|
22
|
-
pattern = matches.first.to_s
|
|
23
|
-
current_compiler = select_compiler
|
|
24
|
-
run_compiler(current_compiler, pattern)
|
|
25
|
-
$compile = true
|
|
26
|
-
end
|
|
27
|
-
# Return false so the Origen generate command stops
|
|
28
|
-
return false
|
|
29
|
-
end
|
|
30
|
-
true
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
35
|
-
def select_compiler
|
|
36
|
-
current_compiler = nil
|
|
37
|
-
if $compiler == :use_app_default
|
|
38
|
-
current_compiler = $dut.compiler
|
|
39
|
-
fail "DUT compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
|
40
|
-
elsif $compiler.is_a? Symbol
|
|
41
|
-
current_compiler = $compiler
|
|
42
|
-
fail "Command line compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
|
43
|
-
end
|
|
44
|
-
current_compiler
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def run_compiler(current_compiler, pattern)
|
|
48
|
-
unless current_compiler.nil?
|
|
49
|
-
debug "Compiling pattern #{pattern} with compiler '#{current_compiler}'..."
|
|
50
|
-
$dut.pattern_compilers[current_compiler].find_jobs(pattern)
|
|
51
|
-
$dut.pattern_compilers[current_compiler].run
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Instantiate an instance of this class immediately when this file is required, this object will
|
|
57
|
-
# then listen for the remainder of the Origen thread
|
|
58
|
-
CallbackHandlers.new
|
|
59
|
-
end
|
|
1
|
+
module OrigenTesters
|
|
2
|
+
class CallbackHandlers
|
|
3
|
+
include Origen::PersistentCallbacks
|
|
4
|
+
|
|
5
|
+
# Snoop the pattern path that was just created and then compile it
|
|
6
|
+
# if the compiler was passed on the command line
|
|
7
|
+
def pattern_generated(path_to_generated_pattern)
|
|
8
|
+
current_compiler = select_compiler
|
|
9
|
+
run_compiler(current_compiler, path_to_generated_pattern)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Listen for a pattern with .atp or .atp.gz extension. If found then compile the fileand kill the 'origen g' command
|
|
13
|
+
def before_pattern_lookup(requested_pattern)
|
|
14
|
+
path = Pathname.new(requested_pattern)
|
|
15
|
+
patname = path.basename
|
|
16
|
+
dir = path.dirname
|
|
17
|
+
if patname.to_s.match(/.atp/)
|
|
18
|
+
if patname.extname == '.atp' || patname.extname == '.gz'
|
|
19
|
+
# Found a .atp or .atp.gz file so we should compile it
|
|
20
|
+
matches = Dir.glob("#{Origen.root}/**/#{patname}")
|
|
21
|
+
fail "Found multiple locations for #{patname}, exiting...\n\t#{matches}" if matches.size > 1
|
|
22
|
+
pattern = matches.first.to_s
|
|
23
|
+
current_compiler = select_compiler
|
|
24
|
+
run_compiler(current_compiler, pattern)
|
|
25
|
+
$compile = true
|
|
26
|
+
end
|
|
27
|
+
# Return false so the Origen generate command stops
|
|
28
|
+
return false
|
|
29
|
+
end
|
|
30
|
+
true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def select_compiler
|
|
36
|
+
current_compiler = nil
|
|
37
|
+
if $compiler == :use_app_default
|
|
38
|
+
current_compiler = $dut.compiler
|
|
39
|
+
fail "DUT compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
|
40
|
+
elsif $compiler.is_a? Symbol
|
|
41
|
+
current_compiler = $compiler
|
|
42
|
+
fail "Command line compiler '#{current_compiler}' is not instantiated" if $dut.pattern_compilers[current_compiler].nil?
|
|
43
|
+
end
|
|
44
|
+
current_compiler
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def run_compiler(current_compiler, pattern)
|
|
48
|
+
unless current_compiler.nil?
|
|
49
|
+
debug "Compiling pattern #{pattern} with compiler '#{current_compiler}'..."
|
|
50
|
+
$dut.pattern_compilers[current_compiler].find_jobs(pattern)
|
|
51
|
+
$dut.pattern_compilers[current_compiler].run
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Instantiate an instance of this class immediately when this file is required, this object will
|
|
57
|
+
# then listen for the remainder of the Origen thread
|
|
58
|
+
CallbackHandlers.new
|
|
59
|
+
end
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
module OrigenTesters
|
|
3
|
-
# A base class that can be used to model command-based, rather than
|
|
4
|
-
# vector-based testers.
|
|
5
|
-
class CommandBasedTester
|
|
6
|
-
include VectorBasedTester
|
|
7
|
-
|
|
8
|
-
def initialize
|
|
9
|
-
@vector_based = false
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Write a string directly to the output file without being processed
|
|
13
|
-
# or modified in any way
|
|
14
|
-
def direct_write(str)
|
|
15
|
-
microcode str
|
|
16
|
-
end
|
|
17
|
-
alias_method :dw, :direct_write
|
|
18
|
-
|
|
19
|
-
# Concept of a cycle not supported, print out an error to the output
|
|
20
|
-
# file to alert the user that execution has hit code that is not
|
|
21
|
-
# compatible with a command based tester.
|
|
22
|
-
def cycle(*_args)
|
|
23
|
-
microcode '*** Cycle called ***'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Concept of a subroutine not supported, print out an error to the output
|
|
27
|
-
# file to alert the user that execution has hit code that is not
|
|
28
|
-
# compatible with a command based tester.
|
|
29
|
-
def call_subroutine(sub)
|
|
30
|
-
microcode "Call_subroutine called to #{sub}"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def format_vector(vec)
|
|
34
|
-
vec.microcode
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Loop the content embedded in the supplied block
|
|
38
|
-
def loop(_name = nil, number_of_loops)
|
|
39
|
-
number_of_loops.times do
|
|
40
|
-
yield
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
alias_method :loop_vector, :loop
|
|
44
|
-
end
|
|
45
|
-
end
|
|
1
|
+
|
|
2
|
+
module OrigenTesters
|
|
3
|
+
# A base class that can be used to model command-based, rather than
|
|
4
|
+
# vector-based testers.
|
|
5
|
+
class CommandBasedTester
|
|
6
|
+
include VectorBasedTester
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@vector_based = false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Write a string directly to the output file without being processed
|
|
13
|
+
# or modified in any way
|
|
14
|
+
def direct_write(str)
|
|
15
|
+
microcode str
|
|
16
|
+
end
|
|
17
|
+
alias_method :dw, :direct_write
|
|
18
|
+
|
|
19
|
+
# Concept of a cycle not supported, print out an error to the output
|
|
20
|
+
# file to alert the user that execution has hit code that is not
|
|
21
|
+
# compatible with a command based tester.
|
|
22
|
+
def cycle(*_args)
|
|
23
|
+
microcode '*** Cycle called ***'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Concept of a subroutine not supported, print out an error to the output
|
|
27
|
+
# file to alert the user that execution has hit code that is not
|
|
28
|
+
# compatible with a command based tester.
|
|
29
|
+
def call_subroutine(sub)
|
|
30
|
+
microcode "Call_subroutine called to #{sub}"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def format_vector(vec)
|
|
34
|
+
vec.microcode
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Loop the content embedded in the supplied block
|
|
38
|
+
def loop(_name = nil, number_of_loops)
|
|
39
|
+
number_of_loops.times do
|
|
40
|
+
yield
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
alias_method :loop_vector, :loop
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/origen_testers/flow.rb
CHANGED
|
@@ -1,382 +1,382 @@
|
|
|
1
|
-
require 'digest/md5'
|
|
2
|
-
module OrigenTesters
|
|
3
|
-
# Provides a common API to add tests to a flow that is supported by all testers.
|
|
4
|
-
#
|
|
5
|
-
# This builds up a flow model using the Abstract Test Program (ATP) gem, which
|
|
6
|
-
# now deals with implementing the flow control API.
|
|
7
|
-
#
|
|
8
|
-
# Individual tester drivers in this plugin are then responsible at the end to
|
|
9
|
-
# render the abstract flow to their specific format and conventions.
|
|
10
|
-
module Flow
|
|
11
|
-
include OrigenTesters::Generator
|
|
12
|
-
|
|
13
|
-
PROGRAM_MODELS_DIR = "#{Origen.root}/tmp/program_models"
|
|
14
|
-
|
|
15
|
-
def self.callstack
|
|
16
|
-
@callstack ||= []
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def self.comment_stack
|
|
20
|
-
@comment_stack ||= []
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def self.flow_comments
|
|
24
|
-
@flow_comments
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def self.flow_comments=(val)
|
|
28
|
-
@flow_comments = val
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.unique_ids
|
|
32
|
-
@unique_ids
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def self.unique_ids=(val)
|
|
36
|
-
@unique_ids = val
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def lines
|
|
40
|
-
@lines
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Returns the abstract test program model, this is shared by all
|
|
44
|
-
# flow created together in a generation run
|
|
45
|
-
def program
|
|
46
|
-
@@program ||= ATP::Program.new
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def save_program
|
|
50
|
-
FileUtils.mkdir_p(PROGRAM_MODELS_DIR) unless File.exist?(PROGRAM_MODELS_DIR)
|
|
51
|
-
program.save("#{PROGRAM_MODELS_DIR}/#{Origen.target.name}")
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def model
|
|
55
|
-
if Origen.interface.resources_mode?
|
|
56
|
-
@throwaway ||= ATP::Flow.new(self)
|
|
57
|
-
else
|
|
58
|
-
@model ||= begin
|
|
59
|
-
f = program.flow(id, description: OrigenTesters::Flow.flow_comments)
|
|
60
|
-
@sig = flow_sig(id)
|
|
61
|
-
f.id = @sig if OrigenTesters::Flow.unique_ids
|
|
62
|
-
f
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def enable(var, options = {})
|
|
68
|
-
add_meta!(options)
|
|
69
|
-
model.enable(var, clean_options(options))
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def disable(var, options = {})
|
|
73
|
-
add_meta!(options)
|
|
74
|
-
model.disable(var, clean_options(options))
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def bin(number, options = {})
|
|
78
|
-
options[:bin_description] ||= options.delete(:description)
|
|
79
|
-
if number.is_a?(Hash)
|
|
80
|
-
fail 'The bin number must be passed as the first argument'
|
|
81
|
-
end
|
|
82
|
-
add_meta!(options)
|
|
83
|
-
options[:type] ||= :fail
|
|
84
|
-
model.bin(number, clean_options(options))
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def pass(number, options = {})
|
|
88
|
-
if number.is_a?(Hash)
|
|
89
|
-
fail 'The bin number must be passed as the first argument'
|
|
90
|
-
end
|
|
91
|
-
options[:type] = :pass
|
|
92
|
-
bin(number, clean_options(options))
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def test(instance, options = {})
|
|
96
|
-
add_meta_and_description!(options)
|
|
97
|
-
model.test(instance, clean_options(options))
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def render(file, options = {})
|
|
101
|
-
add_meta!(options)
|
|
102
|
-
begin
|
|
103
|
-
text = super
|
|
104
|
-
rescue
|
|
105
|
-
text = file
|
|
106
|
-
end
|
|
107
|
-
model.render(text, clean_options(options))
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def cz(instance, cz_setup, options = {})
|
|
111
|
-
add_meta_and_description!(options)
|
|
112
|
-
model.cz(instance, cz_setup, clean_options(options))
|
|
113
|
-
end
|
|
114
|
-
alias_method :characterize, :cz
|
|
115
|
-
|
|
116
|
-
def log(message, options = {})
|
|
117
|
-
add_meta!(options)
|
|
118
|
-
model.log(message, clean_options(options))
|
|
119
|
-
end
|
|
120
|
-
alias_method :logprint, :log
|
|
121
|
-
|
|
122
|
-
def group(name, options = {})
|
|
123
|
-
add_meta!(options)
|
|
124
|
-
model.group(name, clean_options(options)) do
|
|
125
|
-
yield
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def nop(options = {})
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# @api private
|
|
133
|
-
# This fires between target loads (unless overridden by the ATE specific flow class)
|
|
134
|
-
def at_run_start
|
|
135
|
-
@@program = nil
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# @api private
|
|
139
|
-
# This fires between flows (unless overridden by the ATE specific flow class)
|
|
140
|
-
def at_flow_start
|
|
141
|
-
@labels = {}
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
def if_job(*jobs)
|
|
145
|
-
options = jobs.last.is_a?(Hash) ? jobs.pop : {}
|
|
146
|
-
options[:if_job] = jobs.flatten
|
|
147
|
-
add_meta!(options)
|
|
148
|
-
model.with_conditions(options) do
|
|
149
|
-
yield
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
alias_method :if_jobs, :if_job
|
|
153
|
-
|
|
154
|
-
def unless_job(*jobs)
|
|
155
|
-
options = jobs.last.is_a?(Hash) ? jobs.pop : {}
|
|
156
|
-
options[:unless_job] = jobs.flatten
|
|
157
|
-
add_meta!(options)
|
|
158
|
-
model.with_conditions(options) do
|
|
159
|
-
yield
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
alias_method :unless_jobs, :unless_job
|
|
163
|
-
|
|
164
|
-
def if_enable(word, options = {})
|
|
165
|
-
if options[:or]
|
|
166
|
-
yield
|
|
167
|
-
else
|
|
168
|
-
options = { enable: word }
|
|
169
|
-
add_meta!(options)
|
|
170
|
-
model.with_conditions(options) do
|
|
171
|
-
yield
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
alias_method :if_enabled, :if_enable
|
|
176
|
-
|
|
177
|
-
def unless_enable(word, options = {})
|
|
178
|
-
if options[:or]
|
|
179
|
-
yield
|
|
180
|
-
else
|
|
181
|
-
options = { unless_enable: word }
|
|
182
|
-
add_meta!(options)
|
|
183
|
-
model.with_conditions(options) do
|
|
184
|
-
yield
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
alias_method :unless_enabled, :unless_enable
|
|
189
|
-
|
|
190
|
-
def if_passed(test_id, options = {})
|
|
191
|
-
if test_id.is_a?(Array)
|
|
192
|
-
fail 'if_passed only accepts one ID, use if_any_passed or if_all_passed for multiple IDs'
|
|
193
|
-
end
|
|
194
|
-
options = { if_passed: test_id }
|
|
195
|
-
add_meta!(options)
|
|
196
|
-
model.with_conditions(options) do
|
|
197
|
-
yield
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
alias_method :unless_failed, :if_passed
|
|
201
|
-
|
|
202
|
-
def if_failed(test_id, options = {})
|
|
203
|
-
if test_id.is_a?(Array)
|
|
204
|
-
fail 'if_failed only accepts one ID, use if_any_failed or if_all_failed for multiple IDs'
|
|
205
|
-
end
|
|
206
|
-
options = { if_failed: test_id }
|
|
207
|
-
add_meta!(options)
|
|
208
|
-
model.with_conditions(options) do
|
|
209
|
-
yield
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
alias_method :unless_passed, :if_failed
|
|
213
|
-
|
|
214
|
-
def if_ran(test_id, options = {})
|
|
215
|
-
options = { if_ran: test_id }
|
|
216
|
-
add_meta!(options)
|
|
217
|
-
model.with_conditions(options) do
|
|
218
|
-
yield
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
def unless_ran(test_id, options = {})
|
|
223
|
-
options = { unless_ran: test_id }
|
|
224
|
-
add_meta!(options)
|
|
225
|
-
model.with_conditions(options) do
|
|
226
|
-
yield
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
def if_any_failed(*ids)
|
|
231
|
-
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
232
|
-
options[:if_any_failed] = ids.flatten
|
|
233
|
-
add_meta!(options)
|
|
234
|
-
model.with_conditions(options) do
|
|
235
|
-
yield
|
|
236
|
-
end
|
|
237
|
-
end
|
|
238
|
-
|
|
239
|
-
def if_all_failed(*ids)
|
|
240
|
-
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
241
|
-
options[:if_all_failed] = ids.flatten
|
|
242
|
-
add_meta!(options)
|
|
243
|
-
model.with_conditions(options) do
|
|
244
|
-
yield
|
|
245
|
-
end
|
|
246
|
-
end
|
|
247
|
-
|
|
248
|
-
def if_any_passed(*ids)
|
|
249
|
-
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
250
|
-
options[:if_any_passed] = ids.flatten
|
|
251
|
-
add_meta!(options)
|
|
252
|
-
model.with_conditions(options) do
|
|
253
|
-
yield
|
|
254
|
-
end
|
|
255
|
-
end
|
|
256
|
-
|
|
257
|
-
def if_all_passed(*ids)
|
|
258
|
-
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
259
|
-
options[:if_all_passed] = ids.flatten
|
|
260
|
-
add_meta!(options)
|
|
261
|
-
model.with_conditions(options) do
|
|
262
|
-
yield
|
|
263
|
-
end
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
def if_flag(flag, options = {})
|
|
267
|
-
options = { if_flag: flag }
|
|
268
|
-
add_meta!(options)
|
|
269
|
-
model.with_conditions(options) do
|
|
270
|
-
yield
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def unless_flag(flag, options = {})
|
|
275
|
-
options = { unless_flag: flag }
|
|
276
|
-
add_meta!(options)
|
|
277
|
-
model.with_conditions(options) do
|
|
278
|
-
yield
|
|
279
|
-
end
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
# @api private
|
|
283
|
-
def is_the_flow?
|
|
284
|
-
true
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
# Returns true if the test context generated from the supplied options + existing condition
|
|
288
|
-
# wrappers is different from that which was applied to the previous test.
|
|
289
|
-
def context_changed?(options)
|
|
290
|
-
options = clean_options(options)
|
|
291
|
-
model.context_changed?(options)
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def generate_unique_label(name = nil)
|
|
295
|
-
name = 'label' if !name || name == ''
|
|
296
|
-
name.gsub!(' ', '_')
|
|
297
|
-
name.upcase!
|
|
298
|
-
@labels ||= {}
|
|
299
|
-
@labels[name] ||= 0
|
|
300
|
-
@labels[name] += 1
|
|
301
|
-
"#{name}_#{@labels[name]}_#{sig}"
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
# Returns a unique signature that has been generated for the current flow, this can be appended
|
|
305
|
-
# to named references to avoid naming collisions with any other flow
|
|
306
|
-
def sig
|
|
307
|
-
@sig
|
|
308
|
-
end
|
|
309
|
-
alias_method :signature, :sig
|
|
310
|
-
|
|
311
|
-
private
|
|
312
|
-
|
|
313
|
-
# Make a unique signature for the flow based on the flow name and the name of
|
|
314
|
-
# the plugin/app that owns it
|
|
315
|
-
def flow_sig(id)
|
|
316
|
-
s = Digest::MD5.new
|
|
317
|
-
# These guarantee uniqueness within a plugin/app
|
|
318
|
-
s << id.to_s
|
|
319
|
-
s << filename
|
|
320
|
-
# This will add the required plugin uniqueness in the case of a top-level app
|
|
321
|
-
# that has multiple plugins that can generate test program snippets
|
|
322
|
-
if file = OrigenTesters::Flow.callstack.first
|
|
323
|
-
s << get_app(file).name.to_s
|
|
324
|
-
end
|
|
325
|
-
s.to_s[0..6].upcase
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
def get_app(file)
|
|
329
|
-
path = Pathname.new(file).dirname
|
|
330
|
-
until File.exist?(File.join(path, 'config/application.rb')) || path.root?
|
|
331
|
-
path = path.parent
|
|
332
|
-
end
|
|
333
|
-
if path.root?
|
|
334
|
-
fail 'Something went wrong resoving the app root in OrigenTesters'
|
|
335
|
-
end
|
|
336
|
-
Origen.find_app_by_root(path)
|
|
337
|
-
end
|
|
338
|
-
|
|
339
|
-
def add_meta!(options)
|
|
340
|
-
flow_file = OrigenTesters::Flow.callstack.last
|
|
341
|
-
called_from = caller.find { |l| l =~ /^#{flow_file}:.*/ }
|
|
342
|
-
if called_from
|
|
343
|
-
called_from = called_from.split(':')
|
|
344
|
-
options[:source_file] = called_from[0]
|
|
345
|
-
options[:source_line_number] = called_from[1].to_i
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
|
|
349
|
-
def add_meta_and_description!(options)
|
|
350
|
-
add_meta!(options)
|
|
351
|
-
# Can be useful if an app generates additional tests on the fly for a single test in the flow,
|
|
352
|
-
# e.g. a POR, in that case they will not want the description to be attached to the POR, but to
|
|
353
|
-
# the test that follows it
|
|
354
|
-
unless options[:inhibit_description_consumption]
|
|
355
|
-
comments = OrigenTesters::Flow.comment_stack.last
|
|
356
|
-
if options[:source_line_number]
|
|
357
|
-
while comments.first && comments.first.first < options[:source_line_number]
|
|
358
|
-
options[:description] ||= []
|
|
359
|
-
c = comments.shift
|
|
360
|
-
if c[0] + c[1].size == options[:source_line_number]
|
|
361
|
-
options[:description] += c[1]
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
end
|
|
365
|
-
end
|
|
366
|
-
end
|
|
367
|
-
|
|
368
|
-
def clean_options(options)
|
|
369
|
-
ATP::AST::Builder::CONDITION_KEYS.each do |key|
|
|
370
|
-
if v = options.delete(key)
|
|
371
|
-
options[:conditions] ||= {}
|
|
372
|
-
if options[:conditions][key]
|
|
373
|
-
fail "Multiple values assigned to flow condition #{key}"
|
|
374
|
-
else
|
|
375
|
-
options[:conditions][key] = v
|
|
376
|
-
end
|
|
377
|
-
end
|
|
378
|
-
end
|
|
379
|
-
options
|
|
380
|
-
end
|
|
381
|
-
end
|
|
382
|
-
end
|
|
1
|
+
require 'digest/md5'
|
|
2
|
+
module OrigenTesters
|
|
3
|
+
# Provides a common API to add tests to a flow that is supported by all testers.
|
|
4
|
+
#
|
|
5
|
+
# This builds up a flow model using the Abstract Test Program (ATP) gem, which
|
|
6
|
+
# now deals with implementing the flow control API.
|
|
7
|
+
#
|
|
8
|
+
# Individual tester drivers in this plugin are then responsible at the end to
|
|
9
|
+
# render the abstract flow to their specific format and conventions.
|
|
10
|
+
module Flow
|
|
11
|
+
include OrigenTesters::Generator
|
|
12
|
+
|
|
13
|
+
PROGRAM_MODELS_DIR = "#{Origen.root}/tmp/program_models"
|
|
14
|
+
|
|
15
|
+
def self.callstack
|
|
16
|
+
@callstack ||= []
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.comment_stack
|
|
20
|
+
@comment_stack ||= []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.flow_comments
|
|
24
|
+
@flow_comments
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.flow_comments=(val)
|
|
28
|
+
@flow_comments = val
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.unique_ids
|
|
32
|
+
@unique_ids
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.unique_ids=(val)
|
|
36
|
+
@unique_ids = val
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def lines
|
|
40
|
+
@lines
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Returns the abstract test program model, this is shared by all
|
|
44
|
+
# flow created together in a generation run
|
|
45
|
+
def program
|
|
46
|
+
@@program ||= ATP::Program.new
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def save_program
|
|
50
|
+
FileUtils.mkdir_p(PROGRAM_MODELS_DIR) unless File.exist?(PROGRAM_MODELS_DIR)
|
|
51
|
+
program.save("#{PROGRAM_MODELS_DIR}/#{Origen.target.name}")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def model
|
|
55
|
+
if Origen.interface.resources_mode?
|
|
56
|
+
@throwaway ||= ATP::Flow.new(self)
|
|
57
|
+
else
|
|
58
|
+
@model ||= begin
|
|
59
|
+
f = program.flow(id, description: OrigenTesters::Flow.flow_comments)
|
|
60
|
+
@sig = flow_sig(id)
|
|
61
|
+
f.id = @sig if OrigenTesters::Flow.unique_ids
|
|
62
|
+
f
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def enable(var, options = {})
|
|
68
|
+
add_meta!(options)
|
|
69
|
+
model.enable(var, clean_options(options))
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def disable(var, options = {})
|
|
73
|
+
add_meta!(options)
|
|
74
|
+
model.disable(var, clean_options(options))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def bin(number, options = {})
|
|
78
|
+
options[:bin_description] ||= options.delete(:description)
|
|
79
|
+
if number.is_a?(Hash)
|
|
80
|
+
fail 'The bin number must be passed as the first argument'
|
|
81
|
+
end
|
|
82
|
+
add_meta!(options)
|
|
83
|
+
options[:type] ||= :fail
|
|
84
|
+
model.bin(number, clean_options(options))
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def pass(number, options = {})
|
|
88
|
+
if number.is_a?(Hash)
|
|
89
|
+
fail 'The bin number must be passed as the first argument'
|
|
90
|
+
end
|
|
91
|
+
options[:type] = :pass
|
|
92
|
+
bin(number, clean_options(options))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def test(instance, options = {})
|
|
96
|
+
add_meta_and_description!(options)
|
|
97
|
+
model.test(instance, clean_options(options))
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def render(file, options = {})
|
|
101
|
+
add_meta!(options)
|
|
102
|
+
begin
|
|
103
|
+
text = super
|
|
104
|
+
rescue
|
|
105
|
+
text = file
|
|
106
|
+
end
|
|
107
|
+
model.render(text, clean_options(options))
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def cz(instance, cz_setup, options = {})
|
|
111
|
+
add_meta_and_description!(options)
|
|
112
|
+
model.cz(instance, cz_setup, clean_options(options))
|
|
113
|
+
end
|
|
114
|
+
alias_method :characterize, :cz
|
|
115
|
+
|
|
116
|
+
def log(message, options = {})
|
|
117
|
+
add_meta!(options)
|
|
118
|
+
model.log(message, clean_options(options))
|
|
119
|
+
end
|
|
120
|
+
alias_method :logprint, :log
|
|
121
|
+
|
|
122
|
+
def group(name, options = {})
|
|
123
|
+
add_meta!(options)
|
|
124
|
+
model.group(name, clean_options(options)) do
|
|
125
|
+
yield
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def nop(options = {})
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# @api private
|
|
133
|
+
# This fires between target loads (unless overridden by the ATE specific flow class)
|
|
134
|
+
def at_run_start
|
|
135
|
+
@@program = nil
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# @api private
|
|
139
|
+
# This fires between flows (unless overridden by the ATE specific flow class)
|
|
140
|
+
def at_flow_start
|
|
141
|
+
@labels = {}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def if_job(*jobs)
|
|
145
|
+
options = jobs.last.is_a?(Hash) ? jobs.pop : {}
|
|
146
|
+
options[:if_job] = jobs.flatten
|
|
147
|
+
add_meta!(options)
|
|
148
|
+
model.with_conditions(options) do
|
|
149
|
+
yield
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
alias_method :if_jobs, :if_job
|
|
153
|
+
|
|
154
|
+
def unless_job(*jobs)
|
|
155
|
+
options = jobs.last.is_a?(Hash) ? jobs.pop : {}
|
|
156
|
+
options[:unless_job] = jobs.flatten
|
|
157
|
+
add_meta!(options)
|
|
158
|
+
model.with_conditions(options) do
|
|
159
|
+
yield
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
alias_method :unless_jobs, :unless_job
|
|
163
|
+
|
|
164
|
+
def if_enable(word, options = {})
|
|
165
|
+
if options[:or]
|
|
166
|
+
yield
|
|
167
|
+
else
|
|
168
|
+
options = { enable: word }
|
|
169
|
+
add_meta!(options)
|
|
170
|
+
model.with_conditions(options) do
|
|
171
|
+
yield
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
alias_method :if_enabled, :if_enable
|
|
176
|
+
|
|
177
|
+
def unless_enable(word, options = {})
|
|
178
|
+
if options[:or]
|
|
179
|
+
yield
|
|
180
|
+
else
|
|
181
|
+
options = { unless_enable: word }
|
|
182
|
+
add_meta!(options)
|
|
183
|
+
model.with_conditions(options) do
|
|
184
|
+
yield
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
alias_method :unless_enabled, :unless_enable
|
|
189
|
+
|
|
190
|
+
def if_passed(test_id, options = {})
|
|
191
|
+
if test_id.is_a?(Array)
|
|
192
|
+
fail 'if_passed only accepts one ID, use if_any_passed or if_all_passed for multiple IDs'
|
|
193
|
+
end
|
|
194
|
+
options = { if_passed: test_id }
|
|
195
|
+
add_meta!(options)
|
|
196
|
+
model.with_conditions(options) do
|
|
197
|
+
yield
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
alias_method :unless_failed, :if_passed
|
|
201
|
+
|
|
202
|
+
def if_failed(test_id, options = {})
|
|
203
|
+
if test_id.is_a?(Array)
|
|
204
|
+
fail 'if_failed only accepts one ID, use if_any_failed or if_all_failed for multiple IDs'
|
|
205
|
+
end
|
|
206
|
+
options = { if_failed: test_id }
|
|
207
|
+
add_meta!(options)
|
|
208
|
+
model.with_conditions(options) do
|
|
209
|
+
yield
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
alias_method :unless_passed, :if_failed
|
|
213
|
+
|
|
214
|
+
def if_ran(test_id, options = {})
|
|
215
|
+
options = { if_ran: test_id }
|
|
216
|
+
add_meta!(options)
|
|
217
|
+
model.with_conditions(options) do
|
|
218
|
+
yield
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def unless_ran(test_id, options = {})
|
|
223
|
+
options = { unless_ran: test_id }
|
|
224
|
+
add_meta!(options)
|
|
225
|
+
model.with_conditions(options) do
|
|
226
|
+
yield
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
def if_any_failed(*ids)
|
|
231
|
+
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
232
|
+
options[:if_any_failed] = ids.flatten
|
|
233
|
+
add_meta!(options)
|
|
234
|
+
model.with_conditions(options) do
|
|
235
|
+
yield
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def if_all_failed(*ids)
|
|
240
|
+
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
241
|
+
options[:if_all_failed] = ids.flatten
|
|
242
|
+
add_meta!(options)
|
|
243
|
+
model.with_conditions(options) do
|
|
244
|
+
yield
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def if_any_passed(*ids)
|
|
249
|
+
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
250
|
+
options[:if_any_passed] = ids.flatten
|
|
251
|
+
add_meta!(options)
|
|
252
|
+
model.with_conditions(options) do
|
|
253
|
+
yield
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def if_all_passed(*ids)
|
|
258
|
+
options = ids.last.is_a?(Hash) ? ids.pop : {}
|
|
259
|
+
options[:if_all_passed] = ids.flatten
|
|
260
|
+
add_meta!(options)
|
|
261
|
+
model.with_conditions(options) do
|
|
262
|
+
yield
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def if_flag(flag, options = {})
|
|
267
|
+
options = { if_flag: flag }
|
|
268
|
+
add_meta!(options)
|
|
269
|
+
model.with_conditions(options) do
|
|
270
|
+
yield
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def unless_flag(flag, options = {})
|
|
275
|
+
options = { unless_flag: flag }
|
|
276
|
+
add_meta!(options)
|
|
277
|
+
model.with_conditions(options) do
|
|
278
|
+
yield
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# @api private
|
|
283
|
+
def is_the_flow?
|
|
284
|
+
true
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Returns true if the test context generated from the supplied options + existing condition
|
|
288
|
+
# wrappers is different from that which was applied to the previous test.
|
|
289
|
+
def context_changed?(options)
|
|
290
|
+
options = clean_options(options)
|
|
291
|
+
model.context_changed?(options)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def generate_unique_label(name = nil)
|
|
295
|
+
name = 'label' if !name || name == ''
|
|
296
|
+
name.gsub!(' ', '_')
|
|
297
|
+
name.upcase!
|
|
298
|
+
@labels ||= {}
|
|
299
|
+
@labels[name] ||= 0
|
|
300
|
+
@labels[name] += 1
|
|
301
|
+
"#{name}_#{@labels[name]}_#{sig}"
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Returns a unique signature that has been generated for the current flow, this can be appended
|
|
305
|
+
# to named references to avoid naming collisions with any other flow
|
|
306
|
+
def sig
|
|
307
|
+
@sig
|
|
308
|
+
end
|
|
309
|
+
alias_method :signature, :sig
|
|
310
|
+
|
|
311
|
+
private
|
|
312
|
+
|
|
313
|
+
# Make a unique signature for the flow based on the flow name and the name of
|
|
314
|
+
# the plugin/app that owns it
|
|
315
|
+
def flow_sig(id)
|
|
316
|
+
s = Digest::MD5.new
|
|
317
|
+
# These guarantee uniqueness within a plugin/app
|
|
318
|
+
s << id.to_s
|
|
319
|
+
s << filename
|
|
320
|
+
# This will add the required plugin uniqueness in the case of a top-level app
|
|
321
|
+
# that has multiple plugins that can generate test program snippets
|
|
322
|
+
if file = OrigenTesters::Flow.callstack.first
|
|
323
|
+
s << get_app(file).name.to_s
|
|
324
|
+
end
|
|
325
|
+
s.to_s[0..6].upcase
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def get_app(file)
|
|
329
|
+
path = Pathname.new(file).dirname
|
|
330
|
+
until File.exist?(File.join(path, 'config/application.rb')) || path.root?
|
|
331
|
+
path = path.parent
|
|
332
|
+
end
|
|
333
|
+
if path.root?
|
|
334
|
+
fail 'Something went wrong resoving the app root in OrigenTesters'
|
|
335
|
+
end
|
|
336
|
+
Origen.find_app_by_root(path)
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def add_meta!(options)
|
|
340
|
+
flow_file = OrigenTesters::Flow.callstack.last
|
|
341
|
+
called_from = caller.find { |l| l =~ /^#{flow_file}:.*/ }
|
|
342
|
+
if called_from
|
|
343
|
+
called_from = called_from.split(':')
|
|
344
|
+
options[:source_file] = called_from[0]
|
|
345
|
+
options[:source_line_number] = called_from[1].to_i
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
def add_meta_and_description!(options)
|
|
350
|
+
add_meta!(options)
|
|
351
|
+
# Can be useful if an app generates additional tests on the fly for a single test in the flow,
|
|
352
|
+
# e.g. a POR, in that case they will not want the description to be attached to the POR, but to
|
|
353
|
+
# the test that follows it
|
|
354
|
+
unless options[:inhibit_description_consumption]
|
|
355
|
+
comments = OrigenTesters::Flow.comment_stack.last
|
|
356
|
+
if options[:source_line_number]
|
|
357
|
+
while comments.first && comments.first.first < options[:source_line_number]
|
|
358
|
+
options[:description] ||= []
|
|
359
|
+
c = comments.shift
|
|
360
|
+
if c[0] + c[1].size == options[:source_line_number]
|
|
361
|
+
options[:description] += c[1]
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def clean_options(options)
|
|
369
|
+
ATP::AST::Builder::CONDITION_KEYS.each do |key|
|
|
370
|
+
if v = options.delete(key)
|
|
371
|
+
options[:conditions] ||= {}
|
|
372
|
+
if options[:conditions][key]
|
|
373
|
+
fail "Multiple values assigned to flow condition #{key}"
|
|
374
|
+
else
|
|
375
|
+
options[:conditions][key] = v
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
options
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
end
|