testability-driver 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -0
- data/bin/start_app_perf +199 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +39 -0
- data/ext/extconf.rb +67 -0
- data/ext/native_extensions.c +70 -0
- data/lib/matti.rb +30 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
- data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
- data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
- data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/generate.rb +892 -0
- data/lib/tdriver-devtools/doc/update +1 -0
- data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
- data/lib/tdriver-devtools/doc/xslt/update +3 -0
- data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
- data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
- data/lib/tdriver.rb +26 -0
- data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
- data/lib/tdriver/base/behaviour/factory.rb +380 -0
- data/lib/tdriver/base/behaviour/loader.rb +28 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +25 -0
- data/lib/tdriver/base/errors.rb +131 -0
- data/lib/tdriver/base/loader.rb +38 -0
- data/lib/tdriver/base/state_object.rb +270 -0
- data/lib/tdriver/base/sut/adapter.rb +28 -0
- data/lib/tdriver/base/sut/controller.rb +119 -0
- data/lib/tdriver/base/sut/factory.rb +287 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +67 -0
- data/lib/tdriver/base/test_object/abstract.rb +179 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
- data/lib/tdriver/base/test_object/factory.rb +618 -0
- data/lib/tdriver/base/test_object/identificator.rb +511 -0
- data/lib/tdriver/base/test_object/loader.rb +37 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +36 -0
- data/lib/tdriver/matti.rb +35 -0
- data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
- data/lib/tdriver/report/report.rb +47 -0
- data/lib/tdriver/report/report_api.rb +207 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
- data/lib/tdriver/report/report_creator.rb +571 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
- data/lib/tdriver/report/report_data_presentation.rb +152 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +284 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_grouping.rb +539 -0
- data/lib/tdriver/report/report_junit_xml.rb +147 -0
- data/lib/tdriver/report/report_rspec.rb +108 -0
- data/lib/tdriver/report/report_test_case_run.rb +621 -0
- data/lib/tdriver/report/report_test_run.rb +1286 -0
- data/lib/tdriver/report/report_test_unit.rb +175 -0
- data/lib/tdriver/report/report_writer.rb +1405 -0
- data/lib/tdriver/tdriver.rb +158 -0
- data/lib/tdriver/util/common.rb +24 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/crc16.rb +100 -0
- data/lib/tdriver/util/common/environment.rb +153 -0
- data/lib/tdriver/util/common/error.rb +39 -0
- data/lib/tdriver/util/common/file.rb +315 -0
- data/lib/tdriver/util/common/gem.rb +108 -0
- data/lib/tdriver/util/common/kernel.rb +189 -0
- data/lib/tdriver/util/common/loader.rb +39 -0
- data/lib/tdriver/util/common/retryable.rb +98 -0
- data/lib/tdriver/util/common/string.rb +77 -0
- data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
- data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
- data/lib/tdriver/util/dbaccess/error.rb +35 -0
- data/lib/tdriver/util/dbaccess/loader.rb +29 -0
- data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
- data/lib/tdriver/util/hooking.rb +434 -0
- data/lib/tdriver/util/loader.rb +65 -0
- data/lib/tdriver/util/localisation.rb +24 -0
- data/lib/tdriver/util/localisation/error.rb +32 -0
- data/lib/tdriver/util/localisation/loader.rb +28 -0
- data/lib/tdriver/util/localisation/localisation.rb +479 -0
- data/lib/tdriver/util/logger.rb +377 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +26 -0
- data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
- data/lib/tdriver/util/other/config.rb +221 -0
- data/lib/tdriver/util/parameter.rb +24 -0
- data/lib/tdriver/util/parameter/error.rb +45 -0
- data/lib/tdriver/util/parameter/loader.rb +37 -0
- data/lib/tdriver/util/parameter/parameter.rb +285 -0
- data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
- data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
- data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
- data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
- data/lib/tdriver/util/plugin/abstract.rb +60 -0
- data/lib/tdriver/util/plugin/error.rb +25 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +200 -0
- data/lib/tdriver/util/recorder.rb +292 -0
- data/lib/tdriver/util/stats.rb +90 -0
- data/lib/tdriver/util/user_data/error.rb +29 -0
- data/lib/tdriver/util/user_data/loader.rb +26 -0
- data/lib/tdriver/util/user_data/user_data.rb +103 -0
- data/lib/tdriver/util/video_rec.rb +264 -0
- data/lib/tdriver/util/xml/abstraction.rb +47 -0
- data/lib/tdriver/util/xml/builder.rb +54 -0
- data/lib/tdriver/util/xml/document.rb +32 -0
- data/lib/tdriver/util/xml/element.rb +32 -0
- data/lib/tdriver/util/xml/error.rb +46 -0
- data/lib/tdriver/util/xml/loader.rb +46 -0
- data/lib/tdriver/util/xml/nil_element.rb +89 -0
- data/lib/tdriver/util/xml/nodeset.rb +32 -0
- data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
- data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
- data/lib/tdriver/util/xml/xml.rb +170 -0
- data/lib/tdriver/verify/verify.rb +687 -0
- data/lib/tdriver/verify/verify.rb_org +630 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +495 -0
- data/xml/defaults/generic.xml +97 -0
- data/xml/defaults/sut_generic.xml +36 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +227 -0
- metadata +327 -0
|
@@ -0,0 +1,158 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
# Framework main file that needs to be included in tests.
|
|
21
|
+
# Used for setting up testing environment, eg
|
|
22
|
+
#
|
|
23
|
+
# require File.join( ENV['TDRIVER_HOME'] , 'tdriver.rb' )
|
|
24
|
+
# @sut = TDriver.sut(:Id =>'sut_qt') # for Qt, id in configuration file sut_qt
|
|
25
|
+
#
|
|
26
|
+
# Please see class documentation for more info
|
|
27
|
+
|
|
28
|
+
$KCODE = 'u'
|
|
29
|
+
|
|
30
|
+
# Following line to prevent Object#id Warnings
|
|
31
|
+
Object.send( :undef_method, :id ) if Object.respond_to?( :id )
|
|
32
|
+
|
|
33
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'loader' ) )
|
|
34
|
+
|
|
35
|
+
module TDriver
|
|
36
|
+
|
|
37
|
+
# Function to create and (or if already created re-) connect SUT object
|
|
38
|
+
# === params
|
|
39
|
+
# hash:: Defines SUT type, identification attributes etc.
|
|
40
|
+
# :type:: Valid values are :S60 (for Series 60) and :QT (for QT)
|
|
41
|
+
# :id:: Valid id that can be matched in tdriver_parameters.xml
|
|
42
|
+
# === raises
|
|
43
|
+
# ArgumentError:: Wrong argument Type '%s' (Expected Hash)
|
|
44
|
+
# ArgumentError:: SUT type not defined
|
|
45
|
+
# ArgumentError:: SUT type '%s' not supported
|
|
46
|
+
# ArgumentError:: Sut id not given
|
|
47
|
+
# MobyUtil::ParameterFileNotFoundError:: if paramter file 'tdriver_home'/tdriver_parameters.xml is not found
|
|
48
|
+
# === returns
|
|
49
|
+
# Object:: Object that SutFactory returns
|
|
50
|
+
# === example
|
|
51
|
+
# @sut = TDriver.connect_sut(:Id =>'sut_qt') # for qt, id in configuration file sut_qt
|
|
52
|
+
def self.connect_sut( sut_attributes = {} )
|
|
53
|
+
|
|
54
|
+
# if given arguments is type of Symbol expect is as SUT id
|
|
55
|
+
sut_attributes = { :Id => sut_attributes } if sut_attributes.kind_of? Symbol
|
|
56
|
+
|
|
57
|
+
Kernel::raise ArgumentError.new( "Wrong argument type '%s' (Expected Hash)" % sut_attributes.class ) unless sut_attributes.kind_of?( Hash )
|
|
58
|
+
Kernel::raise ArgumentError.new( "Sut id not given!" ) unless sut_attributes.has_key?( :Id )
|
|
59
|
+
|
|
60
|
+
MobyBase::SUTFactory.instance.make( sut_attributes[ :Id ] )
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Function to disconnect SUT object.
|
|
64
|
+
# === params
|
|
65
|
+
# hash:: Defines SUT type, identification attributes etc.
|
|
66
|
+
# :id:: Valid id that can be matched in tdriver_parameters.xml and is already connected
|
|
67
|
+
# === raises
|
|
68
|
+
# ArgumentError:: Not connected to device 'id' if not connected at all / device already disconnected
|
|
69
|
+
# ArgumentError:: Sut id not given
|
|
70
|
+
# === returns
|
|
71
|
+
# Object:: SUT object
|
|
72
|
+
# === example
|
|
73
|
+
# @sut = TDriver.disconnect_sut(:Id =>'sut_qt') # for qt, should be connected already
|
|
74
|
+
def self.disconnect_sut( sut_attributes = {} )
|
|
75
|
+
|
|
76
|
+
# if given arguments is type of Symbol expect is as SUT id
|
|
77
|
+
sut_attributes = { :Id => sut_attributes } if sut_attributes.kind_of? Symbol
|
|
78
|
+
|
|
79
|
+
Kernel::raise ArgumentError.new( "Wrong argument type '%s' (Expected Hash)" % sut_attributes.class ) unless sut_attributes.kind_of?( Hash )
|
|
80
|
+
Kernel::raise ArgumentError.new( "Sut id not given!" ) unless sut_attributes.has_key?( :Id )
|
|
81
|
+
|
|
82
|
+
MobyBase::SUTFactory.instance.disconnect_sut( sut_attributes[ :Id ] )
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Function to reboot SUT object.
|
|
87
|
+
# === params
|
|
88
|
+
# hash:: Defines SUT type, identification attributes etc.
|
|
89
|
+
# :id:: Valid id that can be matched in tdriver_parameters.xml and is already connected
|
|
90
|
+
# === raises
|
|
91
|
+
# ArgumentError:: Not connected to device 'id' if not connected at all / device already disconnected
|
|
92
|
+
# ArgumentError:: Sut id not given
|
|
93
|
+
# === example
|
|
94
|
+
# @sut = TDriver.reboot_sut(:Id =>'sut_qt') # for Qt, should be connected already
|
|
95
|
+
def self.reboot_sut( sut_attributes = {} )
|
|
96
|
+
|
|
97
|
+
# if given arguments is type of Symbol expect is as SUT id
|
|
98
|
+
sut_attributes = { :Id => sut_attributes } if sut_attributes.kind_of? Symbol
|
|
99
|
+
|
|
100
|
+
Kernel::raise ArgumentError.new( "Wrong argument type '%s' (Expected Hash)" % sut_attributes.class ) unless sut_attributes.kind_of?( Hash )
|
|
101
|
+
Kernel::raise ArgumentError.new( "Sut id not given!" ) unless sut_attributes.has_key?( :Id )
|
|
102
|
+
|
|
103
|
+
MobyBase::SUTFactory.instance.reboot_sut( sut_attributes[ :Id ] )
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Wrapper for SUT functionality. For documentation, please see TDriver::connect_sut
|
|
108
|
+
def self.sut( *args )
|
|
109
|
+
|
|
110
|
+
self.connect_sut( *args )
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Wrapper for MobyUtil::Parameter.configured_suts to retrieve all configured sut names
|
|
115
|
+
def self.suts
|
|
116
|
+
|
|
117
|
+
MobyUtil::Parameter.configured_suts
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Wrapper for MobyUtil::ParameterUserAPI class with methods e.g. [] and []=, files and load_xml etc.
|
|
122
|
+
def self.parameter
|
|
123
|
+
|
|
124
|
+
@matti_parameter_instance || ( @matti_parameter_instance = MobyUtil::ParameterUserAPI.instance )
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def self.logger
|
|
129
|
+
|
|
130
|
+
@tdriver_logger_instance || ( @tdriver_logger_instance = MobyUtil::Logger.instance )
|
|
131
|
+
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# enable hooking for performance measurement & debug logging
|
|
135
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
end # TDriver
|
|
139
|
+
|
|
140
|
+
if ARGV.include?( '--debug_exceptions' ) || TDriver.parameter[ :debug_exceptions, 'false' ].to_s.downcase == 'true'
|
|
141
|
+
|
|
142
|
+
# for debugging to see every occured exception
|
|
143
|
+
def Kernel::raise( *args )
|
|
144
|
+
|
|
145
|
+
exception = args.first || $!
|
|
146
|
+
|
|
147
|
+
backtrace = caller.collect{ | line | " %s" % line }.join("\n")
|
|
148
|
+
|
|
149
|
+
puts "%s: %s\nBacktrace: \n%s\n\n" % [ exception.class, exception.message, backtrace ]
|
|
150
|
+
|
|
151
|
+
super
|
|
152
|
+
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Enable logging engine
|
|
158
|
+
MobyUtil::Logger.instance.enable_logging()
|
|
@@ -0,0 +1,24 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
|
|
21
|
+
STDOUT.puts "Please require 'util/common/loader.rb' instead of 'util/common.rb'"
|
|
22
|
+
|
|
23
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'common/loader.rb' ) )
|
|
24
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
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 Testability Driver.
|
|
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 MobyUtil
|
|
21
|
+
|
|
22
|
+
class ArrayHelper
|
|
23
|
+
|
|
24
|
+
def self.rindex_regexp( array, pattern )
|
|
25
|
+
|
|
26
|
+
Kernel::raise TypeError.new("Unexpected variable type '%s' for array (Expected: %s)" % [ array.class, 'Array'] ) unless array.kind_of?( Array )
|
|
27
|
+
Kernel::raise TypeError.new("Unexpected variable type '%s' for regular expression pattern (Expected: %s)" % [ pattern.class, 'Regexp'] ) unless pattern.kind_of?( Regexp )
|
|
28
|
+
|
|
29
|
+
# return nil if no matches found, otherwise return index of value
|
|
30
|
+
return nil if ( array.reverse.each_index{ | index | return @rindex if array[ ( @rindex = ( ( array.size-1 ) - index ) ) ] =~ pattern; } )
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# enable hooking for performance measurement & debug logging
|
|
35
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
36
|
+
|
|
37
|
+
end # ArrayHelper
|
|
38
|
+
|
|
39
|
+
end # MobyUtil
|
|
@@ -0,0 +1,100 @@
|
|
|
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 Testability Driver.
|
|
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 CRC
|
|
21
|
+
|
|
22
|
+
class Crc16
|
|
23
|
+
|
|
24
|
+
@@CCITT_16 = [
|
|
25
|
+
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
|
26
|
+
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
|
27
|
+
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
|
28
|
+
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
|
|
29
|
+
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
|
|
30
|
+
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
|
|
31
|
+
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
|
|
32
|
+
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
|
|
33
|
+
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
|
|
34
|
+
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
|
|
35
|
+
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
|
|
36
|
+
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
|
|
37
|
+
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
|
|
38
|
+
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
|
|
39
|
+
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
|
|
40
|
+
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
|
|
41
|
+
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
|
|
42
|
+
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
|
|
43
|
+
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
|
|
44
|
+
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
|
|
45
|
+
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
|
|
46
|
+
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
|
|
47
|
+
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
|
|
48
|
+
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
|
|
49
|
+
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
|
|
50
|
+
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
|
|
51
|
+
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
|
|
52
|
+
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
|
|
53
|
+
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
|
|
54
|
+
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
|
|
55
|
+
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
|
|
56
|
+
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
@@IBM_16 = [
|
|
60
|
+
0x0000, 0x1081, 0x2102, 0x3183,
|
|
61
|
+
0x4204, 0x5285, 0x6306, 0x7387,
|
|
62
|
+
0x8408, 0x9489, 0xa50a, 0xb58b,
|
|
63
|
+
0xc60c, 0xd68d, 0xe70e, 0xf78f
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
def self.crc16( buf, crc = 0 )
|
|
67
|
+
buf.each_byte{ | x | crc = ( ( crc << 8 ) ^ @@CCITT_16[ ( crc >> 8 ) ^ x ] ) & 0xffff }
|
|
68
|
+
crc
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# use native crc calculation routines if available; using native crc routines increase performance ~10%
|
|
72
|
+
if defined?( TDriver::NativeExtensions )
|
|
73
|
+
|
|
74
|
+
def self.crc16_ibm( buf, crc = 0 )
|
|
75
|
+
|
|
76
|
+
TDriver::NativeExtensions::CRC.crc16_ibm( buf )
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
else
|
|
81
|
+
|
|
82
|
+
# fallback when native extensions are not supported (e.g. jruby)
|
|
83
|
+
def self.crc16_ibm( buf, crc = 0 )
|
|
84
|
+
crc = 0xffff
|
|
85
|
+
buf.each_byte do | c |
|
|
86
|
+
crc = ( ( crc >> 4 ) & 0x0fff ) ^ @@IBM_16[ ( ( crc ^ c ) & 15 ) ]
|
|
87
|
+
c >>= 4
|
|
88
|
+
crc = ( ( crc >> 4 ) & 0x0fff ) ^ @@IBM_16[ ( ( crc ^ c ) & 15 ) ]
|
|
89
|
+
end
|
|
90
|
+
~crc & 0xffff
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# enable hooking for performance measurement & debug logging
|
|
96
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
97
|
+
|
|
98
|
+
end # Crc16
|
|
99
|
+
|
|
100
|
+
end # CRC
|
|
@@ -0,0 +1,153 @@
|
|
|
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 Testability Driver.
|
|
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 MobyUtil
|
|
21
|
+
|
|
22
|
+
class EnvironmentHelper
|
|
23
|
+
|
|
24
|
+
UNKNOWN = :unknown
|
|
25
|
+
|
|
26
|
+
LINUX = :linux
|
|
27
|
+
SOLARIS = :solaris
|
|
28
|
+
WINDOWS = :windows
|
|
29
|
+
OSX = :osx
|
|
30
|
+
CYGWIN = :cygwin
|
|
31
|
+
|
|
32
|
+
def self.java?
|
|
33
|
+
|
|
34
|
+
RUBY_PLATFORM == "java"
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.posix?
|
|
39
|
+
|
|
40
|
+
( platform == LINUX || platform == OSX || platform == CYGWIN || platform == SOLARIS )
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.cygwin?
|
|
45
|
+
|
|
46
|
+
platform == CYGWIN
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.solaris?
|
|
51
|
+
|
|
52
|
+
platform == SOLARIS
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.linux?
|
|
57
|
+
|
|
58
|
+
platform == LINUX
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.windows?
|
|
63
|
+
|
|
64
|
+
platform == WINDOWS
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.osx?
|
|
69
|
+
|
|
70
|
+
platform == OSX
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.unknown_os?
|
|
75
|
+
|
|
76
|
+
platform == UNKNOWN
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Function to retrieve platform type
|
|
81
|
+
# == returns
|
|
82
|
+
# Integer:: LINUX
|
|
83
|
+
def self.platform
|
|
84
|
+
|
|
85
|
+
case Config::CONFIG[ 'host_os' ]
|
|
86
|
+
|
|
87
|
+
when /mswin|mingw|windows/i
|
|
88
|
+
|
|
89
|
+
WINDOWS
|
|
90
|
+
|
|
91
|
+
when /cygwin/i
|
|
92
|
+
|
|
93
|
+
CYGWIN
|
|
94
|
+
|
|
95
|
+
when /linux/i
|
|
96
|
+
|
|
97
|
+
LINUX
|
|
98
|
+
|
|
99
|
+
when /sunos|solaris/i
|
|
100
|
+
|
|
101
|
+
SOLARIS
|
|
102
|
+
|
|
103
|
+
when /darwin/
|
|
104
|
+
|
|
105
|
+
OSX
|
|
106
|
+
|
|
107
|
+
else
|
|
108
|
+
|
|
109
|
+
OTHER
|
|
110
|
+
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Function to retrieve platform type
|
|
116
|
+
# == returns
|
|
117
|
+
# String::
|
|
118
|
+
def self.ruby_platform
|
|
119
|
+
|
|
120
|
+
Config::CONFIG[ 'target_os' ]
|
|
121
|
+
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def self.change_file_ownership!( target, user_name, user_group, recursively = true )
|
|
125
|
+
|
|
126
|
+
`chown -h #{ recursively ? '-R' : '' } #{ user_name }:#{ user_group } #{ target }` if MobyUtil::EnvironmentHelper.posix?
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# linux
|
|
131
|
+
def self.user_group( name = nil )
|
|
132
|
+
|
|
133
|
+
`id -g -n #{ name }`.chomp if MobyUtil::EnvironmentHelper.posix?
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# linux
|
|
138
|
+
def self.user_name
|
|
139
|
+
|
|
140
|
+
result = ENV[ 'LOGNAME' ]
|
|
141
|
+
result = ENV[ 'SUDO_USER' ] if result == "root" || result == ""
|
|
142
|
+
result = ENV[ 'USER' ] if result == "root" || result == ""
|
|
143
|
+
|
|
144
|
+
result
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# enable hooking for performance measurement & debug logging
|
|
149
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
150
|
+
|
|
151
|
+
end # EnvironmentHelper
|
|
152
|
+
|
|
153
|
+
end # MobyUtil
|