origen_testers 0.21.0 → 0.30.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/config/version.rb +1 -2
  3. data/lib/origen_testers.rb +2 -1
  4. data/lib/origen_testers/atp.rb +95 -0
  5. data/lib/origen_testers/atp/ast/extractor.rb +26 -0
  6. data/lib/origen_testers/atp/ast/node.rb +147 -0
  7. data/lib/origen_testers/atp/flow.rb +920 -0
  8. data/lib/origen_testers/atp/flow_api.rb +56 -0
  9. data/lib/origen_testers/atp/formatter.rb +25 -0
  10. data/lib/origen_testers/atp/formatters/basic.rb +32 -0
  11. data/lib/origen_testers/atp/formatters/datalog.rb +65 -0
  12. data/lib/origen_testers/atp/parser.rb +26 -0
  13. data/lib/origen_testers/atp/processor.rb +73 -0
  14. data/lib/origen_testers/atp/processors/add_ids.rb +45 -0
  15. data/lib/origen_testers/atp/processors/add_set_result.rb +22 -0
  16. data/lib/origen_testers/atp/processors/adjacent_if_combiner.rb +100 -0
  17. data/lib/origen_testers/atp/processors/append_to.rb +27 -0
  18. data/lib/origen_testers/atp/processors/apply_post_group_actions.rb +50 -0
  19. data/lib/origen_testers/atp/processors/condition.rb +179 -0
  20. data/lib/origen_testers/atp/processors/continue_implementer.rb +35 -0
  21. data/lib/origen_testers/atp/processors/else_remover.rb +31 -0
  22. data/lib/origen_testers/atp/processors/empty_branch_remover.rb +17 -0
  23. data/lib/origen_testers/atp/processors/extract_set_flags.rb +18 -0
  24. data/lib/origen_testers/atp/processors/flag_optimizer.rb +234 -0
  25. data/lib/origen_testers/atp/processors/flattener.rb +58 -0
  26. data/lib/origen_testers/atp/processors/flow_id.rb +46 -0
  27. data/lib/origen_testers/atp/processors/marshal.rb +33 -0
  28. data/lib/origen_testers/atp/processors/on_pass_fail_remover.rb +39 -0
  29. data/lib/origen_testers/atp/processors/one_flag_per_test.rb +79 -0
  30. data/lib/origen_testers/atp/processors/pre_cleaner.rb +65 -0
  31. data/lib/origen_testers/atp/processors/redundant_condition_remover.rb +28 -0
  32. data/lib/origen_testers/atp/processors/relationship.rb +199 -0
  33. data/lib/origen_testers/atp/processors/sub_flow_remover.rb +10 -0
  34. data/lib/origen_testers/atp/program.rb +48 -0
  35. data/lib/origen_testers/atp/runner.rb +234 -0
  36. data/lib/origen_testers/atp/validator.rb +53 -0
  37. data/lib/origen_testers/atp/validators/condition.rb +4 -0
  38. data/lib/origen_testers/atp/validators/duplicate_ids.rb +32 -0
  39. data/lib/origen_testers/atp/validators/flags.rb +59 -0
  40. data/lib/origen_testers/atp/validators/jobs.rb +55 -0
  41. data/lib/origen_testers/atp/validators/missing_ids.rb +63 -0
  42. data/lib/origen_testers/atp_deprecation.rb +2 -0
  43. metadata +62 -15
