uttk 0.3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/AUTHORS +36 -0
  2. data/COPYING +18 -0
  3. data/ChangeLog +7673 -0
  4. data/GUIDELINES +86 -0
  5. data/LGPL +504 -0
  6. data/NEWS +158 -0
  7. data/NORM +137 -0
  8. data/README +180 -0
  9. data/Rakefile +8 -0
  10. data/SPEC.gemspec +15 -0
  11. data/SPEC.yml +60 -0
  12. data/TODO +23 -0
  13. data/TODO.old +31 -0
  14. data/VERSION +5 -0
  15. data/bin/getopts/uttk.rb +390 -0
  16. data/bin/uttk +188 -0
  17. data/bin/uttk-unit +125 -0
  18. data/lib/uttk.rb +288 -0
  19. data/lib/uttk/dumpers/Basic.rb +23 -0
  20. data/lib/uttk/dumpers/BasicColor.rb +35 -0
  21. data/lib/uttk/dumpers/Dumper.rb +77 -0
  22. data/lib/uttk/dumpers/Html.rb +271 -0
  23. data/lib/uttk/dumpers/Path.rb +24 -0
  24. data/lib/uttk/dumpers/Xml.rb +88 -0
  25. data/lib/uttk/dumpers/Yaml.rb +138 -0
  26. data/lib/uttk/filters.rb +128 -0
  27. data/lib/uttk/filters/Buffer.rb +119 -0
  28. data/lib/uttk/filters/Compact.rb +75 -0
  29. data/lib/uttk/filters/Default.rb +27 -0
  30. data/lib/uttk/filters/DefaultColor.rb +27 -0
  31. data/lib/uttk/filters/Filter.rb +53 -0
  32. data/lib/uttk/filters/Id.rb +30 -0
  33. data/lib/uttk/filters/JustStatus.rb +25 -0
  34. data/lib/uttk/filters/KeepSkipBased.rb +38 -0
  35. data/lib/uttk/filters/NodeCut.rb +97 -0
  36. data/lib/uttk/filters/RPathFilter.rb +134 -0
  37. data/lib/uttk/filters/Saver.rb +53 -0
  38. data/lib/uttk/filters/TextFilter.rb +69 -0
  39. data/lib/uttk/generators/dumper_generator.rb +28 -0
  40. data/lib/uttk/generators/filter_generator.rb +28 -0
  41. data/lib/uttk/generators/generator.rb +86 -0
  42. data/lib/uttk/generators/generator_generator.rb +26 -0
  43. data/lib/uttk/generators/loader_generator.rb +28 -0
  44. data/lib/uttk/generators/path_filter_generator.rb +28 -0
  45. data/lib/uttk/generators/strategy_generator.rb +28 -0
  46. data/lib/uttk/generators/templates/dumper.rb +50 -0
  47. data/lib/uttk/generators/templates/filter.rb +50 -0
  48. data/lib/uttk/generators/templates/generator.rb +28 -0
  49. data/lib/uttk/generators/templates/loader.rb +26 -0
  50. data/lib/uttk/generators/templates/path_filter.rb +28 -0
  51. data/lib/uttk/generators/templates/strategy.rb +59 -0
  52. data/lib/uttk/generators/templates/strategy.yml +28 -0
  53. data/lib/uttk/generators/templates/unit_test.rb +46 -0
  54. data/lib/uttk/loaders/Loader.rb +180 -0
  55. data/lib/uttk/loaders/Ruby.rb +28 -0
  56. data/lib/uttk/loaders/Yaml.rb +98 -0
  57. data/lib/uttk/logger.rb +306 -0
  58. data/lib/uttk/logger/backend.rb +170 -0
  59. data/lib/uttk/logger/path.rb +202 -0
  60. data/lib/uttk/logger/section_node.rb +214 -0
  61. data/lib/uttk/logger/severity.rb +63 -0
  62. data/lib/uttk/logger/to_uttk_log.rb +127 -0
  63. data/lib/uttk/logger/verbosity.rb +61 -0
  64. data/lib/uttk/logger_factory.rb +55 -0
  65. data/lib/uttk/path_filters/ColorStatus.rb +57 -0
  66. data/lib/uttk/path_filters/PathFilter.rb +27 -0
  67. data/lib/uttk/path_filters/RemoveTypes.rb +25 -0
  68. data/lib/uttk/status.rb +146 -0
  69. data/lib/uttk/strategies/Abort.rb +24 -0
  70. data/lib/uttk/strategies/Assert.rb +44 -0
  71. data/lib/uttk/strategies/Authors.rb +45 -0
  72. data/lib/uttk/strategies/Block.rb +113 -0
  73. data/lib/uttk/strategies/Bootstrap.rb +55 -0
  74. data/lib/uttk/strategies/Checkout.rb +64 -0
  75. data/lib/uttk/strategies/Clean.rb +29 -0
  76. data/lib/uttk/strategies/Cmd.rb +60 -0
  77. data/lib/uttk/strategies/CmdBase.rb +130 -0
  78. data/lib/uttk/strategies/Collection.rb +158 -0
  79. data/lib/uttk/strategies/Compile.rb +59 -0
  80. data/lib/uttk/strategies/Composite.rb +201 -0
  81. data/lib/uttk/strategies/Composite/contents_eval.rb +40 -0
  82. data/lib/uttk/strategies/Configure.rb +66 -0
  83. data/lib/uttk/strategies/Error.rb +23 -0
  84. data/lib/uttk/strategies/Fail.rb +26 -0
  85. data/lib/uttk/strategies/IOBased.rb +159 -0
  86. data/lib/uttk/strategies/Import.rb +60 -0
  87. data/lib/uttk/strategies/Iterate.rb +139 -0
  88. data/lib/uttk/strategies/JUnit.rb +205 -0
  89. data/lib/uttk/strategies/KillAll.rb +62 -0
  90. data/lib/uttk/strategies/Make.rb +94 -0
  91. data/lib/uttk/strategies/Package.rb +129 -0
  92. data/lib/uttk/strategies/PackageCollection.rb +78 -0
  93. data/lib/uttk/strategies/Pass.rb +24 -0
  94. data/lib/uttk/strategies/Pool.rb +104 -0
  95. data/lib/uttk/strategies/ProbabilityThreshold.rb +46 -0
  96. data/lib/uttk/strategies/Proxy.rb +42 -0
  97. data/lib/uttk/strategies/RMatch.rb +92 -0
  98. data/lib/uttk/strategies/RUnit.rb +132 -0
  99. data/lib/uttk/strategies/SignalCmd.rb +85 -0
  100. data/lib/uttk/strategies/Sleep.rb +36 -0
  101. data/lib/uttk/strategies/SqlQuery.rb +120 -0
  102. data/lib/uttk/strategies/Strategy.rb +683 -0
  103. data/lib/uttk/strategies/Stub.rb +37 -0
  104. data/lib/uttk/strategies/SubCmd.rb +77 -0
  105. data/lib/uttk/strategies/Suite.rb +71 -0
  106. data/lib/uttk/strategies/Test.rb +89 -0
  107. data/lib/uttk/streams.rb +69 -0
  108. data/lib/uttk/streams/Diff.rb +60 -0
  109. data/lib/uttk/streams/HexaDiff.rb +35 -0
  110. data/lib/uttk/streams/Stream.rb +76 -0
  111. data/lib/uttk/weights.rb +17 -0
  112. data/lib/uttk/weights/WExpr.rb +68 -0
  113. data/lib/uttk/weights/WFloat.rb +23 -0
  114. data/lib/uttk/weights/WMin.rb +22 -0
  115. data/lib/uttk/weights/Weight.rb +105 -0
  116. data/lib/www/javascripts/uttk.js +185 -0
  117. data/misc/expandtab.rb +29 -0
  118. data/misc/header.rb +44 -0
  119. data/misc/renaming +57 -0
  120. data/misc/textile_compiler +194 -0
  121. data/misc/uttk-grep.sh +8 -0
  122. data/misc/uttk-line-count.rb +143 -0
  123. data/test/examples-suite.yml +8 -0
  124. data/test/examples/README +68 -0
  125. data/test/examples/basic.rb +10 -0
  126. data/test/examples/basic.yml +9 -0
  127. data/test/examples/cache/cache_and_fatal.yml +5 -0
  128. data/test/examples/cache/simple.yml +30 -0
  129. data/test/examples/sql/basic.yml +24 -0
  130. data/test/examples/students-suite.yml +9 -0
  131. data/test/examples/students/ball.yml +11 -0
  132. data/test/examples/students/glob_stud.yml +20 -0
  133. data/test/examples/students/mini-lib.yml +61 -0
  134. data/test/examples/students/pool_stud.yml +31 -0
  135. data/test/examples/students/stud.yml +21 -0
  136. data/test/fixtures/ball/20040804-exam_a1-zapngo-tessar_m.tar.gz +0 -0
  137. data/test/fixtures/ball/Makefile +24 -0
  138. data/test/fixtures/ball/bar_p-mini-lib.tar.bz2 +0 -0
  139. data/test/fixtures/ball/bar_p-mini-lib/Makefile +20 -0
  140. data/test/fixtures/ball/bar_p-mini-lib/my_strlen.c +13 -0
  141. data/test/fixtures/ball/foo_s-mini-lib.tar.bz2 +0 -0
  142. data/test/fixtures/ball/foo_s-mini-lib/Makefile +20 -0
  143. data/test/fixtures/ball/foo_s-mini-lib/configure +2 -0
  144. data/test/fixtures/ball/foo_s-mini-lib/my_strlen.c +10 -0
  145. data/test/fixtures/ball/hello.tar.bz2 +0 -0
  146. data/test/fixtures/ball/hello.tar.gz +0 -0
  147. data/test/fixtures/ball/hello/Makefile +14 -0
  148. data/test/fixtures/ball/hello/hello.c +7 -0
  149. data/test/fixtures/ball/jack-exit.tar.bz2 +0 -0
  150. data/test/fixtures/ball/jack-exit/Makefile +14 -0
  151. data/test/fixtures/ball/jack-exit/exit.c +16 -0
  152. data/test/fixtures/ball/joe-exit.tar.bz2 +0 -0
  153. data/test/fixtures/ball/joe-exit/Makefile +14 -0
  154. data/test/fixtures/ball/joe-exit/exit.c +8 -0
  155. data/test/fixtures/ball/joe_i-mini-lib.tar.bz2 +0 -0
  156. data/test/fixtures/ball/joe_i-mini-lib/Makefile +20 -0
  157. data/test/fixtures/ball/joe_i-mini-lib/configure +2 -0
  158. data/test/fixtures/ball/joe_i-mini-lib/my_strlen.c +10 -0
  159. data/test/fixtures/ball/john-exit.tar.bz2 +0 -0
  160. data/test/fixtures/ball/john-exit/Makefile +14 -0
  161. data/test/fixtures/ball/john-exit/exit.c +6 -0
  162. data/test/fixtures/ball/qux_j-mini-lib.tar.bz2 +0 -0
  163. data/test/fixtures/ball/qux_j-mini-lib/Makefile +20 -0
  164. data/test/fixtures/ball/qux_j-mini-lib/my_strlen.c +12 -0
  165. data/test/fixtures/binaries/segv +0 -0
  166. data/test/fixtures/binaries/segv.c +10 -0
  167. data/test/fixtures/binaries/segv.rb +2 -0
  168. data/test/fixtures/demo/command-tutorial/steps/1/check.yml +5 -0
  169. data/test/fixtures/demo/command-tutorial/steps/1/pluralizer.rb +10 -0
  170. data/test/fixtures/demo/command-tutorial/steps/2/bad_check.yml +7 -0
  171. data/test/fixtures/demo/command-tutorial/steps/2/check.yml +7 -0
  172. data/test/fixtures/demo/command-tutorial/steps/2/pluralizer.rb +10 -0
  173. data/test/fixtures/demo/command-tutorial/steps/3.1/check.yml +12 -0
  174. data/test/fixtures/demo/command-tutorial/steps/3/check.yml +14 -0
  175. data/test/fixtures/demo/command-tutorial/steps/4.1/bird.txt +1 -0
  176. data/test/fixtures/demo/command-tutorial/steps/4.1/check.yml +12 -0
  177. data/test/fixtures/demo/command-tutorial/steps/4/check.yml +12 -0
  178. data/test/fixtures/demo/command-tutorial/steps/4/pluralizer.rb +12 -0
  179. data/test/fixtures/demo/command-tutorial/steps/5.1/bird.txt +1 -0
  180. data/test/fixtures/demo/command-tutorial/steps/5.1/check.yml +17 -0
  181. data/test/fixtures/demo/command-tutorial/steps/5.1/pluralizer.rb +17 -0
  182. data/test/fixtures/demo/command-tutorial/steps/5/bird.txt +1 -0
  183. data/test/fixtures/demo/command-tutorial/steps/5/check.yml +16 -0
  184. data/test/fixtures/demo/command-tutorial/steps/5/pluralizer.rb +16 -0
  185. data/test/fixtures/demo/command-tutorial/steps/6.1/bird.txt +1 -0
  186. data/test/fixtures/demo/command-tutorial/steps/6.1/check.yml +22 -0
  187. data/test/fixtures/demo/command-tutorial/steps/6.1/pluralizer.rb +17 -0
  188. data/test/fixtures/demo/command-tutorial/steps/6/bird.txt +1 -0
  189. data/test/fixtures/demo/command-tutorial/steps/6/check.yml +21 -0
  190. data/test/fixtures/demo/command-tutorial/steps/6/pluralizer.rb +17 -0
  191. data/test/fixtures/demo/command-tutorial/steps/7/bird.txt +1 -0
  192. data/test/fixtures/demo/command-tutorial/steps/7/check.yml +22 -0
  193. data/test/fixtures/demo/command-tutorial/steps/7/pluralizer.rb +17 -0
  194. data/test/fixtures/demo/filter-tutorial/check.yml +20 -0
  195. data/test/fixtures/demo/filter-tutorial/filters/CutSkip100.rb +19 -0
  196. data/test/fixtures/demo/filter-tutorial/pluralizer.rb +17 -0
  197. data/test/fixtures/java/unit/MultiRight/Foo/Foo.java +11 -0
  198. data/test/fixtures/java/unit/MultiRight/Foo/FooTest.java +15 -0
  199. data/test/fixtures/java/unit/MultiRight/MultiRight.java +13 -0
  200. data/test/fixtures/java/unit/MultiRight/MultiRightTest.java +12 -0
  201. data/test/fixtures/java/unit/MultiRight/bar/Bar.java +11 -0
  202. data/test/fixtures/java/unit/MultiRight/bar/BarTest.java +21 -0
  203. data/test/fixtures/java/unit/MultiRight/build.sh +7 -0
  204. data/test/fixtures/java/unit/SimpleException/SimpleExceptionTest.java +11 -0
  205. data/test/fixtures/java/unit/SimpleException/build.sh +4 -0
  206. data/test/fixtures/java/unit/build.sh +9 -0
  207. data/test/fixtures/java/unit/multibar.yml +6 -0
  208. data/test/fixtures/java/unit/multifoo.yml +6 -0
  209. data/test/fixtures/java/unit/multiright.yml +8 -0
  210. data/test/fixtures/java/unit/simple_exception.yml +6 -0
  211. data/test/fixtures/mini-lib/Makefile +9 -0
  212. data/test/fixtures/mini-lib/strlen.c +15 -0
  213. data/test/fixtures/package/pkg_foo.tar.gz +0 -0
  214. data/test/fixtures/package/pkg_foo/Makefile +20 -0
  215. data/test/fixtures/package/pkg_foo/bootstrap +3 -0
  216. data/test/fixtures/package/pkg_foo/configure +3 -0
  217. data/test/fixtures/package/pkg_foo/foo.sh +2 -0
  218. data/test/fixtures/text/1.txt +4 -0
  219. data/test/fixtures/unit/bad.rb +26 -0
  220. data/test/fixtures/unit/error.rb +6 -0
  221. data/test/fixtures/unit/good.rb +26 -0
  222. data/test/functional-suite.yml +10 -0
  223. data/test/functional/author.yml +11 -0
  224. data/test/functional/base.yml +119 -0
  225. data/test/functional/base_pool.yml +13 -0
  226. data/test/functional/block.yml +13 -0
  227. data/test/functional/cat.yml +16 -0
  228. data/test/functional/cmd.yml +17 -0
  229. data/test/functional/diff.yml +27 -0
  230. data/test/functional/env_cmd.yml +53 -0
  231. data/test/functional/exit.yml +15 -0
  232. data/test/functional/fatal.yml +23 -0
  233. data/test/functional/glob.yml +11 -0
  234. data/test/functional/hexa-diff.yml +25 -0
  235. data/test/functional/import.yml +41 -0
  236. data/test/functional/iterate.yml +99 -0
  237. data/test/functional/killall.yml +31 -0
  238. data/test/functional/pkg.yml +14 -0
  239. data/test/functional/probability_threshold.yml +35 -0
  240. data/test/functional/r_unit.yml +26 -0
  241. data/test/functional/rmatch.yml +122 -0
  242. data/test/functional/signal_cmd.yml +22 -0
  243. data/test/functional/sub.yml +15 -0
  244. data/test/functional/test.yml +25 -0
  245. data/test/functional/timeout.yml +20 -0
  246. data/test/functional/wc.yml +26 -0
  247. data/test/functional/weight.yml +152 -0
  248. data/test/pkg-suite.yml +8 -0
  249. data/test/pkg/cmdline.yml +80 -0
  250. data/test/pool-suite.yml +8 -0
  251. data/test/pool/base.yml +12 -0
  252. data/test/pool/pool.yml +25 -0
  253. data/test/ruby-suite.rb +10 -0
  254. data/test/ruby-suite.yml +5 -0
  255. data/test/ruby/base.rb +119 -0
  256. data/test/ruby/iterate.rb +21 -0
  257. data/test/ruby/wc.rb +43 -0
  258. data/test/unit-suite.yml +10 -0
  259. data/test/unit/dumpers/path_test.rb +46 -0
  260. data/test/unit/dumpers/xml_test.rb +65 -0
  261. data/test/unit/dumpers/yaml_test.rb +65 -0
  262. data/test/unit/filters/buffer_test.rb +168 -0
  263. data/test/unit/filters/keep_skip_based_test.rb +46 -0
  264. data/test/unit/filters/node_cut_test.rb +72 -0
  265. data/test/unit/filters/rpath_filter_test.rb +191 -0
  266. data/test/unit/filters/text_filter_test.rb +46 -0
  267. data/test/unit/filters_test.rb +119 -0
  268. data/test/unit/logger/section_node_test.rb +120 -0
  269. data/test/unit/logger/severity_test.rb +37 -0
  270. data/test/unit/logger/to_uttk_log_test.rb +113 -0
  271. data/test/unit/logger/verbosity_test.rb +44 -0
  272. data/test/unit/logger_test.rb +203 -0
  273. data/test/unit/strategies/suite_test.rb +151 -0
  274. data/test/uttk-check.yml +8 -0
  275. data/test/uttk-distcheck.yml +18 -0
  276. metadata +399 -0
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # Author:: The Uttk Team. -*- ruby -*-
2
+ # Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
3
+ # License:: LGPL
4
+ # Revision:: $Id: /fey/uttk/trunk/Rakefile 8778 2005-09-26T04:34:48.103938Z ertai $
5
+
6
+ require 'rubygems'
7
+ require_gem 'core_ex'
8
+ load 'core_ex/rakefile_base.rf'
data/SPEC.gemspec ADDED
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{uttk}
3
+ s.version = "0.3.1.2"
4
+ s.date = %q{2006-02-25}
5
+ s.summary = %q{Uttk is an extensible framework for dynamic testing.}
6
+ s.email = ["cuissa_v@epita.fr", "nicolas.despres@gmail.com", "ertai@feydakins.org", "pouill_j@epita.fr", "marco.tessari@gmail.com"]
7
+ s.homepage = %q{http://rubyforge.org/projects/uttk}
8
+ s.rubyforge_project = %q{uttk}
9
+ s.description = %q{Uttk is designed to help you while you are writing dynamic tests for your projects. It keeps track of your test strategies by means of a solid dynamic hierarchy of test strategy classes. The only way to be 100% generic is to be extensible, after all. Network distribution strategies can also be written since Uttk provides cluster features. Uttk understands YAML and Ruby as input languages and speaks YAML, XML and HTML as output languages.}
10
+ s.authors = ["Vincent Cuissard", "Nicolas Despr\350s", "Nicolas Pouillard", "Jerome Pouiller", "Marco Tessari"]
11
+ s.files = ["bin/uttk", "bin/getopts", "bin/uttk-unit", "bin/getopts/uttk.rb", "lib/uttk.rb", "lib/uttk/logger_factory.rb", "lib/uttk/logger.rb", "lib/uttk/filters.rb", "lib/uttk/streams.rb", "lib/uttk/status.rb", "lib/uttk/weights.rb", "lib/uttk/path_filters/RemoveTypes.rb", "lib/uttk/path_filters/ColorStatus.rb", "lib/uttk/path_filters/PathFilter.rb", "lib/uttk/dumpers/Dumper.rb", "lib/uttk/dumpers/Path.rb", "lib/uttk/dumpers/BasicColor.rb", "lib/uttk/dumpers/Html.rb", "lib/uttk/dumpers/Xml.rb", "lib/uttk/dumpers/Yaml.rb", "lib/uttk/dumpers/Basic.rb", "lib/uttk/strategies/Iterate.rb", "lib/uttk/strategies/Cmd.rb", "lib/uttk/strategies/KillAll.rb", "lib/uttk/strategies/Checkout.rb", "lib/uttk/strategies/Pass.rb", "lib/uttk/strategies/Abort.rb", "lib/uttk/strategies/Block.rb", "lib/uttk/strategies/Compile.rb", "lib/uttk/strategies/RMatch.rb", "lib/uttk/strategies/Sleep.rb", "lib/uttk/strategies/Strategy.rb", "lib/uttk/strategies/Pool.rb", "lib/uttk/strategies/IOBased.rb", "lib/uttk/strategies/Authors.rb", "lib/uttk/strategies/RUnit.rb", "lib/uttk/strategies/Import.rb", "lib/uttk/strategies/Composite.rb", "lib/uttk/strategies/Proxy.rb", "lib/uttk/strategies/SubCmd.rb", "lib/uttk/strategies/SqlQuery.rb", "lib/uttk/strategies/JUnit.rb", "lib/uttk/strategies/Clean.rb", "lib/uttk/strategies/Fail.rb", "lib/uttk/strategies/Make.rb", "lib/uttk/strategies/Suite.rb", "lib/uttk/strategies/SignalCmd.rb", "lib/uttk/strategies/Package.rb", "lib/uttk/strategies/Test.rb", "lib/uttk/strategies/ProbabilityThreshold.rb", "lib/uttk/strategies/Stub.rb", "lib/uttk/strategies/Configure.rb", "lib/uttk/strategies/PackageCollection.rb", "lib/uttk/strategies/Collection.rb", "lib/uttk/strategies/CmdBase.rb", "lib/uttk/strategies/Error.rb", "lib/uttk/strategies/Bootstrap.rb", "lib/uttk/strategies/Assert.rb", "lib/uttk/strategies/Composite/contents_eval.rb", "lib/uttk/loaders/Loader.rb", "lib/uttk/loaders/Yaml.rb", "lib/uttk/loaders/Ruby.rb", "lib/uttk/filters/Compact.rb", "lib/uttk/filters/JustStatus.rb", "lib/uttk/filters/Id.rb", "lib/uttk/filters/TextFilter.rb", "lib/uttk/filters/DefaultColor.rb", "lib/uttk/filters/NodeCut.rb", "lib/uttk/filters/Default.rb", "lib/uttk/filters/RPathFilter.rb", "lib/uttk/filters/Buffer.rb", "lib/uttk/filters/Filter.rb", "lib/uttk/filters/KeepSkipBased.rb", "lib/uttk/filters/Saver.rb", "lib/uttk/streams/Diff.rb", "lib/uttk/streams/Stream.rb", "lib/uttk/streams/HexaDiff.rb", "lib/uttk/logger/severity.rb", "lib/uttk/logger/section_node.rb", "lib/uttk/logger/backend.rb", "lib/uttk/logger/verbosity.rb", "lib/uttk/logger/path.rb", "lib/uttk/logger/to_uttk_log.rb", "lib/uttk/generators/path_filter_generator.rb", "lib/uttk/generators/loader_generator.rb", "lib/uttk/generators/generator.rb", "lib/uttk/generators/dumper_generator.rb", "lib/uttk/generators/generator_generator.rb", "lib/uttk/generators/filter_generator.rb", "lib/uttk/generators/strategy_generator.rb", "lib/uttk/generators/templates/filter.rb", "lib/uttk/generators/templates/generator.rb", "lib/uttk/generators/templates/loader.rb", "lib/uttk/generators/templates/dumper.rb", "lib/uttk/generators/templates/unit_test.rb", "lib/uttk/generators/templates/path_filter.rb", "lib/uttk/generators/templates/strategy.rb", "lib/uttk/weights/WExpr.rb", "lib/uttk/weights/WFloat.rb", "lib/uttk/weights/Weight.rb", "lib/uttk/weights/WMin.rb", "lib/uttk/generators/templates/strategy.yml", "lib/www/javascripts/uttk.js", "test/pkg", "test/pool", "test/ruby", "test/unit", "test/unit-suite.yml", "test/examples-suite.yml", "test/functional-suite.yml", "test/uttk-distcheck.yml", "test/functional", "test/ruby-suite.yml", "test/fixtures", "test/pool-suite.yml", "test/examples", "test/ruby-suite.rb", "test/uttk-check.yml", "test/pkg-suite.yml", "test/pkg/cmdline.yml", "test/pool/pool.yml", "test/pool/base.yml", "test/ruby/iterate.rb", "test/ruby/wc.rb", "test/ruby/base.rb", "test/unit/logger_test.rb", "test/unit/filters_test.rb", "test/unit/dumpers", "test/unit/strategies", "test/unit/loaders", "test/unit/filters", "test/unit/logger", "test/unit/dumpers/path_test.rb", "test/unit/dumpers/xml_test.rb", "test/unit/dumpers/yaml_test.rb", "test/unit/strategies/suite_test.rb", "test/unit/filters/node_cut_test.rb", "test/unit/filters/rpath_filter_test.rb", "test/unit/filters/buffer_test.rb", "test/unit/filters/keep_skip_based_test.rb", "test/unit/filters/text_filter_test.rb", "test/unit/logger/to_uttk_log_test.rb", "test/unit/logger/section_node_test.rb", "test/unit/logger/severity_test.rb", "test/unit/logger/verbosity_test.rb", "test/functional/diff.yml", "test/functional/rmatch.yml", "test/functional/probability_threshold.yml", "test/functional/test.yml", "test/functional/fatal.yml", "test/functional/hexa-diff.yml", "test/functional/killall.yml", "test/functional/glob.yml", "test/functional/env_cmd.yml", "test/functional/sub.yml", "test/functional/timeout.yml", "test/functional/author.yml", "test/functional/r_unit.yml", "test/functional/import.yml", "test/functional/iterate.yml", "test/functional/base_pool.yml", "test/functional/wc.yml", "test/functional/signal_cmd.yml", "test/functional/cat.yml", "test/functional/pkg.yml", "test/functional/base.yml", "test/functional/exit.yml", "test/functional/weight.yml", "test/functional/block.yml", "test/functional/cmd.yml", "test/fixtures/binaries", "test/fixtures/ball", "test/fixtures/demo", "test/fixtures/java", "test/fixtures/text", "test/fixtures/unit", "test/fixtures/mini-lib", "test/fixtures/package", "test/fixtures/binaries/segv", "test/fixtures/binaries/segv.rb", "test/fixtures/binaries/segv.c", "test/fixtures/ball/joe-exit.tar.bz2", "test/fixtures/ball/Makefile", "test/fixtures/ball/qux_j-mini-lib", "test/fixtures/ball/joe_i-mini-lib.tar.bz2", "test/fixtures/ball/hello", "test/fixtures/ball/bar_p-mini-lib", "test/fixtures/ball/hello.tar.bz2", "test/fixtures/ball/jack-exit", "test/fixtures/ball/jack-exit.tar.bz2", "test/fixtures/ball/john-exit", "test/fixtures/ball/joe-exit", "test/fixtures/ball/qux_j-mini-lib.tar.bz2", "test/fixtures/ball/foo_s-mini-lib.tar.bz2", "test/fixtures/ball/foo_s-mini-lib", "test/fixtures/ball/hello.tar.gz", "test/fixtures/ball/joe_i-mini-lib", "test/fixtures/ball/john-exit.tar.bz2", "test/fixtures/ball/20040804-exam_a1-zapngo-tessar_m.tar.gz", "test/fixtures/ball/bar_p-mini-lib.tar.bz2", "test/fixtures/ball/qux_j-mini-lib/Makefile", "test/fixtures/ball/qux_j-mini-lib/my_strlen.c", "test/fixtures/ball/hello/Makefile", "test/fixtures/ball/hello/hello.c", "test/fixtures/ball/bar_p-mini-lib/Makefile", "test/fixtures/ball/bar_p-mini-lib/my_strlen.c", "test/fixtures/ball/jack-exit/Makefile", "test/fixtures/ball/jack-exit/exit.c", "test/fixtures/ball/john-exit/Makefile", "test/fixtures/ball/john-exit/exit.c", "test/fixtures/ball/joe-exit/Makefile", "test/fixtures/ball/joe-exit/exit.c", "test/fixtures/ball/foo_s-mini-lib/Makefile", "test/fixtures/ball/foo_s-mini-lib/configure", "test/fixtures/ball/foo_s-mini-lib/my_strlen.c", "test/fixtures/ball/joe_i-mini-lib/Makefile", "test/fixtures/ball/joe_i-mini-lib/configure", "test/fixtures/ball/joe_i-mini-lib/my_strlen.c", "test/fixtures/demo/filter-tutorial", "test/fixtures/demo/command-tutorial", "test/fixtures/demo/filter-tutorial/pluralizer.rb", "test/fixtures/demo/filter-tutorial/filters", "test/fixtures/demo/filter-tutorial/check.yml", "test/fixtures/demo/filter-tutorial/filters/CutSkip100.rb", "test/fixtures/demo/command-tutorial/steps", "test/fixtures/demo/command-tutorial/steps/1", "test/fixtures/demo/command-tutorial/steps/2", "test/fixtures/demo/command-tutorial/steps/3", "test/fixtures/demo/command-tutorial/steps/4", "test/fixtures/demo/command-tutorial/steps/5", "test/fixtures/demo/command-tutorial/steps/6", "test/fixtures/demo/command-tutorial/steps/7", "test/fixtures/demo/command-tutorial/steps/3.1", "test/fixtures/demo/command-tutorial/steps/4.1", "test/fixtures/demo/command-tutorial/steps/5.1", "test/fixtures/demo/command-tutorial/steps/6.1", "test/fixtures/demo/command-tutorial/steps/1/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/1/check.yml", "test/fixtures/demo/command-tutorial/steps/2/bad_check.yml", "test/fixtures/demo/command-tutorial/steps/2/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/2/check.yml", "test/fixtures/demo/command-tutorial/steps/3/check.yml", "test/fixtures/demo/command-tutorial/steps/4/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/4/check.yml", "test/fixtures/demo/command-tutorial/steps/5/bird.txt", "test/fixtures/demo/command-tutorial/steps/5/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/5/check.yml", "test/fixtures/demo/command-tutorial/steps/6/bird.txt", "test/fixtures/demo/command-tutorial/steps/6/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/6/check.yml", "test/fixtures/demo/command-tutorial/steps/7/bird.txt", "test/fixtures/demo/command-tutorial/steps/7/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/7/check.yml", "test/fixtures/demo/command-tutorial/steps/3.1/check.yml", "test/fixtures/demo/command-tutorial/steps/4.1/bird.txt", "test/fixtures/demo/command-tutorial/steps/4.1/check.yml", "test/fixtures/demo/command-tutorial/steps/5.1/bird.txt", "test/fixtures/demo/command-tutorial/steps/5.1/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/5.1/check.yml", "test/fixtures/demo/command-tutorial/steps/6.1/bird.txt", "test/fixtures/demo/command-tutorial/steps/6.1/pluralizer.rb", "test/fixtures/demo/command-tutorial/steps/6.1/check.yml", "test/fixtures/java/unit", "test/fixtures/java/unit/multifoo.yml", "test/fixtures/java/unit/MultiRight", "test/fixtures/java/unit/simple_exception.yml", "test/fixtures/java/unit/multibar.yml", "test/fixtures/java/unit/SimpleException", "test/fixtures/java/unit/multiright.yml", "test/fixtures/java/unit/build.sh", "test/fixtures/java/unit/MultiRight/Foo", "test/fixtures/java/unit/MultiRight/bar", "test/fixtures/java/unit/MultiRight/MultiRightTest.java", "test/fixtures/java/unit/MultiRight/build.sh", "test/fixtures/java/unit/MultiRight/MultiRight.java", "test/fixtures/java/unit/MultiRight/Foo/FooTest.java", "test/fixtures/java/unit/MultiRight/Foo/Foo.java", "test/fixtures/java/unit/MultiRight/bar/BarTest.java", "test/fixtures/java/unit/MultiRight/bar/Bar.java", "test/fixtures/java/unit/SimpleException/SimpleExceptionTest.java", "test/fixtures/java/unit/SimpleException/build.sh", "test/fixtures/text/1.txt", "test/fixtures/unit/error.rb", "test/fixtures/unit/bad.rb", "test/fixtures/unit/good.rb", "test/fixtures/mini-lib/Makefile", "test/fixtures/mini-lib/strlen.c", "test/fixtures/package/pkg_foo.tar.gz", "test/fixtures/package/pkg_foo", "test/fixtures/package/pkg_foo/Makefile", "test/fixtures/package/pkg_foo/configure", "test/fixtures/package/pkg_foo/foo.sh", "test/fixtures/package/pkg_foo/bootstrap", "test/examples/sql", "test/examples/basic.yml", "test/examples/cache", "test/examples/README", "test/examples/students-suite.yml", "test/examples/basic.rb", "test/examples/students", "test/examples/sql/basic.yml", "test/examples/cache/cache_and_fatal.yml", "test/examples/cache/simple.yml", "test/examples/students/mini-lib.yml", "test/examples/students/pool_stud.yml", "test/examples/students/glob_stud.yml", "test/examples/students/ball.yml", "test/examples/students/stud.yml", "misc/renaming", "misc/header.rb", "misc/expandtab.rb", "misc/uttk-grep.sh", "misc/textile_compiler", "misc/uttk-line-count.rb", "LGPL", "NEWS", "NORM", "TODO", "SPEC.gemspec", "Rakefile", "TODO.old", "README", "VERSION", "GUIDELINES", "AUTHORS", "SPEC.yml", "ChangeLog", "COPYING"]
12
+ s.executables = ["uttk", "uttk-unit"]
13
+ s.add_dependency(%q<ruby_ex>, ["~> 0.4.1"])
14
+ s.add_dependency(%q<actionpack>, ["~> 1.11.2"])
15
+ end
data/SPEC.yml ADDED
@@ -0,0 +1,60 @@
1
+ ---
2
+ Author: The Uttk Team.
3
+ License: LGPL
4
+ Revision: '$Id: /w/fey/uttk/trunk/SPEC.yml 22245 2006-02-25T11:17:46.591926Z pouillar $'
5
+
6
+ version: !feydakins.org,2006/version dev-util/uttk-0.3_alpha2#kid
7
+
8
+ title: Uttk -- An extensible framework for dynamic testing.
9
+ summary: Uttk is an extensible framework for dynamic testing.
10
+ description: >
11
+ Uttk is designed to help you while you are writing dynamic tests for your
12
+ projects. It keeps track of your test strategies by means of a solid dynamic
13
+ hierarchy of test strategy classes. The only way to be 100% generic is to be
14
+ extensible, after all. Network distribution strategies can also be written
15
+ since Uttk provides cluster features. Uttk understands YAML and Ruby as
16
+ input languages and speaks YAML, XML and HTML as output languages.
17
+ homepage: http://rubyforge.org/projects/uttk
18
+
19
+ user: ertai
20
+ rubyforge_project: ttk
21
+ rubyforge_sub_package_name: uttk
22
+ root_test_suite: test/uttk-distcheck.yml
23
+ rdoc_dir: doc/html
24
+ tags_url: svn://svn.feydakins.org/uttk/tags
25
+ trunk_url: svn://svn.feydakins.org/uttk/trunk
26
+
27
+ rdoc_tail_files: !filelist
28
+ - lib/uttk/dumpers/Dumper.rb
29
+ - lib/uttk/loaders/Loader.rb
30
+ - lib/uttk/strategies/Strategy.rb
31
+ - lib/uttk/filters/Filter.rb
32
+ - lib/uttk/weights/Weight.rb
33
+ - lib/uttk.rb
34
+
35
+ #FIXME: rdoc + gem fails for the main
36
+ rdoc_files: !filelist
37
+ - README
38
+ - AUTHORS
39
+ - NEWS
40
+ - test/examples/README
41
+ - lib/uttk/**/*.rb
42
+
43
+ pkg_files: !filelist
44
+ - bin/**/*
45
+ - lib/**/*.{rb,yml,js}
46
+ - test/**/*
47
+ - template/**/*
48
+ - misc/**/*
49
+ - '[A-Z]*'
50
+
51
+ dependencies:
52
+ ruby_ex:
53
+ gem : ~> 0.4.1 # FIXME 0.4_alpha XY ...
54
+ tarball: 8837/ruby_ex-0.4_alpha3.tar.gz
55
+ vcs : svn://svn.feydakins.org/ruby_ex/trunk
56
+ actionpack: [~> 1.11.2, 7645/actionpack-1.11.2.tgz]
57
+
58
+ # The version needed to test this uttk.
59
+ # Not the version of this uttk.
60
+ uttk_version: ~> 0.3.1
data/TODO ADDED
@@ -0,0 +1,23 @@
1
+
2
+
3
+ = Introduction
4
+
5
+ Uttk's ToDo list is based on the Uttk's tracker available on www.feydakins.org.
6
+ This tracker is used for both features request and bugs report. This document
7
+ describe how to post a good feature request and/or a good bug report.
8
+
9
+
10
+ = Uttk's tracker
11
+
12
+ http://bugs.feydakins.org
13
+
14
+ This is the main view of Uttk's tracker. It allow you to browse, to sort and
15
+ to search for issues. The _Add issue_ link in the issue action frame on the
16
+ left give you access to the post application form.
17
+
18
+ When submitting a bug or a feature you have to choose the section of Uttk, it
19
+ best fit with. If you don't know, choose the section with the bigger scope.
20
+
21
+
22
+ --
23
+ Uttk's maintainers
data/TODO.old ADDED
@@ -0,0 +1,31 @@
1
+ * Documentation
2
+ * On a un gros probl�me avec les fichiers ouverts sur NetBSD.
3
+ * Le filtre Weight ne semble pas fonctionner, pourtant, nous en avons
4
+ absolument besoin (et il faut qu'il travaille en stream).
5
+ * Je n'ai pas r�ussis � faire des filtres en stream. C'est possible? (Il
6
+ faudrait, sinon, les filtres n'ont plus d'interets)
7
+ _ configure et make n'affichent pas les sorties
8
+ _ L'extraction de tarball est buggu�, il manque l'option "f -" � la
9
+ commande tar
10
+ _ Xml.rb a un bug avec la duplication des attributs. Ca ressemble a une
11
+ sombre histoire de noeuds copi�s par r�f�rence...
12
+ _ Xml.rb devrait nommer son premier noaud "test" en "trace" pour que
13
+ l'intra l'affiche plus joliment
14
+ * Faire un Html.rb qui ne ferais que applisuer une xslt. Vu qu'on a la
15
+ Xlst, ca devrait pas �tre dur. Je cherche une librairie capable
16
+ d'appliquer une Xslt en Ruby... Pa contre, ca a tendance a changer les
17
+ l'optique des flux de log dans la moulinette. Il y aurait des flux Yaml,
18
+ des flux Xml, etc... Maintenant, que j'y pense, ca n'est peut-�tre pas
19
+ une mauvaise id�e... Il suffit de typer un peu plus fortement la sortie
20
+ de nos filtres (Je prefere parler de filtre au sens g�n�ral plutot que
21
+ de Dumper) et c'est bon.
22
+ * Il faut qu'on puise passer des parametre au Loader par la ligne de
23
+ commande. Je pense en particulier � l'upload qui voudra mettre
24
+ l'emplecement de la tarball sur la ligne de commande.
25
+ * Il nous faudrait une classe TTAutoTest permettant de definir des tests
26
+ avant que la moulinette ne se lance. Par exemple: "il faut la tarball de
27
+ ref passe tous les tests" ou bien "il faut que /bin/false ne passe aucun
28
+ test".
29
+ * Il nous faudrait des warpper pour different trucs. c'ets a dire des
30
+ raccourcis vers certains sc�narios tres utilis� (tarball piscine,
31
+ examsm, proj, etc...)
data/VERSION ADDED
@@ -0,0 +1,5 @@
1
+ Uttk version <%= v = Uttk::VERSION; v.major_minor %> { <%= v.tag.pp %> } [<%= v.release_name %>]
2
+
3
+ Copyright (c) 2004, 2005, 2006 Nicolas Despr�s, Nicolas Pouillard
4
+ This is free software; see the source for copying conditions. There is NO
5
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -0,0 +1,390 @@
1
+ # Author:: The Uttk Team.
2
+ # Copyright:: Copyright (c) 2004 Uttk team. All rights reserved.
3
+ # License:: LGPL
4
+ # $Id: /w/fey/uttk/trunk/bin/getopts/uttk.rb 22244 2006-02-25T10:48:53.146614Z pouillar $
5
+
6
+ require 'optparse'
7
+ Hierarchy.import!
8
+ PpHierarchy.import!
9
+
10
+ module Uttk
11
+
12
+ module Getopts
13
+
14
+ class Uttk
15
+
16
+ def self.head
17
+ puts "---
18
+ |Usage: #{ME} [options] [files...]
19
+ |
20
+ |options : use --long-help to see all options
21
+ |
22
+ |files : >
23
+ | by default input files are in Yaml
24
+ | but you can change the loader (see -L)
25
+ |".head_cut!
26
+ end
27
+
28
+ def self.tail
29
+ puts "strategies :
30
+ | input files use and compose strategies:
31
+ | - complete strategy list: --strategy-list
32
+ | - help on one strategy : --long-help aStrategyName
33
+ |
34
+ |documentation:
35
+ | - introduction, tutorial: http://uttk.org
36
+ | - api, generated by RDoc: http://api.uttk.org/doc
37
+ |
38
+ |bug reports : http://dev.uttk.org
39
+ |
40
+ |# Good tests !!
41
+ |# --
42
+ |# The Uttk Team
43
+ |".head_cut!
44
+ end
45
+
46
+ def self.usage
47
+ head
48
+ puts
49
+ tail
50
+ end
51
+
52
+ def self.parse(argv)
53
+ opts = ::Uttk.default_options.dup
54
+ optparser = OptionParser.new do |optparser|
55
+
56
+ optparser.banner = ''
57
+ optparser.summary_indent = ' '
58
+ optparser.summary_width = 25
59
+
60
+ ### Path options
61
+
62
+ optparser.separator 'Path options:'
63
+
64
+ optparser.on('-I',
65
+ '--include PATH',
66
+ 'Add PATH to root path (PATH/strategies, ' +
67
+ 'PATH/filters...)') do |aPath|
68
+ ::Uttk.load_path += aPath.split(':').map { |x| x.to_path }
69
+ ::Uttk.setup_autoload_all
70
+ end
71
+
72
+ ### Strategy options
73
+
74
+ optparser.separator ''
75
+ optparser.separator 'Strategy options:'
76
+
77
+ optparser.on('--strategy-list', 'List all test strategy classes') do
78
+ pp_class_hierarchy('Strategies::Strategy')
79
+ exit
80
+ end
81
+
82
+ ### Loader options
83
+
84
+ optparser.separator ''
85
+ optparser.separator 'Loader options:'
86
+
87
+ all_loaders = sub_modules(Loaders)
88
+
89
+ optparser.on('-L',
90
+ '--loader [TYPE]',
91
+ all_loaders,
92
+ 'Select a loader (no argument for the list)') do |aLoader|
93
+ if aLoader.nil?
94
+ pp_class_hierarchy('Loaders::Loader')
95
+ exit
96
+ else
97
+ opts[:loader] = Loaders.const_get(aLoader)
98
+ end
99
+ end
100
+
101
+ ### Filter options
102
+
103
+ optparser.separator ''
104
+ optparser.separator 'Filter options:'
105
+
106
+ optparser.on('-F',
107
+ '--filter [PIPELINE DESCRIPTION]',
108
+ 'Select a filter pipeline' +
109
+ '(no argument for the list)') do |desc|
110
+ if desc.nil?
111
+ pp_class_hierarchy('Logger::Backend',
112
+ 'Filters::Filter',
113
+ 'PathFilters::PathFilter',
114
+ 'Dumpers::Dumper')
115
+ exit
116
+ else
117
+ begin
118
+ opts[:observers] << desc
119
+ rescue ArgumentError => e
120
+ raise(OptionParser::InvalidArgument, "#{desc}: #{e}")
121
+ end
122
+ end
123
+ end
124
+
125
+ optparser.on('--filter-help', 'More information about filters') do
126
+ all_filters = sub_modules(Filters) + sub_modules(Dumpers)
127
+ puts %Q{
128
+ |filters:
129
+ | The --filter (-F) option take a pipeline description which
130
+ | is a little yaml document.
131
+ |
132
+ | The syntax is basic:
133
+ |
134
+ | Observer ::= <FilterClass>
135
+ | | <FilterClass> ":" Observer
136
+ | | "[" Observer* "]"
137
+ | ;
138
+ |
139
+ | Filters ::= #{all_filters.join(' | ')} ;
140
+ |
141
+ | Examples:
142
+ | Yaml # Use the Yaml output format on the stdout
143
+ | Yaml: foo # Use Yaml on file foo
144
+ | Xml: foo, Yaml: bar # Use Xml on file foo and Yaml on file bar
145
+ | Xml: [ foo, bar] # Use Xml on files foo and bar
146
+ | Yaml, Xml: log.xml # Use Yaml on stdout and Xml on log.xml
147
+ | JustStatus: Yaml # Use the filter JustStatus and display
148
+ | # its output with Yaml
149
+ | JustStatus: {Yaml, Xml: log.xml}
150
+ | # Use Yaml on stdout and Xml on log.xml but trough the
151
+ | # filter JustStatus.
152
+ |
153
+ | Yaml: log.yml, JustStatus: Yaml # This one is usefull
154
+ |
155
+ | You can make your own compositions and save them, see the
156
+ | documentation of the Filters module.
157
+ |
158
+ | Warning:
159
+ | Xml: foo, Xml: bar # Will create only one Xml dumper since
160
+ | # this is a hash with twice the same key.
161
+ |}.head_cut!
162
+ exit
163
+ end
164
+
165
+ ### Weight options
166
+
167
+ optparser.separator ''
168
+ optparser.separator 'Weight options:'
169
+
170
+ optparser.on('-W',
171
+ '--wclass [TYPE]',
172
+ 'Select the weight class ' +
173
+ '(no argument for the list)') do |aString|
174
+ if aString.nil?
175
+ pp_class_hierarchy('Weights::Weight')
176
+ exit
177
+ else
178
+ opts[:wclass] = Weights.const_get(aString)
179
+ end
180
+ end
181
+
182
+ ### Logger options
183
+
184
+ optparser.separator ''
185
+ optparser.separator 'Logger options:'
186
+
187
+ optparser.on('-l',
188
+ '--log STRING',
189
+ 'Set the log base name for log files') do |log|
190
+ default_filter = STDOUT.tty? ? F::DefaultColor : F::Default
191
+ opts[:observers] << default_filter.template(log)
192
+ end
193
+
194
+ optparser.on('-d',
195
+ '--severity [NAME]',
196
+ 'Log severity level ' +
197
+ '(no argument for the list)') do |level|
198
+ if level.nil?
199
+ puts 'Log severity level list:'
200
+ Logger::Severity.labels.each { |l| puts " - #{l}" }
201
+ exit
202
+ else
203
+ begin
204
+ raise NameError if level.nil?
205
+ opts[:log_severity] = Logger::Severity.const_get(level.to_s.upcase)
206
+ rescue NameError
207
+ raise(OptionParser::InvalidArgument, level)
208
+ end
209
+ end
210
+ end
211
+
212
+ higher_level = Logger::Verbosity.higher_level
213
+ optparser.on('-v',
214
+ '--verbosity NUM',
215
+ "Log verbosity level [0-#{higher_level}]") do |level|
216
+ ilevel = level.to_i
217
+ if ilevel.to_s != level
218
+ raise(OptionParser::InvalidArgument, level)
219
+ end
220
+ if 0 <= ilevel and ilevel <= higher_level
221
+ opts[:log_verbosity] = ilevel
222
+ else
223
+ raise(OptionParser::InvalidArgument, level)
224
+ end
225
+ end
226
+
227
+ optparser.on('-s',
228
+ '--log-section [NAME]',
229
+ 'Active a log section ' +
230
+ '(no argument for the list)') do |name|
231
+ if name.nil?
232
+ #FIXME: print the section tree
233
+ exit
234
+ else
235
+ #FIXME: check the validity of the section
236
+ opts[:log_section] << name.to_s
237
+ end
238
+ end
239
+
240
+ ### Miscellaneous options
241
+
242
+ optparser.separator ''
243
+ optparser.separator 'Miscellaneous options:'
244
+
245
+ optparser.on('-S',
246
+ '--symbols symbols',
247
+ 'Add a hash of symbols to the root test suite') do |str|
248
+ opts[:symbols] = YAML.load(str)
249
+ end
250
+
251
+ optparser.on('-A',
252
+ '--attributes attributes',
253
+ 'Add a hash of attributes to ' +
254
+ 'the root test suite') do |aString|
255
+ opts[:attributes] = YAML.load(aString)
256
+ end
257
+
258
+ optparser.on('-C', '--[no-]cache', 'Keep the test in cache') do |c|
259
+ opts[:cache_mode] = c
260
+ end
261
+
262
+ optparser.on('--cache-dir DIR', 'Use the cache in DIR') do |dir|
263
+ dir = Pathname.new(dir)
264
+ unless dir.directory?
265
+ raise OptionParser::InvalidArgument, 'need a directory'
266
+ end
267
+ opts[:cache_dir] = dir
268
+ end
269
+
270
+ optparser.on('-r', '--cache-proc RUBY_CODE',
271
+ 'Use this block to skip tests in cache mode') do |code|
272
+
273
+ unless code =~ /^\s*\|[^,]+,[^,]+\|\s*\S+/
274
+ raise OptionParser::InvalidArgument,
275
+ 'need a ruby block with 2 args (e.g |x,y| ...)'
276
+ end
277
+ opts[:cache_proc] = DumpableProc.new(code)
278
+ end
279
+
280
+ optparser.on('--rpath REGEX_PATH',
281
+ 'Just keep tests with name that matches the REGEX_PATH')\
282
+ do |r|
283
+ opts[:rpath] = RegexPath.new "#{r}/()"
284
+ end
285
+
286
+ optparser.on('--rpath-exclude REGEX_PATH',
287
+ 'Skip tests with name that matches the REGEX_PATH')\
288
+ do |r|
289
+ opts[:rpath_exclude] = RegexPath.new "#{r}/()"
290
+ end
291
+
292
+ optparser.on('-b', '--benchmark',
293
+ 'Switch on benchmark informations') do
294
+ opts[:benchmark] = true
295
+ end
296
+
297
+ optparser.on('--profile', 'Switch on profile informations') do
298
+ opts[:profile] = true
299
+ end
300
+
301
+ optparser.on('--dump-status',
302
+ 'Dump the global status at the end (STDOUT)') do
303
+ opts[:dump_status] = true
304
+ end
305
+
306
+ optparser.on('--gen-strategies-hierarchy',
307
+ 'Generate the strategies hierarchy description') do
308
+ hsh = Strategies.sub_classes_tree(Strategies::Strategy, true, true)
309
+ puts "# Uttk's strategies hierarchy generated on #{Time.now}"
310
+ YAML.dump(hierarchy_to_s(hsh), STDOUT)
311
+ exit
312
+ end
313
+
314
+ optparser.on_tail('-h', '--help', 'Show the brief help message') do
315
+ usage
316
+ exit 0
317
+ end
318
+
319
+ optparser.on_tail('-H', '--long-help [strategy]',
320
+ 'Show this message') do |aStrategy|
321
+ if aStrategy.nil?
322
+ head
323
+ puts optparser
324
+ puts
325
+ tail
326
+ else
327
+ Strategies.const_get(aStrategy).help(STDOUT)
328
+ end
329
+ exit 0
330
+ end
331
+
332
+ optparser.on_tail('--authors', 'Display the AUTHORS file') do
333
+ puts ::Uttk::AUTHORS_PATH.read
334
+ exit 0
335
+ end
336
+
337
+ optparser.on_tail('--version', 'Show version') do
338
+ puts ::Uttk::VERSION_TEXT
339
+ exit 0
340
+ end
341
+
342
+ end
343
+
344
+ optparser.parse!(argv)
345
+ argv << '-' if argv.empty?
346
+ argv.map! { |x| x == '-' ? STDIN : Pathname.new(x) }
347
+ opts
348
+ end
349
+
350
+ protected
351
+ def self.sub_modules(mod)
352
+ mod.constants.sort!.map! { |c| c.to_sym }
353
+ end
354
+
355
+ protected
356
+ def self.pp_class_hierarchy(name, *others)
357
+ if name =~ /^(\w+)::(\w+)$/
358
+ mod = ::Uttk.const_get($1)
359
+ klass = mod.const_get($2)
360
+ puts "#{mod} classes hierarchy:"
361
+ hsh = mod.sub_classes_tree(klass, true, true)
362
+ mods = [mod]
363
+ others.each do |name|
364
+ if name =~ /^(\w+)::(\w+)$/
365
+ mod = ::Uttk.const_get($1)
366
+ mods << mod
367
+ klass = mod.const_get($2)
368
+ hsh[hsh.keys.first].merge! mod.sub_classes_tree(klass, true, true)
369
+ end
370
+ end
371
+ hsh.pp_hierarchy(Regexp.new("^(#{mods.join('|')})::"), true)
372
+ end
373
+ end
374
+
375
+ protected
376
+ def self.hierarchy_to_s(hsh)
377
+ r = {}
378
+ hsh.each { |k, v| r[k.to_s] = hierarchy_to_s(v) }
379
+ r
380
+ end
381
+
382
+ end # class Uttk
383
+
384
+ end # module Getopts
385
+
386
+ end # module Uttk
387
+
388
+
389
+
390
+