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,78 @@
|
|
|
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/strategies/PackageCollection.rb 8789 2005-09-27T14:49:49.088376Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# This strategy takes a set of packages with their dependencies, it
|
|
12
|
+
# computes the topological sort, and make all packages in the right order.
|
|
13
|
+
#
|
|
14
|
+
# * Dependencies are given as a Yaml file.
|
|
15
|
+
# * Installation directories are propagated by with configure options.
|
|
16
|
+
class PackageCollection < Composite
|
|
17
|
+
include Concrete
|
|
18
|
+
|
|
19
|
+
def prologue
|
|
20
|
+
super
|
|
21
|
+
@dependencies = Pathname.new(@dependencies)
|
|
22
|
+
@deps = YAML::load(@dependencies.read)
|
|
23
|
+
@order = @deps.tsort_from(@target)
|
|
24
|
+
@order.each do |dep|
|
|
25
|
+
@symtbl["#{dep}_install_dir".to_sym] = "<<pwd>>/#{dep}"
|
|
26
|
+
create(Import) do |t|
|
|
27
|
+
t.name = dep
|
|
28
|
+
t.import = "#{dep}.yml"
|
|
29
|
+
t.symtbl[:configure_flags] =
|
|
30
|
+
@deps[dep].map { |d| "--with-#{d}=<<pwd>>/#{d}" }.join(' ')
|
|
31
|
+
t.fatal = true
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
protected :prologue
|
|
36
|
+
|
|
37
|
+
attribute :dependencies, 'the dependency file', :mandatory
|
|
38
|
+
attribute :target, 'the target package name'
|
|
39
|
+
|
|
40
|
+
end # class PackageCollection
|
|
41
|
+
|
|
42
|
+
end # module Strategies
|
|
43
|
+
|
|
44
|
+
end # module Uttk
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
require 'tsort'
|
|
49
|
+
|
|
50
|
+
class Hash
|
|
51
|
+
|
|
52
|
+
include TSort
|
|
53
|
+
|
|
54
|
+
alias tsort_each_node each_key
|
|
55
|
+
|
|
56
|
+
def tsort_each_child(node, &block)
|
|
57
|
+
fetch(node).each(&block)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def tsort_each_from ( node=nil, &block )
|
|
61
|
+
return tsort_each(&block) if node.nil?
|
|
62
|
+
each_strongly_connected_component_from(node) do |component|
|
|
63
|
+
if component.size == 1
|
|
64
|
+
block[component.first]
|
|
65
|
+
else
|
|
66
|
+
raise Cyclic, "topological sort failed: #{component.inspect}"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def tsort_from ( node=nil )
|
|
72
|
+
return tsort if node.nil?
|
|
73
|
+
result = []
|
|
74
|
+
tsort_each_from(node) { |n| result << n }
|
|
75
|
+
result
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end # class Hash
|
|
@@ -0,0 +1,24 @@
|
|
|
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/strategies/Pass.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# A test strategy class which always pass.
|
|
12
|
+
class Pass < Strategy
|
|
13
|
+
include Concrete
|
|
14
|
+
|
|
15
|
+
protected
|
|
16
|
+
def assertion
|
|
17
|
+
pass
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end # class Pass
|
|
21
|
+
|
|
22
|
+
end # module Strategies
|
|
23
|
+
|
|
24
|
+
end # module Uttk
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Pool.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# I'm a collection of strategies and I run all of them in a separated
|
|
12
|
+
# thread.
|
|
13
|
+
class Pool < Collection
|
|
14
|
+
include Concrete
|
|
15
|
+
|
|
16
|
+
class PoolComponent
|
|
17
|
+
attr_accessor :test, :thread, :flow, :log
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def initialize ( *a, &b )
|
|
22
|
+
@pool_contents = []
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def abort_hook
|
|
28
|
+
return if defined? @already_aborted
|
|
29
|
+
@already_aborted = true
|
|
30
|
+
@pool_contents.each do |comp|
|
|
31
|
+
test = comp.test
|
|
32
|
+
next if test.status.is_a? StartStatus
|
|
33
|
+
test.abort('pool aborted') if test.running?
|
|
34
|
+
end
|
|
35
|
+
super
|
|
36
|
+
end
|
|
37
|
+
protected :abort_hook
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def prologue
|
|
41
|
+
super
|
|
42
|
+
@pool_upper = @log.new_node :contents, :ordered => true
|
|
43
|
+
path = @log.path
|
|
44
|
+
@pool_contents = @contents.map do |test|
|
|
45
|
+
comp = PoolComponent.new
|
|
46
|
+
comp.test = test
|
|
47
|
+
comp.log = Filters::Saver.new
|
|
48
|
+
comp.flow = @symtbl[:flow_factory].new_flow
|
|
49
|
+
test.symtbl[:flow] = comp.flow
|
|
50
|
+
comp.thread = Thread.new do
|
|
51
|
+
begin
|
|
52
|
+
sleep
|
|
53
|
+
new_log = Logger.new(comp.log)
|
|
54
|
+
new_log.chpath(path)
|
|
55
|
+
run_test(test, new_log)
|
|
56
|
+
rescue Exception => ex
|
|
57
|
+
display_unexpected_exc ex
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
comp
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# This thread is here to catch properly exceptions.
|
|
64
|
+
@real_parent_thread = @thread
|
|
65
|
+
@thread = Thread.new do
|
|
66
|
+
begin
|
|
67
|
+
sleep
|
|
68
|
+
rescue Exception => ex
|
|
69
|
+
abort_hook()
|
|
70
|
+
@real_parent_thread.raise ex
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
protected :prologue
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def run_composite
|
|
78
|
+
@pool_contents.each { |comp| comp.thread.wakeup }
|
|
79
|
+
@pool_contents.each { |comp| comp.thread.join }
|
|
80
|
+
end
|
|
81
|
+
protected :run_composite
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def epilogue
|
|
85
|
+
@pool_contents.each do |comp|
|
|
86
|
+
comp.flow << :not_running?
|
|
87
|
+
@log << comp.log
|
|
88
|
+
end
|
|
89
|
+
@pool_upper.up
|
|
90
|
+
@pool_contents.each do |comp|
|
|
91
|
+
comp.thread.kill if comp.thread.alive?
|
|
92
|
+
comp.flow.destroy
|
|
93
|
+
end
|
|
94
|
+
@pool_contents.clear
|
|
95
|
+
super
|
|
96
|
+
end
|
|
97
|
+
protected :epilogue
|
|
98
|
+
|
|
99
|
+
end # class Pool
|
|
100
|
+
|
|
101
|
+
end # module Strategies
|
|
102
|
+
|
|
103
|
+
end # module Uttk
|
|
104
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
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/strategies/ProbabilityThreshold.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# I validate the status of the strategy _test_ if it is under the value of
|
|
12
|
+
# my _threshold_ attribute.
|
|
13
|
+
class ProbabilityThreshold < Proxy
|
|
14
|
+
include Concrete
|
|
15
|
+
|
|
16
|
+
def prologue
|
|
17
|
+
super
|
|
18
|
+
if @threshold > 1
|
|
19
|
+
raise ArgumentError, "Threshold too high: #@threshold not in [0..1]"
|
|
20
|
+
elsif @threshold < 0
|
|
21
|
+
raise ArgumentError, "Threshold too low: #@threshold not in [0..1]"
|
|
22
|
+
end
|
|
23
|
+
create(@test)
|
|
24
|
+
end
|
|
25
|
+
protected :prologue
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def assertion
|
|
29
|
+
compute_final_weight
|
|
30
|
+
final = @final_weight.get
|
|
31
|
+
@log.final_weight = final
|
|
32
|
+
fail("Not enough (#{final} < #@threshold)") if @final_weight < @threshold
|
|
33
|
+
pass
|
|
34
|
+
end
|
|
35
|
+
protected :assertion
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
attribute :test, 'the strategy', :mandatory, :invisble
|
|
39
|
+
attribute :threshold, 'the probability threshold', :mandatory, nil
|
|
40
|
+
Weights::Weight
|
|
41
|
+
|
|
42
|
+
end # class ProbabilityThreshold
|
|
43
|
+
|
|
44
|
+
end # module Strategies
|
|
45
|
+
|
|
46
|
+
end # module Uttk
|
|
@@ -0,0 +1,42 @@
|
|
|
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/strategies/Proxy.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# I'm composed by only one strategy and I'm transparent in the log.
|
|
12
|
+
class Proxy < Composite
|
|
13
|
+
include Abstract
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def create ( anObject, &block )
|
|
17
|
+
unless @contents.empty?
|
|
18
|
+
raise ArgumentError, "A proxy can contain only one test"
|
|
19
|
+
end
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def run_composite
|
|
25
|
+
test = @contents.first
|
|
26
|
+
test.name ||= 'test'
|
|
27
|
+
run_test(test, @log)
|
|
28
|
+
end
|
|
29
|
+
protected :run_composite
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def new_symtbl
|
|
33
|
+
@symtbl
|
|
34
|
+
end
|
|
35
|
+
protected :new_symtbl
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
end # class Proxy
|
|
39
|
+
|
|
40
|
+
end # module Strategies
|
|
41
|
+
|
|
42
|
+
end # module Uttk
|
|
@@ -0,0 +1,92 @@
|
|
|
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/strategies/RMatch.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# I can be used with to test a test strategy. I will be merged soon with
|
|
12
|
+
# the _Test_ strategy.
|
|
13
|
+
class RMatch < Proxy
|
|
14
|
+
include Concrete
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# Methods
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
def prologue
|
|
21
|
+
super
|
|
22
|
+
@errors_must_match = @match.dup
|
|
23
|
+
@errors_must_not_match = []
|
|
24
|
+
|
|
25
|
+
prefix = @log.path.to_regex_path_string
|
|
26
|
+
@log.debug { @log.prefix = prefix ; nil }
|
|
27
|
+
|
|
28
|
+
c = Class.new(Filters::RPathFilter)
|
|
29
|
+
c.include Concrete
|
|
30
|
+
|
|
31
|
+
@match.each do |rpath|
|
|
32
|
+
c.match prefix + rpath do |filter, path|
|
|
33
|
+
@errors_must_match.delete rpath
|
|
34
|
+
c.disable_matcher()
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
@dont_match.each do |rpath|
|
|
39
|
+
c.match prefix + rpath do |filter, path|
|
|
40
|
+
@errors_must_not_match << rpath
|
|
41
|
+
c.disable_matcher()
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@c_filter = c.new
|
|
46
|
+
@log.add_observer(@c_filter)
|
|
47
|
+
create @test
|
|
48
|
+
end
|
|
49
|
+
protected :prologue
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def assertion
|
|
53
|
+
if @errors_must_match.empty? and @errors_must_not_match.empty?
|
|
54
|
+
pass
|
|
55
|
+
else
|
|
56
|
+
unless @errors_must_match.empty?
|
|
57
|
+
@log.some_wanted_paths_are_missing = @errors_must_match
|
|
58
|
+
end
|
|
59
|
+
unless @errors_must_not_match.empty?
|
|
60
|
+
@log.some_unwanted_paths_are_present = @errors_must_not_match
|
|
61
|
+
end
|
|
62
|
+
fail
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
protected :assertion
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def epilogue
|
|
69
|
+
@log.delete_observer @c_filter
|
|
70
|
+
super
|
|
71
|
+
end
|
|
72
|
+
protected :epilogue
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
# Attributes
|
|
77
|
+
#
|
|
78
|
+
|
|
79
|
+
attribute :match, 'a list of regexp paths which must matched with ' +
|
|
80
|
+
'the test output', Array, []
|
|
81
|
+
|
|
82
|
+
attribute :dont_match, 'a list of regexp paths which must NOT matched with ' +
|
|
83
|
+
'the test output', Array, []
|
|
84
|
+
|
|
85
|
+
attribute :test, 'the test to run at each time',
|
|
86
|
+
:mandatory, :invisible, :dont_expand
|
|
87
|
+
|
|
88
|
+
end # class RMatch
|
|
89
|
+
|
|
90
|
+
end # module Strategies
|
|
91
|
+
|
|
92
|
+
end # module Uttk
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Author:: Nicolas Despres <nicolas.despres@gmail.com>.
|
|
2
|
+
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
|
|
3
|
+
# License:: LGPL
|
|
4
|
+
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/RUnit.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'yaml'
|
|
8
|
+
|
|
9
|
+
module Uttk
|
|
10
|
+
|
|
11
|
+
module Strategies
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# = Description
|
|
15
|
+
#
|
|
16
|
+
# This strategy is wrapper around a Ruby unit test suite based on the
|
|
17
|
+
# test/unit library. Using RUnit you avoid the Ruby `require' problem
|
|
18
|
+
# and you use all the power of the Uttk's Suite and/or Pool.
|
|
19
|
+
#
|
|
20
|
+
# = How it works ?
|
|
21
|
+
#
|
|
22
|
+
# RUnit works by invoking Ruby on the specified file and then by parsing
|
|
23
|
+
# the output in order to inject it into the Uttk's log stream. To do that,
|
|
24
|
+
# you must use a specific TestRunner based on YAML. This TestRunner
|
|
25
|
+
# produces a YAML output readable by a human and the strategy.
|
|
26
|
+
#
|
|
27
|
+
# = Examples
|
|
28
|
+
#
|
|
29
|
+
# You need to first write your unit test suite using the test/unit package
|
|
30
|
+
# and the YAML TestRunner. Then, you write a few line in the input Uttk
|
|
31
|
+
# file to incorporate the unit test in the Uttk's suite.
|
|
32
|
+
#
|
|
33
|
+
# == The unit test suite file: foo_test.rb
|
|
34
|
+
#
|
|
35
|
+
# require 'foo'
|
|
36
|
+
#
|
|
37
|
+
# class FooTest < Test::Unit::TestCase
|
|
38
|
+
#
|
|
39
|
+
# def test_1
|
|
40
|
+
# assert(true)
|
|
41
|
+
# end
|
|
42
|
+
#
|
|
43
|
+
# end
|
|
44
|
+
#
|
|
45
|
+
# == The YAML input file for Uttk
|
|
46
|
+
#
|
|
47
|
+
# ---
|
|
48
|
+
# RUnit example test:
|
|
49
|
+
# strategy: RUnit
|
|
50
|
+
# input: !path my_unit_directory/foo_test.rb
|
|
51
|
+
#
|
|
52
|
+
# == One suite for all your unit test suite
|
|
53
|
+
#
|
|
54
|
+
# If you find cumbersome to write for every unit test files a single RUnit
|
|
55
|
+
# strategy into the YAML input file of Uttk, there is another way that is
|
|
56
|
+
# used in test/unit-suite.yml.
|
|
57
|
+
#
|
|
58
|
+
class RUnit < CmdBase
|
|
59
|
+
include Concrete
|
|
60
|
+
|
|
61
|
+
protected
|
|
62
|
+
def prologue
|
|
63
|
+
@command = '<<ruby>> -- <<uttk-unit>> '
|
|
64
|
+
if @verbose
|
|
65
|
+
@command += '--verbose '
|
|
66
|
+
else
|
|
67
|
+
@command += '--no-verbose '
|
|
68
|
+
end
|
|
69
|
+
@load_path.each { |x| @command += "-I #{x} " }
|
|
70
|
+
@requires = [@requires] unless @requires.respond_to? :each
|
|
71
|
+
@requires.each { |x| @command += "-r #{x} " }
|
|
72
|
+
unless @uttk_unit_options.empty?
|
|
73
|
+
opts = @uttk_unit_options
|
|
74
|
+
opts = [opts] unless opts.respond_to? :each
|
|
75
|
+
opts.each { |x| @command += "#{x} " }
|
|
76
|
+
end
|
|
77
|
+
@command += '-- %i -- --runner yaml -- %a'
|
|
78
|
+
@quiet_print = true
|
|
79
|
+
super
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
protected
|
|
83
|
+
def assertion
|
|
84
|
+
result = nil
|
|
85
|
+
if @error.my.zero? #FIXME: Shouldn't need to use my here !!
|
|
86
|
+
if @output.my.zero?
|
|
87
|
+
skip('No result has been collected probably because no test ' +
|
|
88
|
+
'suite has been run')
|
|
89
|
+
else
|
|
90
|
+
result = YAML.load(@output.my.read)
|
|
91
|
+
r = OpenStruct.new(result)
|
|
92
|
+
@log[:result] = result
|
|
93
|
+
if r.tests_number == 0
|
|
94
|
+
skip PassStatus.new.weight, 'No test suite in this file'
|
|
95
|
+
end
|
|
96
|
+
if r.failures_number != 0 or r.errors_number != 0
|
|
97
|
+
rpath = '/^failures$/^default_test/No tests were specified'
|
|
98
|
+
if r.failures_number == 1 and result.rpath_find :first, rpath
|
|
99
|
+
skip 'No tests were specified'
|
|
100
|
+
elsif r.failures_number.zero?
|
|
101
|
+
fail 'There are errors'
|
|
102
|
+
elsif r.errors_number.zero?
|
|
103
|
+
fail 'There are failures'
|
|
104
|
+
else
|
|
105
|
+
fail 'There are failures and errors'
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
pass
|
|
109
|
+
end
|
|
110
|
+
else
|
|
111
|
+
@error.my.open { |io| result = io.read }
|
|
112
|
+
raise "Some error occures while running the unit test:\n" + result
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
attribute :load_path, 'directories to add to the $LOAD_PATH variable',
|
|
117
|
+
:invisible do [] end
|
|
118
|
+
attribute :requires, 'features to require before load the input',
|
|
119
|
+
[Array, String, Pathname] do [] end
|
|
120
|
+
attribute :uttk_unit_options, 'options for uttk-unit',
|
|
121
|
+
[Array, String] do [] end
|
|
122
|
+
attribute :verbose, 'turn on/off the ruby verbose mode',
|
|
123
|
+
false, :invisible
|
|
124
|
+
|
|
125
|
+
end # class RUnit
|
|
126
|
+
|
|
127
|
+
end # module Strategies
|
|
128
|
+
|
|
129
|
+
end # module Uttk
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|