@@ -0,0 +1,55 @@
1
+ module OrigenTesters::ATP
2
+ module Validators
3
+ class Jobs < Validator
4
+ def setup
5
+ @conflicting = []
6
+ @negative = []
7
+ end
8
+
9
+ def on_completion
10
+ failed = false
11
+ unless @conflicting.empty?
12
+ error 'if_job and unless_job conditions cannot both be applied to the same tests'
13
+ error "The following conflicts were found in flow #{flow.name}:"
14
+ @conflicting.each do |a, b|
15
+ a_condition = a.to_a[1] ? 'if_job: ' : 'unless_job:'
16
+ b_condition = b.to_a[1] ? 'if_job: ' : 'unless_job:'
17
+ error " #{a_condition} #{a.source}"
18
+ error " #{b_condition} #{b.source}"
19
+ error ''
20
+ end
21
+ failed = true
22
+ end
23
+
24
+ unless @negative.empty?
25
+ error 'Job names should not be negated, use unless_job if you want to specify !JOB'
26
+ error "The following negative job names were found in flow #{flow.name}:"
27
+ @negative.each do |node|
28
+ error " #{node.to_a[0]} #{node.source}"
29
+ end
30
+ failed = true
31
+ end
32
+
33
+ failed
34
+ end
35
+
36
+ def on_if_job(node)
37
+ jobs, *nodes = *node
38
+ jobs = [jobs].flatten
39
+ state = node.type == :if_job
40
+ if jobs.any? { |j| j.to_s =~ /^(!|~)/ }
41
+ @negative << node
42
+ end
43
+ @stack ||= []
44
+ if !@stack.empty? && @stack.last[1] != state
45
+ @conflicting << [@stack.last[0], node]
46
+ else
47
+ @stack << [node, state]
48
+ process_all(node)
49
+ @stack.pop
50
+ end
51
+ end
52
+ alias_method :on_unless_job, :on_if_job
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,63 @@
1
+ module OrigenTesters::ATP
2
+ module Validators
3
+ class MissingIDs < Validator
4
+ def setup
5
+ @referenced_ids = {}
6
+ @present_ids ||= {}.with_indifferent_access
7
+ @referenced_early = {}.with_indifferent_access
8
+ end
9
+
10
+ def on_completion
11
+ failed = false
12
+ @referenced_ids.each do |id, nodes|
13
+ unless @present_ids[id]
14
+ error "Test ID #{id} is referenced in flow #{flow.name} in the following lines, but it is never defined:"
15
+ nodes.each do |node|
16
+ error " #{node.source}"
17
+ end
18
+ failed = true
19
+ @referenced_early.delete(id)
20
+ end
21
+ end
22
+ @referenced_early.each do |id, nodes|
23
+ error "Test ID #{id} is referenced in flow #{flow.name} in the following line(s):"
24
+ nodes.each do |node|
25
+ error " #{node.source}"
26
+ end
27
+ error 'but it was not defined until later:'
28
+ error " #{@present_ids[id].first.source}"
29
+ failed = true
30
+ end
31
+ failed
32
+ end
33
+
34
+ def on_id(node)
35
+ id = node.value
36
+ @present_ids[id] ||= []
37
+ @present_ids[id] << node
38
+ end
39
+
40
+ def on_if_failed(node)
41
+ ids = node.to_a[0]
42
+ [ids].flatten.each do |id|
43
+ unless id =~ /^extern/
44
+ @referenced_ids[id] ||= []
45
+ @referenced_ids[id] << node
46
+ unless @present_ids[id]
47
+ @referenced_early[id] ||= []
48
+ @referenced_early[id] << node
49
+ end
50
+ end
51
+ end
52
+ process_all(node)
53
+ end
54
+ alias_method :on_if_any_failed, :on_if_failed
55
+ alias_method :on_if_all_failed, :on_if_failed
56
+ alias_method :on_if_passed, :on_if_failed
57
+ alias_method :on_if_any_passed, :on_if_failed
58
+ alias_method :on_if_all_passed, :on_if_failed
59
+ alias_method :on_if_ran, :on_if_failed
60
+ alias_method :on_unless_ran, :on_if_failed
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,2 @@
1
+ Origen.deprecate 'ATP has been referenced directly, this is now part of OrigenTesters, please update to be OrigenTesters::ATP'
2
+ ATP = OrigenTesters::ATP
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_testers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -39,39 +39,47 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: atp
42
+ name: origen_stil
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.1'
48
45
  - - ">="
49
46
  - !ruby/object:Gem::Version
50
- version: 1.1.3
47
+ version: 0.2.1
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: ast
57
+ requirement: !ruby/object:Gem::Requirement
54
58
  requirements:
