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,205 @@
|
|
|
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/strategies/JUnit.rb 8778 2005-09-26T04:34:48.103938Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#FIXME: adapt me
|
|
8
|
+
#FIXME: remove $debug
|
|
9
|
+
|
|
10
|
+
module Uttk
|
|
11
|
+
|
|
12
|
+
module Strategies
|
|
13
|
+
|
|
14
|
+
# I'm not currently usable, I will be fixed soon.
|
|
15
|
+
class JUnit < Strategy
|
|
16
|
+
include Concrete
|
|
17
|
+
|
|
18
|
+
def initialize ( *a, &b )
|
|
19
|
+
super
|
|
20
|
+
@failure = true
|
|
21
|
+
@output = ""
|
|
22
|
+
@result = { }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def parse_outcome(line)
|
|
26
|
+
case line
|
|
27
|
+
when /^OK \((\d+) test(s|)\)$/
|
|
28
|
+
@result['total tests'] = $1.to_i
|
|
29
|
+
@failure = false
|
|
30
|
+
when /^FAILURES!!!$/
|
|
31
|
+
line = next_line
|
|
32
|
+
if line =~ /^Tests run: (\d+), Failures: (\d+), Errors: (\d+)$/ then
|
|
33
|
+
@result['total tests'] = $1.to_i
|
|
34
|
+
@result['total failures'] = $2.to_i
|
|
35
|
+
@result['total errors' ] = $3.to_i
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
@result['outcome'] = "not found" if $debug >= 1
|
|
39
|
+
end
|
|
40
|
+
next_line
|
|
41
|
+
end
|
|
42
|
+
protected :parse_outcome
|
|
43
|
+
|
|
44
|
+
def parse_location(test_name, line)
|
|
45
|
+
location = []
|
|
46
|
+
i = 0
|
|
47
|
+
while line =~ /^\t(at.+\))$/
|
|
48
|
+
location[i] = $1
|
|
49
|
+
i += 1
|
|
50
|
+
line = next_line
|
|
51
|
+
end
|
|
52
|
+
if location.length != 0 then
|
|
53
|
+
@result[test_name].update({ 'location' => location })
|
|
54
|
+
else
|
|
55
|
+
@result[test_name].update({ 'location' => 'not found' }) if $debug >= 1
|
|
56
|
+
end
|
|
57
|
+
line
|
|
58
|
+
end
|
|
59
|
+
protected :parse_location
|
|
60
|
+
|
|
61
|
+
def parse_failures(line)
|
|
62
|
+
if line =~ /^There (was|were) \d+ failure(s|):$/ then
|
|
63
|
+
line = next_line
|
|
64
|
+
while line =~ /(\d)+\) (\w+)\(([\w.]+)\)junit.framework.(\w+): expected:<(.*)> but was:<(.*)>$/
|
|
65
|
+
@result["failure #$1"] = {'name' => $3 + "." + $2,
|
|
66
|
+
'reason' => $4,
|
|
67
|
+
'expected' => $5,
|
|
68
|
+
'was' => $6 }
|
|
69
|
+
line = parse_location("failure #$1", next_line)
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
@result['failures'] = "not found" if $debug >= 1
|
|
73
|
+
end
|
|
74
|
+
line
|
|
75
|
+
end
|
|
76
|
+
protected :parse_failures
|
|
77
|
+
|
|
78
|
+
def parse_errors(line)
|
|
79
|
+
if line =~ /^There (was|were) \d+ error(s|):$/ then
|
|
80
|
+
line = next_line
|
|
81
|
+
while line =~ /(\d)+\) (\w+)\(([\w.]+)\)([.\w]+)$/
|
|
82
|
+
@result["error #$1"] = {'name' => $3 + "." + $2,
|
|
83
|
+
'reason' => $4 }
|
|
84
|
+
line = parse_location("error #$1", next_line)
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
@result['errors'] = "not found" if $debug >= 1
|
|
88
|
+
end
|
|
89
|
+
line
|
|
90
|
+
end
|
|
91
|
+
protected :parse_errors
|
|
92
|
+
|
|
93
|
+
def parse_time(line)
|
|
94
|
+
if line =~ /^Time: ([\d.]+)$/ then
|
|
95
|
+
@result['time'] = $1.to_f
|
|
96
|
+
else
|
|
97
|
+
@result['time'] = "not found" if $debug >= 1
|
|
98
|
+
end
|
|
99
|
+
next_line
|
|
100
|
+
end
|
|
101
|
+
protected :parse_time
|
|
102
|
+
|
|
103
|
+
def assert_line(line, re)
|
|
104
|
+
if not line =~ re
|
|
105
|
+
raise(Failure, "cannot recognized JUnit output '#{line}'.")
|
|
106
|
+
end
|
|
107
|
+
next_line
|
|
108
|
+
end
|
|
109
|
+
protected :assert_line
|
|
110
|
+
|
|
111
|
+
def parse_output(line)
|
|
112
|
+
line = assert_line(line, /^[.FE]*$/)
|
|
113
|
+
line = parse_time(line)
|
|
114
|
+
line = parse_errors(line)
|
|
115
|
+
line = parse_failures(line)
|
|
116
|
+
line = assert_line(line, /^$/)
|
|
117
|
+
line = parse_outcome(line)
|
|
118
|
+
line = assert_line(line, /^$/)
|
|
119
|
+
end
|
|
120
|
+
protected :parse_output
|
|
121
|
+
|
|
122
|
+
def next_line
|
|
123
|
+
line = @output.gets
|
|
124
|
+
line.chomp unless line.nil?
|
|
125
|
+
end
|
|
126
|
+
protected :next_line
|
|
127
|
+
|
|
128
|
+
def check_workdir
|
|
129
|
+
if not File.exist?(@workdir) then
|
|
130
|
+
raise Failure, "the work dir '#{workdir}' doesn't exist."
|
|
131
|
+
elsif not File.directory?(@workdir) then
|
|
132
|
+
raise Failure, "the work dir '#{workdir}' is not a directory."
|
|
133
|
+
elsif not File.readable?(@workdir) then
|
|
134
|
+
raise Failure, "the work dir '#{workdir}' isn unreadable."
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
protected :check_workdir
|
|
138
|
+
|
|
139
|
+
def check_testclasses_validity
|
|
140
|
+
@testclasses.gsub!(/\.class(\s+|$)/, ' ')
|
|
141
|
+
@testclasses.chomp!(' ')
|
|
142
|
+
testclasses_tbl = @testclasses.split(/\s+/)
|
|
143
|
+
if testclasses_tbl.length == 0 then
|
|
144
|
+
raise Failure, "no testclass are specified."
|
|
145
|
+
end
|
|
146
|
+
testclasses_tbl.each do |x|
|
|
147
|
+
filename = @workdir + "/" + x.gsub(/\./, '/') + ".class"
|
|
148
|
+
if not File.exist?(filename) then
|
|
149
|
+
raise Failure, "the testclass '#{filename}' doesn't exist."
|
|
150
|
+
elsif not File.file?(filename) then
|
|
151
|
+
raise Failure, "the testclass '#{filename}' is not a regular file."
|
|
152
|
+
elsif not File.readable?(filename) then
|
|
153
|
+
raise Failure, "the testclass '#{filename}' is unreadable."
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
protected :check_testclasses_validity
|
|
158
|
+
|
|
159
|
+
def prologue
|
|
160
|
+
super
|
|
161
|
+
check_workdir
|
|
162
|
+
check_testclasses_validity
|
|
163
|
+
@old_classpath = ENV['CLASSPATH'];
|
|
164
|
+
ENV['CLASSPATH'] = "" if ENV['CLASSPATH'].nil?
|
|
165
|
+
ENV['CLASSPATH'] += ':/usr/share/java/junit.jar:.'
|
|
166
|
+
@old_workdir = Dir.pwd
|
|
167
|
+
Dir.chdir(@workdir)
|
|
168
|
+
@log['real working dir is'] = Dir.pwd if $debug >= 1
|
|
169
|
+
end
|
|
170
|
+
protected :prologue
|
|
171
|
+
|
|
172
|
+
def run_impl
|
|
173
|
+
@output = IO.popen("java junit.textui.TestRunner #@testclasses")
|
|
174
|
+
parse_output(next_line)
|
|
175
|
+
@output.close
|
|
176
|
+
end
|
|
177
|
+
protected :run_impl
|
|
178
|
+
|
|
179
|
+
def assertion
|
|
180
|
+
@failure ? fail : pass
|
|
181
|
+
end
|
|
182
|
+
protected :assertion
|
|
183
|
+
|
|
184
|
+
def epilogue
|
|
185
|
+
ENV['CLASSPATH'] = @old_classpath
|
|
186
|
+
Dir.chdir(@old_workdir)
|
|
187
|
+
print_result
|
|
188
|
+
super
|
|
189
|
+
end
|
|
190
|
+
protected :epilogue
|
|
191
|
+
|
|
192
|
+
def print_result
|
|
193
|
+
@result.sort.each { |k,v| @log[k] = v }
|
|
194
|
+
end
|
|
195
|
+
protected :print_result
|
|
196
|
+
|
|
197
|
+
attribute :testclasses, 'the name of the JUnit classes to test', "", :mandatory
|
|
198
|
+
attribute :workdir, 'the working directory where java is runned', '.'
|
|
199
|
+
attribute :options, 'extra options to pass to java', ''
|
|
200
|
+
|
|
201
|
+
end # class JUnit
|
|
202
|
+
|
|
203
|
+
end # module Strategies
|
|
204
|
+
|
|
205
|
+
end # module Uttk
|
|
@@ -0,0 +1,62 @@
|
|
|
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/KillAll.rb 22102 2006-02-21T23:03:39.538964Z pouillar $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
# I kill all the process that match my _regexp_ attribute by sending my
|
|
12
|
+
# _signal_ attribute. I'm unfortunately not compatible with all OS since I
|
|
13
|
+
# depend on the _ps_ program.
|
|
14
|
+
class KillAll < Strategy
|
|
15
|
+
include Concrete
|
|
16
|
+
|
|
17
|
+
def prologue
|
|
18
|
+
super
|
|
19
|
+
@pids = []
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def run_impl
|
|
23
|
+
IO.popen('ps a') do |ps|
|
|
24
|
+
ps.readline
|
|
25
|
+
ps.each do |line|
|
|
26
|
+
if line =~ /^\s*(\d+)(?:\s+\S+){3}\s+(.*)$/
|
|
27
|
+
pid, name = $1.to_i, $2
|
|
28
|
+
if name =~ @regexp
|
|
29
|
+
@pids << pid
|
|
30
|
+
begin
|
|
31
|
+
Process.kill(@signal, pid)
|
|
32
|
+
rescue
|
|
33
|
+
raise RuntimeError, "Cannot kill #{name}:#{pid}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
else
|
|
37
|
+
raise RuntimeError, 'bad ps output'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def assertion
|
|
44
|
+
pass if @pids.empty?
|
|
45
|
+
fail "I killed some process #{@pids.inspect}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def epilogue
|
|
49
|
+
unless @pids.empty?
|
|
50
|
+
@log.process = @pids
|
|
51
|
+
sleep 0.2
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attribute :signal, 'Signal to send to selected processes', 'KILL'
|
|
56
|
+
attribute :regexp, 'A regexp to match process names', :mandatory
|
|
57
|
+
|
|
58
|
+
end # class KillAll
|
|
59
|
+
|
|
60
|
+
end # module Strategies
|
|
61
|
+
|
|
62
|
+
end # module Uttk
|
|
@@ -0,0 +1,94 @@
|
|
|
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/Make.rb 8789 2005-09-27T14:49:49.088376Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
class Make < Proxy
|
|
12
|
+
include Concrete
|
|
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
|
+
def prologue
|
|
35
|
+
super
|
|
36
|
+
cmd = mk_cmd(@target.target, @continue_mode, @jobs, @options)
|
|
37
|
+
create(Cmd) do |test|
|
|
38
|
+
test.name = 'internal command'
|
|
39
|
+
test.exit = 0
|
|
40
|
+
test.dir = @dir
|
|
41
|
+
test.command = cmd
|
|
42
|
+
test.reject :strategy, :exit, :fatal, :dir
|
|
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
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class All < Target
|
|
65
|
+
include Concrete
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class Check < Target
|
|
69
|
+
include Concrete
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
class DistCheck < Target
|
|
73
|
+
include Concrete
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class Install < Target
|
|
77
|
+
include Concrete
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
attribute :dir, 'building directory', :mandatory
|
|
81
|
+
|
|
82
|
+
attribute :target, 'select a target', Class, Default, :invisible
|
|
83
|
+
|
|
84
|
+
attribute :continue_mode, 'use the -k option of make', false
|
|
85
|
+
|
|
86
|
+
attribute :jobs, 'number of jobs (-j option)'
|
|
87
|
+
|
|
88
|
+
attribute :options, 'other options' do [] end
|
|
89
|
+
|
|
90
|
+
end # class Make
|
|
91
|
+
|
|
92
|
+
end # module Strategies
|
|
93
|
+
|
|
94
|
+
end # module Uttk
|
|
@@ -0,0 +1,129 @@
|
|
|
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/Package.rb 8789 2005-09-27T14:49:49.088376Z ertai $
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Uttk
|
|
8
|
+
|
|
9
|
+
module Strategies
|
|
10
|
+
|
|
11
|
+
class Package < Collection
|
|
12
|
+
include Concrete
|
|
13
|
+
include Ordered
|
|
14
|
+
|
|
15
|
+
def prologue
|
|
16
|
+
extract_dir = '<<extract_dir>>'
|
|
17
|
+
self.attributes = {
|
|
18
|
+
:dir => extract_dir,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
super
|
|
22
|
+
|
|
23
|
+
create(Checkout) do |checkout|
|
|
24
|
+
checkout.name = 'Checkout'
|
|
25
|
+
checkout.url = @url
|
|
26
|
+
checkout.fatal = true
|
|
27
|
+
checkout.weight = 0
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
unless skip_step? 'configure'
|
|
31
|
+
create(Bootstrap) do |bootstrap|
|
|
32
|
+
bootstrap.name = 'Bootstrapping'
|
|
33
|
+
bootstrap.weight = 0
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
unless skip_step? 'bootstrap'
|
|
38
|
+
create(Configure) do |configure|
|
|
39
|
+
configure.name = 'Configuring'
|
|
40
|
+
configure.prefix = @prefix
|
|
41
|
+
configure.flags = @configure_flags
|
|
42
|
+
configure.weight = 0
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
unless skip_step? 'build'
|
|
47
|
+
create(Make) do |build|
|
|
48
|
+
build.name = 'Building'
|
|
49
|
+
build.continue_mode = true
|
|
50
|
+
# build.jobs = 2
|
|
51
|
+
build.fatal = true
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
make = {}
|
|
56
|
+
|
|
57
|
+
[ Make::Check, Make::DistCheck, Make::Install ].each do |step|
|
|
58
|
+
step_name = step.target
|
|
59
|
+
next if skip_step? step_name
|
|
60
|
+
create(Make) do |build|
|
|
61
|
+
build.name = "Building #{step_name}"
|
|
62
|
+
build.target = step
|
|
63
|
+
build.fatal = true
|
|
64
|
+
make[step_name.to_sym] = build
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if @install_prefix and make.has_key? :install
|
|
69
|
+
make[:install].options << "prefix=#@install_prefix"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if make.has_key? :distcheck
|
|
73
|
+
make[:distcheck].options <<
|
|
74
|
+
"DISTCHECK_CONFIGURE_FLAGS='<<configure_flags>>'"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# FIXME does this step make sense
|
|
78
|
+
unless skip_step? 'tarball'
|
|
79
|
+
create(Block) do |test|
|
|
80
|
+
test.name = 'Exporting the tarball'
|
|
81
|
+
test.test = proc do
|
|
82
|
+
balls = Pathname.glob("#{extract_dir}/*.tar.*")
|
|
83
|
+
unless balls.empty?
|
|
84
|
+
@log.new_node :contents, :ordered => true do
|
|
85
|
+
balls.each do |ball|
|
|
86
|
+
ball.copy(dir)
|
|
87
|
+
@log << ball
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
true
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
unless @test.nil? or skip_step? 'test'
|
|
97
|
+
create(@test)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
unless skip_step? 'clean'
|
|
101
|
+
create(Clean) do |clean|
|
|
102
|
+
clean.name = 'Cleaning'
|
|
103
|
+
clean.fatal = true
|
|
104
|
+
clean.weight = 0
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def skip_step? ( step )
|
|
111
|
+
step = /#{step}/i unless step.is_a? Regexp
|
|
112
|
+
@skip_steps.any? { |x| step =~ x }
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
attribute :url, 'url of the package to install', :mandatory
|
|
117
|
+
attribute :test, 'the test to execute', :invisible
|
|
118
|
+
attribute :prefix, 'the prefix directory for `configure\''
|
|
119
|
+
attribute :configure_flags, 'set flags for the configure step'
|
|
120
|
+
attribute :install_prefix, 'the prefix directory for `make install\''
|
|
121
|
+
attribute :skip_steps, 'steps to skip (a list of strings or regexps)' do
|
|
122
|
+
[]
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
end # class Package
|
|
126
|
+
|
|
127
|
+
end # module Strategies
|
|
128
|
+
|
|
129
|
+
end # module Uttk
|