uttk 0.3.6.1 → 0.4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/BESTOF +13 -0
- data/ChangeLog +19 -0
- data/MATRIX +6 -0
- data/NEWS +34 -4
- data/PITFALLS +13 -0
- data/Rakefile +19 -2
- data/SPEC.gemspec +18 -0
- data/SPEC.yml +21 -7
- data/bin/getopts/uttk.rb +23 -10
- data/lib/uttk.rb +16 -12
- data/lib/uttk/dumpers/Mail.rb +41 -0
- data/lib/uttk/dumpers/Yaml.rb +2 -2
- data/lib/uttk/filters/KeepSkipBased.rb +1 -1
- data/lib/uttk/generators/templates/loader.rb +1 -1
- data/lib/uttk/generators/templates/strategy-command.rb +72 -0
- data/lib/uttk/generators/templates/strategy.rb +4 -3
- data/lib/uttk/generators/templates/unit_test.rb +1 -1
- data/lib/uttk/loaders/Loader.rb +1 -1
- data/lib/uttk/loaders/Ruby.rb +1 -1
- data/lib/uttk/loaders/Yaml.rb +2 -2
- data/lib/uttk/logger/section_node.rb +1 -1
- data/lib/uttk/logger/severity.rb +1 -1
- data/lib/uttk/logger/to_uttk_log.rb +2 -2
- data/lib/uttk/logger/verbosity.rb +1 -1
- data/lib/uttk/logger_factory.rb +1 -1
- data/lib/uttk/status.rb +1 -1
- data/lib/uttk/strategies/Abort.rb +1 -1
- data/lib/uttk/strategies/Assert.rb +1 -1
- data/lib/uttk/strategies/Authors.rb +2 -2
- data/lib/uttk/strategies/Bootstrap.rb +38 -11
- data/lib/uttk/strategies/Checkout.rb +3 -2
- data/lib/uttk/strategies/Clean.rb +1 -1
- data/lib/uttk/strategies/Collection.rb +3 -3
- data/lib/uttk/strategies/Command.rb +95 -0
- data/lib/uttk/strategies/Composite/contents_eval.rb +1 -1
- data/lib/uttk/strategies/Configure.rb +34 -25
- data/lib/uttk/strategies/Error.rb +1 -1
- data/lib/uttk/strategies/Fail.rb +1 -1
- data/lib/uttk/strategies/HostSelector.rb +143 -0
- data/lib/uttk/strategies/Import.rb +2 -2
- data/lib/uttk/strategies/Iterate.rb +1 -1
- data/lib/uttk/strategies/JUnit.rb +1 -1
- data/lib/uttk/strategies/Jump.rb +81 -0
- data/lib/uttk/strategies/Make.rb +28 -58
- data/lib/uttk/strategies/Package.rb +5 -6
- data/lib/uttk/strategies/PackageCollection.rb +1 -1
- data/lib/uttk/strategies/Pass.rb +1 -1
- data/lib/uttk/strategies/RUnit.rb +63 -49
- data/lib/uttk/strategies/SignalCmd.rb +1 -1
- data/lib/uttk/strategies/Sleep.rb +1 -1
- data/lib/uttk/strategies/SqlQuery.rb +1 -1
- data/lib/uttk/strategies/Strategy.rb +153 -3
- data/lib/uttk/strategies/SubCmd.rb +51 -31
- data/lib/uttk/strategies/Suite.rb +1 -1
- data/lib/uttk/strategies/Test.rb +1 -1
- data/lib/uttk/strategies/{ProbabilityThreshold.rb → Threshold.rb} +3 -3
- data/lib/uttk/streams.rb +1 -1
- data/lib/uttk/streams/Diff.rb +1 -1
- data/lib/uttk/streams/Stream.rb +1 -1
- data/lib/uttk/version_id.rb +1 -1
- data/lib/uttk/weights/WExpr.rb +1 -1
- data/lib/uttk/weights/WFloat.rb +1 -1
- data/lib/uttk/weights/WMin.rb +1 -1
- data/lib/uttk/weights/Weight.rb +1 -1
- data/lib/www/images/opentriangle.gif +0 -0
- data/lib/www/images/triangle.gif +0 -0
- data/lib/www/stylesheets/uttk.css +167 -0
- data/misc/expandtab.rb +1 -1
- data/test/examples/students/mini-lib.yml +1 -1
- data/test/fixtures/binaries/segv +0 -0
- data/test/functional/base.yml +29 -0
- data/test/functional/cat.yml +2 -2
- data/test/functional/cmd.yml +5 -0
- data/test/functional/command.yml +14 -0
- data/test/functional/diff.yml +2 -2
- data/test/functional/env_cmd.yml +3 -3
- data/test/functional/exit.yml +1 -1
- data/test/functional/host_selector.yml +30 -0
- data/test/functional/iterate.yml +31 -37
- data/test/functional/jump.yml +34 -0
- data/test/functional/pkg.yml +1 -1
- data/test/functional/{probability_threshold.yml → threshold.yml} +2 -2
- data/test/functional/timeout.yml +1 -1
- data/test/functional/wc.yml +2 -2
- data/test/unit/dumpers/mail_test.rb +46 -0
- data/test/unit/filters/keep_skip_based_test.rb +1 -1
- data/test/unit/filters/text_filter_test.rb +1 -1
- metadata +258 -253
- data/test/fixtures/demo/command-tutorial/steps/1/check.yml +0 -5
- data/test/fixtures/demo/command-tutorial/steps/1/pluralizer.rb +0 -10
- data/test/fixtures/demo/command-tutorial/steps/2/bad_check.yml +0 -7
- data/test/fixtures/demo/command-tutorial/steps/2/check.yml +0 -7
- data/test/fixtures/demo/command-tutorial/steps/2/pluralizer.rb +0 -10
- data/test/fixtures/demo/command-tutorial/steps/3.1/check.yml +0 -12
- data/test/fixtures/demo/command-tutorial/steps/3/check.yml +0 -14
- data/test/fixtures/demo/command-tutorial/steps/4.1/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/4.1/check.yml +0 -12
- data/test/fixtures/demo/command-tutorial/steps/4/check.yml +0 -12
- data/test/fixtures/demo/command-tutorial/steps/4/pluralizer.rb +0 -12
- data/test/fixtures/demo/command-tutorial/steps/5.1/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/5.1/check.yml +0 -17
- data/test/fixtures/demo/command-tutorial/steps/5.1/pluralizer.rb +0 -17
- data/test/fixtures/demo/command-tutorial/steps/5/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/5/check.yml +0 -16
- data/test/fixtures/demo/command-tutorial/steps/5/pluralizer.rb +0 -16
- data/test/fixtures/demo/command-tutorial/steps/6.1/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/6.1/check.yml +0 -22
- data/test/fixtures/demo/command-tutorial/steps/6.1/pluralizer.rb +0 -17
- data/test/fixtures/demo/command-tutorial/steps/6/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/6/check.yml +0 -21
- data/test/fixtures/demo/command-tutorial/steps/6/pluralizer.rb +0 -17
- data/test/fixtures/demo/command-tutorial/steps/7/bird.txt +0 -1
- data/test/fixtures/demo/command-tutorial/steps/7/check.yml +0 -22
- data/test/fixtures/demo/command-tutorial/steps/7/pluralizer.rb +0 -17
@@ -0,0 +1,72 @@
|
|
1
|
+
# Author:: <%= fullname %> <<%= email %>>.
|
2
|
+
# Copyright:: Copyright (c) <%= year %> Uttk Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/generators/templates/strategy-command.rb 24395 2006-07-10T07:52:32.589929Z ertai $
|
5
|
+
|
6
|
+
|
7
|
+
module Uttk
|
8
|
+
|
9
|
+
module Strategies
|
10
|
+
|
11
|
+
class <%= class_name %> < Strategy
|
12
|
+
include Concrete
|
13
|
+
|
14
|
+
#
|
15
|
+
# Methods
|
16
|
+
#
|
17
|
+
|
18
|
+
def prologue
|
19
|
+
super
|
20
|
+
@runner = mk_system_runner
|
21
|
+
@command = 'a_command...'.to_ocmd
|
22
|
+
# ...
|
23
|
+
end
|
24
|
+
protected :prologue
|
25
|
+
|
26
|
+
|
27
|
+
def run_impl
|
28
|
+
@my_data = @command.run @runner
|
29
|
+
end
|
30
|
+
protected :run_impl
|
31
|
+
|
32
|
+
|
33
|
+
def assertion
|
34
|
+
assert_cmd UM::StreamMatcher, @my_data,
|
35
|
+
:output => ...,
|
36
|
+
:error => ...,
|
37
|
+
:exit => ...
|
38
|
+
# ...
|
39
|
+
pass
|
40
|
+
end
|
41
|
+
protected :assertion
|
42
|
+
|
43
|
+
|
44
|
+
def abort_hook
|
45
|
+
@runner.abort @my_data if @runner and defined? @my_data
|
46
|
+
super
|
47
|
+
end
|
48
|
+
protected :abort_hook
|
49
|
+
|
50
|
+
|
51
|
+
def epilogue
|
52
|
+
@my_data.clean if defined? @my_data
|
53
|
+
super
|
54
|
+
end
|
55
|
+
protected :epilogue
|
56
|
+
|
57
|
+
|
58
|
+
#
|
59
|
+
# Attributes
|
60
|
+
#
|
61
|
+
|
62
|
+
# Contains the OCmd::Datas::Data object, the result of the command running.
|
63
|
+
attr_reader :my_data
|
64
|
+
|
65
|
+
attribute :an_attribute, 'a description', THE_CLASS, DEFAULT_VALUE,
|
66
|
+
:mandatory, :invisible
|
67
|
+
|
68
|
+
end # class <%= class_name %>
|
69
|
+
|
70
|
+
end # module Strategies
|
71
|
+
|
72
|
+
end # module Uttk
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: <%= fullname %> <<%= email %>>.
|
2
2
|
# Copyright:: Copyright (c) <%= year %> Uttk Team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# Revision:: $Id: /fey/uttk/trunk/lib/uttk/generators/templates/strategy.rb
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/generators/templates/strategy.rb 24396 2006-07-10T08:23:37.784417Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -24,7 +24,7 @@ module Uttk
|
|
24
24
|
|
25
25
|
def run_impl
|
26
26
|
# ...
|
27
|
-
super
|
27
|
+
super # useless when subclassing Strategy
|
28
28
|
# ...
|
29
29
|
end
|
30
30
|
protected :run_impl
|
@@ -32,7 +32,8 @@ module Uttk
|
|
32
32
|
|
33
33
|
def assertion
|
34
34
|
# ...
|
35
|
-
|
35
|
+
fail('the reason') if ...
|
36
|
+
pass
|
36
37
|
end
|
37
38
|
protected :assertion
|
38
39
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: <%= fullname %> <<%= email %>>.
|
2
2
|
# Copyright:: Copyright (c) <%= year %> Uttk Team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# Revision:: $Id: /fey/uttk/trunk/lib/uttk/generators/templates/unit_test.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/generators/templates/unit_test.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
test_section __FILE__ do
|
7
7
|
|
data/lib/uttk/loaders/Loader.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/loaders/Loader.rb 8788 2005-09-27T14:23:19.686215Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/loaders/Loader.rb 8788 2005-09-27T14:23:19.686215Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
data/lib/uttk/loaders/Ruby.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despr�s <nicolas.despres@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/loaders/Ruby.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/loaders/Ruby.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
data/lib/uttk/loaders/Yaml.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/loaders/Yaml.rb
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/loaders/Yaml.rb 24396 2006-07-10T08:23:37.784417Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
require 'yaml'
|
@@ -36,7 +36,7 @@ module YAML
|
|
36
36
|
|
37
37
|
module BaseNode
|
38
38
|
|
39
|
-
CLASS_KEY_LIST = [:strategy, :wclass, :symtbl_class]
|
39
|
+
CLASS_KEY_LIST = [:strategy, :wclass, :symtbl_class, :matcher]
|
40
40
|
|
41
41
|
def key_transform ( t, k, v )
|
42
42
|
k = k.uttk_loader_yaml_transform if k.is_a? BaseNode
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/logger/section_node.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/logger/section_node.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
data/lib/uttk/logger/severity.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/logger/severity.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/logger/severity.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/logger/to_uttk_log.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/logger/to_uttk_log.rb 24396 2006-07-10T08:23:37.784417Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -54,7 +54,7 @@ module Uttk
|
|
54
54
|
end # class ::Hash
|
55
55
|
|
56
56
|
|
57
|
-
|
57
|
+
::OHash.class_eval do
|
58
58
|
|
59
59
|
def to_uttk_log_with_key ( key, log )
|
60
60
|
super key, log, :ordered => true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/logger/verbosity.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/logger/verbosity.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
#FIXME: manage "attr_once"
|
data/lib/uttk/logger_factory.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/logger_factory.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/logger_factory.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
data/lib/uttk/status.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/status.rb 8800 2005-10-09T11:12:27.126567Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/status.rb 8800 2005-10-09T11:12:27.126567Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/strategies/Abort.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Abort.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# Revision:: $Id: /fey/uttk/trunk/lib/uttk/strategies/Assert.rb 8789 2005-09-27T14:49:49.088376Z ertai $
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Assert.rb 8789 2005-09-27T14:49:49.088376Z ertai $
|
5
5
|
|
6
6
|
require 'test/unit'
|
7
7
|
Test::Unit.run = true
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Marco Tessari <marco.tessari@epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Authors.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Authors.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -23,7 +23,7 @@ module Uttk
|
|
23
23
|
authors = []
|
24
24
|
IO.foreach(author) do |line|
|
25
25
|
authors << $1 if line =~ /^\* ([-a-z]{1,6}_[-_a-zA-Z\d]).*$/
|
26
|
-
|
26
|
+
end
|
27
27
|
|
28
28
|
unless authors.include?(@author)
|
29
29
|
fail "AUTHORS not well formatted"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Bootstrap.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Bootstrap.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -11,7 +11,7 @@ module Uttk
|
|
11
11
|
# Run the bootstrap(.sh)? script or a classic autoreconf. This strategy is
|
12
12
|
# used by the _Package_ strategy in case of the tested package does use
|
13
13
|
# the _autotools_ or not.
|
14
|
-
class Bootstrap <
|
14
|
+
class Bootstrap < Strategy
|
15
15
|
include Concrete
|
16
16
|
|
17
17
|
BOOTSTRAP = /bootstrap(\.sh)?/
|
@@ -19,21 +19,48 @@ module Uttk
|
|
19
19
|
|
20
20
|
def prologue
|
21
21
|
super
|
22
|
-
|
22
|
+
@runner = mk_system_runner
|
23
23
|
cmd = self.class.have_bootstrap? @dir
|
24
24
|
if cmd.nil? and Configure.have_configure_input? @dir
|
25
25
|
cmd = AUTORECONF
|
26
26
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
test.command = cmd
|
33
|
-
test.reject :strategy
|
34
|
-
end
|
27
|
+
if cmd.nil? or Configure.have_configure? @dir
|
28
|
+
@bootstrap = nil
|
29
|
+
else
|
30
|
+
@bootstrap = cmd.to_ocmd
|
31
|
+
@bootstrap.dir = @dir
|
35
32
|
end
|
36
33
|
end
|
34
|
+
protected :prologue
|
35
|
+
|
36
|
+
|
37
|
+
def run_impl
|
38
|
+
skip_pass if @bootstrap.nil?
|
39
|
+
@my_data = @bootstrap.run @runner
|
40
|
+
end
|
41
|
+
protected :run_impl
|
42
|
+
|
43
|
+
|
44
|
+
def assertion
|
45
|
+
assert_cmd UM::StreamMatcher, @my_data,
|
46
|
+
:exit => 0, :error => nil, :output => nil
|
47
|
+
pass
|
48
|
+
end
|
49
|
+
protected :assertion
|
50
|
+
|
51
|
+
|
52
|
+
def abort_hook
|
53
|
+
@runner.abort @my_data if @runner and defined? @my_data
|
54
|
+
super
|
55
|
+
end
|
56
|
+
protected :abort_hook
|
57
|
+
|
58
|
+
|
59
|
+
def epilogue
|
60
|
+
@my_data.clean if defined? @my_data
|
61
|
+
super
|
62
|
+
end
|
63
|
+
protected :epilogue
|
37
64
|
|
38
65
|
|
39
66
|
def dir= ( dir )
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Checkout.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Checkout.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
module Uttk
|
7
7
|
|
@@ -16,9 +16,10 @@ module Uttk
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run_impl
|
19
|
+
FileType.import!
|
19
20
|
begin
|
20
21
|
file, data = @url.checkout
|
21
|
-
if data.is_a?
|
22
|
+
if data.is_a? OCmd::Datas::Data
|
22
23
|
out, err = data.output, data.error
|
23
24
|
@log.my_stdout = out.read unless out.nil? or out.size.zero?
|
24
25
|
@log.my_stderr = err.read unless err.nil? or err.size.zero?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Marco Tessari <marco.tessari@epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/strategies/Clean.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Clean.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Collection.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Collection.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -28,9 +28,9 @@ module Uttk
|
|
28
28
|
# collection.
|
29
29
|
def create ( anObject=strategyclass, &block )
|
30
30
|
super do |t|
|
31
|
-
@log.debug{"assign collection attributes #{@attributes.size}"}
|
31
|
+
# @log.debug{"assign collection attributes #{@attributes.size}"}
|
32
32
|
@attributes.each do |k,v|
|
33
|
-
@log.debug{"assign attribute: #{k}"}
|
33
|
+
# @log.debug{"assign attribute: #{k}"}
|
34
34
|
next if k == :contents
|
35
35
|
t.assign_one(k, v, true)
|
36
36
|
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2006 Uttk team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Command.rb 24393 2006-07-10T07:38:49.140737Z ertai $
|
5
|
+
|
6
|
+
|
7
|
+
module Uttk
|
8
|
+
|
9
|
+
module Strategies
|
10
|
+
|
11
|
+
# I can check many interaction with a command line based program, such as:
|
12
|
+
# its standard output, exit status, standard error. I can specify to a
|
13
|
+
# given command its arguments, environment variables and standard input.
|
14
|
+
#
|
15
|
+
# A tutorial introduces how to use this strategy at
|
16
|
+
# http://uttk.org/shelf/documentation
|
17
|
+
class Command < Strategy
|
18
|
+
include Concrete
|
19
|
+
|
20
|
+
#
|
21
|
+
# Methods
|
22
|
+
#
|
23
|
+
|
24
|
+
def prologue
|
25
|
+
super
|
26
|
+
@runner = mk_system_runner @env
|
27
|
+
@command = @command.to_ocmd
|
28
|
+
@command += @args.to_ocmd_args
|
29
|
+
@command.dir = @dir
|
30
|
+
@command.input = @input
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def run_impl
|
35
|
+
@my_data = @command.run @runner
|
36
|
+
end
|
37
|
+
protected :run_impl
|
38
|
+
|
39
|
+
|
40
|
+
def assertion
|
41
|
+
assert_cmd @matcher, @my_data,
|
42
|
+
:output => @output,
|
43
|
+
:error => @error,
|
44
|
+
:exit => @exit
|
45
|
+
pass
|
46
|
+
end
|
47
|
+
protected :assertion
|
48
|
+
|
49
|
+
|
50
|
+
def abort_hook
|
51
|
+
@runner.abort @my_data if @runner and defined? @my_data
|
52
|
+
super
|
53
|
+
end
|
54
|
+
protected :abort_hook
|
55
|
+
|
56
|
+
|
57
|
+
def epilogue
|
58
|
+
@my_data.clean if defined? @my_data
|
59
|
+
super
|
60
|
+
end
|
61
|
+
protected :epilogue
|
62
|
+
|
63
|
+
|
64
|
+
#
|
65
|
+
# Attributes
|
66
|
+
#
|
67
|
+
|
68
|
+
# Contains the OCmd::Datas::Data object, the result of the command running.
|
69
|
+
attr_reader :my_data
|
70
|
+
|
71
|
+
# The OCmd::Runners::Runner used to run the command.
|
72
|
+
attr_accessor :runner
|
73
|
+
|
74
|
+
attribute :command, 'the command to execute', :mandatory,
|
75
|
+
[String, Pathname, Array]
|
76
|
+
attribute :dir, 'the directory where to launch the command',
|
77
|
+
[String, Pathname]
|
78
|
+
attribute :args, 'the arguments for the command',
|
79
|
+
[Array, String, Numeric]
|
80
|
+
|
81
|
+
attribute :input, 'the input reference', :invisible, nil
|
82
|
+
attribute :output, 'the output reference', :invisible, nil
|
83
|
+
attribute :error, 'the error reference', :invisible, nil
|
84
|
+
|
85
|
+
attribute :exit, 'the exit status reference', Integer
|
86
|
+
attribute :env, 'environment variables', Hash do {} end
|
87
|
+
|
88
|
+
attribute :matcher, 'the matcher class (< UM::UnfiedMatcher)',
|
89
|
+
[Class, UM::UnifiedMatcher], UM::StreamMatcher.new
|
90
|
+
|
91
|
+
end # class Command
|
92
|
+
|
93
|
+
end # module Strategies
|
94
|
+
|
95
|
+
end # module Uttk
|