Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [8403f5] default Maximize Restore History

Refactor report infrastructure and include a separate page that list performance statistics for several other interesting benchmarks not included in main report.

Peter Donald Peter Donald 2007-07-10

1 2 > >> (Page 1 of 2)
added test/unit/report/regression_report_test.rb
changed app/controllers/results/base_controller.rb
changed app/controllers/results/test_run_controller.rb
changed app/models/report/base_test_run_by_revision.rb
changed app/models/report_mailer.rb
changed app/views/report_mailer/report.rhtml
changed app/views/results/test_run/show.haml
changed config/routes.rb
changed db/migrate/034_create_statistics_name_map.rb
changed public/stylesheets/application.css
changed test/functional/results/test_run_controller_test.rb
changed test/unit/report_mailer_test.rb
changed test/unit/routing_test.rb
copied app/controllers/reports/test_run_by_revision_report_controller.rb -> app/models/report/performance_report.rb
copied app/helpers/reports/test_run_by_revision_report_helper.rb -> app/helpers/results/test_run_helper.rb
copied app/models/report/test_run_by_revision.rb -> app/models/report/regression_report.rb
copied app/views/reports/test_run_by_revision_report/show.haml -> app/views/results/test_run/regression_report.haml
copied test/functional/reports/test_run_by_revision_report_controller_test.rb -> app/views/results/test_run/performance_report.haml
copied test/helpers/reports/test_run_by_revision_report_helper_test.rb -> test/helpers/results/test_run_helper_test.rb
test/unit/report/regression_report_test.rb Diff Switch to side-by-side view
Loading...
app/controllers/results/base_controller.rb Diff Switch to side-by-side view
Loading...
app/controllers/results/test_run_controller.rb Diff Switch to side-by-side view
Loading...
app/models/report/base_test_run_by_revision.rb Diff Switch to side-by-side view
Loading...
app/models/report_mailer.rb Diff Switch to side-by-side view
Loading...
app/views/report_mailer/report.rhtml Diff Switch to side-by-side view
Loading...
app/views/results/test_run/show.haml Diff Switch to side-by-side view
Loading...
config/routes.rb Diff Switch to side-by-side view
Loading...
db/migrate/034_create_statistics_name_map.rb Diff Switch to side-by-side view
Loading...
public/stylesheets/application.css Diff Switch to side-by-side view
Loading...
test/functional/results/test_run_controller_test.rb Diff Switch to side-by-side view
Loading...
test/unit/report_mailer_test.rb Diff Switch to side-by-side view
Loading...
test/unit/routing_test.rb Diff Switch to side-by-side view
Loading...
app/controllers/reports/test_run_by_revision_report_controller.rb to app/models/report/performance_report.rb
--- a/app/controllers/reports/test_run_by_revision_report_controller.rb
+++ b/app/models/report/performance_report.rb
@@ -10,17 +10,21 @@
 #  See the COPYRIGHT.txt file distributed with this work for information
 #  regarding copyright ownership.
 #
-class Reports::TestRunByRevisionReportController < ApplicationController
-  verify :method => :get, :redirect_to => :access_denied_url
-  caches_page :show
-  session :off
+class Report::PerformanceReport < Report::BaseTestRunByRevision
+  # Input parameters
+  attr_reader :test_run, :window_size
 
-  def show
-    host = Tdm::Host.find_by_name(params[:host_name])
-    raise CatTrack::SecurityError unless host
-    test_run = host.test_runs.find_by_id_and_variant(params[:test_run_id], params[:test_run_variant])
-    raise CatTrack::SecurityError unless test_run
-    test_run.host = host # Avoid loads when rendering
-    @report = Report::TestRunByRevision.new(test_run)
+  # Output parameters
+  attr_reader :test_runs, :statistics
+
+  def initialize(test_run, window_size = 10)
+    super
+  end
+
+  private
+
+  def perform
+    super
+    @statistics = gen_perf_stats(nil)
   end
 end
app/helpers/reports/test_run_by_revision_report_helper.rb to app/helpers/results/test_run_helper.rb
--- a/app/helpers/reports/test_run_by_revision_report_helper.rb
+++ b/app/helpers/results/test_run_helper.rb
@@ -10,7 +10,7 @@
 #  See the COPYRIGHT.txt file distributed with this work for information
 #  regarding copyright ownership.
 #
-module Reports::TestRunByRevisionReportHelper
+module Results::TestRunHelper
 
   def hide_tests_javascript(name)
     "Element.toggle('#{name}'); Element.toggleClassName('#{name}_toggle','open')"
@@ -78,6 +78,6 @@
       end
     end
     suffix = include_suffix ? " (#{ratio}%)" : ''
