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
@@ -1,7 +1,7 @@
|
|
1
1
|
# Author:: Nicolas Despr�s <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/Composite/contents_eval.rb 8788 2005-09-27T14:23:19.686215Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Composite/contents_eval.rb 8788 2005-09-27T14:23:19.686215Z 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/Configure.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Configure.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -10,40 +10,49 @@ module Uttk
|
|
10
10
|
|
11
11
|
# I run then check whether the configure stage of a compilation process fail.
|
12
12
|
# I used in the _Package_ strategy to handle the configuration stage.
|
13
|
-
class Configure <
|
13
|
+
class Configure < Strategy
|
14
14
|
include Concrete
|
15
15
|
|
16
16
|
CONFIGURE = /^configure(\.sh)?$/
|
17
17
|
CONFIGURE_INPUT = /^configure\.(ac|in)$/
|
18
18
|
|
19
|
-
def mk_command ( script )
|
20
|
-
cmd = script.to_s
|
21
|
-
cmd += " --prefix=#@prefix" if @prefix
|
22
|
-
if @flags.is_a? Array
|
23
|
-
@flags = @flags.join(' ')
|
24
|
-
else
|
25
|
-
@flags = @flags.to_s
|
26
|
-
end
|
27
|
-
symtbl_configure_flags = @symtbl[:configure_flags]
|
28
|
-
@flags += ' ' + symtbl_configure_flags unless symtbl_configure_flags.nil?
|
29
|
-
@symtbl[:configure_flags] = @flags
|
30
|
-
cmd + ' ' + @flags
|
31
|
-
end
|
32
|
-
|
33
19
|
def prologue
|
34
20
|
super
|
35
|
-
@
|
21
|
+
@runner = mk_system_runner
|
22
|
+
@dir = @dir.to_path
|
36
23
|
if script = self.class.have_configure?(@dir)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
test.verbose_print = true
|
43
|
-
test.reject :strategy, :dir
|
44
|
-
end
|
24
|
+
flags = @flags.to_ocmd_args + @symtbl[:configure_flags].to_ocmd_args
|
25
|
+
flags << "--prefix=#@prefix" if @prefix
|
26
|
+
@symtbl[:configure_flags] = flags
|
27
|
+
@configure = script.to_ocmd + @flags
|
28
|
+
@configure.dir = @dir
|
45
29
|
end
|
46
30
|
end
|
31
|
+
protected :prologue
|
32
|
+
|
33
|
+
def run_impl
|
34
|
+
@my_data = @configure.run @runner
|
35
|
+
end
|
36
|
+
protected :run_impl
|
37
|
+
|
38
|
+
def assertion
|
39
|
+
assert_cmd UM::StreamMatcher, @my_data,
|
40
|
+
:exit => 0, :error => nil, :output => nil
|
41
|
+
pass
|
42
|
+
end
|
43
|
+
protected :assertion
|
44
|
+
|
45
|
+
def abort_hook
|
46
|
+
@runner.abort @my_data if @runner and defined? @my_data
|
47
|
+
super
|
48
|
+
end
|
49
|
+
protected :abort_hook
|
50
|
+
|
51
|
+
def epilogue
|
52
|
+
@my_data.clean if defined? @my_data
|
53
|
+
super
|
54
|
+
end
|
55
|
+
protected :epilogue
|
47
56
|
|
48
57
|
def self.have_configure_input? ( dir=Pathname.new('.') )
|
49
58
|
res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE_INPUT }
|
@@ -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/strategies/Error.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Error.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
data/lib/uttk/strategies/Fail.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/strategies/Fail.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Fail.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 TTK Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/strategies/HostSelector.rb 29680 2006-09-13T07:36:54.996888Z ertai $
|
5
|
+
|
6
|
+
module Uttk
|
7
|
+
|
8
|
+
module Strategies
|
9
|
+
|
10
|
+
#
|
11
|
+
# Example:
|
12
|
+
# root: !S::Suite
|
13
|
+
# contents:
|
14
|
+
# - selector: !S::HostSelector
|
15
|
+
# hosts: # The list of hosts.
|
16
|
+
# - ssh://joe:tux@foo.com # Via ssh on foo.com.
|
17
|
+
# - druby://bar.fr:4242/ttk # Another custom protocol.
|
18
|
+
# - ... # Hosts can also be specified
|
19
|
+
# # with a file containing hosts
|
20
|
+
# # or an url.
|
21
|
+
# static_select: | # Performed just one time.
|
22
|
+
# reject! { |x| not x.alive? } # Example of static cleaning.
|
23
|
+
# shuffle! # Shuffle the hosts.
|
24
|
+
# dynamic_select: | # Called to elect an host.
|
25
|
+
# roll # Move the first host to the
|
26
|
+
# # end of the list and return it
|
27
|
+
# # Other examples:
|
28
|
+
# # - first (take the first)
|
29
|
+
# # - choose (randomly)
|
30
|
+
# - big suite: !S::Pool
|
31
|
+
# attribute: !S::Jump
|
32
|
+
# to: !url <<host_selector.elect>>
|
33
|
+
# test: !S::Suite
|
34
|
+
# ... something long ...
|
35
|
+
# contents:
|
36
|
+
# - ...
|
37
|
+
# - ...
|
38
|
+
#
|
39
|
+
class HostSelector < Strategy
|
40
|
+
include Concrete
|
41
|
+
|
42
|
+
#
|
43
|
+
# Methods
|
44
|
+
#
|
45
|
+
def elect_host
|
46
|
+
do_dynamic_select
|
47
|
+
end
|
48
|
+
|
49
|
+
def call ( selector, argument )
|
50
|
+
if selector.arity == 1
|
51
|
+
selector[argument]
|
52
|
+
else
|
53
|
+
argument.instance_eval(&selector)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
protected :call
|
57
|
+
|
58
|
+
def do_static_select
|
59
|
+
@hosts_pool = @hosts.dup
|
60
|
+
result = call(@static_select, @hosts_pool)
|
61
|
+
@hosts_pool = result unless result.nil?
|
62
|
+
end
|
63
|
+
protected :do_static_select
|
64
|
+
|
65
|
+
def do_dynamic_select
|
66
|
+
call(@dynamic_select, @hosts_pool)
|
67
|
+
end
|
68
|
+
protected :do_dynamic_select
|
69
|
+
|
70
|
+
#
|
71
|
+
# Suppose that we have URI::Generic#load_average which returns the current
|
72
|
+
# load average of the targeted host.
|
73
|
+
#
|
74
|
+
# With dynamic select you can simply do that
|
75
|
+
#
|
76
|
+
# dynamic_select:
|
77
|
+
# min { |x, y| x.load_average <=> y.load_average }
|
78
|
+
#
|
79
|
+
# dynamic_min:
|
80
|
+
# load_average
|
81
|
+
#
|
82
|
+
# dynamic_min:
|
83
|
+
# ((alive?)? 0 : Float::MAX) + 3 * load_average.first + 5 * current_jobs_count
|
84
|
+
def do_dynamic_min
|
85
|
+
@hosts_pool.min { |x, y| call(dynamic_min, x) <=> call(dynamic_min, y) }
|
86
|
+
end
|
87
|
+
protected :do_dynamic_min
|
88
|
+
|
89
|
+
def prologue
|
90
|
+
super
|
91
|
+
@static_select = @static_select.to_proc
|
92
|
+
@dynamic_select = @dynamic_select.to_proc if @dynamic_select
|
93
|
+
@dynamic_min = @dynamic_min.to_proc if @dynamic_min
|
94
|
+
unless @dynamic_select or @dynamic_min
|
95
|
+
raise ArgumentError, "Need at least dynamic_select or dynamic_min"
|
96
|
+
end
|
97
|
+
@symtbl[:host_selector] = self
|
98
|
+
@symtbl[:'host_selector.elect'] = SymTbl::Trigger.new { elect }
|
99
|
+
# ...
|
100
|
+
end
|
101
|
+
protected :prologue
|
102
|
+
|
103
|
+
def run_impl
|
104
|
+
do_static_select
|
105
|
+
# ...
|
106
|
+
super
|
107
|
+
# ...
|
108
|
+
end
|
109
|
+
protected :run_impl
|
110
|
+
|
111
|
+
def assertion
|
112
|
+
pass
|
113
|
+
# ...
|
114
|
+
super
|
115
|
+
end
|
116
|
+
protected :assertion
|
117
|
+
|
118
|
+
def epilogue
|
119
|
+
# ...
|
120
|
+
super
|
121
|
+
end
|
122
|
+
protected :epilogue
|
123
|
+
|
124
|
+
#
|
125
|
+
# Attributes
|
126
|
+
#
|
127
|
+
attribute :hosts,
|
128
|
+
'hosts to distribute',
|
129
|
+
Object, [], :mandatory
|
130
|
+
|
131
|
+
attribute :static_select,
|
132
|
+
'static block for selection (called once)',
|
133
|
+
[String, Proc], 'shuffle'
|
134
|
+
|
135
|
+
attribute :dynamic_select,
|
136
|
+
'dynamic block for selection (called for each election)',
|
137
|
+
[String, Proc], 'roll'
|
138
|
+
|
139
|
+
end # class HostSelector
|
140
|
+
|
141
|
+
end # module Strategies
|
142
|
+
|
143
|
+
end # 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/Import.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Import.rb 53986 2007-01-14T15:03:21.549822Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
@@ -32,7 +32,7 @@ module Uttk
|
|
32
32
|
|
33
33
|
def epilogue
|
34
34
|
@symtbl[:loader] = @save_loader unless @loader.nil?
|
35
|
-
@symtbl[:pwd] = @old_pwd
|
35
|
+
@symtbl[:pwd] = @old_pwd if defined? @old_pwd
|
36
36
|
super
|
37
37
|
end
|
38
38
|
protected :epilogue
|
@@ -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/Iterate.rb 8813 2005-10-12T08:41:50.904292Z ertai $
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Iterate.rb 8813 2005-10-12T08:41:50.904292Z 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/JUnit.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/JUnit.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
#FIXME: adapt me
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
+
# Copyright:: Copyright (c) 2005 TTK Team. All rights reserved.
|
3
|
+
# License:: LGPL
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Jump.rb 53986 2007-01-14T15:03:21.549822Z ertai $
|
5
|
+
|
6
|
+
module Uttk
|
7
|
+
|
8
|
+
module Strategies
|
9
|
+
|
10
|
+
# Jump to a specific url and run a strategy.
|
11
|
+
class Jump < Strategy
|
12
|
+
include Concrete
|
13
|
+
|
14
|
+
#
|
15
|
+
# Methods
|
16
|
+
#
|
17
|
+
|
18
|
+
|
19
|
+
def run_impl
|
20
|
+
super
|
21
|
+
@status = @to.jump_and_eval mk_input do |output|
|
22
|
+
@log.new_node 'Remote execution' do
|
23
|
+
YAML.load_from_io(output.open) do |notif|
|
24
|
+
@log.send(*notif)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
# @log.up
|
28
|
+
end
|
29
|
+
if @status.is_a? Status
|
30
|
+
raise @status
|
31
|
+
else
|
32
|
+
raise_error "Bad status: `#{@status.inspect}'"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
protected :run_impl
|
36
|
+
|
37
|
+
|
38
|
+
def mk_input
|
39
|
+
dumpable_symtbl = SymTbl.new
|
40
|
+
dumpable_symtbl.merge!(@symtbl)
|
41
|
+
dumpable_symtbl.local.delete :log
|
42
|
+
dumpable_symtbl[:master_pwd] = @symtbl[:pwd]
|
43
|
+
marshaled_input = Marshal.dump([@test, dumpable_symtbl]).dump
|
44
|
+
input = "
|
45
|
+
# require 'rubygems'
|
46
|
+
# require_gem 'uttk'
|
47
|
+
# require 'uttk'
|
48
|
+
uttk_dir = '#{Uttk.dir.expand_path}'
|
49
|
+
require \"\#{uttk_dir}\"
|
50
|
+
# FIXME Move the getopts in lib and make it lazy loaded
|
51
|
+
require \"\#{uttk_dir.to_path.parent.parent/'bin'/'getopts'/'uttk'}\"
|
52
|
+
|
53
|
+
test, root_symtbl = Marshal.load #{marshaled_input}
|
54
|
+
opts = Uttk::Getopts::Uttk.parse(['-F', 'Notif'])
|
55
|
+
root_symtbl.merge! opts
|
56
|
+
symtbl = Uttk.default_symtbl(root_symtbl).new_child
|
57
|
+
test.uttk_testify(symtbl).run
|
58
|
+
"
|
59
|
+
end
|
60
|
+
protected :mk_input
|
61
|
+
|
62
|
+
|
63
|
+
def to= ( anObject )
|
64
|
+
@to = anObject
|
65
|
+
@url = anObject.to_url
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Attributes
|
70
|
+
#
|
71
|
+
attribute :to, 'the destination url', [String, URI::Generic], :mandatory
|
72
|
+
|
73
|
+
attribute :test, 'the test to run on the destination url',
|
74
|
+
:mandatory, :invisible, :dont_expand
|
75
|
+
|
76
|
+
|
77
|
+
end # class Jump
|
78
|
+
|
79
|
+
end # module Strategies
|
80
|
+
|
81
|
+
end # module Uttk
|
data/lib/uttk/strategies/Make.rb
CHANGED
@@ -1,85 +1,55 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005, 2006 Uttk team. All rights reserved.
|
3
3
|
# License:: LGPL
|
4
|
-
# $Id: /fey/uttk/trunk/lib/uttk/strategies/Make.rb
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Make.rb 24394 2006-07-10T07:38:58.276210Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
module Uttk
|
8
8
|
|
9
9
|
module Strategies
|
10
10
|
|
11
|
-
class Make <
|
11
|
+
class Make < Strategy
|
12
12
|
include Concrete
|
13
13
|
|
14
|
-
def mk_make_cmd
|
15
|
-
@symtbl[:make] || ENV['MAKE'] || 'make'
|
16
|
-
end
|
17
|
-
|
18
|
-
def mk_cmd ( target, continue_mode, jobs=nil, options='' )
|
19
|
-
make = mk_make_cmd()
|
20
|
-
unless options.empty?
|
21
|
-
case options
|
22
|
-
when Array
|
23
|
-
options = ' ' + options.join(' ')
|
24
|
-
when String
|
25
|
-
options = " #{options}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
opts = ''
|
29
|
-
opts += ' -k' if continue_mode
|
30
|
-
opts += " -j#{jobs}" if jobs
|
31
|
-
"#{make} #{target}#{opts}#{options}"
|
32
|
-
end
|
33
|
-
|
34
14
|
def prologue
|
35
15
|
super
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# test.reject :status
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class Target
|
48
|
-
include Abstract
|
49
|
-
def target
|
50
|
-
self.class.target
|
51
|
-
end
|
52
|
-
def self.target
|
53
|
-
name.downcase.sub(/^.*:/, '')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class Default < Target
|
58
|
-
include Concrete
|
59
|
-
def self.target
|
60
|
-
''
|
61
|
-
end
|
16
|
+
@runner = mk_system_runner
|
17
|
+
@make = (@symtbl[:make] || ENV['MAKE'] || 'make').to_ocmd
|
18
|
+
@make.dir = @dir
|
19
|
+
@make += @options.to_ocmd_args
|
20
|
+
@make << '-k' if @continue_mode
|
21
|
+
@make << "-j#@jobs" if @jobs
|
22
|
+
@make << @target unless @target.blank?
|
62
23
|
end
|
24
|
+
protected :prologue
|
63
25
|
|
64
|
-
|
65
|
-
|
26
|
+
def run_impl
|
27
|
+
@my_data = @make.run(@runner)
|
66
28
|
end
|
29
|
+
protected :run_impl
|
67
30
|
|
68
|
-
|
69
|
-
|
31
|
+
def abort_hook
|
32
|
+
@runner.abort @my_data if @runner and defined? @my_data
|
33
|
+
super
|
70
34
|
end
|
35
|
+
protected :abort_hook
|
71
36
|
|
72
|
-
|
73
|
-
|
37
|
+
def assertion
|
38
|
+
assert_cmd UM::StreamMatcher, @my_data,
|
39
|
+
:exit => 0, :error => nil, :output => nil
|
40
|
+
pass
|
74
41
|
end
|
42
|
+
protected :assertion
|
75
43
|
|
76
|
-
|
77
|
-
|
44
|
+
def epilogue
|
45
|
+
@my_data.clean if defined? @my_data
|
46
|
+
super
|
78
47
|
end
|
48
|
+
protected :epilogue
|
79
49
|
|
80
50
|
attribute :dir, 'building directory', :mandatory
|
81
51
|
|
82
|
-
attribute :target, 'select a target',
|
52
|
+
attribute :target, 'select a target', String, '', :invisible
|
83
53
|
|
84
54
|
attribute :continue_mode, 'use the -k option of make', false
|
85
55
|
|