cutedriver-qt-sut-plugin 2.0.0.20210120165900

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/env.rb +24 -0
  3. data/installer/extconf.rb +62 -0
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +157 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +312 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +300 -0
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +214 -0
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_cpu.rb +145 -0
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_gpu.rb +147 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_mem.rb +142 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_pwr.rb +146 -0
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +192 -0
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +375 -0
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +82 -0
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +214 -0
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +189 -0
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +1039 -0
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +767 -0
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +166 -0
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +157 -0
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +112 -0
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +474 -0
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +134 -0
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +279 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +302 -0
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +840 -0
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +257 -0
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +117 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +272 -0
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +877 -0
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +67 -0
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +44 -0
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +171 -0
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
  45. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
  46. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +199 -0
  47. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
  48. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +192 -0
  49. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +53 -0
  50. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +48 -0
  51. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +65 -0
  52. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +57 -0
  53. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +53 -0
  54. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +93 -0
  55. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +53 -0
  56. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +62 -0
  57. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +46 -0
  58. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +98 -0
  59. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +200 -0
  60. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +466 -0
  61. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +185 -0
  62. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +69 -0
  63. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +287 -0
  64. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
  65. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +370 -0
  66. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +79 -0
  67. data/lib/testability-driver-qt-sut-plugin.rb +24 -0
  68. data/xml/behaviour/qt.xml +845 -0
  69. data/xml/defaults/sut_qt.xml +9 -0
  70. data/xml/keymap/qt.xml +321 -0
  71. data/xml/keymap/win.xml +174 -0
  72. data/xml/template/qt.xml +141 -0
  73. metadata +127 -0
