testability-driver-qt-sut-plugin 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +33 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +5 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +36 -1
- data/xml/behaviour/qt.xml +4 -0
- metadata +5 -5
@@ -710,6 +710,39 @@ module MobyBehaviour
|
|
710
710
|
end
|
711
711
|
end
|
712
712
|
|
713
|
+
# == description
|
714
|
+
# Does MemSpy heap dump from the given application. The dump will be
|
715
|
+
# saved in a file, which need to be separately fetched from the device.\ŋ
|
716
|
+
# \n
|
717
|
+
# [b]NOTE:[/b] Only supported on Symbian platform.
|
718
|
+
#
|
719
|
+
# == arguments
|
720
|
+
# thread_name
|
721
|
+
# String
|
722
|
+
# description: Name of the application thread.
|
723
|
+
# example: 'phonebook2'
|
724
|
+
#
|
725
|
+
# == returns
|
726
|
+
# String
|
727
|
+
# description: Response message
|
728
|
+
# example: 'OK'
|
729
|
+
#
|
730
|
+
def dump_heap(thread_name)
|
731
|
+
status = nil
|
732
|
+
begin
|
733
|
+
status = execute_command(MobyCommand::Application.new(
|
734
|
+
:ThreadHeapDump,
|
735
|
+
{:application_name => thread_name}
|
736
|
+
)
|
737
|
+
)
|
738
|
+
$logger.behaviour "PASS;Successfully dumped thread heap.;#{ id };sut;{};dump_heap;"
|
739
|
+
rescue Exception => e
|
740
|
+
$logger.behaviour "FAIL;Failed to dump thread heap.;#{ id };sut;{};dump_heap;"
|
741
|
+
raise RuntimeError, "Unable to dump thread heap: Exception: #{ e.message } (#{ e.class })"
|
742
|
+
end
|
743
|
+
status
|
744
|
+
end
|
745
|
+
|
713
746
|
# == description
|
714
747
|
# Groups behaviours into a single message. Commands are executed in the target in sequence using the given interval as timeout between the commands. The interval is not quaranteed to be exactly the specified amount and will vary depending on the load in the target device. Therefore it is not recommended to use the interval as basis for the test results. The commands are all executed in the target device in a single roundtrip from TDriver to the target device so no verification will or can be done between the commands so do not group behaviours which change the ui in a way that the next command may fail. Best use cases for the grouping is static behaviours such as virtual keyboard button taps. Behaviours can only be qrouped for one application at a time and you need to provide the application object as parameter. Sut behaviours cannot be grouped.
|
715
748
|
# == arguments
|
@@ -115,7 +115,11 @@ module MobyPlugin
|
|
115
115
|
$parameters[ sut_id ][ :socket_read_timeout, "15" ].to_i,
|
116
116
|
|
117
117
|
# tcp/ip write timeouts, default: 15 (seconds)
|
118
|
-
$parameters[ sut_id ][ :socket_write_timeout, "
|
118
|
+
$parameters[ sut_id ][ :socket_write_timeout, "25" ].to_i,
|
119
|
+
|
120
|
+
# tcp/ip connection timeouts, default: 15 (seconds)
|
121
|
+
$parameters[ sut_id ][ :socket_connect_timeout, "15" ].to_i
|
122
|
+
|
119
123
|
|
120
124
|
)
|
121
125
|
|
@@ -35,6 +35,7 @@ module MobyController
|
|
35
35
|
attr_accessor(
|
36
36
|
:socket_read_timeout,
|
37
37
|
:socket_write_timeout,
|
38
|
+
:socket_connect_timeout,
|
38
39
|
:deflate_service_request,
|
39
40
|
:deflate_minimum_size,
|
40
41
|
:deflate_compression_level
|
@@ -48,7 +49,7 @@ module MobyController
|
|
48
49
|
# once usage is complete the shutdown_comms is called
|
49
50
|
# == params
|
50
51
|
# sut_id id for the sut so that client details can be fetched from params
|
51
|
-
def initialize( sut_id, receive_timeout = 25, send_timeout = 25 )
|
52
|
+
def initialize( sut_id, receive_timeout = 25, send_timeout = 25, connect_timeout = 25 )
|
52
53
|
|
53
54
|
# reset socket
|
54
55
|
@socket = nil
|
@@ -72,6 +73,7 @@ module MobyController
|
|
72
73
|
# set timeouts
|
73
74
|
@socket_read_timeout = receive_timeout
|
74
75
|
@socket_write_timeout = send_timeout
|
76
|
+
@socket_connect_timeout = connect_timeout
|
75
77
|
|
76
78
|
# randomized value for initial message packet counter
|
77
79
|
@counter = rand( 1000 )
|
@@ -116,6 +118,32 @@ module MobyController
|
|
116
118
|
|
117
119
|
end
|
118
120
|
|
121
|
+
def timeout_capable_socket_opener(ip,port,timeout=nil)
|
122
|
+
addr = Socket.getaddrinfo(ip, nil)
|
123
|
+
sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)
|
124
|
+
if timeout
|
125
|
+
secs = Integer(timeout)
|
126
|
+
usecs = Integer((timeout - secs) * 1_000_000)
|
127
|
+
optval = [secs, usecs].pack("l_2")
|
128
|
+
## actual timeout gets triggered after 2 times of "timeout" value, most likely because my patch applies timeout to read AND write ..
|
129
|
+
sock.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval
|
130
|
+
sock.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval
|
131
|
+
## also, worth checking if there's actually some Socket::SO_* that applies the timeout to connection forming ..
|
132
|
+
end
|
133
|
+
begin
|
134
|
+
sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))
|
135
|
+
rescue Errno::EINPROGRESS
|
136
|
+
resp = IO.select([sock],nil, nil, timeout.to_i)
|
137
|
+
begin
|
138
|
+
sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))
|
139
|
+
rescue Errno::EISCONN
|
140
|
+
end
|
141
|
+
end
|
142
|
+
sock ## Its also worth noting that if we set RCV AND SNDTIMEOT to some value when checking for established socket,
|
143
|
+
## it might make sense to set the defaults values back again so that only during the connection, timeout is
|
144
|
+
## different..
|
145
|
+
end
|
146
|
+
|
119
147
|
# TODO: document me
|
120
148
|
def connect( id = nil )
|
121
149
|
|
@@ -135,8 +163,15 @@ module MobyController
|
|
135
163
|
execute_hook( 'before_connect', id, ip, port ) if hooked?( 'before_connect' )
|
136
164
|
|
137
165
|
# open tcp/ip connection
|
166
|
+
# Using ruby TCPSocket this way will utilize the underlying kernel to do the timeout, which by default is too long (In my tests, on ubuntu 10.10, TCPSocket.open
|
167
|
+
# will wait for exactly 380 seconds before throwing exception which is *FAR* too long ..
|
138
168
|
@socket = TCPSocket.open( ip, port )
|
139
169
|
|
170
|
+
|
171
|
+
# open tcp/ip connectio
|
172
|
+
## The block will actually double the time, so halve it. Actual timeout will +1 if it's an odd number
|
173
|
+
# @socket = timeout_capable_socket_opener(ip,port,(@socket_connect_timeout.to_i / 2.0).ceil)
|
174
|
+
|
140
175
|
# set connected status to true
|
141
176
|
@connected = true
|
142
177
|
|
data/xml/behaviour/qt.xml
CHANGED
@@ -73,6 +73,10 @@
|
|
73
73
|
<description>Stop generating CPU load.</description>
|
74
74
|
<example>cpu_load_stop</example>
|
75
75
|
</method>
|
76
|
+
<method name="dump_heap">
|
77
|
+
<description>Capture thread heap dump.</description>
|
78
|
+
<example>dump_heap('akncapserver')</example>
|
79
|
+
</method>
|
76
80
|
<method name="group_behaviours">
|
77
81
|
<description>Group behaviours into a single message.</description>
|
78
82
|
<example>group_behaviours(1, app){app.Node.tap;app.Node1.tap}</example>
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testability-driver-qt-sut-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- TDriver team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-11 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|