uttk 0.3.1.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/AUTHORS +36 -0
- data/COPYING +18 -0
- data/ChangeLog +7673 -0
- data/GUIDELINES +86 -0
- data/LGPL +504 -0
- data/NEWS +158 -0
- data/NORM +137 -0
- data/README +180 -0
- data/Rakefile +8 -0
- data/SPEC.gemspec +15 -0
- data/SPEC.yml +60 -0
- data/TODO +23 -0
- data/TODO.old +31 -0
- data/VERSION +5 -0
- data/bin/getopts/uttk.rb +390 -0
- data/bin/uttk +188 -0
- data/bin/uttk-unit +125 -0
- data/lib/uttk.rb +288 -0
- data/lib/uttk/dumpers/Basic.rb +23 -0
- data/lib/uttk/dumpers/BasicColor.rb +35 -0
- data/lib/uttk/dumpers/Dumper.rb +77 -0
- data/lib/uttk/dumpers/Html.rb +271 -0
- data/lib/uttk/dumpers/Path.rb +24 -0
- data/lib/uttk/dumpers/Xml.rb +88 -0
- data/lib/uttk/dumpers/Yaml.rb +138 -0
- data/lib/uttk/filters.rb +128 -0
- data/lib/uttk/filters/Buffer.rb +119 -0
- data/lib/uttk/filters/Compact.rb +75 -0
- data/lib/uttk/filters/Default.rb +27 -0
- data/lib/uttk/filters/DefaultColor.rb +27 -0
- data/lib/uttk/filters/Filter.rb +53 -0
- data/lib/uttk/filters/Id.rb +30 -0
- data/lib/uttk/filters/JustStatus.rb +25 -0
- data/lib/uttk/filters/KeepSkipBased.rb +38 -0
- data/lib/uttk/filters/NodeCut.rb +97 -0
- data/lib/uttk/filters/RPathFilter.rb +134 -0
- data/lib/uttk/filters/Saver.rb +53 -0
- data/lib/uttk/filters/TextFilter.rb +69 -0
- data/lib/uttk/generators/dumper_generator.rb +28 -0
- data/lib/uttk/generators/filter_generator.rb +28 -0
- data/lib/uttk/generators/generator.rb +86 -0
- data/lib/uttk/generators/generator_generator.rb +26 -0
- data/lib/uttk/generators/loader_generator.rb +28 -0
- data/lib/uttk/generators/path_filter_generator.rb +28 -0
- data/lib/uttk/generators/strategy_generator.rb +28 -0
- data/lib/uttk/generators/templates/dumper.rb +50 -0
- data/lib/uttk/generators/templates/filter.rb +50 -0
- data/lib/uttk/generators/templates/generator.rb +28 -0
- data/lib/uttk/generators/templates/loader.rb +26 -0
- data/lib/uttk/generators/templates/path_filter.rb +28 -0
- data/lib/uttk/generators/templates/strategy.rb +59 -0
- data/lib/uttk/generators/templates/strategy.yml +28 -0
- data/lib/uttk/generators/templates/unit_test.rb +46 -0
- data/lib/uttk/loaders/Loader.rb +180 -0
- data/lib/uttk/loaders/Ruby.rb +28 -0
- data/lib/uttk/loaders/Yaml.rb +98 -0
- data/lib/uttk/logger.rb +306 -0
- data/lib/uttk/logger/backend.rb +170 -0
- data/lib/uttk/logger/path.rb +202 -0
- data/lib/uttk/logger/section_node.rb +214 -0
- data/lib/uttk/logger/severity.rb +63 -0
- data/lib/uttk/logger/to_uttk_log.rb +127 -0
- data/lib/uttk/logger/verbosity.rb +61 -0
- data/lib/uttk/logger_factory.rb +55 -0
- data/lib/uttk/path_filters/ColorStatus.rb +57 -0
- data/lib/uttk/path_filters/PathFilter.rb +27 -0
- data/lib/uttk/path_filters/RemoveTypes.rb +25 -0
- data/lib/uttk/status.rb +146 -0
- data/lib/uttk/strategies/Abort.rb +24 -0
- data/lib/uttk/strategies/Assert.rb +44 -0
- data/lib/uttk/strategies/Authors.rb +45 -0
- data/lib/uttk/strategies/Block.rb +113 -0
- data/lib/uttk/strategies/Bootstrap.rb +55 -0
- data/lib/uttk/strategies/Checkout.rb +64 -0
- data/lib/uttk/strategies/Clean.rb +29 -0
- data/lib/uttk/strategies/Cmd.rb +60 -0
- data/lib/uttk/strategies/CmdBase.rb +130 -0
- data/lib/uttk/strategies/Collection.rb +158 -0
- data/lib/uttk/strategies/Compile.rb +59 -0
- data/lib/uttk/strategies/Composite.rb +201 -0
- data/lib/uttk/strategies/Composite/contents_eval.rb +40 -0
- data/lib/uttk/strategies/Configure.rb +66 -0
- data/lib/uttk/strategies/Error.rb +23 -0
- data/lib/uttk/strategies/Fail.rb +26 -0
- data/lib/uttk/strategies/IOBased.rb +159 -0
- data/lib/uttk/strategies/Import.rb +60 -0
- data/lib/uttk/strategies/Iterate.rb +139 -0
- data/lib/uttk/strategies/JUnit.rb +205 -0
- data/lib/uttk/strategies/KillAll.rb +62 -0
- data/lib/uttk/strategies/Make.rb +94 -0
- data/lib/uttk/strategies/Package.rb +129 -0
- data/lib/uttk/strategies/PackageCollection.rb +78 -0
- data/lib/uttk/strategies/Pass.rb +24 -0
- data/lib/uttk/strategies/Pool.rb +104 -0
- data/lib/uttk/strategies/ProbabilityThreshold.rb +46 -0
- data/lib/uttk/strategies/Proxy.rb +42 -0
- data/lib/uttk/strategies/RMatch.rb +92 -0
- data/lib/uttk/strategies/RUnit.rb +132 -0
- data/lib/uttk/strategies/SignalCmd.rb +85 -0
- data/lib/uttk/strategies/Sleep.rb +36 -0
- data/lib/uttk/strategies/SqlQuery.rb +120 -0
- data/lib/uttk/strategies/Strategy.rb +683 -0
- data/lib/uttk/strategies/Stub.rb +37 -0
- data/lib/uttk/strategies/SubCmd.rb +77 -0
- data/lib/uttk/strategies/Suite.rb +71 -0
- data/lib/uttk/strategies/Test.rb +89 -0
- data/lib/uttk/streams.rb +69 -0
- data/lib/uttk/streams/Diff.rb +60 -0
- data/lib/uttk/streams/HexaDiff.rb +35 -0
- data/lib/uttk/streams/Stream.rb +76 -0
- data/lib/uttk/weights.rb +17 -0
- data/lib/uttk/weights/WExpr.rb +68 -0
- data/lib/uttk/weights/WFloat.rb +23 -0
- data/lib/uttk/weights/WMin.rb +22 -0
- data/lib/uttk/weights/Weight.rb +105 -0
- data/lib/www/javascripts/uttk.js +185 -0
- data/misc/expandtab.rb +29 -0
- data/misc/header.rb +44 -0
- data/misc/renaming +57 -0
- data/misc/textile_compiler +194 -0
- data/misc/uttk-grep.sh +8 -0
- data/misc/uttk-line-count.rb +143 -0
- data/test/examples-suite.yml +8 -0
- data/test/examples/README +68 -0
- data/test/examples/basic.rb +10 -0
- data/test/examples/basic.yml +9 -0
- data/test/examples/cache/cache_and_fatal.yml +5 -0
- data/test/examples/cache/simple.yml +30 -0
- data/test/examples/sql/basic.yml +24 -0
- data/test/examples/students-suite.yml +9 -0
- data/test/examples/students/ball.yml +11 -0
- data/test/examples/students/glob_stud.yml +20 -0
- data/test/examples/students/mini-lib.yml +61 -0
- data/test/examples/students/pool_stud.yml +31 -0
- data/test/examples/students/stud.yml +21 -0
- data/test/fixtures/ball/20040804-exam_a1-zapngo-tessar_m.tar.gz +0 -0
- data/test/fixtures/ball/Makefile +24 -0
- data/test/fixtures/ball/bar_p-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/bar_p-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/bar_p-mini-lib/my_strlen.c +13 -0
- data/test/fixtures/ball/foo_s-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/foo_s-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/foo_s-mini-lib/configure +2 -0
- data/test/fixtures/ball/foo_s-mini-lib/my_strlen.c +10 -0
- data/test/fixtures/ball/hello.tar.bz2 +0 -0
- data/test/fixtures/ball/hello.tar.gz +0 -0
- data/test/fixtures/ball/hello/Makefile +14 -0
- data/test/fixtures/ball/hello/hello.c +7 -0
- data/test/fixtures/ball/jack-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/jack-exit/Makefile +14 -0
- data/test/fixtures/ball/jack-exit/exit.c +16 -0
- data/test/fixtures/ball/joe-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/joe-exit/Makefile +14 -0
- data/test/fixtures/ball/joe-exit/exit.c +8 -0
- data/test/fixtures/ball/joe_i-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/joe_i-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/joe_i-mini-lib/configure +2 -0
- data/test/fixtures/ball/joe_i-mini-lib/my_strlen.c +10 -0
- data/test/fixtures/ball/john-exit.tar.bz2 +0 -0
- data/test/fixtures/ball/john-exit/Makefile +14 -0
- data/test/fixtures/ball/john-exit/exit.c +6 -0
- data/test/fixtures/ball/qux_j-mini-lib.tar.bz2 +0 -0
- data/test/fixtures/ball/qux_j-mini-lib/Makefile +20 -0
- data/test/fixtures/ball/qux_j-mini-lib/my_strlen.c +12 -0
- data/test/fixtures/binaries/segv +0 -0
- data/test/fixtures/binaries/segv.c +10 -0
- data/test/fixtures/binaries/segv.rb +2 -0
- data/test/fixtures/demo/command-tutorial/steps/1/check.yml +5 -0
- data/test/fixtures/demo/command-tutorial/steps/1/pluralizer.rb +10 -0
- data/test/fixtures/demo/command-tutorial/steps/2/bad_check.yml +7 -0
- data/test/fixtures/demo/command-tutorial/steps/2/check.yml +7 -0
- data/test/fixtures/demo/command-tutorial/steps/2/pluralizer.rb +10 -0
- data/test/fixtures/demo/command-tutorial/steps/3.1/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/3/check.yml +14 -0
- data/test/fixtures/demo/command-tutorial/steps/4.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/4.1/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/4/check.yml +12 -0
- data/test/fixtures/demo/command-tutorial/steps/4/pluralizer.rb +12 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/check.yml +17 -0
- data/test/fixtures/demo/command-tutorial/steps/5.1/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/5/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/5/check.yml +16 -0
- data/test/fixtures/demo/command-tutorial/steps/5/pluralizer.rb +16 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/check.yml +22 -0
- data/test/fixtures/demo/command-tutorial/steps/6.1/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/6/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/6/check.yml +21 -0
- data/test/fixtures/demo/command-tutorial/steps/6/pluralizer.rb +17 -0
- data/test/fixtures/demo/command-tutorial/steps/7/bird.txt +1 -0
- data/test/fixtures/demo/command-tutorial/steps/7/check.yml +22 -0
- data/test/fixtures/demo/command-tutorial/steps/7/pluralizer.rb +17 -0
- data/test/fixtures/demo/filter-tutorial/check.yml +20 -0
- data/test/fixtures/demo/filter-tutorial/filters/CutSkip100.rb +19 -0
- data/test/fixtures/demo/filter-tutorial/pluralizer.rb +17 -0
- data/test/fixtures/java/unit/MultiRight/Foo/Foo.java +11 -0
- data/test/fixtures/java/unit/MultiRight/Foo/FooTest.java +15 -0
- data/test/fixtures/java/unit/MultiRight/MultiRight.java +13 -0
- data/test/fixtures/java/unit/MultiRight/MultiRightTest.java +12 -0
- data/test/fixtures/java/unit/MultiRight/bar/Bar.java +11 -0
- data/test/fixtures/java/unit/MultiRight/bar/BarTest.java +21 -0
- data/test/fixtures/java/unit/MultiRight/build.sh +7 -0
- data/test/fixtures/java/unit/SimpleException/SimpleExceptionTest.java +11 -0
- data/test/fixtures/java/unit/SimpleException/build.sh +4 -0
- data/test/fixtures/java/unit/build.sh +9 -0
- data/test/fixtures/java/unit/multibar.yml +6 -0
- data/test/fixtures/java/unit/multifoo.yml +6 -0
- data/test/fixtures/java/unit/multiright.yml +8 -0
- data/test/fixtures/java/unit/simple_exception.yml +6 -0
- data/test/fixtures/mini-lib/Makefile +9 -0
- data/test/fixtures/mini-lib/strlen.c +15 -0
- data/test/fixtures/package/pkg_foo.tar.gz +0 -0
- data/test/fixtures/package/pkg_foo/Makefile +20 -0
- data/test/fixtures/package/pkg_foo/bootstrap +3 -0
- data/test/fixtures/package/pkg_foo/configure +3 -0
- data/test/fixtures/package/pkg_foo/foo.sh +2 -0
- data/test/fixtures/text/1.txt +4 -0
- data/test/fixtures/unit/bad.rb +26 -0
- data/test/fixtures/unit/error.rb +6 -0
- data/test/fixtures/unit/good.rb +26 -0
- data/test/functional-suite.yml +10 -0
- data/test/functional/author.yml +11 -0
- data/test/functional/base.yml +119 -0
- data/test/functional/base_pool.yml +13 -0
- data/test/functional/block.yml +13 -0
- data/test/functional/cat.yml +16 -0
- data/test/functional/cmd.yml +17 -0
- data/test/functional/diff.yml +27 -0
- data/test/functional/env_cmd.yml +53 -0
- data/test/functional/exit.yml +15 -0
- data/test/functional/fatal.yml +23 -0
- data/test/functional/glob.yml +11 -0
- data/test/functional/hexa-diff.yml +25 -0
- data/test/functional/import.yml +41 -0
- data/test/functional/iterate.yml +99 -0
- data/test/functional/killall.yml +31 -0
- data/test/functional/pkg.yml +14 -0
- data/test/functional/probability_threshold.yml +35 -0
- data/test/functional/r_unit.yml +26 -0
- data/test/functional/rmatch.yml +122 -0
- data/test/functional/signal_cmd.yml +22 -0
- data/test/functional/sub.yml +15 -0
- data/test/functional/test.yml +25 -0
- data/test/functional/timeout.yml +20 -0
- data/test/functional/wc.yml +26 -0
- data/test/functional/weight.yml +152 -0
- data/test/pkg-suite.yml +8 -0
- data/test/pkg/cmdline.yml +80 -0
- data/test/pool-suite.yml +8 -0
- data/test/pool/base.yml +12 -0
- data/test/pool/pool.yml +25 -0
- data/test/ruby-suite.rb +10 -0
- data/test/ruby-suite.yml +5 -0
- data/test/ruby/base.rb +119 -0
- data/test/ruby/iterate.rb +21 -0
- data/test/ruby/wc.rb +43 -0
- data/test/unit-suite.yml +10 -0
- data/test/unit/dumpers/path_test.rb +46 -0
- data/test/unit/dumpers/xml_test.rb +65 -0
- data/test/unit/dumpers/yaml_test.rb +65 -0
- data/test/unit/filters/buffer_test.rb +168 -0
- data/test/unit/filters/keep_skip_based_test.rb +46 -0
- data/test/unit/filters/node_cut_test.rb +72 -0
- data/test/unit/filters/rpath_filter_test.rb +191 -0
- data/test/unit/filters/text_filter_test.rb +46 -0
- data/test/unit/filters_test.rb +119 -0
- data/test/unit/logger/section_node_test.rb +120 -0
- data/test/unit/logger/severity_test.rb +37 -0
- data/test/unit/logger/to_uttk_log_test.rb +113 -0
- data/test/unit/logger/verbosity_test.rb +44 -0
- data/test/unit/logger_test.rb +203 -0
- data/test/unit/strategies/suite_test.rb +151 -0
- data/test/uttk-check.yml +8 -0
- data/test/uttk-distcheck.yml +18 -0
- metadata +399 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/Default.rb 22074 2006-02-21T13:47:00.947568Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
class Default < Id
|
|
12
|
+
|
|
13
|
+
def self.template ( str )
|
|
14
|
+
[
|
|
15
|
+
'Yaml: [%s.yml]', "Xml: [%s.xml]",
|
|
16
|
+
'JustStatus: [RemoveTypes: [Yaml]]',
|
|
17
|
+
'Compact: [NodeCut: [!skip ^contents$, [Html: [%s.html]]]]',
|
|
18
|
+
].join(', ') % [str, str, str]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
composition template('log')
|
|
22
|
+
|
|
23
|
+
end # class Default
|
|
24
|
+
|
|
25
|
+
end # module Filters
|
|
26
|
+
|
|
27
|
+
end # module Uttk
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/DefaultColor.rb 22074 2006-02-21T13:47:00.947568Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
class DefaultColor < Id
|
|
12
|
+
|
|
13
|
+
def self.template ( str )
|
|
14
|
+
[
|
|
15
|
+
'Yaml: [%s.yml]', "Xml: [%s.xml]",
|
|
16
|
+
'JustStatus: [RemoveTypes: [ColorStatus: [Yaml]]]',
|
|
17
|
+
'Compact: [NodeCut: [!skip ^contents$, [Html: [%s.html]]]]',
|
|
18
|
+
].join(', ') % [str, str, str]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
composition template('log')
|
|
22
|
+
|
|
23
|
+
end # class DefaultColor
|
|
24
|
+
|
|
25
|
+
end # module Filters
|
|
26
|
+
|
|
27
|
+
end # module Uttk
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/filters/Filter.rb 22184 2006-02-23T16:12:25.225774Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
# A tutorial introduces how to create new filters at
|
|
10
|
+
# http://uttk.org/shelf/documentation
|
|
11
|
+
module Filters
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# FIXME: document me
|
|
15
|
+
class Filter < Logger::Backend
|
|
16
|
+
include Abstract
|
|
17
|
+
include Observable
|
|
18
|
+
|
|
19
|
+
class_inheritable_hash :default_options
|
|
20
|
+
self.default_options = {}
|
|
21
|
+
|
|
22
|
+
def initialize ( observers=[], options=nil )
|
|
23
|
+
@options = default_options.merge(options || {})
|
|
24
|
+
observers.each do |obs|
|
|
25
|
+
raise ObserverError, obs unless obs.respond_to? :update
|
|
26
|
+
add_observer(obs)
|
|
27
|
+
end
|
|
28
|
+
super()
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def notif ( *args )
|
|
32
|
+
changed
|
|
33
|
+
notify_observers(*args)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.composition ( *desc )
|
|
37
|
+
class_eval do
|
|
38
|
+
@@desc = desc
|
|
39
|
+
def initialize ( *a, &b )
|
|
40
|
+
super()
|
|
41
|
+
Filters[*@@desc].each do |obs|
|
|
42
|
+
raise ObserverError, obs unless obs.respond_to? :update
|
|
43
|
+
add_observer(obs)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end # class Filter
|
|
50
|
+
|
|
51
|
+
end # module Filters
|
|
52
|
+
|
|
53
|
+
end # module Uttk
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/Id.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
class Id < Filter
|
|
12
|
+
include Concrete
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def new_leaf ( path, leaf )
|
|
16
|
+
notif :new_leaf, path, leaf
|
|
17
|
+
end
|
|
18
|
+
protected :new_leaf
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def close
|
|
22
|
+
notif :close
|
|
23
|
+
end
|
|
24
|
+
protected :close
|
|
25
|
+
|
|
26
|
+
end # class Id
|
|
27
|
+
|
|
28
|
+
end # module Filters
|
|
29
|
+
|
|
30
|
+
end # module Uttk
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/JustStatus.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
class JustStatus < RPathFilter
|
|
12
|
+
include Concrete
|
|
13
|
+
|
|
14
|
+
match '^status$/.*\Z', :display
|
|
15
|
+
|
|
16
|
+
def display ( path )
|
|
17
|
+
leaf = path.pop.segment
|
|
18
|
+
notif :new_leaf, path, leaf
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end # class JustStatus
|
|
22
|
+
|
|
23
|
+
end # module Filters
|
|
24
|
+
|
|
25
|
+
end # module Uttk
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /fey/uttk/trunk/lib/uttk/filters/KeepSkipBased.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
|
5
|
+
|
|
6
|
+
module Uttk
|
|
7
|
+
|
|
8
|
+
module Filters
|
|
9
|
+
|
|
10
|
+
class KeepSkipBased < Id
|
|
11
|
+
include Concrete # Abstract
|
|
12
|
+
|
|
13
|
+
attr_reader :keep, :skip
|
|
14
|
+
|
|
15
|
+
default_options.merge! :keep => %r{}, # Keep anything
|
|
16
|
+
:skip => %r{\A\Z} # Skip only empty strings
|
|
17
|
+
|
|
18
|
+
def initialize ( observers, options, &b )
|
|
19
|
+
super
|
|
20
|
+
@keep, @skip, @action = @options.values_at :keep, :skip, :action
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def keep? ( node )
|
|
25
|
+
node_s = node.to_s
|
|
26
|
+
(node_s =~ @keep and node_s !~ @skip)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def skip? ( node )
|
|
31
|
+
! keep? node
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end # class KeepSkipBased
|
|
35
|
+
|
|
36
|
+
end # module Filters
|
|
37
|
+
|
|
38
|
+
end # module Uttk
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/NodeCut.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
# FIXME Can be path based
|
|
12
|
+
# This filter cut nodes which match `keep' but not `skip'
|
|
13
|
+
# options:
|
|
14
|
+
# keep: A regular expression (all keys which match this regexp are cut)
|
|
15
|
+
# skip: Antoher regexp that skip keys which match
|
|
16
|
+
# prune: Completly cut all sub nodes of a cut one
|
|
17
|
+
class NodeCut < KeepSkipBased
|
|
18
|
+
include Concrete
|
|
19
|
+
|
|
20
|
+
default_options.merge! :prune => false # Don't prune by default
|
|
21
|
+
|
|
22
|
+
def initialize ( *a, &b )
|
|
23
|
+
super
|
|
24
|
+
@pruning_path = Set.new
|
|
25
|
+
@pruning_path_node = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def new_node ( path, node )
|
|
30
|
+
if @pruning_path_node or keep? node.segment
|
|
31
|
+
super
|
|
32
|
+
elsif prune?
|
|
33
|
+
@pruning_path << path.to_s
|
|
34
|
+
@pruning_path_node = path.dup << node
|
|
35
|
+
else
|
|
36
|
+
@pruning_path << path.to_s
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
protected :new_node
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def up ( path )
|
|
43
|
+
node = path.last
|
|
44
|
+
path_s= path.to_s
|
|
45
|
+
if @pruning_path.include? path_s
|
|
46
|
+
@pruning_path_node = nil
|
|
47
|
+
@pruning_path.delete path_s
|
|
48
|
+
else
|
|
49
|
+
super
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
protected :up
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def notif ( msg, *args )
|
|
56
|
+
return super if args.first.nil?
|
|
57
|
+
path = args.shift
|
|
58
|
+
return if pruning_path? path
|
|
59
|
+
copy = path.dup
|
|
60
|
+
copy.delete_if do |x|
|
|
61
|
+
skip? x.segment
|
|
62
|
+
end
|
|
63
|
+
super(msg, copy, *args)
|
|
64
|
+
end
|
|
65
|
+
protected :notif
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def prune?
|
|
69
|
+
@options[:prune]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def pruning_path? ( path )
|
|
74
|
+
return false unless @pruning_path_node
|
|
75
|
+
@pruning_path_node.each_with_index do |seg, i|
|
|
76
|
+
return false if seg != path[i]
|
|
77
|
+
end
|
|
78
|
+
return true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
module Assertions
|
|
83
|
+
def assert_node_cut ( input, ref, options )
|
|
84
|
+
@mock_object.mock_clear
|
|
85
|
+
@filter = NodeCut.new([@mock_object], options)
|
|
86
|
+
input.each do |n|
|
|
87
|
+
@filter.update(*Logger.make_notif(n))
|
|
88
|
+
end
|
|
89
|
+
assert_mock Logger.make_notifs(ref)
|
|
90
|
+
end
|
|
91
|
+
end # module Assertions
|
|
92
|
+
|
|
93
|
+
end # class NodeCut
|
|
94
|
+
|
|
95
|
+
end # module Filters
|
|
96
|
+
|
|
97
|
+
end # module Uttk
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/filters/RPathFilter.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
class RPathFilter < Id
|
|
12
|
+
# FIXME include Abstract
|
|
13
|
+
|
|
14
|
+
attr_reader :log
|
|
15
|
+
|
|
16
|
+
def initialize ( *a, &b )
|
|
17
|
+
@log = Logger.new # FIXME PERAPHS you can remove me
|
|
18
|
+
@matchers = matchers.dup
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def add_observer ( obj )
|
|
24
|
+
@log.add_observer(obj)
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def new_leaf ( lpath, leaf )
|
|
30
|
+
lpath << leaf
|
|
31
|
+
@matchers.each do |matcher|
|
|
32
|
+
next unless matcher.active?
|
|
33
|
+
if matcher.have_a_star?
|
|
34
|
+
buf = matcher.buffer
|
|
35
|
+
is_prefix = lpath.rpath_prefix(matcher.re)
|
|
36
|
+
unless buf.empty? or is_prefix
|
|
37
|
+
buf.buffer.rpath(matcher.re) do |*args|
|
|
38
|
+
matcher[self, *args]
|
|
39
|
+
end
|
|
40
|
+
buf.reset
|
|
41
|
+
end
|
|
42
|
+
if is_prefix
|
|
43
|
+
if buf.empty?
|
|
44
|
+
l = Logger.new(buf)
|
|
45
|
+
lpath.each do |seg|
|
|
46
|
+
l.new_node seg.segment, seg.options
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
buf.update(:new_leaf, lpath, leaf)
|
|
50
|
+
end
|
|
51
|
+
else
|
|
52
|
+
lpath.rpath(matcher.re) do |*args|
|
|
53
|
+
matcher[self, *args]
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class_inheritable_accessor :matchers
|
|
61
|
+
self.matchers = []
|
|
62
|
+
|
|
63
|
+
# The _aRegexpPath_ is matched against the path of every notification
|
|
64
|
+
# the filter receive. If the notification path matches, then the method
|
|
65
|
+
# mentioned as second argument is called. If no method are mentioned, it
|
|
66
|
+
# looks for a block. You must supply either a method or a block, not
|
|
67
|
+
# both.
|
|
68
|
+
def self.match ( aRegexPath, aMethod=nil, &block )
|
|
69
|
+
if aMethod.nil? and block.nil?
|
|
70
|
+
raise ArgumentError, "no block or method given"
|
|
71
|
+
end
|
|
72
|
+
if aMethod and block
|
|
73
|
+
raise ArgumentError, "supply a block OR a method name not both"
|
|
74
|
+
end
|
|
75
|
+
self.matchers = matchers + [Matcher.new(aRegexPath, aMethod, &block)]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.disable_matcher
|
|
79
|
+
raise Matcher::Disable
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Matcher
|
|
83
|
+
attr_accessor :re, :block, :buffer
|
|
84
|
+
|
|
85
|
+
class Disable < Exception
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def initialize ( aRegexPath, aMethod=nil, &block )
|
|
89
|
+
@re = aRegexPath
|
|
90
|
+
@re = RegexPath.new(@re) unless @re.is_a? RegexPath
|
|
91
|
+
@block = aMethod || block
|
|
92
|
+
@have_a_star = @re.segments.any? { |x| x.captured? }
|
|
93
|
+
@buffer = Filters::Buffer.new
|
|
94
|
+
@active = true
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def have_a_star?
|
|
98
|
+
@have_a_star
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def active?
|
|
102
|
+
@active
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def [] ( obj, *args )
|
|
106
|
+
begin
|
|
107
|
+
if @block.is_a? Symbol
|
|
108
|
+
obj.send(@block, *args)
|
|
109
|
+
else
|
|
110
|
+
@block[obj, *args]
|
|
111
|
+
end
|
|
112
|
+
rescue Disable
|
|
113
|
+
@active = false
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
end # class Matcher
|
|
118
|
+
|
|
119
|
+
module Assertions
|
|
120
|
+
attr_accessor :logger, :output_tree
|
|
121
|
+
attr_reader :rpath_filter
|
|
122
|
+
def assert_rpath_filter ( ref, aClass )
|
|
123
|
+
@rpath_filter = aClass.new([mock_object])
|
|
124
|
+
@logger.add_observer @rpath_filter
|
|
125
|
+
@logger << @output_tree
|
|
126
|
+
assert_mock(*Logger.make_notifs(ref))
|
|
127
|
+
end
|
|
128
|
+
end # module Assertions
|
|
129
|
+
|
|
130
|
+
end # class RPathFilter
|
|
131
|
+
|
|
132
|
+
end # module Filters
|
|
133
|
+
|
|
134
|
+
end # module Uttk
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/filters/Saver.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Filters
|
|
10
|
+
|
|
11
|
+
# FIXME Path based
|
|
12
|
+
#
|
|
13
|
+
# This very basic filter, observe a logger, and
|
|
14
|
+
# save all received leaves, without any formatting.
|
|
15
|
+
#
|
|
16
|
+
# With this observer you save a sort of execution trace.
|
|
17
|
+
# After that you can apply to another logger the same
|
|
18
|
+
# message sequence.
|
|
19
|
+
#
|
|
20
|
+
# You can also simply check that two results are equal,
|
|
21
|
+
# for that, just compare the sequence message.
|
|
22
|
+
#
|
|
23
|
+
class Saver < Filter
|
|
24
|
+
include Concrete
|
|
25
|
+
|
|
26
|
+
def initialize(*a, &b)
|
|
27
|
+
super
|
|
28
|
+
@out = []
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def new_leaf ( *args )
|
|
32
|
+
@out << args
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get
|
|
36
|
+
@out.dup
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def to_uttk_log ( log )
|
|
40
|
+
each do |a|
|
|
41
|
+
log.update(:new_leaf, *a)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def each ( &block )
|
|
46
|
+
@out.each(&block)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end # class Saver
|
|
50
|
+
|
|
51
|
+
end # module Filters
|
|
52
|
+
|
|
53
|
+
end # Uttk
|