passenger 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (550) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +10 -0
  5. data/CHANGELOG +21 -0
  6. data/build/agents.rb +2 -2
  7. data/build/apache2.rb +6 -5
  8. data/build/common_library.rb +22 -7
  9. data/build/cxx_tests.rb +0 -3
  10. data/build/misc.rb +1 -1
  11. data/dev/parse_file_descriptor_log +119 -0
  12. data/doc/CloudLicensingConfiguration.html +387 -0
  13. data/doc/Design and Architecture.html +2430 -0
  14. data/doc/Packaging.html +488 -0
  15. data/doc/Security of user switching support.html +1833 -0
  16. data/doc/ServerOptimizationGuide.html +659 -0
  17. data/doc/ServerOptimizationGuide.txt.md +8 -0
  18. data/doc/Users guide Apache.html +9116 -0
  19. data/doc/Users guide Apache.idmap.txt +6 -2
  20. data/doc/Users guide Apache.txt +26 -7
  21. data/doc/Users guide Nginx.html +9025 -0
  22. data/doc/Users guide Nginx.idmap.txt +7 -3
  23. data/doc/Users guide Nginx.txt +29 -6
  24. data/doc/Users guide Standalone.html +3983 -0
  25. data/doc/Users guide.html +1748 -0
  26. data/doc/users_guide_snippets/installation.txt +4 -4
  27. data/ext/apache2/Configuration.cpp +16 -5
  28. data/ext/apache2/Configuration.hpp +4 -2
  29. data/ext/apache2/Hooks.cpp +44 -19
  30. data/ext/boost/libs/thread/src/pthread/once.cpp +2 -0
  31. data/ext/boost/libs/thread/src/pthread/once_atomic.cpp +6 -0
  32. data/ext/common/AgentsStarter.h +3 -2
  33. data/ext/common/ApplicationPool2/DirectSpawner.h +14 -4
  34. data/ext/common/ApplicationPool2/DummySpawner.h +12 -7
  35. data/ext/common/ApplicationPool2/Implementation.cpp +1 -1
  36. data/ext/common/ApplicationPool2/Process.h +2 -1
  37. data/ext/common/ApplicationPool2/Session.h +6 -6
  38. data/ext/common/ApplicationPool2/SmartSpawner.h +19 -4
  39. data/ext/common/ApplicationPool2/Socket.h +59 -27
  40. data/ext/common/ApplicationPool2/Spawner.h +2 -2
  41. data/ext/common/BackgroundEventLoop.cpp +6 -1
  42. data/ext/common/Constants.h +1 -1
  43. data/ext/common/EventedClient.h +1 -1
  44. data/ext/common/EventedServer.h +2 -2
  45. data/ext/common/FileDescriptor.h +25 -6
  46. data/ext/common/Logging.cpp +107 -52
  47. data/ext/common/Logging.h +146 -19
  48. data/ext/common/MessageClient.h +2 -2
  49. data/ext/common/MessageServer.h +3 -2
  50. data/ext/common/RandomGenerator.h +8 -7
  51. data/ext/common/SafeLibev.h +5 -1
  52. data/ext/common/ServerKit/AcceptLoadBalancer.h +9 -4
  53. data/ext/common/ServerKit/FdSinkChannel.h +5 -2
  54. data/ext/common/ServerKit/FdSourceChannel.h +5 -2
  55. data/ext/common/ServerKit/FileBufferedChannel.h +2 -0
  56. data/ext/common/ServerKit/FileBufferedFdSinkChannel.h +7 -2
  57. data/ext/common/ServerKit/HttpServer.h +6 -0
  58. data/ext/common/ServerKit/Server.h +40 -3
  59. data/ext/common/StaticString.h +20 -0
  60. data/ext/common/UnionStation/Connection.h +3 -1
  61. data/ext/common/UnionStation/Core.h +6 -4
  62. data/ext/common/Utils.cpp +4 -3
  63. data/ext/common/Utils/DateParsing.h +19 -5
  64. data/ext/common/Utils/FastStringStream.h +183 -0
  65. data/ext/common/Utils/IOUtils.cpp +47 -28
  66. data/ext/common/Utils/IOUtils.h +56 -12
  67. data/ext/common/Utils/MessagePassing.h +3 -3
  68. data/ext/common/Utils/ProcessMetricsCollector.h +2 -2
  69. data/ext/common/Utils/ScopeGuard.h +16 -5
  70. data/ext/common/Utils/SpeedMeter.h +2 -2
  71. data/ext/common/Utils/StrIntUtils.cpp +6 -6
  72. data/ext/common/Utils/StrIntUtils.h +2 -1
  73. data/ext/common/agents/Base.cpp +56 -4
  74. data/ext/common/agents/Base.h +2 -1
  75. data/ext/common/agents/HelperAgent/AdminServer.h +122 -11
  76. data/ext/common/agents/HelperAgent/Main.cpp +16 -5
  77. data/ext/common/agents/HelperAgent/OptionParser.h +7 -1
  78. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
  79. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +10 -1
  80. data/ext/common/agents/HelperAgent/RequestHandler/Request.h +8 -0
  81. data/ext/common/agents/HelperAgent/RequestHandler/TurboCaching.h +4 -3
  82. data/ext/common/agents/LoggingAgent/AdminServer.h +57 -11
  83. data/ext/common/agents/LoggingAgent/LoggingServer.h +3 -3
  84. data/ext/common/agents/LoggingAgent/Main.cpp +11 -3
  85. data/ext/common/agents/Watchdog/AdminServer.h +53 -11
  86. data/ext/common/agents/Watchdog/AgentWatcher.cpp +3 -3
  87. data/ext/common/agents/Watchdog/Main.cpp +13 -6
  88. data/ext/libeio/ecb.h +1 -1
  89. data/ext/libev/ev.c +13 -1
  90. data/ext/libev/ev.h +3 -0
  91. data/ext/nginx/Configuration.c +28 -6
  92. data/ext/nginx/Configuration.h +2 -1
  93. data/ext/nginx/ngx_http_passenger_module.c +5 -4
  94. data/ext/oxt/dynamic_thread_group.hpp +38 -5
  95. data/lib/phusion_passenger.rb +1 -1
  96. data/lib/phusion_passenger/common_library.rb +9 -5
  97. data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
  98. data/lib/phusion_passenger/packaging.rb +23 -37
  99. data/passenger.gemspec +21 -21
  100. metadata +4 -453
  101. metadata.gz.asc +7 -7
  102. data/.gitignore +0 -68
  103. data/.travis.yml +0 -16
  104. data/Gemfile +0 -17
  105. data/Gemfile.lock +0 -39
  106. data/Vagrantfile +0 -54
  107. data/debian.template/README.Debian +0 -15
  108. data/debian.template/changelog +0 -316
  109. data/debian.template/compat +0 -1
  110. data/debian.template/control.erb +0 -91
  111. data/debian.template/copyright +0 -385
  112. data/debian.template/libapache2-mod-passenger.install +0 -3
  113. data/debian.template/libapache2-mod-passenger.postinst +0 -36
  114. data/debian.template/libapache2-mod-passenger.prerm +0 -15
  115. data/debian.template/locations.ini.erb +0 -14
  116. data/debian.template/passenger-dev.install.erb +0 -3
  117. data/debian.template/passenger-doc.install.erb +0 -2
  118. data/debian.template/passenger.conf +0 -6
  119. data/debian.template/passenger.docs +0 -4
  120. data/debian.template/passenger.install.erb +0 -14
  121. data/debian.template/passenger.load +0 -3
  122. data/debian.template/passenger.manpages +0 -3
  123. data/debian.template/patches/series +0 -0
  124. data/debian.template/rules.erb +0 -76
  125. data/debian.template/source/format +0 -1
  126. data/ext/common/EventedBufferedInput.h +0 -458
  127. data/packaging/rpm/LICENSE.txt +0 -19
  128. data/packaging/rpm/Makefile +0 -13
  129. data/packaging/rpm/README.md +0 -41
  130. data/packaging/rpm/Vagrantfile +0 -38
  131. data/packaging/rpm/Vagrantfile.centos +0 -30
  132. data/packaging/rpm/build +0 -170
  133. data/packaging/rpm/create_project +0 -41
  134. data/packaging/rpm/git_update +0 -88
  135. data/packaging/rpm/image/Dockerfile +0 -37
  136. data/packaging/rpm/image/Gemfile +0 -3
  137. data/packaging/rpm/image/Gemfile.lock +0 -12
  138. data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +0 -19
  139. data/packaging/rpm/image/amazon2014-i386.cfg +0 -96
  140. data/packaging/rpm/image/amazon2014-x86_64.cfg +0 -96
  141. data/packaging/rpm/image/site-defaults.cfg +0 -168
  142. data/packaging/rpm/internal/build_tasks.rb +0 -238
  143. data/packaging/rpm/internal/dummygpg +0 -11
  144. data/packaging/rpm/internal/exec_build +0 -42
  145. data/packaging/rpm/internal/get_distro_arch +0 -14
  146. data/packaging/rpm/internal/get_distro_id +0 -10
  147. data/packaging/rpm/internal/git_update +0 -27
  148. data/packaging/rpm/internal/inituidgid +0 -17
  149. data/packaging/rpm/internal/my_init +0 -344
  150. data/packaging/rpm/internal/python27 +0 -3
  151. data/packaging/rpm/internal/repo_update +0 -46
  152. data/packaging/rpm/internal/setuser +0 -26
  153. data/packaging/rpm/internal/tracking_helper +0 -40
  154. data/packaging/rpm/jenkins_release +0 -99
  155. data/packaging/rpm/lib/build_tasks_support.rb +0 -402
  156. data/packaging/rpm/lib/preprocessor.rb +0 -341
  157. data/packaging/rpm/nginx_spec/404.html +0 -119
  158. data/packaging/rpm/nginx_spec/50x.html +0 -119
  159. data/packaging/rpm/nginx_spec/index.html +0 -116
  160. data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +0 -13
  161. data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
  162. data/packaging/rpm/nginx_spec/nginx-upgrade +0 -13
  163. data/packaging/rpm/nginx_spec/nginx-upgrade.8 +0 -151
  164. data/packaging/rpm/nginx_spec/nginx.conf +0 -131
  165. data/packaging/rpm/nginx_spec/nginx.init +0 -144
  166. data/packaging/rpm/nginx_spec/nginx.logrotate +0 -13
  167. data/packaging/rpm/nginx_spec/nginx.service +0 -15
  168. data/packaging/rpm/nginx_spec/nginx.spec.template +0 -560
  169. data/packaging/rpm/nginx_spec/nginx.sysconfig +0 -4
  170. data/packaging/rpm/nginx_spec/passenger.conf +0 -9
  171. data/packaging/rpm/nginx_spec/poweredby.png +0 -0
  172. data/packaging/rpm/passenger_spec/apache-passenger.conf.in +0 -26
  173. data/packaging/rpm/passenger_spec/config.json +0 -30
  174. data/packaging/rpm/passenger_spec/passenger.logrotate +0 -7
  175. data/packaging/rpm/passenger_spec/passenger.spec.template +0 -478
  176. data/packaging/rpm/passenger_spec/passenger_dynamic_thread_group.patch +0 -16
  177. data/packaging/rpm/passenger_spec/passenger_tests_default_config_example.patch +0 -44
  178. data/packaging/rpm/passenger_spec/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -21
  179. data/packaging/rpm/repo_update +0 -114
  180. data/packaging/rpm/setup-system +0 -61
  181. data/packaging/rpm/shell +0 -10
  182. data/test/.rspec +0 -4
  183. data/test/config.json.example +0 -42
  184. data/test/config.json.rpm-automation +0 -15
  185. data/test/config.json.travis +0 -15
  186. data/test/config.json.vagrant +0 -30
  187. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +0 -124
  188. data/test/cxx/ApplicationPool2/OptionsTest.cpp +0 -30
  189. data/test/cxx/ApplicationPool2/PoolTest.cpp +0 -2062
  190. data/test/cxx/ApplicationPool2/ProcessTest.cpp +0 -130
  191. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +0 -243
  192. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +0 -823
  193. data/test/cxx/BufferedIOTest.cpp +0 -364
  194. data/test/cxx/CachedFileStatTest.cpp +0 -402
  195. data/test/cxx/CxxTestMain.cpp +0 -181
  196. data/test/cxx/DataStructures/LStringTest.cpp +0 -275
  197. data/test/cxx/DataStructures/StringKeyTableTest.cpp +0 -199
  198. data/test/cxx/DateParsingTest.cpp +0 -75
  199. data/test/cxx/DechunkerTest.cpp +0 -250
  200. data/test/cxx/EventedBufferedInputTest.cpp +0 -758
  201. data/test/cxx/EventedClientTest.cpp +0 -523
  202. data/test/cxx/FileChangeCheckerTest.cpp +0 -331
  203. data/test/cxx/FileDescriptorTest.cpp +0 -69
  204. data/test/cxx/FilterSupportTest.cpp +0 -433
  205. data/test/cxx/IOUtilsTest.cpp +0 -861
  206. data/test/cxx/MemoryKit/MbufTest.cpp +0 -213
  207. data/test/cxx/MessageIOTest.cpp +0 -360
  208. data/test/cxx/MessagePassingTest.cpp +0 -81
  209. data/test/cxx/MessageReadersWritersTest.cpp +0 -576
  210. data/test/cxx/MessageServerTest.cpp +0 -393
  211. data/test/cxx/ProcessMetricsCollectorTest.cpp +0 -123
  212. data/test/cxx/RequestHandlerTest.cpp +0 -1463
  213. data/test/cxx/ResponseCacheTest.cpp +0 -322
  214. data/test/cxx/ServerKit/ChannelTest.cpp +0 -1467
  215. data/test/cxx/ServerKit/CookieUtilsTest.cpp +0 -274
  216. data/test/cxx/ServerKit/FileBufferedChannelTest.cpp +0 -992
  217. data/test/cxx/ServerKit/HeaderTableTest.cpp +0 -177
  218. data/test/cxx/ServerKit/HttpServerTest.cpp +0 -1580
  219. data/test/cxx/ServerKit/ServerTest.cpp +0 -408
  220. data/test/cxx/StaticStringTest.cpp +0 -220
  221. data/test/cxx/StringMapTest.cpp +0 -131
  222. data/test/cxx/SystemTimeTest.cpp +0 -37
  223. data/test/cxx/TemplateTest.cpp +0 -118
  224. data/test/cxx/TestSupport.cpp +0 -207
  225. data/test/cxx/TestSupport.h +0 -333
  226. data/test/cxx/UnionStationTest.cpp +0 -741
  227. data/test/cxx/Utils/StrIntUtilsTest.cpp +0 -39
  228. data/test/cxx/UtilsTest.cpp +0 -672
  229. data/test/cxx/VariantMapTest.cpp +0 -191
  230. data/test/gdbinit.example +0 -34
  231. data/test/integration_tests/apache2_tests.rb +0 -585
  232. data/test/integration_tests/downloaded_binaries_tests.rb +0 -185
  233. data/test/integration_tests/native_packaging_spec.rb +0 -368
  234. data/test/integration_tests/nginx_tests.rb +0 -402
  235. data/test/integration_tests/shared/example_webapp_tests.rb +0 -289
  236. data/test/integration_tests/source_packaging_test.rb +0 -201
  237. data/test/integration_tests/spec_helper.rb +0 -22
  238. data/test/integration_tests/standalone_tests.rb +0 -392
  239. data/test/node/line_reader_spec.js +0 -338
  240. data/test/node/spec_helper.js +0 -65
  241. data/test/oxt/backtrace_test.cpp +0 -88
  242. data/test/oxt/counter.hpp +0 -55
  243. data/test/oxt/dynamic_thread_group_test.cpp +0 -131
  244. data/test/oxt/oxt_test_main.cpp +0 -27
  245. data/test/oxt/spin_lock_test.cpp +0 -59
  246. data/test/oxt/syscall_interruption_test.cpp +0 -39
  247. data/test/ruby/debug_logging_spec.rb +0 -145
  248. data/test/ruby/message_channel_spec.rb +0 -196
  249. data/test/ruby/rack/loader_spec.rb +0 -42
  250. data/test/ruby/rack/preloader_spec.rb +0 -48
  251. data/test/ruby/rails3.0/loader_spec.rb +0 -26
  252. data/test/ruby/rails3.0/preloader_spec.rb +0 -32
  253. data/test/ruby/rails3.1/loader_spec.rb +0 -26
  254. data/test/ruby/rails3.1/preloader_spec.rb +0 -32
  255. data/test/ruby/rails3.2/loader_spec.rb +0 -26
  256. data/test/ruby/rails3.2/preloader_spec.rb +0 -32
  257. data/test/ruby/rails4.0/loader_spec.rb +0 -28
  258. data/test/ruby/rails4.0/preloader_spec.rb +0 -34
  259. data/test/ruby/rails4.1/loader_spec.rb +0 -28
  260. data/test/ruby/rails4.1/preloader_spec.rb +0 -34
  261. data/test/ruby/request_handler_spec.rb +0 -747
  262. data/test/ruby/shared/loader_sharedspec.rb +0 -247
  263. data/test/ruby/shared/rails/union_station_extensions_sharedspec.rb +0 -357
  264. data/test/ruby/shared/ruby_loader_sharedspec.rb +0 -55
  265. data/test/ruby/spec_helper.rb +0 -114
  266. data/test/ruby/standalone/runtime_installer_spec.rb +0 -402
  267. data/test/ruby/union_station_spec.rb +0 -288
  268. data/test/ruby/utils/file_system_watcher_spec.rb +0 -229
  269. data/test/ruby/utils/hosts_file_parser.rb +0 -258
  270. data/test/ruby/utils/tee_input_spec.rb +0 -235
  271. data/test/ruby/utils/unseekable_socket_spec.rb +0 -66
  272. data/test/ruby/utils_spec.rb +0 -41
  273. data/test/stub/apache2/httpd.conf.erb +0 -122
  274. data/test/stub/apache2/mime.types +0 -748
  275. data/test/stub/garbage1.dat +0 -0
  276. data/test/stub/garbage2.dat +0 -0
  277. data/test/stub/garbage3.dat +0 -0
  278. data/test/stub/http_request.yml +0 -23
  279. data/test/stub/index.html +0 -1
  280. data/test/stub/nginx/koi-utf +0 -109
  281. data/test/stub/nginx/koi-win +0 -103
  282. data/test/stub/nginx/mime.types +0 -70
  283. data/test/stub/nginx/nginx.conf.erb +0 -70
  284. data/test/stub/nginx/win-utf +0 -126
  285. data/test/stub/node/app.js +0 -133
  286. data/test/stub/node/public/.gitignore +0 -0
  287. data/test/stub/node/tmp/.gitignore +0 -0
  288. data/test/stub/rack/config.ru +0 -95
  289. data/test/stub/rack/library.rb +0 -16
  290. data/test/stub/rack/public/.gitignore +0 -0
  291. data/test/stub/rack/start.rb +0 -52
  292. data/test/stub/rack/tmp/.gitignore +0 -0
  293. data/test/stub/rails3.0/.gitignore +0 -4
  294. data/test/stub/rails3.0/Gemfile +0 -22
  295. data/test/stub/rails3.0/Gemfile.lock +0 -80
  296. data/test/stub/rails3.0/Rakefile +0 -10
  297. data/test/stub/rails3.0/app/controllers/application_controller.rb +0 -4
  298. data/test/stub/rails3.0/app/helpers/application_helper.rb +0 -2
  299. data/test/stub/rails3.0/app/views/layouts/application.html.erb +0 -14
  300. data/test/stub/rails3.0/config.ru +0 -4
  301. data/test/stub/rails3.0/config/application.rb +0 -48
  302. data/test/stub/rails3.0/config/boot.rb +0 -13
  303. data/test/stub/rails3.0/config/database.yml +0 -22
  304. data/test/stub/rails3.0/config/environment.rb +0 -5
  305. data/test/stub/rails3.0/config/environments/development.rb +0 -19
  306. data/test/stub/rails3.0/config/environments/production.rb +0 -48
  307. data/test/stub/rails3.0/config/environments/test.rb +0 -32
  308. data/test/stub/rails3.0/config/initializers/backtrace_silencers.rb +0 -7
  309. data/test/stub/rails3.0/config/initializers/inflections.rb +0 -10
  310. data/test/stub/rails3.0/config/initializers/mime_types.rb +0 -5
  311. data/test/stub/rails3.0/config/initializers/passenger.rb +0 -2
  312. data/test/stub/rails3.0/config/initializers/secret_token.rb +0 -7
  313. data/test/stub/rails3.0/config/initializers/session_store.rb +0 -8
  314. data/test/stub/rails3.0/config/locales/en.yml +0 -5
  315. data/test/stub/rails3.0/config/routes.rb +0 -58
  316. data/test/stub/rails3.0/db/seeds.rb +0 -7
  317. data/test/stub/rails3.0/doc/README_FOR_APP +0 -2
  318. data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
  319. data/test/stub/rails3.0/log/.gitignore +0 -0
  320. data/test/stub/rails3.0/public/404.html +0 -26
  321. data/test/stub/rails3.0/public/422.html +0 -26
  322. data/test/stub/rails3.0/public/500.html +0 -26
  323. data/test/stub/rails3.0/public/favicon.ico +0 -0
  324. data/test/stub/rails3.0/public/index.html +0 -279
  325. data/test/stub/rails3.0/public/robots.txt +0 -5
  326. data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
  327. data/test/stub/rails3.0/script/rails +0 -9
  328. data/test/stub/rails3.0/test/performance/browsing_test.rb +0 -9
  329. data/test/stub/rails3.0/test/test_helper.rb +0 -13
  330. data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
  331. data/test/stub/rails3.1/.gitignore +0 -15
  332. data/test/stub/rails3.1/Gemfile +0 -37
  333. data/test/stub/rails3.1/Gemfile.lock +0 -115
  334. data/test/stub/rails3.1/README +0 -261
  335. data/test/stub/rails3.1/Rakefile +0 -7
  336. data/test/stub/rails3.1/app/assets/images/rails.png +0 -0
  337. data/test/stub/rails3.1/app/assets/stylesheets/application.css +0 -7
  338. data/test/stub/rails3.1/app/controllers/application_controller.rb +0 -3
  339. data/test/stub/rails3.1/app/helpers/application_helper.rb +0 -2
  340. data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
  341. data/test/stub/rails3.1/app/models/.gitkeep +0 -0
  342. data/test/stub/rails3.1/app/views/layouts/application.html.erb +0 -14
  343. data/test/stub/rails3.1/config.ru +0 -4
  344. data/test/stub/rails3.1/config/application.rb +0 -48
  345. data/test/stub/rails3.1/config/boot.rb +0 -6
  346. data/test/stub/rails3.1/config/database.yml +0 -25
  347. data/test/stub/rails3.1/config/environment.rb +0 -5
  348. data/test/stub/rails3.1/config/environments/development.rb +0 -30
  349. data/test/stub/rails3.1/config/environments/production.rb +0 -60
  350. data/test/stub/rails3.1/config/environments/test.rb +0 -39
  351. data/test/stub/rails3.1/config/initializers/backtrace_silencers.rb +0 -7
  352. data/test/stub/rails3.1/config/initializers/inflections.rb +0 -10
  353. data/test/stub/rails3.1/config/initializers/mime_types.rb +0 -5
  354. data/test/stub/rails3.1/config/initializers/passenger.rb +0 -2
  355. data/test/stub/rails3.1/config/initializers/secret_token.rb +0 -7
  356. data/test/stub/rails3.1/config/initializers/session_store.rb +0 -8
  357. data/test/stub/rails3.1/config/initializers/wrap_parameters.rb +0 -14
  358. data/test/stub/rails3.1/config/locales/en.yml +0 -5
  359. data/test/stub/rails3.1/config/routes.rb +0 -58
  360. data/test/stub/rails3.1/db/seeds.rb +0 -7
  361. data/test/stub/rails3.1/doc/README_FOR_APP +0 -2
  362. data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
  363. data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
  364. data/test/stub/rails3.1/log/.gitkeep +0 -0
  365. data/test/stub/rails3.1/public/404.html +0 -26
  366. data/test/stub/rails3.1/public/422.html +0 -26
  367. data/test/stub/rails3.1/public/500.html +0 -26
  368. data/test/stub/rails3.1/public/favicon.ico +0 -0
  369. data/test/stub/rails3.1/public/index.html +0 -241
  370. data/test/stub/rails3.1/public/robots.txt +0 -5
  371. data/test/stub/rails3.1/script/rails +0 -6
  372. data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
  373. data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
  374. data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
  375. data/test/stub/rails3.1/test/performance/browsing_test.rb +0 -12
  376. data/test/stub/rails3.1/test/test_helper.rb +0 -13
  377. data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
  378. data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
  379. data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
  380. data/test/stub/rails3.2/.gitignore +0 -15
  381. data/test/stub/rails3.2/Gemfile +0 -39
  382. data/test/stub/rails3.2/Gemfile.lock +0 -113
  383. data/test/stub/rails3.2/Rakefile +0 -7
  384. data/test/stub/rails3.2/app/assets/images/rails.png +0 -0
  385. data/test/stub/rails3.2/app/assets/stylesheets/application.css +0 -13
  386. data/test/stub/rails3.2/app/controllers/application_controller.rb +0 -3
  387. data/test/stub/rails3.2/app/helpers/application_helper.rb +0 -2
  388. data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
  389. data/test/stub/rails3.2/app/models/.gitkeep +0 -0
  390. data/test/stub/rails3.2/app/views/layouts/application.html.erb +0 -14
  391. data/test/stub/rails3.2/config.ru +0 -4
  392. data/test/stub/rails3.2/config/application.rb +0 -62
  393. data/test/stub/rails3.2/config/boot.rb +0 -6
  394. data/test/stub/rails3.2/config/database.yml +0 -25
  395. data/test/stub/rails3.2/config/environment.rb +0 -5
  396. data/test/stub/rails3.2/config/environments/development.rb +0 -37
  397. data/test/stub/rails3.2/config/environments/production.rb +0 -67
  398. data/test/stub/rails3.2/config/environments/test.rb +0 -37
  399. data/test/stub/rails3.2/config/initializers/backtrace_silencers.rb +0 -7
  400. data/test/stub/rails3.2/config/initializers/inflections.rb +0 -15
  401. data/test/stub/rails3.2/config/initializers/mime_types.rb +0 -5
  402. data/test/stub/rails3.2/config/initializers/passenger.rb +0 -2
  403. data/test/stub/rails3.2/config/initializers/secret_token.rb +0 -7
  404. data/test/stub/rails3.2/config/initializers/session_store.rb +0 -8
  405. data/test/stub/rails3.2/config/initializers/wrap_parameters.rb +0 -14
  406. data/test/stub/rails3.2/config/locales/en.yml +0 -5
  407. data/test/stub/rails3.2/config/routes.rb +0 -58
  408. data/test/stub/rails3.2/db/seeds.rb +0 -7
  409. data/test/stub/rails3.2/doc/README_FOR_APP +0 -2
  410. data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
  411. data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
  412. data/test/stub/rails3.2/log/.gitkeep +0 -0
  413. data/test/stub/rails3.2/public/404.html +0 -26
  414. data/test/stub/rails3.2/public/422.html +0 -26
  415. data/test/stub/rails3.2/public/500.html +0 -25
  416. data/test/stub/rails3.2/public/favicon.ico +0 -0
  417. data/test/stub/rails3.2/public/index.html +0 -241
  418. data/test/stub/rails3.2/public/robots.txt +0 -5
  419. data/test/stub/rails3.2/script/rails +0 -6
  420. data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
  421. data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
  422. data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
  423. data/test/stub/rails3.2/test/performance/browsing_test.rb +0 -12
  424. data/test/stub/rails3.2/test/test_helper.rb +0 -13
  425. data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
  426. data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
  427. data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
  428. data/test/stub/rails4.0/.gitignore +0 -16
  429. data/test/stub/rails4.0/Gemfile +0 -45
  430. data/test/stub/rails4.0/Gemfile.lock +0 -126
  431. data/test/stub/rails4.0/README.rdoc +0 -28
  432. data/test/stub/rails4.0/Rakefile +0 -6
  433. data/test/stub/rails4.0/app/assets/images/.keep +0 -0
  434. data/test/stub/rails4.0/app/assets/javascripts/application.js +0 -16
  435. data/test/stub/rails4.0/app/assets/stylesheets/application.css +0 -13
  436. data/test/stub/rails4.0/app/controllers/application_controller.rb +0 -5
  437. data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
  438. data/test/stub/rails4.0/app/helpers/application_helper.rb +0 -2
  439. data/test/stub/rails4.0/app/mailers/.keep +0 -0
  440. data/test/stub/rails4.0/app/models/.keep +0 -0
  441. data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
  442. data/test/stub/rails4.0/app/views/layouts/application.html.erb +0 -14
  443. data/test/stub/rails4.0/bin/bundle +0 -3
  444. data/test/stub/rails4.0/bin/rails +0 -4
  445. data/test/stub/rails4.0/bin/rake +0 -4
  446. data/test/stub/rails4.0/config.ru +0 -4
  447. data/test/stub/rails4.0/config/application.rb +0 -23
  448. data/test/stub/rails4.0/config/boot.rb +0 -4
  449. data/test/stub/rails4.0/config/database.yml +0 -25
  450. data/test/stub/rails4.0/config/environment.rb +0 -5
  451. data/test/stub/rails4.0/config/environments/development.rb +0 -29
  452. data/test/stub/rails4.0/config/environments/production.rb +0 -80
  453. data/test/stub/rails4.0/config/environments/test.rb +0 -36
  454. data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +0 -7
  455. data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +0 -4
  456. data/test/stub/rails4.0/config/initializers/inflections.rb +0 -16
  457. data/test/stub/rails4.0/config/initializers/mime_types.rb +0 -5
  458. data/test/stub/rails4.0/config/initializers/passenger.rb +0 -2
  459. data/test/stub/rails4.0/config/initializers/secret_token.rb +0 -12
  460. data/test/stub/rails4.0/config/initializers/session_store.rb +0 -3
  461. data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +0 -14
  462. data/test/stub/rails4.0/config/locales/en.yml +0 -23
  463. data/test/stub/rails4.0/config/routes.rb +0 -57
  464. data/test/stub/rails4.0/db/seeds.rb +0 -7
  465. data/test/stub/rails4.0/lib/assets/.keep +0 -0
  466. data/test/stub/rails4.0/lib/tasks/.keep +0 -0
  467. data/test/stub/rails4.0/log/.keep +0 -0
  468. data/test/stub/rails4.0/public/404.html +0 -58
  469. data/test/stub/rails4.0/public/422.html +0 -58
  470. data/test/stub/rails4.0/public/500.html +0 -57
  471. data/test/stub/rails4.0/public/favicon.ico +0 -0
  472. data/test/stub/rails4.0/public/robots.txt +0 -5
  473. data/test/stub/rails4.0/test/controllers/.keep +0 -0
  474. data/test/stub/rails4.0/test/fixtures/.keep +0 -0
  475. data/test/stub/rails4.0/test/helpers/.keep +0 -0
  476. data/test/stub/rails4.0/test/integration/.keep +0 -0
  477. data/test/stub/rails4.0/test/mailers/.keep +0 -0
  478. data/test/stub/rails4.0/test/models/.keep +0 -0
  479. data/test/stub/rails4.0/test/test_helper.rb +0 -15
  480. data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
  481. data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
  482. data/test/stub/rails4.1/.gitignore +0 -16
  483. data/test/stub/rails4.1/Gemfile +0 -45
  484. data/test/stub/rails4.1/Gemfile.lock +0 -129
  485. data/test/stub/rails4.1/README.rdoc +0 -28
  486. data/test/stub/rails4.1/Rakefile +0 -6
  487. data/test/stub/rails4.1/app/assets/images/.keep +0 -0
  488. data/test/stub/rails4.1/app/assets/javascripts/application.js +0 -16
  489. data/test/stub/rails4.1/app/assets/stylesheets/application.css +0 -13
  490. data/test/stub/rails4.1/app/controllers/application_controller.rb +0 -5
  491. data/test/stub/rails4.1/app/controllers/concerns/.keep +0 -0
  492. data/test/stub/rails4.1/app/helpers/application_helper.rb +0 -2
  493. data/test/stub/rails4.1/app/mailers/.keep +0 -0
  494. data/test/stub/rails4.1/app/models/.keep +0 -0
  495. data/test/stub/rails4.1/app/models/concerns/.keep +0 -0
  496. data/test/stub/rails4.1/app/views/layouts/application.html.erb +0 -14
  497. data/test/stub/rails4.1/bin/bundle +0 -3
  498. data/test/stub/rails4.1/bin/rails +0 -4
  499. data/test/stub/rails4.1/bin/rake +0 -4
  500. data/test/stub/rails4.1/config.ru +0 -4
  501. data/test/stub/rails4.1/config/application.rb +0 -23
  502. data/test/stub/rails4.1/config/boot.rb +0 -4
  503. data/test/stub/rails4.1/config/database.yml +0 -25
  504. data/test/stub/rails4.1/config/environment.rb +0 -5
  505. data/test/stub/rails4.1/config/environments/development.rb +0 -29
  506. data/test/stub/rails4.1/config/environments/production.rb +0 -80
  507. data/test/stub/rails4.1/config/environments/test.rb +0 -36
  508. data/test/stub/rails4.1/config/initializers/backtrace_silencers.rb +0 -7
  509. data/test/stub/rails4.1/config/initializers/filter_parameter_logging.rb +0 -4
  510. data/test/stub/rails4.1/config/initializers/inflections.rb +0 -16
  511. data/test/stub/rails4.1/config/initializers/mime_types.rb +0 -5
  512. data/test/stub/rails4.1/config/initializers/passenger.rb +0 -5
  513. data/test/stub/rails4.1/config/initializers/secret_token.rb +0 -12
  514. data/test/stub/rails4.1/config/initializers/session_store.rb +0 -3
  515. data/test/stub/rails4.1/config/initializers/wrap_parameters.rb +0 -14
  516. data/test/stub/rails4.1/config/locales/en.yml +0 -23
  517. data/test/stub/rails4.1/config/routes.rb +0 -57
  518. data/test/stub/rails4.1/db/seeds.rb +0 -7
  519. data/test/stub/rails4.1/lib/assets/.keep +0 -0
  520. data/test/stub/rails4.1/lib/tasks/.keep +0 -0
  521. data/test/stub/rails4.1/log/.keep +0 -0
  522. data/test/stub/rails4.1/public/404.html +0 -58
  523. data/test/stub/rails4.1/public/422.html +0 -58
  524. data/test/stub/rails4.1/public/500.html +0 -57
  525. data/test/stub/rails4.1/public/favicon.ico +0 -0
  526. data/test/stub/rails4.1/public/robots.txt +0 -5
  527. data/test/stub/rails4.1/test/controllers/.keep +0 -0
  528. data/test/stub/rails4.1/test/fixtures/.keep +0 -0
  529. data/test/stub/rails4.1/test/helpers/.keep +0 -0
  530. data/test/stub/rails4.1/test/integration/.keep +0 -0
  531. data/test/stub/rails4.1/test/mailers/.keep +0 -0
  532. data/test/stub/rails4.1/test/models/.keep +0 -0
  533. data/test/stub/rails4.1/test/test_helper.rb +0 -15
  534. data/test/stub/rails4.1/vendor/assets/javascripts/.keep +0 -0
  535. data/test/stub/rails4.1/vendor/assets/stylesheets/.keep +0 -0
  536. data/test/stub/start_error.pl +0 -24
  537. data/test/stub/upload_data.txt +0 -494
  538. data/test/stub/wsgi/passenger_wsgi.py +0 -212
  539. data/test/stub/wsgi/public/.gitignore +0 -0
  540. data/test/stub/wsgi/tmp/.gitignore +0 -0
  541. data/test/support/allocate_memory.c +0 -14
  542. data/test/support/apache2_controller.rb +0 -258
  543. data/test/support/multipart.rb +0 -62
  544. data/test/support/nginx_controller.rb +0 -97
  545. data/test/support/placebo-preloader.rb +0 -88
  546. data/test/support/test_helper.rb +0 -455
  547. data/test/support/valgrind.h +0 -2539
  548. data/test/tut/tut.h +0 -1310
  549. data/test/tut/tut_reporter.h +0 -256
  550. data/test/valgrind-osx.supp +0 -7
