Class: OrigenTesters::ATP::Validators::Jobs

Inherits:
OrigenTesters::ATP::Validator show all
Defined in:
lib/origen_testers/atp/validators/jobs.rb

Instance Attribute Summary

Attributes inherited from OrigenTesters::ATP::Validator

#flow

Instance Method Summary collapse

Methods inherited from OrigenTesters::ATP::Validator

#error, #initialize, #process, #test_process, testing, testing=

Methods inherited from Processor

#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags

Constructor Details

This class inherits a constructor from OrigenTesters::ATP::Validator

Instance Method Details

#on_completionObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/origen_testers/atp/validators/jobs.rb', line 9

def on_completion
  failed = false
  unless @conflicting.empty?
    error 'if_job and unless_job conditions cannot both be applied to the same tests'
    error "The following conflicts were found in flow #{flow.name}:"
    @conflicting.each do |a, b|
      a_condition = a.to_a[1] ? 'if_job:    ' : 'unless_job:'
      b_condition = b.to_a[1] ? 'if_job:    ' : 'unless_job:'
      error "  #{a_condition} #{a.source}"
      error "  #{b_condition} #{b.source}"
      error ''
    end
    failed = true
  end

  unless @negative.empty?
    error 'Job names should not be negated, use unless_job if you want to specify !JOB'
    error "The following negative job names were found in flow #{flow.name}:"
    @negative.each do |node|
      error "  #{node.to_a[0]} #{node.source}"
    end
    failed = true
  end

  failed
end

#on_if_job(node) ⇒ Object Also known as: on_unless_job



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/origen_testers/atp/validators/jobs.rb', line 36

def on_if_job(node)
  jobs, *nodes = *node
  jobs = [jobs].flatten
  state = node.type == :if_job
  if jobs.any? { |j| j.to_s =~ /^(!|~)/ }
    @negative << node
  end
  @stack ||= []
  if !@stack.empty? && @stack.last[1] != state
    @conflicting << [@stack.last[0], node]
  else
    @stack << [node, state]
    process_all(node)
    @stack.pop
  end
end

#setupObject



4
5
6
7
# File 'lib/origen_testers/atp/validators/jobs.rb', line 4

def setup
  @conflicting = []
  @negative = []
end