/usr/bin/cqa-compare-results is in collab-qa-tools 0.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 67 68 69 70 71 72 73 74 | #!/usr/bin/ruby
# Script to compare two result files (res.* files)
lists = []
pkgs = {}
ARGV.each do |f|
lists << f
pkgs[f] = {}
IO::read(f).each_line do |l|
s = l.split(' ', 5)
if s[4].nil? or s[4] == ''
err = '-'
else
err = s[4].chomp
end
pkgs[f][s[0]] = [ s[1], s[2], s[3].to_i, err ]
end
end
f1 = lists[0]
f2 = lists[1]
def difftime(a, b)
m = [a, b].min
m = 0.1 if m == 0
m = m.to_f
ratio = (a - b).abs
if m < 30
p = 0.4
elsif m < 100
p = 0.3
elsif m < 300
p = 0.2
else
p = 0.1
end
if (ratio/m) >= p
return true
else
return false
end
end
(pkgs[f1].keys + pkgs[f2].keys).sort.uniq.each do |pkg|
pkgs[f1][pkg] = ['-', '-', 0, '-'] if pkgs[f1][pkg].nil?
pkgs[f2][pkg] = ['-', '-', 0, '-'] if pkgs[f2][pkg].nil?
s = "#{pkg} #{pkgs[f1][pkg][0]} #{pkgs[f2][pkg][0]} "
if pkgs[f1][pkg][0] == pkgs[f2][pkg][0]
s += "SAMEVER "
else
s += "DIFFVER "
end
s += "#{pkgs[f1][pkg][1]} #{pkgs[f2][pkg][1]} "
if pkgs[f1][pkg][1] == pkgs[f2][pkg][1]
s += "SAMERES "
else
s += "DIFFRES "
end
s += "#{pkgs[f1][pkg][2]} #{pkgs[f2][pkg][2]} "
if not difftime(pkgs[f1][pkg][2],pkgs[f2][pkg][2])
s += "SAMETIME "
else
t1 = pkgs[f1][pkg][2]
t2 = pkgs[f2][pkg][2]
s += "DIFFTIME(#{(t1.to_f/t2.to_f)})"
end
s += "#{pkgs[f1][pkg][3]} #{pkgs[f2][pkg][3]} "
if pkgs[f1][pkg][3] == pkgs[f2][pkg][3]
s += "SAMEEXP "
else
s += "DIFFEXP "
end
puts s
end
|