-    "<span style=\"#{style}\">#{str_value}#{suffix}</span>"
+    "<span style=\"#{style}\" title=\"#{h(str_value)}\">#{truncate(str_value,8)}#{suffix}</span>"
   end
 end
app/models/report/test_run_by_revision.rb to app/models/report/regression_report.rb
--- a/app/models/report/test_run_by_revision.rb
+++ b/app/models/report/regression_report.rb
@@ -10,12 +10,12 @@
 #  See the COPYRIGHT.txt file distributed with this work for information
 #  regarding copyright ownership.
 #
-class Report::TestRunByRevision < Report::BaseTestRunByRevision
+class Report::RegressionReport < Report::BaseTestRunByRevision
   # Input parameters
   attr_reader :test_run, :window_size
 
   # Output parameters
-  attr_reader :test_runs, :new_failures, :new_successes, :intermittent_failures, :consistent_failures, :missing_tests, :perf_stats, :bc_by_tr, :tc_by_tr
+  attr_reader :test_runs, :new_failures, :new_successes, :intermittent_failures, :consistent_failures, :missing_tests, :statistics, :bc_by_tr, :tc_by_tr
 
   def initialize(test_run, window_size = 10)
     super
@@ -100,7 +100,7 @@
     'dacapo: lusearch', 'dacapo: pmd', 'dacapo: sunflow', 'dacapo: xalan',
     'SPECjvm98', 'SPECjbb2000', 'SPECjbb2005' ]
 
-    @perf_stats = gen_perf_stats(stats)
+    @statistics = gen_perf_stats(stats)
   end
 
 end
app/views/reports/test_run_by_revision_report/show.haml to app/views/results/test_run/regression_report.haml
--- a/app/views/reports/test_run_by_revision_report/show.haml
+++ b/app/views/results/test_run/regression_report.haml
@@ -126,7 +126,7 @@
         %ul.actions
           %li= link_for(t, :label => "Show")
 
-- if @report.perf_stats.size > 0 or @report.test_runs.size > 1
+- if @report.statistics.size > 0 or @report.test_runs.size > 1
   %h2 Performance Statistics
   %table.report
     %tr
@@ -137,7 +137,7 @@
       %th.row Success Rate
       - @report.test_runs.each do |tr|
         %td= h("#{tr.successes.size}/#{tr.test_cases.size}")
-    - @report.perf_stats.each do |r|
+    - @report.statistics.each do |r|
       %tr
         %th.row= h(r['name'])
         - @report.test_runs.each do |tr|
test/functional/reports/test_run_by_revision_report_controller_test.rb to app/views/results/test_run/performance_report.haml
--- a/test/functional/reports/test_run_by_revision_report_controller_test.rb
+++ b/app/views/results/test_run/performance_report.haml
@@ -1,42 +1,37 @@
-#
-#  This file is part of the Jikes RVM project (http://jikesrvm.org).
-#
-#  This file is licensed to You under the Common Public License (CPL);
-#  You may not use this file except in compliance with the License. You
-#  may obtain a copy of the License at
-#
-#      http://www.opensource.org/licenses/cpl1.0.php
-#
-#  See the COPYRIGHT.txt file distributed with this work for information
-#  regarding copyright ownership.
-#
-require File.dirname(__FILE__) + '/../../test_helper'
-require 'reports/test_run_by_revision_report_controller'
+- @content_for_breadcrumbs = draw_breadcrumbs(@report.test_run, 'performance_report')
+- @page_title = "Performance Report: #{h(@report.test_run.label)}"
+- scm_url = SystemSetting['scm.url']
+%h1.page-title= @page_title
 
-class Reports::TestRunByRevisionReportController
-  # Re-raise errors caught by the controller.
-  def rescue_action(e)
-    raise e
-  end
-end
+%h2 Test Runs Covered By Report
+%table.list
+  %tr
+    %th Name
+    %th Revision
+    %th Time
+    %th Operations
+  - @report.test_runs.each do |t|
+    %tr
+      %td= h(t.label)
+      %td= revision_link_for_url(scm_url, t.revision)
+      %td= t.occurred_at
+      %td
+        %ul.actions
+          %li= link_for(t, :label => "Show")
 
