10 TEST_AFTER_REVISION
= 'c7a7d86bdbc8c4a7351cb7142c90e74a6ef08515'
12 OPTIONS
= OpenStruct
.new
14 options
= OptionParser
.new
do |opts
|
15 opts
.on('-h', '--help', 'Output this help information') do |h
|
19 opts
.on('-r', '--results PATH', 'Path to results') do |r
|
26 if OPTIONS
.help
or not OPTIONS
.results
then
27 puts options
.summarize
32 attr_reader
:commit, :working_path, :results_path, :final_path
34 def initialize(commit
)
36 @working_path = Tempfile
.new('rbx-working-').path
37 @results_path = Tempfile
.new('rbx-results-').path
38 @final_path = OPTIONS
.results
+ '/' + @commit + '/'
42 matches
= `git log --pretty=fuller #{commit}`.split(/\n/)[4].match(/: +(.+ \d\d\d\d) ([+-]\d\d)(\d\d)/)
43 date
= ParseDate
.parsedate(matches
[1])
44 puts matches
[2].to_i
* 3600 + matches
[3].to_i
45 Time
.gm(*date
) + matches
[2].to_i
* 3600 + matches
[3].to_i
50 "#{d.year}-#{'%02d' % d.month}-#{'%02d' % d.day}-" +
51 "#{'%02d' % d.hour}-#{'%02d' % d.min}-#{'%02d' % d.sec}"
55 File
.directory
?(final_path
)
59 execute
"rm -rf #{working_path}",false
60 execute
"rm -rf #{results_path}",false
65 execute
"git clone git://git.rubini.us/code #{working_path}"
67 Dir
.chdir working_path
70 Dir
.mkdir results_path
71 execute
"bin/bm -c -d -f -p #{results_path} -w >/dev/null 2>&1"
73 execute
"mv #{results_path} #{final_path}"
75 warn
"Failed during benchmark"
82 def execute(command
,raise_error
= true)
84 unless system command
then
93 def benchmarkable_commits
96 `git log`.grep(/^commit/).each
do |line
|
97 break if line
=~
/#{TEST_AFTER_REVISION}$/
98 commit
= Commit
.new(line
.match(/\w+$/)[0])
99 break if commit
.complete
?
107 benchmarkable_commits
.each
{ |commit
| commit
.benchmark
}