File: merge-results.rb

package info (click to toggle)
collab-qa-tools 0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,668 kB
  • ctags: 247
  • sloc: ruby: 3,432; makefile: 2
file content (66 lines) | stat: -rwxr-xr-x 1,659 bytes parent folder | download
1
2
3
4
5
6
7
8
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/ruby -w

class Result
  attr_accessor :version, :result, :time, :guess, :explanation
  def to_s
    "#{@version} #{@result} #{@time} #{@guess} #{@explanation}"
  end
end

previous = {}
IO::read(ARGV[0]).each_line do |l|
  l.chomp!
  r = Result::new
  p, r.version, r.result, r.time, r.guess, r.explanation = l.split(' ', 6)
  if r.explanation.nil?
    r.explanation = ""
  end
  # cleanup old explanations
  r.explanation.gsub!(/ NEWFAIL$/ ,'')
  previous[p] = r 
end

IO::read(ARGV[1]).each_line do |l|
  l.chomp!
  r = Result::new
  pkg, r.version, r.result, r.time, r.guess, r.explanation = l.split(' ', 6)
  r.explanation = "TODO" if r.explanation.nil?
  if previous[pkg].nil?
    r.explanation += " NEWFAIL"
  else
    prev = previous[pkg]
    if prev.explanation != "TODO"
      r.explanation = prev.explanation
      r.explanation.gsub!(/RECHECK[^\s]*/,'')
      r.explanation.gsub!(/NEWFAIL/, '')
      r.explanation.gsub!(/\s+/, ' ')
      r.explanation += " RECHECK"
      r.explanation += " RECHECK_VERSION" if r.version != prev.version
      r.explanation += " RECHECK_GUESS" if r.guess != prev.guess
      nt = r.time.to_f
      ot = prev.time.to_f
      m = [ nt, ot ].min.to_f
      ratio = (nt - ot).abs.to_f
      if m < 30
        p = 1.0
      elsif m < 100
        p = 0.6
      elsif m < 300
        p = 0.4
      else
        p = 0.2
      end
      if (ratio/m) >= p
        r.explanation += " RECHECK_TIME(#{nt.to_i}/#{ot.to_i})"
      end
    end
    previous.delete(pkg)
  end
  puts "#{pkg} #{r}"
end
File::open('no-longer-fails', 'w') do |f|
  previous.each_pair do |pkg, val|
    f.puts pkg + ' ' + val.to_s
  end
end