lib/atp/validators/jobs.rb in atp-0.8.0 vs lib/atp/validators/jobs.rb in atp-1.0.0
- old
+ new
@@ -7,37 +7,38 @@
end
def on_completion
failed = false
unless @conflicting.empty?
- Origen.log.error 'if_job and unless_job conditions cannot both be applied to the same tests'
- Origen.log.error "The following conflicts were found in flow #{flow.name}:"
+ 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:'
- Origen.log.error " #{a_condition} #{a.source}"
- Origen.log.error " #{b_condition} #{b.source}"
- Origen.log.error ''
+ error " #{a_condition} #{a.source}"
+ error " #{b_condition} #{b.source}"
+ error ''
end
failed = true
end
unless @negative.empty?
- Origen.log.error 'Job names should not be negated, use unless_job if you want to specify !JOB'
- Origen.log.error "The following negative job names were found in flow #{flow.name}:"
+ 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|
- Origen.log.error " #{node.to_a[0]} #{node.source}"
+ error " #{node.to_a[0]} #{node.source}"
end
failed = true
end
failed
end
- def on_job(node)
- jobs, state, *nodes = *node
+ 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
@@ -46,8 +47,9 @@
@stack << [node, state]
process_all(node)
@stack.pop
end
end
+ alias_method :on_unless_job, :on_if_job
end
end
end