forked from mika/jenkins-debian-glue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adtsummary_tap
executable file
·43 lines (37 loc) · 1.12 KB
/
adtsummary_tap
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
#!/usr/bin/env ruby
if ARGV[0].nil?
$stderr.puts "Usage: #{File.basename $0} <autopkgtest_summary_file>"
exit 1
end
file = ARGV[0]
counter = 1
found_error = 0
begin
output = File.open("#{file}", "r").read
rescue
$stderr.puts "Error: can't read file #{file}"
exit 1
end
num_lines = output.lines.count
if num_lines == 0
puts "1..0 # Skipped: no autopkgtest output found"
exit 0
end
puts "1..#{num_lines}"
output.gsub(/:\n/, ':').each_line do |critic|
if critic =~ /.*PASS.*/
cmd = /(.*)? (PASS)$/.match(critic)[1]
puts "ok #{counter} #{cmd} passed"
counter += 1
elsif critic =~ /.*FAIL.*status.*/ # versions >= 2.2.3+nmu1 of autopkgtest
test = /(.*)? (FAIL non-zero exit status )(.*)?/.match(critic)[1]
status = /(.*)? (FAIL non-zero exit status )(.*)?/.match(critic)[3]
puts "not ok #{counter} #{test} - exit status #{status}"
counter += 1
elsif critic =~ /.*FAIL status.*/ # older versions of autopkgtest
test = /(.*)? (FAIL status:)(.*)?/.match(critic)[1]
cmd = /(.*)? (FAIL status:)(.*)?/.match(critic)[3]
puts "not ok #{counter} #{test} #{cmd}"
counter += 1
end
end