@@ -1,1310 +0,0 @@
1
- /**
2
- * TUT unit testing framework.
3
- * http://tut-framework.sourceforge.net/
4
- *
5
- * Copyright 2002-2006 Vladimir Dyuzhev.
6
- *
7
- * Redistribution and use in source and binary forms, with or without
8
- * modification, are permitted provided that the following conditions are met:
9
- *
10
- * Redistributions of source code must retain the above copyright notice, this
11
- * list of conditions and the following disclaimer.
12
- * Redistributions in binary form must reproduce the above copyright notice,
13
- * this list of conditions and the following disclaimer in the documentation
14
- * and/or other materials provided with the distribution.
15
- *
16
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
18
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
- * AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
- */
27
-
28
- // Slightly modified for use in this software package.
29
-
30
- #ifndef TUT_H_GUARD
31
- #define TUT_H_GUARD
32
-
33
- #include <iostream>
34
- #include <map>
35
- #include <vector>
36
- #include <string>
37
- #include <sstream>
38
- #include <typeinfo>
39
-
40
- #if defined(TUT_USE_SEH)
41
- #include <windows.h>
42
- #include <winbase.h>
43
- #endif
44
-
45
- #ifdef __SOLARIS9__
46
- // Solaris 9 only has putenv, not setenv.
47
- static int setenv(const char *name, const char *value, int override) {
48
- int ret;
49
- char *s = (char*)malloc(strlen(name) + strlen(value) + 2);
50
- s[0] = 0;
51
- strcpy(s, name);
52
- strcpy(s, "=");
53
- strcpy(s, value);
54
- ret = putenv(s);
55
- free(s);
56
- return ret;
57
- }
58
- #endif
59
-
60
- #define DEFINE_TEST_GROUP(name) \
61
- using namespace tut; \
62
- typedef test_group<name> factory; \
63
- typedef factory::object object; \
64
- factory name## _group(#name)
65
-
66
- #define DEFINE_TEST_GROUP_WITH_LIMIT(name, limit) \
67
- using namespace tut; \
68
- typedef test_group<name, limit> factory; \
69
- typedef factory::object object; \
70
- factory name## _group(#name)
71
-
72
- #define TEST_METHOD(i) \
73
- template<> template<> \
74
- void object::test<i>()
75
-
76
- #ifdef __GNUC__
77
- #define TUT_UNUSED __attribute__((unused))
78
- #else
79
- #define TUT_UNUSED
80
- #endif
81
-
82
- /**
83
- * Template Unit Tests Framework for C++.
84
- * http://tut.dozen.ru
85
- *
86
- * @author Vladimir Dyuzhev, Vladimir.Dyuzhev@gmail.com
87
- */
88
- namespace tut
89
- {
90
-
91
- /**
92
- * The base for all TUT exceptions.
93
- */
94
- struct tut_error : public std::exception
95
- {
96
- tut_error(const std::string& msg)
97
- : err_msg(msg)
98
- {
99
- }
100
-
101
- ~tut_error() throw()
102
- {
103
- }
104
-
105
- const char* what() const throw()
106
- {
107
- return err_msg.c_str();
108
- }
109
-
110
- private:
111
-
112
- std::string err_msg;
113
- };
114
-
115
- /**
116
- * Exception to be throwed when attempted to execute
117
- * missed test by number.
118
- */
119
- struct no_such_test : public tut_error
120
- {
121
- no_such_test()
122
- : tut_error("no such test")
123
- {
124
- }
125
-
126
- ~no_such_test() throw()
127
- {
128
- }
129
- };
130
-
131
- /**
132
- * No such test and passed test number is higher than
133
- * any test number in current group. Used in one-by-one
134
- * test running when upper bound is not known.
135
- */
136
- struct beyond_last_test : public no_such_test
137
- {
138
- beyond_last_test()
139
- {
140
- }
141
-
142
- ~beyond_last_test() throw()
143
- {
144
- }
145
- };
146
-
147
- /**
148
- * Group not found exception.
149
- */
150
- struct no_such_group : public tut_error
151
- {
152
- no_such_group(const std::string& grp)
153
- : tut_error(grp)
154
- {
155
- }
156
-
157
- ~no_such_group() throw()
158
- {
159
- }
160
- };
161
-
162
- /**
163
- * Internal exception to be throwed when
164
- * no more tests left in group or journal.
165
- */
166
- struct no_more_tests
167
- {
168
- no_more_tests()
169
- {
170
- }
171
-
172
- ~no_more_tests() throw()
173
- {
174
- }
175
- };
176
-
177
- /**
178
- * Internal exception to be throwed when
179
- * test constructor has failed.
180
- */
181
- struct bad_ctor : public tut_error
182
- {
183
- bad_ctor(const std::string& msg)
184
- : tut_error(msg)
185
- {
186
- }
187
-
188
- ~bad_ctor() throw()
189
- {
190
- }
191
- };
192
-
193
- /**
194
- * Exception to be throwed when ensure() fails or fail() called.
195
- */
196
- struct failure : public tut_error
197
- {
198
- failure(const std::string& msg)
199
- : tut_error(msg)
200
- {
201
- }
202
-
203
- ~failure() throw()
204
- {
205
- }
206
- };
207
-
208
- /**
209
- * Exception to be throwed when test desctructor throwed an exception.
210
- */
211
- struct warning : public tut_error
212
- {
213
- warning(const std::string& msg)
214
- : tut_error(msg)
215
- {
216
- }
217
-
218
- ~warning() throw()
219
- {
220
- }
221
- };
222
-
223
- /**
224
- * Exception to be throwed when test issued SEH (Win32)
225
- */
226
- struct seh : public tut_error
227
- {
228
- seh(const std::string& msg)
229
- : tut_error(msg)
230
- {
231
- }
232
-
233
- ~seh() throw()
234
- {
235
- }
236
- };
237
-
238
- /**
239
- * Return type of runned test/test group.
240
- *
241
- * For test: contains result of test and, possible, message
242
- * for failure or exception.
243
- */
244
- struct test_result
245
- {
246
- /**
247
- * Test group name.
248
- */
249
- std::string group;
250
-
251
- /**
252
- * Test number in group.
253
- */
254
- int test;
255
-
256
- /**
257
- * Test name (optional)
258
- */
259
- std::string name;
260
-
261
- /**
262
- * ok - test finished successfully
263
- * fail - test failed with ensure() or fail() methods
264
- * ex - test throwed an exceptions
265
- * warn - test finished successfully, but test destructor throwed
266
- * term - test forced test application to terminate abnormally
267
- */
268
- enum result_type
269
- {
270
- ok,
271
- fail,
272
- ex,
273
- warn,
274
- term,
275
- ex_ctor
276
- };
277
-
278
- result_type result;
279
-
280
- /**
281
- * Exception message for failed test.
282
- */
283
- std::string message;
284
- std::string exception_typeid;
285
-
286
- /**
287
- * Default constructor.
288
- */
289
- test_result()
290
- : test(0),
291
- result(ok)
292
- {
293
- }
294
-
295
- /**
296
- * Constructor.
297
- */
298
- test_result(const std::string& grp, int pos,
299
- const std::string& test_name, result_type res)
300
- : group(grp),
301
- test(pos),
302
- name(test_name),
303
- result(res)
304
- {
305
- }
306
-
307
- /**
308
- * Constructor with exception.
309
- */
310
- test_result(const std::string& grp,int pos,
311
- const std::string& test_name, result_type res,
312
- const std::exception& ex)
313
- : group(grp),
314
- test(pos),
315
- name(test_name),
316
- result(res),
317
- message(ex.what()),
318
- exception_typeid(typeid(ex).name())
319
- {
320
- }
321
- };
322
-
323
- /**
324
- * Interface.
325
- * Test group operations.
326
- */
327
- struct group_base
328
- {
329
- virtual ~group_base()
330
- {
331
- }
332
-
333
- // execute tests iteratively
334
- virtual void rewind() = 0;
335
- virtual test_result run_next() = 0;
336
-
337
- // execute one test
338
- virtual test_result run_test(int n) = 0;
339
- };
340
-
341
- /**
342
- * Test runner callback interface.
343
- * Can be implemented by caller to update
344
- * tests results in real-time. User can implement
345
- * any of callback methods, and leave unused
346
- * in default implementation.
347
- */
348
- struct callback
349
- {
350
- /**
351
- * Virtual destructor is a must for subclassed types.
352
- */
353
- virtual ~callback()
354
- {
355
- }
356
-
357
- /**
358
- * Called when new test run started.
359
- */
360
- virtual void run_started()
361
- {
362
- }
363
-
364
- /**
365
- * Called when a group started
366
- * @param name Name of the group
367
- */
368
- virtual void group_started(const std::string& /*name*/)
369
- {
370
- }
371
-
372
- /**
373
- * Called when a test finished.
374
- * @param tr Test results.
375
- */
376
- virtual void test_completed(const test_result& /*tr*/)
377
- {
378
- }
379
-
380
- /**
381
- * Called when a group is completed
382
- * @param name Name of the group
383
- */
384
- virtual void group_completed(const std::string& /*name*/)
385
- {
386
- }
387
-
388
- /**
389
- * Called when all tests in run completed.
390
- */
391
- virtual void run_completed()
392
- {
393
- }
394
- };
395
-
396
- /**
397
- * Typedef for runner::list_groups()
398
- */
399
- typedef std::vector<std::string> groupnames;
400
-
401
- /**
402
- * Test runner.
403
- */
404
- class test_runner
405
- {
406
-
407
- public:
408
-
409
- /**
410
- * Constructor
411
- */
412
- test_runner()
413
- : callback_(&default_callback_)
414
- {
415
- }
416
-
417
- /**
418
- * Stores another group for getting by name.
419
- */
420
- void register_group(const std::string& name, group_base* gr)
421
- {
422
- if (gr == 0)
423
- {
424
- throw tut_error("group shall be non-null");
425
- }
426
-
427
- // TODO: inline variable
428
- groups::iterator found = groups_.find(name);
429
- if (found != groups_.end())
430
- {
431
- std::string msg("attempt to add already existent group " + name);
432
- // this exception terminates application so we use cerr also
433
- // TODO: should this message appear in stream?
434
- std::cerr << msg << std::endl;
435
- throw tut_error(msg);
436
- }
437
-
438
- groups_[name] = gr;
439
- }
440
-
441
- /**
442
- * Stores callback object.
443
- */
444
- void set_callback(callback* cb)
445
- {
446
- callback_ = cb == 0 ? &default_callback_ : cb;
447
- }
448
-
449
- /**
450
- * Returns callback object.
451
- */
452
- callback& get_callback() const
453
- {
454
- return *callback_;
455
- }
456
-
457
- /**
458
- * Returns list of known test groups.
459
- */
460
- const groupnames list_groups() const
461
- {
462
- groupnames ret;
463
- const_iterator i = groups_.begin();
464
- const_iterator e = groups_.end();
465
- while (i != e)
466
- {
467
- ret.push_back(i->first);
468
- ++i;
469
- }
470
- return ret;
471
- }
472
-
473
- /**
474
- * Runs all tests in all groups.
475
- * @param callback Callback object if exists; null otherwise
476
- */
477
- void run_tests() const
478
- {
479
- callback_->run_started();
480
-
481
- const_iterator i = groups_.begin();
482
- const_iterator e = groups_.end();
483
- while (i != e)
484
- {
485
- callback_->group_started(i->first);
486
- try
487
- {
488
- run_all_tests_in_group_(i);
489
- }
490
- catch (const no_more_tests&)
491
- {
492
- callback_->group_completed(i->first);
493
- }
494
-
495
- ++i;
496
- }
497
-
498
- callback_->run_completed();
499
- }
500
-
501
- /**
502
- * Runs all tests in specified group.
503
- */
504
- void run_tests(const std::string& group_name) const
505
- {
506
- callback_->run_started();
507
-
508
- const_iterator i = groups_.find(group_name);
509
- if (i == groups_.end())
510
- {
511
- callback_->run_completed();
512
- throw no_such_group(group_name);
513
- }
514
-
515
- callback_->group_started(group_name);
516
- try
517
- {
518
- run_all_tests_in_group_(i);
519
- }
520
- catch (const no_more_tests&)
521
- {
522
- // ok
523
- }
524
-
525
- callback_->group_completed(group_name);
526
- callback_->run_completed();
527
- }
528
-
529
- /**
530
- * Runs one test in specified group.
531
- */
532
- test_result run_test(const std::string& group_name, int n) const
533
- {
534
- callback_->run_started();
535
-
536
- const_iterator i = groups_.find(group_name);
537
- if (i == groups_.end())
538
- {
539
- callback_->run_completed();
540
- throw no_such_group(group_name);
541
- }
542
-
543
- callback_->group_started(group_name);
544
- try
545
- {
546
- test_result tr = i->second->run_test(n);
547
- callback_->test_completed(tr);
548
- callback_->group_completed(group_name);
549
- callback_->run_completed();
550
- return tr;
551
- }
552
- catch (const beyond_last_test&)
553
- {
554
- callback_->group_completed(group_name);
555
- callback_->run_completed();
556
- throw;
557
- }
558
- catch (const no_such_test&)
559
- {
560
- callback_->group_completed(group_name);
561
- callback_->run_completed();
562
- throw;
563
- }
564
- }
565
-
566
- /**
567
- * Runs specified tests in specified groups.
568
- */
569
- void run_tests(const std::map< std::string, std::vector<int> >& groups_and_tests) const
570
- {
571
- callback_->run_started();
572
-
573
- std::map< std::string, std::vector<int> >::const_iterator g_it;
574
- for (g_it = groups_and_tests.begin(); g_it != groups_and_tests.end(); g_it++)
575
- {
576
- const std::string &group_name = g_it->first;
577
- const std::vector<int> &test_numbers = g_it->second;
578
-
579
- const_iterator i = groups_.find(group_name);
580
- if (i == groups_.end())
581
- {
582
- callback_->run_completed();
583
- throw no_such_group(group_name);
584
- }
585
-
586
- callback_->group_started(group_name);
587
- try
588
- {
589
- if (test_numbers.empty())
590
- {
591
- run_all_tests_in_group_(i);
592
- }
593
- else
594
- {
595
- std::vector<int>::const_iterator n_it;
596
- for (n_it = test_numbers.begin(); n_it != test_numbers.end(); n_it++)
597
- {
598
- int n = *n_it;
599
- test_result tr = i->second->run_test(n);
600
- callback_->test_completed(tr);
601
- }
602
- }
603
- }
604
- catch (const no_more_tests&)
605
- {
606
- // ok
607
- }
608
- catch (const beyond_last_test&)
609
- {
610
- callback_->group_completed(group_name);
611
- callback_->run_completed();
612
- throw;
613
- }
614
- catch (const no_such_test&)
615
- {
616
- callback_->group_completed(group_name);
617
- callback_->run_completed();
618
- throw;
619
- }
620
-
621
- callback_->group_completed(group_name);
622
- }
623
-
624
- callback_->run_completed();
625
- }
626
-
627
- protected:
628
-
629
- typedef std::map<std::string, group_base*> groups;
630
- typedef groups::iterator iterator;
631
- typedef groups::const_iterator const_iterator;
632
- groups groups_;
633
-
634
- callback default_callback_;
635
- callback* callback_;
636
-
637
-
638
- private:
639
-
640
- void run_all_tests_in_group_(const_iterator i) const
641
- {
642
- i->second->rewind();
643
- for ( ;; )
644
- {
645
- test_result tr = i->second->run_next();
646
- callback_->test_completed(tr);
647
-
648
- if (tr.result == test_result::ex_ctor)
649
- {
650
- throw no_more_tests();
651
- }
652
- }
653
- }
654
- };
655
-
656
- /**
657
- * Singleton for test_runner implementation.
658
- * Instance with name runner_singleton shall be implemented
659
- * by user.
660
- */
661
- class test_runner_singleton
662
- {
663
- public:
664
-
665
- static test_runner& get()
666
- {
667
- static test_runner tr;
668
- return tr;
669
- }
670
- };
671
-
672
- extern test_runner_singleton runner;
673
-
674
- /**
675
- * Test object. Contains data test run upon and default test method
676
- * implementation. Inherited from Data to allow tests to
677
- * access test data as members.
678
- */
679
- template <class Data>
680
- class test_object : public Data
681
- {
682
- public:
683
-
684
- /**
685
- * Default constructor
686
- */
687
- test_object()
688
- {
689
- }
690
-
691
- void set_test_name(const std::string& current_test_name)
692
- {
693
- current_test_name_ = current_test_name;
694
- }
695
-
696
- const std::string& get_test_name() const
697
- {
698
- return current_test_name_;
699
- }
700
-
701
- /**
702
- * Default do-nothing test.
703
- */
704
- template <int n>
705
- void test()
706
- {
707
- called_method_was_a_dummy_test_ = true;
708
- }
709
-
710
- /**
711
- * The flag is set to true by default (dummy) test.
712
- * Used to detect usused test numbers and avoid unnecessary
713
- * test object creation which may be time-consuming depending
714
- * on operations described in Data::Data() and Data::~Data().
715
- * TODO: replace with throwing special exception from default test.
716
- */
717
- bool called_method_was_a_dummy_test_;
718
-
719
- private:
720
-
721
- std::string current_test_name_;
722
- };
723
-
724
- namespace
725
- {
726
-
727
- /**
728
- * Tests provided condition.
729
- * Throws if false.
730
- */
731
- TUT_UNUSED void ensure(bool cond)
732
- {
733
- if (!cond)
734
- {
735
- // TODO: default ctor?
736
- throw failure("");
737
- }
738
- }
739
-
740
- /**
741
- * Tests provided condition.
742
- * Throws if true.
743
- */
744
- TUT_UNUSED void ensure_not(bool cond)
745
- {
746
- ensure(!cond);
747
- }
748
-
749
- /**
750
- * Tests provided condition.
751
- * Throws if false.
752
- */
753
- template <typename T>
754
- void ensure(const T msg, bool cond)
755
- {
756
- if (!cond)
757
- {
758
- throw failure(msg);
759
- }
760
- }
761
-
762
- /**
763
- * Tests provided condition.
764
- * Throws if true.
765
- */
766
- template <typename T>
767
- void ensure_not(const T msg, bool cond)
768
- {
769
- ensure(msg, !cond);
770
- }
771
-
772
- /**
773
- * Tests two objects for being equal.
774
- * Throws if false.
775
- *
776
- * NB: both T and Q must have operator << defined somewhere, or
777
- * client code will not compile at all!
778
- */
779
- template <class T, class Q>
780
- void ensure_equals(const char* msg, const Q& actual, const T& expected)
781
- {
782
- if (expected != actual)
783
- {
784
- std::stringstream ss;
785
- ss << (msg ? msg : "")
786
- << (msg ? ":" : "")
787
- << " expected '"
788
- << expected
789
- << "' actual '"
790
- << actual
791
- << '\'';
792
- throw failure(ss.str().c_str());
793
- }
794
- }
795
-
796
- template <class T, class Q>
797
- void ensure_equals(const Q& actual, const T& expected)
798
- {
799
- ensure_equals<>(0, actual, expected);
800
- }
801
-
802
- /**
803
- * Tests two objects for being at most in given distance one from another.
804
- * Borders are excluded.
805
- * Throws if false.
806
- *
807
- * NB: T must have operator << defined somewhere, or
808
- * client code will not compile at all! Also, T shall have
809
- * operators + and -, and be comparable.
810
- */
811
- template <class T>
812
- void ensure_distance(const char* msg, const T& actual, const T& expected,
813
- const T& distance)
814
- {
815
- if (expected-distance >= actual || expected+distance <= actual)
816
- {
817
- std::stringstream ss;
818
- ss << (msg ? msg : "")
819
- << (msg? ":" : "")
820
- << " expected ("
821
- << expected-distance
822
- << " - "
823
- << expected+distance
824
- << ") actual '"
825
- << actual
826
- << '\'';
827
- throw failure(ss.str().c_str());
828
- }
829
- }
830
-
831
- template <class T>
832
- void ensure_distance(const T& actual, const T& expected, const T& distance)
833
- {
834
- ensure_distance<>(0, actual, expected, distance);
835
- }
836
-
837
- /**
838
- * Unconditionally fails with message.
839
- */
840
- TUT_UNUSED void fail(const char* msg = "")
841
- {
842
- throw failure(msg);
843
- }
844
-
845
- } // end of namespace
846
-
847
- /**
848
- * Walks through test tree and stores address of each
849
- * test method in group. Instantiation stops at 0.
850
- */
851
- template <class Test, class Group, int n>
852
- struct tests_registerer
853
- {
854
- static void reg(Group& group)
855
- {
856
- group.reg(n, &Test::template test<n>);
857
- tests_registerer<Test, Group, n - 1>::reg(group);
858
- }
859
- };
860
-
861
- template <class Test, class Group>
862
- struct tests_registerer<Test, Group, 0>
863
- {
864
- static void reg(Group&)
865
- {
866
- }
867
- };
868
-
869
- /**
870
- * Test group; used to recreate test object instance for
871
- * each new test since we have to have reinitialized
872
- * Data base class.
873
- */
874
- template <class Data, int MaxTestsInGroup = 50>
875
- class test_group : public group_base
876
- {
877
- const char* name_;
878
-
879
- typedef void (test_object<Data>::*testmethod)();
880
- typedef std::map<int, testmethod> tests;
881
- typedef typename tests::iterator tests_iterator;
882
- typedef typename tests::const_iterator tests_const_iterator;
883
- typedef typename tests::const_reverse_iterator
884
- tests_const_reverse_iterator;
885
- typedef typename tests::size_type size_type;
886
-
887
- tests tests_;
888
- tests_iterator current_test_;
889
-
890
- /**
891
- * Exception-in-destructor-safe smart-pointer class.
892
- */
893
- template <class T>
894
- class safe_holder
895
- {
896
- T* p_;
897
- bool permit_throw_in_dtor;
898
-
899
- safe_holder(const safe_holder&);
900
- safe_holder& operator=(const safe_holder&);
901
-
902
- public:
903
- safe_holder()
904
- : p_(0),
905
- permit_throw_in_dtor(false)
906
- {
907
- }
908
-
909
- ~safe_holder()
910
- {
911
- release();
912
- }
913
-
914
- T* operator->() const
915
- {
916
- return p_;
917
- }
918
-
919
- T* get() const
920
- {
921
- return p_;
922
- }
923
-
924
- /**
925
- * Tell ptr it can throw from destructor. Right way is to
926
- * use std::uncaught_exception(), but some compilers lack
927
- * correct implementation of the function.
928
- */
929
- void permit_throw()
930
- {
931
- permit_throw_in_dtor = true;
932
- }
933
-
934
- /**
935
- * Specially treats exceptions in test object destructor;
936
- * if test itself failed, exceptions in destructor
937
- * are ignored; if test was successful and destructor failed,
938
- * warning exception throwed.
939
- */
940
- void release()
941
- {
942
- try
943
- {
944
- if (delete_obj() == false)
945
- {
946
- throw warning("destructor of test object raised"
947
- " an SEH exception");
948
- }
949
- }
950
- catch (const std::exception& ex)
951
- {
952
- if (permit_throw_in_dtor)
953
- {
954
- std::string msg = "destructor of test object raised"
955
- " exception: ";
956
- msg += ex.what();
957
- throw warning(msg);
958
- }
959
- }
960
- catch( ... )
961
- {
962
- if (permit_throw_in_dtor)
963
- {
964
- throw warning("destructor of test object raised an"
965
- " exception");
966
- }
967
- }
968
- }
969
-
970
- /**
971
- * Re-init holder to get brand new object.
972
- */
973
- void reset()
974
- {
975
- release();
976
- permit_throw_in_dtor = false;
977
- p_ = new T();
978
- }
979
-
980
- bool delete_obj()
981
- {
982
- #if defined(TUT_USE_SEH)
983
- __try
984
- {
985
- #endif
986
- T* p = p_;
987
- p_ = 0;
988
- delete p;
989
- #if defined(TUT_USE_SEH)
990
- }
991
- __except(handle_seh_(::GetExceptionCode()))
992
- {
993
- if (permit_throw_in_dtor)
994
- {
995
- return false;
996
- }
997
- }
998
- #endif
999
- return true;
1000
- }
1001
- };
1002
-
1003
- public:
1004
-
1005
- typedef test_object<Data> object;
1006
-
1007
- /**
1008
- * Creates and registers test group with specified name.
1009
- */
1010
- test_group(const char* name)
1011
- : name_(name)
1012
- {
1013
- // register itself
1014
- runner.get().register_group(name_,this);
1015
-
1016
- // register all tests
1017
- tests_registerer<object, test_group, MaxTestsInGroup>::reg(*this);
1018
- }
1019
-
1020
- /**
1021
- * This constructor is used in self-test run only.
1022
- */
1023
- test_group(const char* name, test_runner& another_runner)
1024
- : name_(name)
1025
- {
1026
- // register itself
1027
- another_runner.register_group(name_, this);
1028
-
1029
- // register all tests
1030
- tests_registerer<test_object<Data>, test_group,
1031
- MaxTestsInGroup>::reg(*this);
1032
- };
1033
-
1034
- /**
1035
- * Registers test method under given number.
1036
- */
1037
- void reg(int n, testmethod tm)
1038
- {
1039
- tests_[n] = tm;
1040
- }
1041
-
1042
- /**
1043
- * Reset test position before first test.
1044
- */
1045
- void rewind()
1046
- {
1047
- current_test_ = tests_.begin();
1048
- }
1049
-
1050
- /**
1051
- * Runs next test.
1052
- */
1053
- test_result run_next()
1054
- {
1055
- if (current_test_ == tests_.end())
1056
- {
1057
- throw no_more_tests();
1058
- }
1059
-
1060
- // find next user-specialized test
1061
- safe_holder<object> obj;
1062
- while (current_test_ != tests_.end())
1063
- {
1064
- try
1065
- {
1066
- return run_test_(current_test_++, obj);
1067
- }
1068
- catch (const no_such_test&)
1069
- {
1070
- continue;
1071
- }
1072
- }
1073
-
1074
- throw no_more_tests();
1075
- }
1076
-
1077
- /**
1078
- * Runs one test by position.
1079
- */
1080
- test_result run_test(int n)
1081
- {
1082
- // beyond tests is special case to discover upper limit
1083
- if (tests_.rbegin() == tests_.rend())
1084
- {
1085
- throw beyond_last_test();
1086
- }
1087
-
1088
- if (tests_.rbegin()->first < n)
1089
- {
1090
- throw beyond_last_test();
1091
- }
1092
-
1093
- // withing scope; check if given test exists
1094
- tests_iterator ti = tests_.find(n);
1095
- if (ti == tests_.end())
1096
- {
1097
- throw no_such_test();
1098
- }
1099
-
1100
- safe_holder<object> obj;
1101
- return run_test_(ti, obj);
1102
- }
1103
-
1104
- private:
1105
-
1106
- /**
1107
- * VC allows only one exception handling type per function,
1108
- * so I have to split the method.
1109
- *
1110
- * TODO: refactoring needed!
1111
- */
1112
- test_result run_test_(const tests_iterator& ti, safe_holder<object>& obj)
1113
- {
1114
- std::string current_test_name;
1115
- int number = ti->first; // In a variable so we can easily inspect wih gdb.
1116
- try
1117
- {
1118
- if (run_test_seh_(ti->second,obj, current_test_name) == false)
1119
- {
1120
- throw seh("seh");
1121
- }
1122
- }
1123
- catch (const no_such_test&)
1124
- {
1125
- throw;
1126
- }
1127
- catch (const warning& ex)
1128
- {
1129
- // test ok, but destructor failed
1130
- if (obj.get())
1131
- {
1132
- current_test_name = obj->get_test_name();
1133
- }
1134
- test_result tr(name_,ti->first, current_test_name,
1135
- test_result::warn, ex);
1136
- return tr;
1137
- }
1138
- catch (const failure& ex)
1139
- {
1140
- // test failed because of ensure() or similar method
1141
- if (obj.get())
1142
- {
1143
- current_test_name = obj->get_test_name();
1144
- }
1145
- test_result tr(name_,ti->first, current_test_name,
1146
- test_result::fail, ex);
1147
- return tr;
1148
- }
1149
- catch (const seh& ex)
1150
- {
1151
- // test failed with sigsegv, divide by zero, etc
1152
- if (obj.get())
1153
- {
1154
- current_test_name = obj->get_test_name();
1155
- }
1156
- test_result tr(name_, ti->first, current_test_name,
1157
- test_result::term, ex);
1158
- return tr;
1159
- }
1160
- catch (const bad_ctor& ex)
1161
- {
1162
- // test failed because test ctor failed; stop the whole group
1163
- if (obj.get())
1164
- {
1165
- current_test_name = obj->get_test_name();
1166
- }
1167
- test_result tr(name_, ti->first, current_test_name,
1168
- test_result::ex_ctor, ex);
1169
- return tr;
1170
- }
1171
- /*
1172
- catch (const std::exception& ex)
1173
- {
1174
- // test failed with std::exception
1175
- if (obj.get())
1176
- {
1177
- current_test_name = obj->get_test_name();
1178
- }
1179
- test_result tr(name_, ti->first, current_test_name,
1180
- test_result::ex, ex);
1181
- return tr;
1182
- }
1183
- catch (...)
1184
- {
1185
- // test failed with unknown exception
1186
- if (obj.get())
1187
- {
1188
- current_test_name = obj->get_test_name();
1189
- }
1190
- test_result tr(name_, ti->first, current_test_name,
1191
- test_result::ex);
1192
- return tr;
1193
- }
1194
- */
1195
-
1196
- // test passed
1197
- test_result tr(name_,number, current_test_name, test_result::ok);
1198
- return tr;
1199
- }
1200
-
1201
- /**
1202
- * Runs one under SEH if platform supports it.
1203
- */
1204
- bool run_test_seh_(testmethod tm, safe_holder<object>& obj,
1205
- std::string& current_test_name)
1206
- {
1207
- #if defined(TUT_USE_SEH)
1208
- __try
1209
- {
1210
- #endif
1211
- if (obj.get() == 0)
1212
- {
1213
- reset_holder_(obj);
1214
- }
1215
-
1216
- obj->called_method_was_a_dummy_test_ = false;
1217
-
1218
- #if defined(TUT_USE_SEH)
1219
-
1220
- __try
1221
- {
1222
- #endif
1223
- (obj.get()->*tm)();
1224
- #if defined(TUT_USE_SEH)
1225
- }
1226
- __except(handle_seh_(::GetExceptionCode()))
1227
- {
1228
- // throw seh("SEH");
1229
- current_test_name = obj->get_test_name();
1230
- return false;
1231
- }
1232
- #endif
1233
-
1234
- if (obj->called_method_was_a_dummy_test_)
1235
- {
1236
- // do not call obj.release(); reuse object
1237
- throw no_such_test();
1238
- }
1239
-
1240
- current_test_name = obj->get_test_name();
1241
- obj.permit_throw();
1242
- obj.release();
1243
- #if defined(TUT_USE_SEH)
1244
- }
1245
- __except(handle_seh_(::GetExceptionCode()))
1246
- {
1247
- return false;
1248
- }
1249
- #endif
1250
- return true;
1251
- }
1252
-
1253
- void reset_holder_(safe_holder<object>& obj)
1254
- {
1255
- try
1256
- {
1257
- obj.reset();
1258
- }
1259
- catch (const std::exception& ex)
1260
- {
1261
- throw bad_ctor(ex.what());
1262
- }
1263
- catch (...)
1264
- {
1265
- throw bad_ctor("test constructor has generated an exception;"
1266
- " group execution is terminated");
1267
- }
1268
- }
1269
- };
1270
-
1271
- #if defined(TUT_USE_SEH)
1272
- /**
1273
- * Decides should we execute handler or ignore SE.
1274
- */
1275
- inline int handle_seh_(DWORD excode)
1276
- {
1277
- switch(excode)
1278
- {
1279
- case EXCEPTION_ACCESS_VIOLATION:
1280
- case EXCEPTION_DATATYPE_MISALIGNMENT:
1281
- case EXCEPTION_BREAKPOINT:
1282
- case EXCEPTION_SINGLE_STEP:
1283
- case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
1284
- case EXCEPTION_FLT_DENORMAL_OPERAND:
1285
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
1286
- case EXCEPTION_FLT_INEXACT_RESULT:
1287
- case EXCEPTION_FLT_INVALID_OPERATION:
1288
- case EXCEPTION_FLT_OVERFLOW:
1289
- case EXCEPTION_FLT_STACK_CHECK:
1290
- case EXCEPTION_FLT_UNDERFLOW:
1291
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
1292
- case EXCEPTION_INT_OVERFLOW:
1293
- case EXCEPTION_PRIV_INSTRUCTION:
1294
- case EXCEPTION_IN_PAGE_ERROR:
1295
- case EXCEPTION_ILLEGAL_INSTRUCTION:
1296
- case EXCEPTION_NONCONTINUABLE_EXCEPTION:
1297
- case EXCEPTION_STACK_OVERFLOW:
1298
- case EXCEPTION_INVALID_DISPOSITION:
1299
- case EXCEPTION_GUARD_PAGE:
1300
- case EXCEPTION_INVALID_HANDLE:
1301
- return EXCEPTION_EXECUTE_HANDLER;
1302
- };
1303
-
1304
- return EXCEPTION_CONTINUE_SEARCH;
1305
- }
1306
- #endif
1307
- }
1308
-
1309
- #endif
1310
-