RobL Vs

Background

autotest on ubuntu

Finally got around to sorting out autotest on this ubuntu box, I remembered reading on Mr JohnC’s blog about it. Also found a rather nice article on Autotest notifications on Ubuntu using lib-notify

vi ~/.autotest

 1module Autotest::GnomeNotify
 2 
 3  # Time notification will be displayed before disappearing automatically
 4  EXPIRATION_IN_SECONDS = 2
 5  ERROR_STOCK_ICON = "gtk-dialog-error"
 6  SUCCESS_STOCK_ICON = "gtk-dialog-info"
 7 
 8  # Convenience method to send an error notification message
 9  #
10  # [stock_icon]   Stock icon name of icon to display
11  # [title]        Notification message title
12  # [message]      Core message for the notification
13  def self.notify stock_icon, title, message
14    options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}"
15    system "notify-send #{options} '#{title}' '#{message}'"
16  end
17 
18  Autotest.add_hook :red do |at|
19    notify ERROR_STOCK_ICON, "Tests failed", "#{at.files_to_test.size} tests failed"
20  end
21 
22  Autotest.add_hook :green do |at|
23    notify SUCCESS_STOCK_ICON, "All tests passed, good job!", ""
24  end
25 
26end