calypso 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/calypso/unittest.rb +2 -0
- data/lib/calypso/version.rb +1 -1
- data/lib/calypso.rb +29 -9
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54ea4595b7a3ec507bfbb0a49d03c24fb7cb7e49
|
4
|
+
data.tar.gz: 52ac19c39a4cc38adfabeb924dec1e1562ebe805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b53b775c3e3ab569a804dc8f1077502fe05355d42088f8e303a39c7f68f369e708dcd98c793ff3ca1bdb719a04c37f7bceddbc9bf79eff37c02d154088dd6d4
|
7
|
+
data.tar.gz: a150d32764677cc1b22eb455374b53f197b1348dc98210a4b96f9ef19aa1e2cc1cdb123a9bc3bfb1b67b9062e027084eeaeaa0768bd3e2c63353969fdc86d011
|
data/lib/calypso/unittest.rb
CHANGED
@@ -38,6 +38,8 @@ module Calypso
|
|
38
38
|
attr_reader :exec
|
39
39
|
# @return [Boolean] Whether or not the test should be ran automatically.
|
40
40
|
attr_reader :autorun
|
41
|
+
# @return [SerialPortData] Information about the serial port used by the test
|
42
|
+
attr_reader :serial
|
41
43
|
|
42
44
|
# Create a new UnitTest model.
|
43
45
|
#
|
data/lib/calypso/version.rb
CHANGED
data/lib/calypso.rb
CHANGED
@@ -44,6 +44,8 @@ module Calypso
|
|
44
44
|
options.bare = false
|
45
45
|
options.hardware = nil
|
46
46
|
options.run_mode = :all
|
47
|
+
options.tty_fix = false
|
48
|
+
options.tty_fix = true if ENV['TTY_FIX'].eql? 'true'
|
47
49
|
|
48
50
|
parser = OptionParser.new do |p|
|
49
51
|
p.banner = "Usage: calypso [options] -c [config]"
|
@@ -58,6 +60,11 @@ module Calypso
|
|
58
60
|
options.bare = true
|
59
61
|
end
|
60
62
|
|
63
|
+
p.on('-f', '--tty-fix',
|
64
|
+
'Enforce the correct TTY settings before trying to run a test') do
|
65
|
+
options.tty_fix = true
|
66
|
+
end
|
67
|
+
|
61
68
|
p.on('-t [TESTID]', '--test [TESTID]',
|
62
69
|
'Run a specific test') do |id|
|
63
70
|
options.single = id
|
@@ -118,23 +125,24 @@ module Calypso
|
|
118
125
|
|
119
126
|
case options.run_mode
|
120
127
|
when :all
|
121
|
-
Calypso.run(config)
|
128
|
+
Calypso.run(config, options)
|
122
129
|
when :hardware
|
123
|
-
Calypso.run_hardware(config, options.hardware)
|
130
|
+
Calypso.run_hardware(config, options, options.hardware)
|
124
131
|
when :single
|
125
|
-
Calypso.run_single(config, options
|
132
|
+
Calypso.run_single(config, options)
|
126
133
|
end
|
127
134
|
end
|
128
135
|
|
129
136
|
# Run a single test.
|
130
137
|
#
|
131
138
|
# @param parser [Calypso::ParserProxy] Configuration parser.
|
132
|
-
# @param
|
139
|
+
# @param options [OpenStruct] Options passed to Calypso on the cmd line.
|
133
140
|
# @return [nil]
|
134
|
-
def run_single(parser,
|
135
|
-
test = parser.tests[
|
141
|
+
def run_single(parser, options)
|
142
|
+
test = parser.tests[options.single]
|
136
143
|
puts "Running test [#{test.name}]"
|
137
144
|
|
145
|
+
Calypso.tty_fix(test.serial) if options.tty_fix
|
138
146
|
test.execute
|
139
147
|
puts "[#{test.name}]: #{test.success? ? 'OK' : 'FAIL'}"
|
140
148
|
end
|
@@ -142,9 +150,10 @@ module Calypso
|
|
142
150
|
# Run all tests for a specific piece of hardware.
|
143
151
|
#
|
144
152
|
# @param config [Calypso::ParserProxy] Configuration parser.
|
153
|
+
# @param options [OpenStruct] Options passed to Calypso on the cmd line.
|
145
154
|
# @param hwid [String] Hardware ID.
|
146
155
|
# @return [nil]
|
147
|
-
def run_hardware(config, hwid)
|
156
|
+
def run_hardware(config, options, hwid)
|
148
157
|
hw = config.hardware[hwid]
|
149
158
|
tests = hw.tests
|
150
159
|
puts "Running #{hw.name} tests. Press enter to continue..."
|
@@ -152,6 +161,7 @@ module Calypso
|
|
152
161
|
|
153
162
|
tests.each do |test|
|
154
163
|
next unless test.autorun
|
164
|
+
Calypso.tty_fix(test.serial) if options.tty_fix
|
155
165
|
test.execute
|
156
166
|
success = "successfully" if test.success?
|
157
167
|
success = "unsuccessfully" unless test.success?
|
@@ -170,14 +180,24 @@ module Calypso
|
|
170
180
|
# Run all unit tests.
|
171
181
|
#
|
172
182
|
# @param parser [Calypso::ParserProxy] Configuration parser.
|
183
|
+
# @param options [OpenStruct] Options passed to Calypso on the cmd line.
|
173
184
|
# @return [nil]
|
174
|
-
def run(parser)
|
185
|
+
def run(parser, options)
|
175
186
|
hw = parser.hardware
|
176
187
|
|
177
188
|
hw.each do |hwid, hwdata|
|
178
|
-
Calypso.run_hardware(parser, hwid)
|
189
|
+
Calypso.run_hardware(parser, options, hwid)
|
179
190
|
end
|
180
191
|
end
|
192
|
+
|
193
|
+
# Fix the serial TTY configuration.
|
194
|
+
#
|
195
|
+
# @param serial [Calypso::SerialPortData] Serial port data
|
196
|
+
# @return [nil]
|
197
|
+
def tty_fix(serial)
|
198
|
+
fix_cmd = "stty 57600 raw ignbrk hup < #{serial.port}"
|
199
|
+
system(fix_cmd)
|
200
|
+
end
|
181
201
|
end
|
182
202
|
end
|
183
203
|
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calypso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Megens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.10.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.10.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 10.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 10.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.2.2
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Embedded test automation.
|
112
112
|
test_files: []
|
113
|
-
has_rdoc:
|