-class Reports::TestRunByRevisionReportControllerTest < Test::Unit::TestCase
-  def setup
-    @controller = Reports::TestRunByRevisionReportController.new
-    @request    = ActionController::TestRequest.new
-    @response   = ActionController::TestResponse.new
-  end
-
-  def session_data
-    {:user_id => 1}
-  end
-
-  def test_show
-    id = 1
-    test_run = Tdm::TestRun.find(id)
-    get(:show, {:host_name => test_run.host.name, :test_run_variant => test_run.variant, :test_run_id => test_run.id}, session_data)
-    assert_normal_response('show', 1)
-    assert_assigned(:report)
-    assert_equal(id, assigns(:report).test_run.id)
-  end
-end
+- if @report.statistics.size > 0 or @report.test_runs.size > 1
+  %h2 Performance Statistics
+  %table.report
+    %tr
+      %th.pivot
+      - @report.test_runs.each do |tr|
+        %th.column= tr.label
+    %tr
+      %th.row Success Rate
+      - @report.test_runs.each do |tr|
+        %td= h("#{tr.successes.size}/#{tr.test_cases.size}")
+    - @report.statistics.each do |r|
+      %tr
+        %th.row= h(r['name'])
+        - @report.test_runs.each do |tr|
+          %td= perf_stat(tr.id, r)
test/helpers/reports/test_run_by_revision_report_helper_test.rb to test/helpers/results/test_run_helper_test.rb
--- a/test/helpers/reports/test_run_by_revision_report_helper_test.rb
+++ b/test/helpers/results/test_run_helper_test.rb
@@ -12,10 +12,12 @@
 #
 require File.dirname(__FILE__) + '/../../test_helper'
 
-class Reports::TestRunByRevisionReportHelperTest < Test::Unit::TestCase
+class Results::TestRunHelperTest < Test::Unit::TestCase
 
   class MyClass
-    include Reports::TestRunByRevisionReportHelper
+    include Results::TestRunHelper
+    include ERB::Util
+    include ActionView::Helpers::TextHelper
   end
 
   def test_tests_header
@@ -32,20 +34,21 @@
     values = [0.0, 0.8, 1.6, 2.4, 3].collect {|v| (4 - v).to_s }
     row = {'std_deviation' => '1', 'best_score' => '4', "less_is_more" => '0'}
     assert_equal("", MyClass.new.perf_stat(1, row.merge({"test_run_1" => nil})))
-    assert_equal("<span style=\"color: green; font-weight: bold;\">4</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => '4'})))
-    assert_equal("<span style=\"color: green;\">#{values[1]}</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[1]})))
-    assert_equal("<span style=\"\">#{values[2]} (-40%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[2]})))
-    assert_equal("<span style=\"color: red;\">#{values[3]} (-60%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[3]})))
-    assert_equal("<span style=\"color: red; font-weight: bold;\">#{values[4]} (-75%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[4]})))
+    assert_equal("<span style=\"color: green; font-weight: bold;\" title=\"4\">4</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => '4'})))
+    assert_equal("<span style=\"color: green;\" title=\"#{values[1]}\">#{values[1]}</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[1]})))
+    assert_equal("<span style=\"\" title=\"#{values[2]}\">#{values[2]} (-40%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[2]})))
+    assert_equal("<span style=\"color: red;\" title=\"#{values[3]}\">#{values[3]} (-60%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[3]})))
+    assert_equal("<span style=\"color: red; font-weight: bold;\" title=\"#{values[4]}\">#{values[4]} (-75%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[4]})))
 
     values = [0.0, 0.8, 1.6, 2.4, 3].collect {|v| (4 + v).to_s }
     row = {'std_deviation' => '1', 'best_score' => '4', "less_is_more" => '1'}
     assert_equal("", MyClass.new.perf_stat(1, row.merge({"test_run_1" => nil})))
-    assert_equal("<span style=\"color: green; font-weight: bold;\">4</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => '4'})))
-    assert_equal("<span style=\"color: green;\">#{values[1]}</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[1]})))
-    assert_equal("<span style=\"\">#{values[2]} (+39%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[2]})))
-    assert_equal("<span style=\"color: red;\">#{values[3]} (+60%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[3]})))
-    assert_equal("<span style=\"color: red; font-weight: bold;\">#{values[4]} (+75%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[4]})))
+    assert_equal("<span style=\"color: green; font-weight: bold;\" title=\"4\">4</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => '4'})))
+    assert_equal("<span style=\"color: green;\" title=\"#{values[1]}\">#{values[1]}</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[1]})))
+    assert_equal("<span style=\"\" title=\"#{values[2]}\">#{values[2]} (+39%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[2]})))
+    assert_equal("<span style=\"color: red;\" title=\"#{values[3]}\">#{values[3]} (+60%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[3]})))
+    assert_equal("<span style=\"color: red; font-weight: bold;\" title=\"#{values[4]}\">#{values[4]} (+75%)</span>", MyClass.new.perf_stat(1, row.merge({"test_run_1" => values[4]})))
+
+    assert_equal("<span style=\"color: green; font-weight: bold;\" title=\"10000000000\">10000...</span>", MyClass.new.perf_stat(1, {'std_deviation' => '1', 'best_score' => '10000000000', "less_is_more" => '1', "test_run_1" => '10000000000'}))
   end
-
 end
1 2 > >> (Page 1 of 2)