@@ -0,0 +1,767 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyBehaviour
21
+
22
+ module QT
23
+
24
+ # == description
25
+ # This module contains implementation to control info logging for cpu, mem, and gpu
26
+ #
27
+ # == behaviour
28
+ # InfoLogger
29
+ #
30
+ # == requires
31
+ # testability-driver-qt-sut-plugin
32
+ #
33
+ # == input_type
34
+ # *
35
+ #
36
+ # == sut_type
37
+ # qt
38
+ #
39
+ # == sut_version
40
+ # *
41
+ #
42
+ # == objects
43
+ # sut;application
44
+ #
45
+ module InfoLoggerBehaviour
46
+
47
+ include MobyBehaviour::QT::Behaviour
48
+
49
+ # == description
50
+ # Starts logging the cpu usage the application or qttasserver if called for sut. Logging is done to a file in the given intervals (seconds).
51
+ # Small (<1) intervals may cause problems and should be avoided.
52
+ #
53
+ # The default behaviour is that a new log file will be started whenever the logging is started.
54
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
55
+ #
56
+ # == arguments
57
+ # params
58
+ # Hash
59
+ # description: Update interval and path for the log file. Interval value is in seconds.
60
+ # The file path given must exist on the target.
61
+ # Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
62
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
63
+ #
64
+ # == returns
65
+ # nil
66
+ # description: -
67
+ # example: -
68
+ #
69
+ # == exceptions
70
+ # ArgumentError
71
+ # description: For missing / wrong argument types
72
+ #
73
+ # == info
74
+ #
75
+ def log_cpu(params)
76
+ params[:action] = 'start'
77
+ execute_info('cpu', params)
78
+ end
79
+
80
+ # == description
81
+ # Stops the cpu load logging and returns the results and xml data.
82
+ # Will return an error if the logging was not started.
83
+ # The logging is done by writing the values to a log file.
84
+ # When the logging is stopped the file is read and a xml format of the data is returned.
85
+ # The file is removed.\n
86
+ #
87
+ # The data is returned in the same format as the ui state xml. Each log enty contains a timestamp the and cpu load value.\n
88
+ #
89
+ # The top object is of type logData and name cpuLoad. It contains the number of entries. The entries are the child elements of logData element.
90
+ #
91
+ # [code]
92
+ # <object id="0" name="cpuLoad" type="logData" >
93
+ # <attributes>
94
+ # <attribute name="entryCount" >
95
+ # <value>8</value>
96
+ # </attribute>
97
+ # </attributes>
98
+ # <object>
99
+ # [/code]
100
+ #
101
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz) and cpuLoad (%).\n
102
+ #
103
+ # [code]
104
+ # <object id="0" name="LogEntry" type="logEntry" >
105
+ # <attributes>
106
+ # <attribute name="timeStamp" >
107
+ # <value>20100109184651114</value>
108
+ # </attribute>
109
+ # <attribute name="cpuLoad" >
110
+ # <value>21.8966</value>
111
+ # </attribute>
112
+ # </attributes>
113
+ # </object>
114
+ # [/code]
115
+ #
116
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
117
+ #
118
+ # [code]
119
+ # # start logging
120
+ # @app.log_cpu( :interval => 1, :filePath => 'C:\Data' )
121
+ #
122
+ # # perform the tests here...
123
+ #
124
+ # # stop logging and get data as state object
125
+ # log_data_object = @sut.state_object( @app.stop_cpu_log )
126
+ #
127
+ # # collect values from log_data_object to result array
128
+ # result = ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).collect do | index |
129
+ #
130
+ # log_data_object.logEntry( :id => index.to_s ).attribute( 'cpuLoad' ).to_i
131
+ #
132
+ # end
133
+ #
134
+ # g = Gruff::Line.new
135
+ # g.title = "Application cpu usage"
136
+ # g.data( "Cpu Usage", result )
137
+ # g.write( "cpu_load.png" )
138
+ # [/code]
139
+ #
140
+ # The example produces a graph which shows the cpu load (values depend on the testing steps, device, platform etc...).
141
+ #
142
+ # == arguments
143
+ # params
144
+ # Hash
145
+ # description: Optional parameters.
146
+ # example: {:clearLog => true}
147
+ #
148
+ # == returns
149
+ # Xml
150
+ # description: data is returned in the same format as the ui state xml
151
+ # example: <object id="0" name="LogEntry" type="logEntry" >
152
+ # <attributes>
153
+ # <attribute name="timeStamp" >
154
+ # <value>20100109184651114</value>
155
+ # </attribute>
156
+ # <attribute name="cpuLoad" >
157
+ # <value>21.8966</value>
158
+ # </attribute>
159
+ # </attributes>
160
+ # </object>
161
+ #
162
+ # == exceptions
163
+ # RuntimeError
164
+ # description: When no data has been colleted
165
+ # ArgumentError
166
+ # description: For missing / wrong argument types
167
+ #
168
+ # == info
169
+ #
170
+ def stop_cpu_log(params={})
171
+ params[:action] = 'stop'
172
+ execute_info('cpu', params)
173
+ end
174
+
175
+ # == description
176
+ # Starts logging the memory usage of the application or sut.
177
+ # Normally this is the heap size used. Logging is done to a file in the given intervals (seconds).
178
+ # Small (<1) intervals may cause problems and should be avoided.
179
+ #
180
+ # The default behaviour is that a new log file will be started whenever the logging is started.
181
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
182
+ #
183
+ # == arguments
184
+ # params
185
+ # Hash
186
+ # description: Update interval and path for the log file. Interval value is in seconds.
187
+ # The file path given must exist on the target.
188
+ # Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
189
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
190
+ #
191
+ # == returns
192
+ # nil
193
+ # description: -
194
+ # example: -
195
+ # == exceptions
196
+ # ArgumentError
197
+ # description: For missing / wrong argument types
198
+ #
199
+ # == info
200
+ #
201
+ def log_mem(params)
202
+ params[:action] = 'start'
203
+ execute_info('mem', params)
204
+ end
205
+
206
+ # == description
207
+ # Stops the memory logging and returns the results and xml data.
208
+ # Will return an error if the logging was not started.
209
+ # The logging is done by writing the values to a log file.
210
+ # When the logging is stopped the file is read and a xml format of the data is returned. The file is removed.
211
+ #
212
+ # The top object is of type logData and name memUsage. It contains the number of entries. The entries are the child elements of logData element.\n
213
+ #
214
+ # [code]
215
+ # <object id="0" name="memUsage" type="logData" >
216
+ # <attributes>
217
+ # <attribute name="entryCount" >
218
+ # <value>8</value>
219
+ # </attribute>
220
+ # </attributes>
221
+ # <object>
222
+ # [/code]
223
+ #
224
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz) and heapSize.
225
+ #
226
+ # [code]
227
+ # <object id="0" name="LogEntry" type="logEntry" >
228
+ # <attributes>
229
+ # <attribute name="timeStamp" >
230
+ # <value>20100109184651114</value>
231
+ # </attribute>
232
+ # <attribute name="heapSize" >
233
+ # <value>3337448</value>
234
+ # </attribute>
235
+ # </attributes>
236
+ # </object>
237
+ # [/code]
238
+ #
239
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
240
+ #
241
+ # [code]
242
+ # # start logging
243
+ # @app.log_mem( :interval => 1, :filePath => 'C:\Data' )
244
+ #
245
+ # # perform the tests here...
246
+ #
247
+ # # stop logging and get data as state object
248
+ # log_data_object = @sut.state_object( @app.stop_mem_log )
249
+ #
250
+ # # collect values from log_data_object to result array
251
+ # result = ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).collect do | index |
252
+ #
253
+ # log_data_object.logEntry( :id => index.to_s ).attribute( 'heapSize' ).to_i
254
+ #
255
+ # end
256
+ #
257
+ # g = Gruff::Line.new
258
+ # g.title = "Application memory usage"
259
+ # g.data( "Memory Usage", result )
260
+ # g.write( "info_mem_load.png" )
261
+ # [/code]
262
+ # Above example produces a graph which shows the memory usage (values depend on the testing steps, device, platform etc...).
263
+ #
264
+ # == arguments
265
+ # params
266
+ # Hash
267
+ # description: Optional parameters.
268
+ # example: {:clearLog => true}
269
+ #
270
+ # == returns
271
+ # Xml
272
+ # description: data is returned in the same format as the ui state xml
273
+ # example: <object id="0" name="LogEntry" type="logEntry" >
274
+ # <attributes>
275
+ # <attribute name="timeStamp" >
276
+ # <value>20100109184651114</value>
277
+ # </attribute>
278
+ # <attribute name="heapSize" >
279
+ # <value>3337448</value>
280
+ # </attribute>
281
+ # </attributes>
282
+ # </object>
283
+ #
284
+ # == exceptions
285
+ # RuntimeError
286
+ # description: When no data has been colleted
287
+ # ArgumentError
288
+ # description: For missing / wrong argument types
289
+ #
290
+ # == info
291
+ #
292
+ def stop_mem_log(params={})
293
+ params[:action] = 'stop'
294
+ execute_info('mem', params)
295
+ end
296
+
297
+ # == description
298
+ # Starts logging the gpu memory usage of the application.
299
+ # NOTE: not supported on all platforms. Platforms not supporting will return -1 values.
300
+ # Logging is done to a file in the given intervals (seconds). Small (<1) intervals may cause problems and should be avoided.
301
+ #
302
+ # The default behaviour is that a new log file will be started whenever the logging is started.
303
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
304
+ #
305
+ # == arguments
306
+ # params
307
+ # Hash
308
+ # description: Update interval and path for the log file. Interval value is in seconds.
309
+ # The file path given must exist on the target.
310
+ # Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
311
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
312
+ #
313
+ # == returns
314
+ # nil
315
+ # description: -
316
+ # example: -
317
+ # == exceptions
318
+ # ArgumentError
319
+ # description: For missing / wrong argument types
320
+ #
321
+ # == info
322
+ #
323
+ def log_gpu_mem(params)
324
+ params[:action] = 'start'
325
+ execute_info('gpu', params)
326
+ end
327
+
328
+
329
+ # == description
330
+ # Starts logging the power usage of the device
331
+ # NOTE: not supported on all platforms. Platforms not supporting this will return -1 values.
332
+ # Logging is done to a file in the given intervals (seconds). Small (<1) intervals may cause problems and should be avoided.
333
+ #
334
+ # The default behaviour is that a new log file will be created whenever the logging is started.
335
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
336
+ #
337
+ # == arguments
338
+ # params
339
+ # Hash
340
+ # description: Update interval and path for the log file. Interval value is in seconds.
341
+ # The file path given must exist on the target.
342
+ # Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
343
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
344
+ #
345
+ # == returns
346
+ # nil
347
+ # description: -
348
+ # example: -
349
+ # == exceptions
350
+ # ArgumentError
351
+ # description: For missing / wrong argument types
352
+ #
353
+ # == info
354
+ #
355
+ def log_pwr(params)
356
+ params[:action] = 'start'
357
+ execute_info('pwr', params)
358
+ end
359
+
360
+
361
+ # == description
362
+ # Stops the gpu memory logging and returns the results and xml data.
363
+ # Will return an error if the logging was not started.
364
+ # The logging is done by writing the values to a log file.
365
+ # When the logging is stopped the file is read and a xml format of the data is returned. The file is removed.\n
366
+ #
367
+ # Top object is of type logData and name gpuMemUsage. It contains the number of entries. The entries are the child elements of logData element.
368
+ #
369
+ # [code]
370
+ # <object id="0" name="gpuMemUsage" type="logData" >
371
+ # <attributes>
372
+ # <attribute name="entryCount" >
373
+ # <value>8</value>
374
+ # </attribute>
375
+ # </attributes>
376
+ # <objects>
377
+ # [/code]
378
+ #
379
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz), totalMem, usedMem, freeMem, processPrivateMem and processSharedMem. Process specific details may not always be available. \n
380
+ #
381
+ # [code]
382
+ # <object id="0" name="LogEntry" type="logEntry" >
383
+ # <attributes>
384
+ # <attribute name="timeStamp" >
385
+ # <value>20100108190741059</value>
386
+ # </attribute>
387
+ # <attribute name="totalMem" >
388
+ # <value>33554432</value>
389
+ # </attribute>
390
+ # <attribute name="usedMem" >
391
+ # <value>17252576</value>
392
+ # </attribute>
393
+ # <attribute name="freeMem" >
394
+ # <value>16301856</value>
395
+ # </attribute>
396
+ # <attribute name="processPrivateMem" >
397
+ # <value>5170739</value>
398
+ # </attribute>
399
+ # <attribute name="processSharedMem" >
400
+ # <value>0</value>
401
+ # </attribute>
402
+ # </attributes>
403
+ # </object>
404
+ # [/code]
405
+ #
406
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
407
+ #
408
+ # [code]
409
+ # # start logging
410
+ # @app.log_gpu_mem( :interval => 1, :filePath => 'C:\Data' )
411
+ #
412
+ # # perform the tests here...
413
+ #
414
+ # # stop logging and get data as state object
415
+ # log_data_object = @sut.state_object( @app.stop_gpu_log )
416
+ #
417
+ # # create arrays for the results
418
+ # total_memory = []
419
+ # used_memory = []
420
+ # free_memory = []
421
+ # process_private_memory = []
422
+ # process_shared_memory = []
423
+ #
424
+ # # collect values from each log entry and store to results array
425
+ # ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).each do | index |
426
+ #
427
+ # # store log entry reference to variable
428
+ # entry = log_data_object.logEntry( :id => index.to_s )
429
+ #
430
+ # # store entry values to array
431
+ # total_memory << entry.attribute( 'totalMem' ).to_i
432
+ # used_memory << entry.attribute( 'usedMem' ).to_i
433
+ # free_memory << entry.attribute( 'freeMem' ).to_i
434
+ # process_private_memory << entry.attribute( 'processPrivateMem' ).to_i
435
+ # process_shared_memory << entry.attribute( 'processSharedMem' ).to_i
436
+ #
437
+ # end
438
+ #
439
+ # g = Gruff::Line.new
440
+ # g.title = "Application cpu usage%"
441
+ # g.data( "Total memory", total_memory )
442
+ # g.data( "Used memory", used_memory )
443
+ # g.data( "Free memory", free_memory )
444
+ # g.data( "Process private memory", process_private_memory )
445
+ # g.data( "Process shared memory", process_shared_memory )
446
+ # g.write( "info_gpu_load.png" )
447
+ # [/code]
448
+ #
449
+ # The example produces a graph which shows the cpu load (values depend on the testing steps, device, platform etc...).
450
+ #
451
+ # == arguments
452
+ # params
453
+ # Hash
454
+ # description: Optional parameters.
455
+ # example: {:clearLog => true}
456
+ #
457
+ # == returns
458
+ # Xml
459
+ # description: data is returned in the same format as the ui state xml
460
+ # example: <object id="0" name="LogEntry" type="logEntry" >
461
+ # <attributes>
462
+ # <attribute name="timeStamp" >
463
+ # <value>20100108190741059</value>
464
+ # </attribute>
465
+ # <attribute name="totalMem" >
466
+ # <value>33554432</value>
467
+ # </attribute>
468
+ # <attribute name="usedMem" >
469
+ # <value>17252576</value>
470
+ # </attribute>
471
+ # <attribute name="freeMem" >
472
+ # <value>16301856</value>
473
+ # </attribute>
474
+ # <attribute name="processPrivateMem" >
475
+ # <value>5170739</value>
476
+ # </attribute>
477
+ # <attribute name="processSharedMem" >
478
+ # <value>0</value>
479
+ # </attribute>
480
+ # </attributes>
481
+ # </object>
482
+ #
483
+ # == exceptions
484
+ # RuntimeError
485
+ # description: When no data has been colleted
486
+ # ArgumentError
487
+ # description: For missing / wrong argument types
488
+ #
489
+ # == info
490
+ #
491
+ def stop_gpu_log(params={})
492
+ params[:action] = 'stop'
493
+ execute_info('gpu', params)
494
+ end
495
+
496
+
497
+ # == description
498
+ # Stops the power logging and returns the results and xml data.
499
+ # Will return an error if the logging was not started.
500
+ # The logging is done by writing the values to a log file.
501
+ # When the logging is stopped the file is read and a xml format of the data is returned. The file is removed.\n
502
+ #
503
+ # Top object is of type logData and name pwrUsage. It contains the number of entries. The entries are the child elements of logData element.
504
+ #
505
+ # [code]
506
+ # <object id="0" name="pwrUsage" type="logData" >
507
+ # <attributes>
508
+ # <attribute name="entryCount" >
509
+ # <value>8</value>
510
+ # </attribute>
511
+ # </attributes>
512
+ # <objects>
513
+ # [/code]
514
+ #
515
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz), totalMem, usedMem, freeMem, processPrivateMem and processSharedMem. Process specific details may not always be available. \n
516
+ #
517
+ # [code]
518
+ # <object id="0" name="LogEntry" type="logEntry" >
519
+ # <attributes>
520
+ # <attribute name="timeStamp" >
521
+ # <value>20100108190741059</value>
522
+ # </attribute>
523
+ # <attribute name="voltage" >
524
+ # <value>4317</value>
525
+ # </attribute>
526
+ # <attribute name="current" >
527
+ # <value>-107</value>
528
+ # </attribute>
529
+ # </attributes>
530
+ # </object>
531
+ # [/code]
532
+ #
533
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
534
+ #
535
+ # [code]
536
+ # # start logging
537
+ # @app.log_pwr( :interval => 1, :filePath => 'C:\Data' )
538
+ #
539
+ # # perform the tests here...
540
+ #
541
+ # # stop logging and get data as state object
542
+ # log_data_object = @sut.state_object( @app.stop_pwr )
543
+ #
544
+ # # create arrays for the results
545
+ # voltage = []
546
+ # current = []
547
+ #
548
+ # # collect values from each log entry and store to results array
549
+ # ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).each do | index |
550
+ #
551
+ # # store log entry reference to variable
552
+ # entry = log_data_object.logEntry( :id => index.to_s )
553
+ #
554
+ # # store entry values to array
555
+ # voltage << entry.attribute( 'voltage' ).to_i
556
+ # current << entry.attribute( 'current' ).to_i
557
+ #
558
+ # end
559
+ #
560
+ # g = Gruff::Line.new
561
+ # g.title = "Application cpu usage%"
562
+ # g.data( "voltage", voltage )
563
+ # g.data( "current", current )
564
+ # g.write( "info_pwr.png" )
565
+ # [/code]
566
+ #
567
+ # The example produces a graph which shows the power usage (values depend on the testing steps, device, platform etc...).
568
+ #
569
+ # == arguments
570
+ # params
571
+ # Hash
572
+ # description: Optional parameters.
573
+ # example: {:clearLog => true}
574
+ #
575
+ # == returns
576
+ # Xml
577
+ # description: data is returned in the same format as the ui state xml
578
+ # example: <object id="0" name="LogEntry" type="logEntry" >
579
+ # <attributes>
580
+ # <attribute name="timeStamp" >
581
+ # <value>20100108190741059</value>
582
+ # </attribute>
583
+ # <attribute name="voltage" >
584
+ # <value>4318</value>
585
+ # </attribute>
586
+ # <attribute name="current" >
587
+ # <value>-107</value>
588
+ # </attribute>
589
+ # </attributes>
590
+ # </object>
591
+ #
592
+ # == exceptions
593
+ # RuntimeError
594
+ # description: When no data has been colleted
595
+ # ArgumentError
596
+ # description: For missing / wrong argument types
597
+ #
598
+ # == info
599
+ #
600
+ def stop_pwr_log(params={})
601
+ params[:action] = 'stop'
602
+ execute_info('pwr', params)
603
+ end
604
+
605
+
606
+
607
+ # == description
608
+ # Load the cpu log without stopping the logging.
609
+ #
610
+ # == arguments
611
+ # params
612
+ # Hash
613
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
614
+ # example: {:clearLog => true}
615
+ #
616
+ #
617
+ # == returns
618
+ # Xml
619
+ # description: data is returned in the same format as the ui state xml
620
+ # example: -
621
+ #
622
+ # == exceptions
623
+ # RuntimeError
624
+ # description: When no data has been colleted
625
+ # ArgumentError
626
+ # description: For missing / wrong argument types
627
+ #
628
+ # == info
629
+ #
630
+ def load_cpu_log(params={})
631
+ params[:action] = 'load'
632
+ execute_info('cpu', params)
633
+ end
634
+
635
+ # == description
636
+ # Load the mem log without stopping the logging.
637
+ #
638
+ # == arguments
639
+ # params
640
+ # Hash
641
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
642
+ # example: {:clearLog => true}
643
+ #
644
+ #
645
+ # == returns
646
+ # Xml
647
+ # description: data is returned in the same format as the ui state xml
648
+ # example: -
649
+ #
650
+ # == exceptions
651
+ # RuntimeError
652
+ # description: When no data has been colleted
653
+ # ArgumentError
654
+ # description: For missing / wrong argument types
655
+ #
656
+ # == info
657
+ #
658
+ def load_mem_log(params={})
659
+ params[:action] = 'load'
660
+ execute_info('mem', params)
661
+ end
662
+
663
+ # == description
664
+ # Load the gpu log without stopping the logging.
665
+ #
666
+ # == arguments
667
+ # params
668
+ # Hash
669
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
670
+ # example: {:clearLog => true}
671
+ #
672
+ #
673
+ # == returns
674
+ # Xml
675
+ # description: data is returned in the same format as the ui state xml
676
+ # example: -
677
+ #
678
+ # == exceptions
679
+ # RuntimeError
680
+ # description: When no data has been colleted
681
+ # ArgumentError
682
+ # description: For missing / wrong argument types
683
+ #
684
+ # == info
685
+ #
686
+
687
+ def load_gpu_log(params={})
688
+ params[:action] = 'load'
689
+ execute_info('gpu', params)
690
+ end
691
+
692
+
693
+ # == description
694
+ # Load the power log without stopping the logging.
695
+ #
696
+ # == arguments
697
+ # params
698
+ # Hash
699
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
700
+ # example: {:clearLog => true}
701
+ #
702
+ #
703
+ # == returns
704
+ # Xml
705
+ # description: data is returned in the same format as the ui state xml
706
+ # example: -
707
+ #
708
+ # == exceptions
709
+ # RuntimeError
710
+ # description: When no data has been colleted
711
+ # ArgumentError
712
+ # description: For missing / wrong argument types
713
+ #
714
+ # == info
715
+ #
716
+ def load_pwr_log(params={})
717
+ params[:action] = 'load'
718
+ execute_info('pwr', params)
719
+ end
720
+
721
+ private
722
+
723
+ def execute_info(service, params)
724
+ begin
725
+
726
+ validate_params(params)
727
+
728
+ time = params[:interval].to_f
729
+ interval = time*1000
730
+ params[:interval] = interval.to_i
731
+
732
+ command = MobyCommand::InfoLoggerCommand.new(service, params )
733
+
734
+ ret = nil
735
+ if self.class == MobyBase::SUT
736
+ ret = execute_command( command )
737
+ else
738
+ command.application_id = get_application_id
739
+ ret = @sut.execute_command( command )
740
+ end
741
+
742
+ rescue Exception => e
743
+ $logger.behaviour "FAIL;Failed infologger \"#{params.to_s}\".;#{service};"
744
+ raise e
745
+ end
746
+ $logger.behaviour "PASS;Operation infologger succeeded with params \"#{params.to_s}\".;#{service};"
747
+ ret
748
+ end
749
+
750
+ def validate_params(params)
751
+ #type
752
+ raise ArgumentError.new("Parameters must be a hash (e.g. {:filePath => 'C:\Data\',:interval => 1 }") unless params.kind_of?(Hash)
753
+ if params[:action] == 'start'
754
+ #speed
755
+ raise ArgumentError.new("Log file path must be defined (e.g. :filePath => 'C:\Data\')") unless params[:filePath]
756
+ #distance
757
+ raise ArgumentError.new("Interval 1 must be an number (e.g. :interval => 1") unless params[:interval].kind_of?(Numeric)
758
+ end
759
+ end
760
+
761
+ # enable hooking for performance measurement & debug logging
762
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
763
+
764
+
765
+ end
766
+ end
767
+ end