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,127 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /fey/uttk/trunk/lib/uttk/logger/to_uttk_log.rb 8779 2005-09-26T05:57:23.628040Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
class Logger
|
|
10
|
+
|
|
11
|
+
# These extensions add to any object, a proper way
|
|
12
|
+
# to inject an object in a result like Logger.
|
|
13
|
+
#
|
|
14
|
+
# Example:
|
|
15
|
+
#
|
|
16
|
+
# include Uttk
|
|
17
|
+
# anObject.to_uttk_log(Logger.new(Dumper::Yaml.new(STDERR)))
|
|
18
|
+
#
|
|
19
|
+
module ToUttkLog
|
|
20
|
+
|
|
21
|
+
class ::Object
|
|
22
|
+
|
|
23
|
+
def to_uttk_log ( log )
|
|
24
|
+
log.new_leaf(self)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def to_uttk_log_with_key ( key, log )
|
|
28
|
+
log.new_node key do
|
|
29
|
+
log << self
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end # class ::Object
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ::Hash
|
|
37
|
+
|
|
38
|
+
def to_uttk_log ( log )
|
|
39
|
+
each do |k, v|
|
|
40
|
+
next if k == :strategy
|
|
41
|
+
log[k] = v
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_uttk_log_with_key ( key, log, opts=nil )
|
|
46
|
+
if has_key? :strategy
|
|
47
|
+
opts = (opts || {}).merge(:type => self[:strategy])
|
|
48
|
+
end
|
|
49
|
+
log.new_node key, opts do
|
|
50
|
+
log << self
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end # class ::Hash
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class ::OHash < ::Hash
|
|
58
|
+
|
|
59
|
+
def to_uttk_log_with_key ( key, log )
|
|
60
|
+
super key, log, :ordered => true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end # class ::OHash
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class ::Array
|
|
67
|
+
|
|
68
|
+
# WARNING: Do not implement Array#to_uttk_log it doesn't make sense.
|
|
69
|
+
|
|
70
|
+
def to_uttk_log_with_key ( key, log )
|
|
71
|
+
unless ! empty? and all? { |x| x.is_a? Hash and x.size == 1 }
|
|
72
|
+
return super
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
log.new_node key, :ordered => true do
|
|
76
|
+
each do |x|
|
|
77
|
+
k, v = x.to_a.first
|
|
78
|
+
log[k] = v
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end # class ::Array
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ::Exception
|
|
87
|
+
|
|
88
|
+
def to_uttk_log ( log )
|
|
89
|
+
if log.severity_level <= Severity::DEBUG
|
|
90
|
+
long_pp.to_uttk_log(log)
|
|
91
|
+
elsif log.severity_level <= Severity::VERBOSE_INFO
|
|
92
|
+
short_pp.to_uttk_log(log)
|
|
93
|
+
else
|
|
94
|
+
tiny_pp.to_uttk_log(log)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end # class ::Exception
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class ::Benchmark::Tms
|
|
102
|
+
|
|
103
|
+
def to_uttk_log ( log )
|
|
104
|
+
if @label.empty?
|
|
105
|
+
benchmark_tms_to_uttk_log(log)
|
|
106
|
+
else
|
|
107
|
+
log.new_node(@label) { benchmark_tms_to_uttk_log(log) }
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def benchmark_tms_to_uttk_log(log)
|
|
112
|
+
log[:cutime] = @cutime
|
|
113
|
+
log[:cstime] = @cstime
|
|
114
|
+
log[:utime] = @utime
|
|
115
|
+
log[:stime] = @stime
|
|
116
|
+
log[:total] = @total
|
|
117
|
+
log[:real] = @real
|
|
118
|
+
end
|
|
119
|
+
private :benchmark_tms_to_uttk_log
|
|
120
|
+
|
|
121
|
+
end # class ::Benchmark::Tms
|
|
122
|
+
|
|
123
|
+
end # module ToUttkLog
|
|
124
|
+
|
|
125
|
+
end # class Logger
|
|
126
|
+
|
|
127
|
+
end # module Uttk
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /fey/uttk/trunk/lib/uttk/logger/verbosity.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#FIXME: manage "attr_once"
|
|
8
|
+
|
|
9
|
+
module Uttk
|
|
10
|
+
|
|
11
|
+
class Logger
|
|
12
|
+
|
|
13
|
+
class Verbosity
|
|
14
|
+
|
|
15
|
+
@@level_fields = []
|
|
16
|
+
@@higher_level = 0
|
|
17
|
+
|
|
18
|
+
def self.higher_level
|
|
19
|
+
@@higher_level
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.verbosity(meth, level)
|
|
23
|
+
unless method_defined?(meth)
|
|
24
|
+
raise(ArgumentError, "`#{meth}' - is not an instance method")
|
|
25
|
+
end
|
|
26
|
+
if level <= 0
|
|
27
|
+
raise(ArgumentError,
|
|
28
|
+
"`#{level}' - verbosity level must be strictly positive")
|
|
29
|
+
end
|
|
30
|
+
@@higher_level = level if level > @@higher_level
|
|
31
|
+
@@level_fields[level] ||= []
|
|
32
|
+
@@level_fields[level] << meth
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.level_fields(level)
|
|
36
|
+
@@level_fields[level] ||= []
|
|
37
|
+
@@level_fields[level]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def severity_level(severity_level, section_names)
|
|
41
|
+
Severity.label(severity_level)
|
|
42
|
+
end
|
|
43
|
+
verbosity :severity_level, 1
|
|
44
|
+
|
|
45
|
+
def sections(severity_level, section_names)
|
|
46
|
+
section_names
|
|
47
|
+
end
|
|
48
|
+
verbosity :sections, 2
|
|
49
|
+
|
|
50
|
+
def date(severity_level, section_names)
|
|
51
|
+
Time.now
|
|
52
|
+
end
|
|
53
|
+
verbosity :date, 3
|
|
54
|
+
|
|
55
|
+
end # Verbosity
|
|
56
|
+
|
|
57
|
+
end # class Logger
|
|
58
|
+
|
|
59
|
+
end # module Uttk
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /fey/uttk/trunk/lib/uttk/logger_factory.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
class LoggerFactory
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@section_tree = create_section_tree
|
|
13
|
+
@severity_level = Logger::Severity::DEBUG
|
|
14
|
+
@verbosity = Logger::Verbosity.new
|
|
15
|
+
@verbosity_level = 0
|
|
16
|
+
@active_section = []
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attr_accessor :verbosity_level
|
|
20
|
+
|
|
21
|
+
attr_accessor :severity_level
|
|
22
|
+
|
|
23
|
+
attr_accessor :active_section
|
|
24
|
+
|
|
25
|
+
attr_accessor :section_tree
|
|
26
|
+
|
|
27
|
+
def create(*a, &b)
|
|
28
|
+
log = Logger.new(*a, &b)
|
|
29
|
+
log.severity_level = @severity_level
|
|
30
|
+
log.verbosity_level = @verbosity_level
|
|
31
|
+
log.section_tree = @section_tree
|
|
32
|
+
log.active_section(true, *@active_section)
|
|
33
|
+
log
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#FIXME: move in another place, in order to separate the Logger from Uttk.
|
|
37
|
+
#FIXME: follow the strategy hierarchy without loading all the classes
|
|
38
|
+
private
|
|
39
|
+
def create_section_tree
|
|
40
|
+
tree = Logger::SectionNode.new('all')
|
|
41
|
+
[ 'strategies' ].each do |dir|
|
|
42
|
+
dir_node = Logger::SectionNode.new(dir)
|
|
43
|
+
tree << dir_node
|
|
44
|
+
(Uttk.dir + dir).each_entry do |p|
|
|
45
|
+
if p.to_s =~ /^(\w+)\.rb$/
|
|
46
|
+
dir_node << Logger::SectionNode.new($1)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
tree
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end # class LoggerFactory
|
|
54
|
+
|
|
55
|
+
end # module Uttk
|
|
@@ -0,0 +1,57 @@
|
|
|
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/path_filters/ColorStatus.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
class StyledString < String
|
|
7
|
+
def to_yaml ( opts={} )
|
|
8
|
+
to_s
|
|
9
|
+
end
|
|
10
|
+
def to_s
|
|
11
|
+
self
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module Uttk
|
|
16
|
+
|
|
17
|
+
module PathFilters
|
|
18
|
+
|
|
19
|
+
class ColorStatus < PathFilter
|
|
20
|
+
include Concrete
|
|
21
|
+
|
|
22
|
+
def initialize ( *a, &b )
|
|
23
|
+
raise "HighLine is unavailable" unless defined? HighLine
|
|
24
|
+
@h = HighLine.new
|
|
25
|
+
super
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
STYLE =
|
|
29
|
+
{
|
|
30
|
+
:PASS => [:green],
|
|
31
|
+
:FAIL => [:red],
|
|
32
|
+
:ABORT => [:magenta],
|
|
33
|
+
:SKIP => [:yellow],
|
|
34
|
+
:ERROR => [:bold, :red]
|
|
35
|
+
}
|
|
36
|
+
STYLE.default = []
|
|
37
|
+
|
|
38
|
+
def color ( str )
|
|
39
|
+
if str =~ /^([A-Z]+)(\(.*\))?$/
|
|
40
|
+
node = StyledString.new(@h.color(str, *STYLE[$1.to_sym]).to_s)
|
|
41
|
+
else
|
|
42
|
+
str
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def filter ( path, leaf )
|
|
47
|
+
if (leaf.is_a? Symbol or leaf.is_a? String) and not leaf.to_s.empty?
|
|
48
|
+
leaf = color(leaf.to_s)
|
|
49
|
+
end
|
|
50
|
+
[path, leaf]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end # class ColorStatus
|
|
54
|
+
|
|
55
|
+
end # module PathFilters
|
|
56
|
+
|
|
57
|
+
end # module Uttk
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright:: Copyright (c) 2005 Uttk Team. All rights reserved.
|
|
2
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# Revision:: $Id: /w/fey/uttk/trunk/lib/uttk/path_filters/PathFilter.rb 21975 2006-02-19T22:24:11.182512Z pouillar $
|
|
5
|
+
|
|
6
|
+
module Uttk
|
|
7
|
+
|
|
8
|
+
module PathFilters
|
|
9
|
+
|
|
10
|
+
class PathFilter < Filters::Filter
|
|
11
|
+
include Abstract
|
|
12
|
+
|
|
13
|
+
def filter ( path, node )
|
|
14
|
+
raise NotImplementedError
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update ( msg, *args )
|
|
18
|
+
args = filter(*args) if msg == :new_leaf
|
|
19
|
+
notif msg, *args
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end # class PathFilter
|
|
23
|
+
|
|
24
|
+
end # module PathFilters
|
|
25
|
+
|
|
26
|
+
end # module Uttk
|
|
27
|
+
|
|
@@ -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/path_filters/RemoveTypes.rb 21844 2006-02-17T17:26:59.771162Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module PathFilters
|
|
10
|
+
|
|
11
|
+
class RemoveTypes < PathFilter
|
|
12
|
+
include Concrete
|
|
13
|
+
|
|
14
|
+
def filter ( path, leaf )
|
|
15
|
+
path.each do |seg|
|
|
16
|
+
seg.options.delete :type
|
|
17
|
+
end
|
|
18
|
+
[path, leaf]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end # class RemoveTypes
|
|
22
|
+
|
|
23
|
+
end # module PathFilters
|
|
24
|
+
|
|
25
|
+
end # module Uttk
|
data/lib/uttk/status.rb
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /fey/uttk/trunk/lib/uttk/status.rb 8800 2005-10-09T11:12:27.126567Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
class Status < UttkException
|
|
10
|
+
include Abstract
|
|
11
|
+
|
|
12
|
+
def self.default_weight ( aSymbol )
|
|
13
|
+
self.default_weight_value = Weights::Default.new(aSymbol)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.status_name
|
|
17
|
+
name.sub(/^.*?(\w+)Status$/, '\1').upcase.to_sym
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.hook_name
|
|
21
|
+
(status_name.to_s.downcase + '_hook').to_sym
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
attr_accessor :weight, :reason
|
|
26
|
+
class_inheritable_accessor :default_weight_value
|
|
27
|
+
class_inheritable_accessor :default_reason
|
|
28
|
+
self.default_reason = nil
|
|
29
|
+
default_weight :FAIL
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def initialize ( anObject=nil )
|
|
33
|
+
super()
|
|
34
|
+
@reason = anObject || default_reason
|
|
35
|
+
@weight = default_weight_value
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def to_uttk_log ( log )
|
|
39
|
+
log.status = self.to_s
|
|
40
|
+
log.reason = @reason unless @reason.nil?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def hook_name
|
|
44
|
+
self.class.hook_name
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_s
|
|
48
|
+
res = self.class.status_name.to_s
|
|
49
|
+
if @weight != default_weight_value
|
|
50
|
+
res += "(#{@weight.get})"
|
|
51
|
+
end
|
|
52
|
+
res
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def pass?
|
|
56
|
+
false
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end # class Status
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class PassStatus < Status
|
|
64
|
+
include Concrete
|
|
65
|
+
default_weight :PASS
|
|
66
|
+
def pass?
|
|
67
|
+
true
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class SkipStatus < Status
|
|
74
|
+
include Concrete
|
|
75
|
+
def initialize ( aWeight=nil, anObject=nil )
|
|
76
|
+
super(anObject)
|
|
77
|
+
@weight = aWeight unless aWeight.nil?
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class ErrorStatus < Status
|
|
84
|
+
include Concrete
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class AbortStatus < Status
|
|
90
|
+
include Concrete
|
|
91
|
+
end # class AbortStatus
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class TimeoutAbortStatus < AbortStatus
|
|
96
|
+
|
|
97
|
+
attr_reader :timeout_id
|
|
98
|
+
|
|
99
|
+
@@timeout_id ||= -1
|
|
100
|
+
|
|
101
|
+
def initialize ( *a, &b )
|
|
102
|
+
@timeout_id = (@@timeout_id += 1)
|
|
103
|
+
super
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def == ( rhs )
|
|
107
|
+
rhs.class <= self.class and @timeout_id == rhs.timeout_id
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.status_name
|
|
111
|
+
:ABORT
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end # class TimeoutAbortStatus
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class StartStatus < Status
|
|
119
|
+
include Concrete
|
|
120
|
+
default_weight :START
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class RunningStatus < Status
|
|
126
|
+
include Concrete
|
|
127
|
+
default_weight :FAIL
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class FailStatus < Status
|
|
133
|
+
include Concrete
|
|
134
|
+
|
|
135
|
+
def initialize ( aWeight=nil, anObject=nil )
|
|
136
|
+
super(anObject)
|
|
137
|
+
@weight = aWeight unless aWeight.nil?
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def hook_name
|
|
141
|
+
:failed_hook
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end # class FailStatus
|
|
145
|
+
|
|
146
|
+
end # module Uttk
|