55
59
  - - "~>"
56
60
  - !ruby/object:Gem::Version
57
- version: '1.1'
58
- - - ">="
61
+ version: '2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
59
67
  - !ruby/object:Gem::Version
60
- version: 1.1.3
68
+ version: '2'
61
69
  - !ruby/object:Gem::Dependency
62
- name: origen_stil
70
+ name: sexpistol
63
71
  requirement: !ruby/object:Gem::Requirement
64
72
  requirements:
65
- - - ">="
73
+ - - "~>"
66
74
  - !ruby/object:Gem::Version
67
- version: 0.2.1
75
+ version: '0.0'
68
76
  type: :runtime
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
71
79
  requirements:
72
- - - ">="
80
+ - - "~>"
73
81
  - !ruby/object:Gem::Version
74
- version: 0.2.1
82
+ version: '0.0'
75
83
  description:
76
84
  email:
77
85
  - stephen.f.mcginty@gmail.com
@@ -91,6 +99,45 @@ files:
91
99
  - lib/commands/run.rb
92
100
  - lib/origen_testers.rb
93
101
  - lib/origen_testers/api.rb
102
+ - lib/origen_testers/atp.rb
103
+ - lib/origen_testers/atp/ast/extractor.rb
104
+ - lib/origen_testers/atp/ast/node.rb
105
+ - lib/origen_testers/atp/flow.rb
106
+ - lib/origen_testers/atp/flow_api.rb
107
+ - lib/origen_testers/atp/formatter.rb
108
+ - lib/origen_testers/atp/formatters/basic.rb
109
+ - lib/origen_testers/atp/formatters/datalog.rb
110
+ - lib/origen_testers/atp/parser.rb
111
+ - lib/origen_testers/atp/processor.rb
112
+ - lib/origen_testers/atp/processors/add_ids.rb
113
+ - lib/origen_testers/atp/processors/add_set_result.rb
114
+ - lib/origen_testers/atp/processors/adjacent_if_combiner.rb
115
+ - lib/origen_testers/atp/processors/append_to.rb
116
+ - lib/origen_testers/atp/processors/apply_post_group_actions.rb
117
+ - lib/origen_testers/atp/processors/condition.rb
118
+ - lib/origen_testers/atp/processors/continue_implementer.rb
119
+ - lib/origen_testers/atp/processors/else_remover.rb
120
+ - lib/origen_testers/atp/processors/empty_branch_remover.rb
121
+ - lib/origen_testers/atp/processors/extract_set_flags.rb
122
+ - lib/origen_testers/atp/processors/flag_optimizer.rb
123
+ - lib/origen_testers/atp/processors/flattener.rb
124
+ - lib/origen_testers/atp/processors/flow_id.rb
125
+ - lib/origen_testers/atp/processors/marshal.rb
126
+ - lib/origen_testers/atp/processors/on_pass_fail_remover.rb
127
+ - lib/origen_testers/atp/processors/one_flag_per_test.rb
128
+ - lib/origen_testers/atp/processors/pre_cleaner.rb
129
+ - lib/origen_testers/atp/processors/redundant_condition_remover.rb
130
+ - lib/origen_testers/atp/processors/relationship.rb
131
+ - lib/origen_testers/atp/processors/sub_flow_remover.rb
132
+ - lib/origen_testers/atp/program.rb
133
+ - lib/origen_testers/atp/runner.rb
134
+ - lib/origen_testers/atp/validator.rb
135
+ - lib/origen_testers/atp/validators/condition.rb
136
+ - lib/origen_testers/atp/validators/duplicate_ids.rb
137
+ - lib/origen_testers/atp/validators/flags.rb
138
+ - lib/origen_testers/atp/validators/jobs.rb
139
+ - lib/origen_testers/atp/validators/missing_ids.rb
140
+ - lib/origen_testers/atp_deprecation.rb
94
141
  - lib/origen_testers/basic_test_setups.rb
95
142
  - lib/origen_testers/callback_handlers.rb
96
143
  - lib/origen_testers/command_based_tester.rb