Class: Calypso::UnitTest
- Inherits:
-
Object
- Object
- Calypso::UnitTest
- Defined in:
- lib/calypso/unittest.rb
Overview
Unit test model class
Instance Attribute Summary collapse
-
#autorun ⇒ Boolean
readonly
Whether or not the test should be ran automatically.
-
#exec ⇒ String
readonly
Unit test build and execution targets.
-
#hardware ⇒ Calypso::Hardware
readonly
Unit test hardware.
-
#hw ⇒ Calypso::Hardware
readonly
Unit test hardware.
-
#mode ⇒ Symbol
readonly
Unit test mode.
-
#name ⇒ String
readonly
Unit test name.
-
#path ⇒ String
readonly
Unit test path.
-
#serial ⇒ SerialPortData
readonly
Information about the serial port used by the test.
Instance Method Summary collapse
-
#execute ⇒ Boolean
Execute the unit test.
-
#initialize(conf, serial, hw) ⇒ UnitTest
constructor
Create a new UnitTest model.
-
#success? ⇒ Boolean
Check if the test ran succesfully.
-
#update ⇒ nil
Update the unit test configuration file.
Constructor Details
#initialize(conf, serial, hw) ⇒ UnitTest
Create a new UnitTest model.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/calypso/unittest.rb', line 49 def initialize(conf, serial, hw) @name = conf['name'] @path = File. conf['path'] @mode = conf['mode'] == 'manual' ? :manual : :auto @hw = hw @hardware = hw @exec = conf['execute'] config = conf['config'] @conf = "#{@path}/#{config}" unless conf.nil? @libdir = File. conf['libdir'] unless conf['libdir'].nil? @serial = serial @raw = conf @success = false @autorun = conf['autorun'] @compare_file = conf['compare'] end |
Instance Attribute Details
#autorun ⇒ Boolean (readonly)
Returns Whether or not the test should be ran automatically.
40 41 42 |
# File 'lib/calypso/unittest.rb', line 40 def autorun @autorun end |
#exec ⇒ String (readonly)
Returns Unit test build and execution targets.
38 39 40 |
# File 'lib/calypso/unittest.rb', line 38 def exec @exec end |
#hardware ⇒ Calypso::Hardware (readonly)
Returns Unit test hardware.
36 37 38 |
# File 'lib/calypso/unittest.rb', line 36 def hardware @hardware end |
#hw ⇒ Calypso::Hardware (readonly)
Returns Unit test hardware.
34 35 36 |
# File 'lib/calypso/unittest.rb', line 34 def hw @hw end |
#mode ⇒ Symbol (readonly)
Returns Unit test mode.
32 33 34 |
# File 'lib/calypso/unittest.rb', line 32 def mode @mode end |
#name ⇒ String (readonly)
Returns Unit test name.
28 29 30 |
# File 'lib/calypso/unittest.rb', line 28 def name @name end |
#path ⇒ String (readonly)
Returns Unit test path.
30 31 32 |
# File 'lib/calypso/unittest.rb', line 30 def path @path end |
#serial ⇒ SerialPortData (readonly)
Returns Information about the serial port used by the test.
42 43 44 |
# File 'lib/calypso/unittest.rb', line 42 def serial @serial end |
Instance Method Details
#execute ⇒ Boolean
Execute the unit test.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/calypso/unittest.rb', line 69 def execute kbuild = Kbuild.new(@conf, @path) unless Calypso.. kbuild.clean kbuild.build kbuild.install_modules(@libdir) end kbuild.build_test(@exec) sp = Calypso::SerialMonitor.new(@serial.port) manual_stop = sp.monitor if manual_stop or @mode == :manual print "Did the test run succesfully? [y/n]: " reply = gets.chomp @success = true if reply.eql? 'y' or reply.eql? 'Y' else @success = compare(sp) end end |
#success? ⇒ Boolean
Check if the test ran succesfully.
103 104 105 |
# File 'lib/calypso/unittest.rb', line 103 def success? @success end |