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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +10 -0
- data/CHANGELOG +21 -0
- data/build/agents.rb +2 -2
- data/build/apache2.rb +6 -5
- data/build/common_library.rb +22 -7
- data/build/cxx_tests.rb +0 -3
- data/build/misc.rb +1 -1
- data/dev/parse_file_descriptor_log +119 -0
- data/doc/CloudLicensingConfiguration.html +387 -0
- data/doc/Design and Architecture.html +2430 -0
- data/doc/Packaging.html +488 -0
- data/doc/Security of user switching support.html +1833 -0
- data/doc/ServerOptimizationGuide.html +659 -0
- data/doc/ServerOptimizationGuide.txt.md +8 -0
- data/doc/Users guide Apache.html +9116 -0
- data/doc/Users guide Apache.idmap.txt +6 -2
- data/doc/Users guide Apache.txt +26 -7
- data/doc/Users guide Nginx.html +9025 -0
- data/doc/Users guide Nginx.idmap.txt +7 -3
- data/doc/Users guide Nginx.txt +29 -6
- data/doc/Users guide Standalone.html +3983 -0
- data/doc/Users guide.html +1748 -0
- data/doc/users_guide_snippets/installation.txt +4 -4
- data/ext/apache2/Configuration.cpp +16 -5
- data/ext/apache2/Configuration.hpp +4 -2
- data/ext/apache2/Hooks.cpp +44 -19
- data/ext/boost/libs/thread/src/pthread/once.cpp +2 -0
- data/ext/boost/libs/thread/src/pthread/once_atomic.cpp +6 -0
- data/ext/common/AgentsStarter.h +3 -2
- data/ext/common/ApplicationPool2/DirectSpawner.h +14 -4
- data/ext/common/ApplicationPool2/DummySpawner.h +12 -7
- data/ext/common/ApplicationPool2/Implementation.cpp +1 -1
- data/ext/common/ApplicationPool2/Process.h +2 -1
- data/ext/common/ApplicationPool2/Session.h +6 -6
- data/ext/common/ApplicationPool2/SmartSpawner.h +19 -4
- data/ext/common/ApplicationPool2/Socket.h +59 -27
- data/ext/common/ApplicationPool2/Spawner.h +2 -2
- data/ext/common/BackgroundEventLoop.cpp +6 -1
- data/ext/common/Constants.h +1 -1
- data/ext/common/EventedClient.h +1 -1
- data/ext/common/EventedServer.h +2 -2
- data/ext/common/FileDescriptor.h +25 -6
- data/ext/common/Logging.cpp +107 -52
- data/ext/common/Logging.h +146 -19
- data/ext/common/MessageClient.h +2 -2
- data/ext/common/MessageServer.h +3 -2
- data/ext/common/RandomGenerator.h +8 -7
- data/ext/common/SafeLibev.h +5 -1
- data/ext/common/ServerKit/AcceptLoadBalancer.h +9 -4
- data/ext/common/ServerKit/FdSinkChannel.h +5 -2
- data/ext/common/ServerKit/FdSourceChannel.h +5 -2
- data/ext/common/ServerKit/FileBufferedChannel.h +2 -0
- data/ext/common/ServerKit/FileBufferedFdSinkChannel.h +7 -2
- data/ext/common/ServerKit/HttpServer.h +6 -0
- data/ext/common/ServerKit/Server.h +40 -3
- data/ext/common/StaticString.h +20 -0
- data/ext/common/UnionStation/Connection.h +3 -1
- data/ext/common/UnionStation/Core.h +6 -4
- data/ext/common/Utils.cpp +4 -3
- data/ext/common/Utils/DateParsing.h +19 -5
- data/ext/common/Utils/FastStringStream.h +183 -0
- data/ext/common/Utils/IOUtils.cpp +47 -28
- data/ext/common/Utils/IOUtils.h +56 -12
- data/ext/common/Utils/MessagePassing.h +3 -3
- data/ext/common/Utils/ProcessMetricsCollector.h +2 -2
- data/ext/common/Utils/ScopeGuard.h +16 -5
- data/ext/common/Utils/SpeedMeter.h +2 -2
- data/ext/common/Utils/StrIntUtils.cpp +6 -6
- data/ext/common/Utils/StrIntUtils.h +2 -1
- data/ext/common/agents/Base.cpp +56 -4
- data/ext/common/agents/Base.h +2 -1
- data/ext/common/agents/HelperAgent/AdminServer.h +122 -11
- data/ext/common/agents/HelperAgent/Main.cpp +16 -5
- data/ext/common/agents/HelperAgent/OptionParser.h +7 -1
- data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
- data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +10 -1
- data/ext/common/agents/HelperAgent/RequestHandler/Request.h +8 -0
- data/ext/common/agents/HelperAgent/RequestHandler/TurboCaching.h +4 -3
- data/ext/common/agents/LoggingAgent/AdminServer.h +57 -11
- data/ext/common/agents/LoggingAgent/LoggingServer.h +3 -3
- data/ext/common/agents/LoggingAgent/Main.cpp +11 -3
- data/ext/common/agents/Watchdog/AdminServer.h +53 -11
- data/ext/common/agents/Watchdog/AgentWatcher.cpp +3 -3
- data/ext/common/agents/Watchdog/Main.cpp +13 -6
- data/ext/libeio/ecb.h +1 -1
- data/ext/libev/ev.c +13 -1
- data/ext/libev/ev.h +3 -0
- data/ext/nginx/Configuration.c +28 -6
- data/ext/nginx/Configuration.h +2 -1
- data/ext/nginx/ngx_http_passenger_module.c +5 -4
- data/ext/oxt/dynamic_thread_group.hpp +38 -5
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/common_library.rb +9 -5
- data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
- data/lib/phusion_passenger/packaging.rb +23 -37
- data/passenger.gemspec +21 -21
- metadata +4 -453
- metadata.gz.asc +7 -7
- data/.gitignore +0 -68
- data/.travis.yml +0 -16
- data/Gemfile +0 -17
- data/Gemfile.lock +0 -39
- data/Vagrantfile +0 -54
- data/debian.template/README.Debian +0 -15
- data/debian.template/changelog +0 -316
- data/debian.template/compat +0 -1
- data/debian.template/control.erb +0 -91
- data/debian.template/copyright +0 -385
- data/debian.template/libapache2-mod-passenger.install +0 -3
- data/debian.template/libapache2-mod-passenger.postinst +0 -36
- data/debian.template/libapache2-mod-passenger.prerm +0 -15
- data/debian.template/locations.ini.erb +0 -14
- data/debian.template/passenger-dev.install.erb +0 -3
- data/debian.template/passenger-doc.install.erb +0 -2
- data/debian.template/passenger.conf +0 -6
- data/debian.template/passenger.docs +0 -4
- data/debian.template/passenger.install.erb +0 -14
- data/debian.template/passenger.load +0 -3
- data/debian.template/passenger.manpages +0 -3
- data/debian.template/patches/series +0 -0
- data/debian.template/rules.erb +0 -76
- data/debian.template/source/format +0 -1
- data/ext/common/EventedBufferedInput.h +0 -458
- data/packaging/rpm/LICENSE.txt +0 -19
- data/packaging/rpm/Makefile +0 -13
- data/packaging/rpm/README.md +0 -41
- data/packaging/rpm/Vagrantfile +0 -38
- data/packaging/rpm/Vagrantfile.centos +0 -30
- data/packaging/rpm/build +0 -170
- data/packaging/rpm/create_project +0 -41
- data/packaging/rpm/git_update +0 -88
- data/packaging/rpm/image/Dockerfile +0 -37
- data/packaging/rpm/image/Gemfile +0 -3
- data/packaging/rpm/image/Gemfile.lock +0 -12
- data/packaging/rpm/image/RPM-GPG-KEY-amazon-ga +0 -19
- data/packaging/rpm/image/amazon2014-i386.cfg +0 -96
- data/packaging/rpm/image/amazon2014-x86_64.cfg +0 -96
- data/packaging/rpm/image/site-defaults.cfg +0 -168
- data/packaging/rpm/internal/build_tasks.rb +0 -238
- data/packaging/rpm/internal/dummygpg +0 -11
- data/packaging/rpm/internal/exec_build +0 -42
- data/packaging/rpm/internal/get_distro_arch +0 -14
- data/packaging/rpm/internal/get_distro_id +0 -10
- data/packaging/rpm/internal/git_update +0 -27
- data/packaging/rpm/internal/inituidgid +0 -17
- data/packaging/rpm/internal/my_init +0 -344
- data/packaging/rpm/internal/python27 +0 -3
- data/packaging/rpm/internal/repo_update +0 -46
- data/packaging/rpm/internal/setuser +0 -26
- data/packaging/rpm/internal/tracking_helper +0 -40
- data/packaging/rpm/jenkins_release +0 -99
- data/packaging/rpm/lib/build_tasks_support.rb +0 -402
- data/packaging/rpm/lib/preprocessor.rb +0 -341
- data/packaging/rpm/nginx_spec/404.html +0 -119
- data/packaging/rpm/nginx_spec/50x.html +0 -119
- data/packaging/rpm/nginx_spec/index.html +0 -116
- data/packaging/rpm/nginx_spec/nginx-auto-cc-gcc.patch +0 -13
- data/packaging/rpm/nginx_spec/nginx-logo.png +0 -0
- data/packaging/rpm/nginx_spec/nginx-upgrade +0 -13
- data/packaging/rpm/nginx_spec/nginx-upgrade.8 +0 -151
- data/packaging/rpm/nginx_spec/nginx.conf +0 -131
- data/packaging/rpm/nginx_spec/nginx.init +0 -144
- data/packaging/rpm/nginx_spec/nginx.logrotate +0 -13
- data/packaging/rpm/nginx_spec/nginx.service +0 -15
- data/packaging/rpm/nginx_spec/nginx.spec.template +0 -560
- data/packaging/rpm/nginx_spec/nginx.sysconfig +0 -4
- data/packaging/rpm/nginx_spec/passenger.conf +0 -9
- data/packaging/rpm/nginx_spec/poweredby.png +0 -0
- data/packaging/rpm/passenger_spec/apache-passenger.conf.in +0 -26
- data/packaging/rpm/passenger_spec/config.json +0 -30
- data/packaging/rpm/passenger_spec/passenger.logrotate +0 -7
- data/packaging/rpm/passenger_spec/passenger.spec.template +0 -478
- data/packaging/rpm/passenger_spec/passenger_dynamic_thread_group.patch +0 -16
- data/packaging/rpm/passenger_spec/passenger_tests_default_config_example.patch +0 -44
- data/packaging/rpm/passenger_spec/rubygem-passenger-4.0.18-GLIBC_HAVE_LONG_LONG.patch +0 -21
- data/packaging/rpm/repo_update +0 -114
- data/packaging/rpm/setup-system +0 -61
- data/packaging/rpm/shell +0 -10
- data/test/.rspec +0 -4
- data/test/config.json.example +0 -42
- data/test/config.json.rpm-automation +0 -15
- data/test/config.json.travis +0 -15
- data/test/config.json.vagrant +0 -30
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +0 -124
- data/test/cxx/ApplicationPool2/OptionsTest.cpp +0 -30
- data/test/cxx/ApplicationPool2/PoolTest.cpp +0 -2062
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +0 -130
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +0 -243
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +0 -823
- data/test/cxx/BufferedIOTest.cpp +0 -364
- data/test/cxx/CachedFileStatTest.cpp +0 -402
- data/test/cxx/CxxTestMain.cpp +0 -181
- data/test/cxx/DataStructures/LStringTest.cpp +0 -275
- data/test/cxx/DataStructures/StringKeyTableTest.cpp +0 -199
- data/test/cxx/DateParsingTest.cpp +0 -75
- data/test/cxx/DechunkerTest.cpp +0 -250
- data/test/cxx/EventedBufferedInputTest.cpp +0 -758
- data/test/cxx/EventedClientTest.cpp +0 -523
- data/test/cxx/FileChangeCheckerTest.cpp +0 -331
- data/test/cxx/FileDescriptorTest.cpp +0 -69
- data/test/cxx/FilterSupportTest.cpp +0 -433
- data/test/cxx/IOUtilsTest.cpp +0 -861
- data/test/cxx/MemoryKit/MbufTest.cpp +0 -213
- data/test/cxx/MessageIOTest.cpp +0 -360
- data/test/cxx/MessagePassingTest.cpp +0 -81
- data/test/cxx/MessageReadersWritersTest.cpp +0 -576
- data/test/cxx/MessageServerTest.cpp +0 -393
- data/test/cxx/ProcessMetricsCollectorTest.cpp +0 -123
- data/test/cxx/RequestHandlerTest.cpp +0 -1463
- data/test/cxx/ResponseCacheTest.cpp +0 -322
- data/test/cxx/ServerKit/ChannelTest.cpp +0 -1467
- data/test/cxx/ServerKit/CookieUtilsTest.cpp +0 -274
- data/test/cxx/ServerKit/FileBufferedChannelTest.cpp +0 -992
- data/test/cxx/ServerKit/HeaderTableTest.cpp +0 -177
- data/test/cxx/ServerKit/HttpServerTest.cpp +0 -1580
- data/test/cxx/ServerKit/ServerTest.cpp +0 -408
- data/test/cxx/StaticStringTest.cpp +0 -220
- data/test/cxx/StringMapTest.cpp +0 -131
- data/test/cxx/SystemTimeTest.cpp +0 -37
- data/test/cxx/TemplateTest.cpp +0 -118
- data/test/cxx/TestSupport.cpp +0 -207
- data/test/cxx/TestSupport.h +0 -333
- data/test/cxx/UnionStationTest.cpp +0 -741
- data/test/cxx/Utils/StrIntUtilsTest.cpp +0 -39
- data/test/cxx/UtilsTest.cpp +0 -672
- data/test/cxx/VariantMapTest.cpp +0 -191
- data/test/gdbinit.example +0 -34
- data/test/integration_tests/apache2_tests.rb +0 -585
- data/test/integration_tests/downloaded_binaries_tests.rb +0 -185
- data/test/integration_tests/native_packaging_spec.rb +0 -368
- data/test/integration_tests/nginx_tests.rb +0 -402
- data/test/integration_tests/shared/example_webapp_tests.rb +0 -289
- data/test/integration_tests/source_packaging_test.rb +0 -201
- data/test/integration_tests/spec_helper.rb +0 -22
- data/test/integration_tests/standalone_tests.rb +0 -392
- data/test/node/line_reader_spec.js +0 -338
- data/test/node/spec_helper.js +0 -65
- data/test/oxt/backtrace_test.cpp +0 -88
- data/test/oxt/counter.hpp +0 -55
- data/test/oxt/dynamic_thread_group_test.cpp +0 -131
- data/test/oxt/oxt_test_main.cpp +0 -27
- data/test/oxt/spin_lock_test.cpp +0 -59
- data/test/oxt/syscall_interruption_test.cpp +0 -39
- data/test/ruby/debug_logging_spec.rb +0 -145
- data/test/ruby/message_channel_spec.rb +0 -196
- data/test/ruby/rack/loader_spec.rb +0 -42
- data/test/ruby/rack/preloader_spec.rb +0 -48
- data/test/ruby/rails3.0/loader_spec.rb +0 -26
- data/test/ruby/rails3.0/preloader_spec.rb +0 -32
- data/test/ruby/rails3.1/loader_spec.rb +0 -26
- data/test/ruby/rails3.1/preloader_spec.rb +0 -32
- data/test/ruby/rails3.2/loader_spec.rb +0 -26
- data/test/ruby/rails3.2/preloader_spec.rb +0 -32
- data/test/ruby/rails4.0/loader_spec.rb +0 -28
- data/test/ruby/rails4.0/preloader_spec.rb +0 -34
- data/test/ruby/rails4.1/loader_spec.rb +0 -28
- data/test/ruby/rails4.1/preloader_spec.rb +0 -34
- data/test/ruby/request_handler_spec.rb +0 -747
- data/test/ruby/shared/loader_sharedspec.rb +0 -247
- data/test/ruby/shared/rails/union_station_extensions_sharedspec.rb +0 -357
- data/test/ruby/shared/ruby_loader_sharedspec.rb +0 -55
- data/test/ruby/spec_helper.rb +0 -114
- data/test/ruby/standalone/runtime_installer_spec.rb +0 -402
- data/test/ruby/union_station_spec.rb +0 -288
- data/test/ruby/utils/file_system_watcher_spec.rb +0 -229
- data/test/ruby/utils/hosts_file_parser.rb +0 -258
- data/test/ruby/utils/tee_input_spec.rb +0 -235
- data/test/ruby/utils/unseekable_socket_spec.rb +0 -66
- data/test/ruby/utils_spec.rb +0 -41
- data/test/stub/apache2/httpd.conf.erb +0 -122
- data/test/stub/apache2/mime.types +0 -748
- data/test/stub/garbage1.dat +0 -0
- data/test/stub/garbage2.dat +0 -0
- data/test/stub/garbage3.dat +0 -0
- data/test/stub/http_request.yml +0 -23
- data/test/stub/index.html +0 -1
- data/test/stub/nginx/koi-utf +0 -109
- data/test/stub/nginx/koi-win +0 -103
- data/test/stub/nginx/mime.types +0 -70
- data/test/stub/nginx/nginx.conf.erb +0 -70
- data/test/stub/nginx/win-utf +0 -126
- data/test/stub/node/app.js +0 -133
- data/test/stub/node/public/.gitignore +0 -0
- data/test/stub/node/tmp/.gitignore +0 -0
- data/test/stub/rack/config.ru +0 -95
- data/test/stub/rack/library.rb +0 -16
- data/test/stub/rack/public/.gitignore +0 -0
- data/test/stub/rack/start.rb +0 -52
- data/test/stub/rack/tmp/.gitignore +0 -0
- data/test/stub/rails3.0/.gitignore +0 -4
- data/test/stub/rails3.0/Gemfile +0 -22
- data/test/stub/rails3.0/Gemfile.lock +0 -80
- data/test/stub/rails3.0/Rakefile +0 -10
- data/test/stub/rails3.0/app/controllers/application_controller.rb +0 -4
- data/test/stub/rails3.0/app/helpers/application_helper.rb +0 -2
- data/test/stub/rails3.0/app/views/layouts/application.html.erb +0 -14
- data/test/stub/rails3.0/config.ru +0 -4
- data/test/stub/rails3.0/config/application.rb +0 -48
- data/test/stub/rails3.0/config/boot.rb +0 -13
- data/test/stub/rails3.0/config/database.yml +0 -22
- data/test/stub/rails3.0/config/environment.rb +0 -5
- data/test/stub/rails3.0/config/environments/development.rb +0 -19
- data/test/stub/rails3.0/config/environments/production.rb +0 -48
- data/test/stub/rails3.0/config/environments/test.rb +0 -32
- data/test/stub/rails3.0/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails3.0/config/initializers/inflections.rb +0 -10
- data/test/stub/rails3.0/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails3.0/config/initializers/passenger.rb +0 -2
- data/test/stub/rails3.0/config/initializers/secret_token.rb +0 -7
- data/test/stub/rails3.0/config/initializers/session_store.rb +0 -8
- data/test/stub/rails3.0/config/locales/en.yml +0 -5
- data/test/stub/rails3.0/config/routes.rb +0 -58
- data/test/stub/rails3.0/db/seeds.rb +0 -7
- data/test/stub/rails3.0/doc/README_FOR_APP +0 -2
- data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.0/log/.gitignore +0 -0
- data/test/stub/rails3.0/public/404.html +0 -26
- data/test/stub/rails3.0/public/422.html +0 -26
- data/test/stub/rails3.0/public/500.html +0 -26
- data/test/stub/rails3.0/public/favicon.ico +0 -0
- data/test/stub/rails3.0/public/index.html +0 -279
- data/test/stub/rails3.0/public/robots.txt +0 -5
- data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.0/script/rails +0 -9
- data/test/stub/rails3.0/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails3.0/test/test_helper.rb +0 -13
- data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.1/.gitignore +0 -15
- data/test/stub/rails3.1/Gemfile +0 -37
- data/test/stub/rails3.1/Gemfile.lock +0 -115
- data/test/stub/rails3.1/README +0 -261
- data/test/stub/rails3.1/Rakefile +0 -7
- data/test/stub/rails3.1/app/assets/images/rails.png +0 -0
- data/test/stub/rails3.1/app/assets/stylesheets/application.css +0 -7
- data/test/stub/rails3.1/app/controllers/application_controller.rb +0 -3
- data/test/stub/rails3.1/app/helpers/application_helper.rb +0 -2
- data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.1/app/models/.gitkeep +0 -0
- data/test/stub/rails3.1/app/views/layouts/application.html.erb +0 -14
- data/test/stub/rails3.1/config.ru +0 -4
- data/test/stub/rails3.1/config/application.rb +0 -48
- data/test/stub/rails3.1/config/boot.rb +0 -6
- data/test/stub/rails3.1/config/database.yml +0 -25
- data/test/stub/rails3.1/config/environment.rb +0 -5
- data/test/stub/rails3.1/config/environments/development.rb +0 -30
- data/test/stub/rails3.1/config/environments/production.rb +0 -60
- data/test/stub/rails3.1/config/environments/test.rb +0 -39
- data/test/stub/rails3.1/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails3.1/config/initializers/inflections.rb +0 -10
- data/test/stub/rails3.1/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails3.1/config/initializers/passenger.rb +0 -2
- data/test/stub/rails3.1/config/initializers/secret_token.rb +0 -7
- data/test/stub/rails3.1/config/initializers/session_store.rb +0 -8
- data/test/stub/rails3.1/config/initializers/wrap_parameters.rb +0 -14
- data/test/stub/rails3.1/config/locales/en.yml +0 -5
- data/test/stub/rails3.1/config/routes.rb +0 -58
- data/test/stub/rails3.1/db/seeds.rb +0 -7
- data/test/stub/rails3.1/doc/README_FOR_APP +0 -2
- data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.1/log/.gitkeep +0 -0
- data/test/stub/rails3.1/public/404.html +0 -26
- data/test/stub/rails3.1/public/422.html +0 -26
- data/test/stub/rails3.1/public/500.html +0 -26
- data/test/stub/rails3.1/public/favicon.ico +0 -0
- data/test/stub/rails3.1/public/index.html +0 -241
- data/test/stub/rails3.1/public/robots.txt +0 -5
- data/test/stub/rails3.1/script/rails +0 -6
- data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.1/test/performance/browsing_test.rb +0 -12
- data/test/stub/rails3.1/test/test_helper.rb +0 -13
- data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.2/.gitignore +0 -15
- data/test/stub/rails3.2/Gemfile +0 -39
- data/test/stub/rails3.2/Gemfile.lock +0 -113
- data/test/stub/rails3.2/Rakefile +0 -7
- data/test/stub/rails3.2/app/assets/images/rails.png +0 -0
- data/test/stub/rails3.2/app/assets/stylesheets/application.css +0 -13
- data/test/stub/rails3.2/app/controllers/application_controller.rb +0 -3
- data/test/stub/rails3.2/app/helpers/application_helper.rb +0 -2
- data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.2/app/models/.gitkeep +0 -0
- data/test/stub/rails3.2/app/views/layouts/application.html.erb +0 -14
- data/test/stub/rails3.2/config.ru +0 -4
- data/test/stub/rails3.2/config/application.rb +0 -62
- data/test/stub/rails3.2/config/boot.rb +0 -6
- data/test/stub/rails3.2/config/database.yml +0 -25
- data/test/stub/rails3.2/config/environment.rb +0 -5
- data/test/stub/rails3.2/config/environments/development.rb +0 -37
- data/test/stub/rails3.2/config/environments/production.rb +0 -67
- data/test/stub/rails3.2/config/environments/test.rb +0 -37
- data/test/stub/rails3.2/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails3.2/config/initializers/inflections.rb +0 -15
- data/test/stub/rails3.2/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails3.2/config/initializers/passenger.rb +0 -2
- data/test/stub/rails3.2/config/initializers/secret_token.rb +0 -7
- data/test/stub/rails3.2/config/initializers/session_store.rb +0 -8
- data/test/stub/rails3.2/config/initializers/wrap_parameters.rb +0 -14
- data/test/stub/rails3.2/config/locales/en.yml +0 -5
- data/test/stub/rails3.2/config/routes.rb +0 -58
- data/test/stub/rails3.2/db/seeds.rb +0 -7
- data/test/stub/rails3.2/doc/README_FOR_APP +0 -2
- data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.2/log/.gitkeep +0 -0
- data/test/stub/rails3.2/public/404.html +0 -26
- data/test/stub/rails3.2/public/422.html +0 -26
- data/test/stub/rails3.2/public/500.html +0 -25
- data/test/stub/rails3.2/public/favicon.ico +0 -0
- data/test/stub/rails3.2/public/index.html +0 -241
- data/test/stub/rails3.2/public/robots.txt +0 -5
- data/test/stub/rails3.2/script/rails +0 -6
- data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.2/test/performance/browsing_test.rb +0 -12
- data/test/stub/rails3.2/test/test_helper.rb +0 -13
- data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails4.0/.gitignore +0 -16
- data/test/stub/rails4.0/Gemfile +0 -45
- data/test/stub/rails4.0/Gemfile.lock +0 -126
- data/test/stub/rails4.0/README.rdoc +0 -28
- data/test/stub/rails4.0/Rakefile +0 -6
- data/test/stub/rails4.0/app/assets/images/.keep +0 -0
- data/test/stub/rails4.0/app/assets/javascripts/application.js +0 -16
- data/test/stub/rails4.0/app/assets/stylesheets/application.css +0 -13
- data/test/stub/rails4.0/app/controllers/application_controller.rb +0 -5
- data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/helpers/application_helper.rb +0 -2
- data/test/stub/rails4.0/app/mailers/.keep +0 -0
- data/test/stub/rails4.0/app/models/.keep +0 -0
- data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/views/layouts/application.html.erb +0 -14
- data/test/stub/rails4.0/bin/bundle +0 -3
- data/test/stub/rails4.0/bin/rails +0 -4
- data/test/stub/rails4.0/bin/rake +0 -4
- data/test/stub/rails4.0/config.ru +0 -4
- data/test/stub/rails4.0/config/application.rb +0 -23
- data/test/stub/rails4.0/config/boot.rb +0 -4
- data/test/stub/rails4.0/config/database.yml +0 -25
- data/test/stub/rails4.0/config/environment.rb +0 -5
- data/test/stub/rails4.0/config/environments/development.rb +0 -29
- data/test/stub/rails4.0/config/environments/production.rb +0 -80
- data/test/stub/rails4.0/config/environments/test.rb +0 -36
- data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/stub/rails4.0/config/initializers/inflections.rb +0 -16
- data/test/stub/rails4.0/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails4.0/config/initializers/passenger.rb +0 -2
- data/test/stub/rails4.0/config/initializers/secret_token.rb +0 -12
- data/test/stub/rails4.0/config/initializers/session_store.rb +0 -3
- data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +0 -14
- data/test/stub/rails4.0/config/locales/en.yml +0 -23
- data/test/stub/rails4.0/config/routes.rb +0 -57
- data/test/stub/rails4.0/db/seeds.rb +0 -7
- data/test/stub/rails4.0/lib/assets/.keep +0 -0
- data/test/stub/rails4.0/lib/tasks/.keep +0 -0
- data/test/stub/rails4.0/log/.keep +0 -0
- data/test/stub/rails4.0/public/404.html +0 -58
- data/test/stub/rails4.0/public/422.html +0 -58
- data/test/stub/rails4.0/public/500.html +0 -57
- data/test/stub/rails4.0/public/favicon.ico +0 -0
- data/test/stub/rails4.0/public/robots.txt +0 -5
- data/test/stub/rails4.0/test/controllers/.keep +0 -0
- data/test/stub/rails4.0/test/fixtures/.keep +0 -0
- data/test/stub/rails4.0/test/helpers/.keep +0 -0
- data/test/stub/rails4.0/test/integration/.keep +0 -0
- data/test/stub/rails4.0/test/mailers/.keep +0 -0
- data/test/stub/rails4.0/test/models/.keep +0 -0
- data/test/stub/rails4.0/test/test_helper.rb +0 -15
- data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
- data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
- data/test/stub/rails4.1/.gitignore +0 -16
- data/test/stub/rails4.1/Gemfile +0 -45
- data/test/stub/rails4.1/Gemfile.lock +0 -129
- data/test/stub/rails4.1/README.rdoc +0 -28
- data/test/stub/rails4.1/Rakefile +0 -6
- data/test/stub/rails4.1/app/assets/images/.keep +0 -0
- data/test/stub/rails4.1/app/assets/javascripts/application.js +0 -16
- data/test/stub/rails4.1/app/assets/stylesheets/application.css +0 -13
- data/test/stub/rails4.1/app/controllers/application_controller.rb +0 -5
- data/test/stub/rails4.1/app/controllers/concerns/.keep +0 -0
- data/test/stub/rails4.1/app/helpers/application_helper.rb +0 -2
- data/test/stub/rails4.1/app/mailers/.keep +0 -0
- data/test/stub/rails4.1/app/models/.keep +0 -0
- data/test/stub/rails4.1/app/models/concerns/.keep +0 -0
- data/test/stub/rails4.1/app/views/layouts/application.html.erb +0 -14
- data/test/stub/rails4.1/bin/bundle +0 -3
- data/test/stub/rails4.1/bin/rails +0 -4
- data/test/stub/rails4.1/bin/rake +0 -4
- data/test/stub/rails4.1/config.ru +0 -4
- data/test/stub/rails4.1/config/application.rb +0 -23
- data/test/stub/rails4.1/config/boot.rb +0 -4
- data/test/stub/rails4.1/config/database.yml +0 -25
- data/test/stub/rails4.1/config/environment.rb +0 -5
- data/test/stub/rails4.1/config/environments/development.rb +0 -29
- data/test/stub/rails4.1/config/environments/production.rb +0 -80
- data/test/stub/rails4.1/config/environments/test.rb +0 -36
- data/test/stub/rails4.1/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails4.1/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/stub/rails4.1/config/initializers/inflections.rb +0 -16
- data/test/stub/rails4.1/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails4.1/config/initializers/passenger.rb +0 -5
- data/test/stub/rails4.1/config/initializers/secret_token.rb +0 -12
- data/test/stub/rails4.1/config/initializers/session_store.rb +0 -3
- data/test/stub/rails4.1/config/initializers/wrap_parameters.rb +0 -14
- data/test/stub/rails4.1/config/locales/en.yml +0 -23
- data/test/stub/rails4.1/config/routes.rb +0 -57
- data/test/stub/rails4.1/db/seeds.rb +0 -7
- data/test/stub/rails4.1/lib/assets/.keep +0 -0
- data/test/stub/rails4.1/lib/tasks/.keep +0 -0
- data/test/stub/rails4.1/log/.keep +0 -0
- data/test/stub/rails4.1/public/404.html +0 -58
- data/test/stub/rails4.1/public/422.html +0 -58
- data/test/stub/rails4.1/public/500.html +0 -57
- data/test/stub/rails4.1/public/favicon.ico +0 -0
- data/test/stub/rails4.1/public/robots.txt +0 -5
- data/test/stub/rails4.1/test/controllers/.keep +0 -0
- data/test/stub/rails4.1/test/fixtures/.keep +0 -0
- data/test/stub/rails4.1/test/helpers/.keep +0 -0
- data/test/stub/rails4.1/test/integration/.keep +0 -0
- data/test/stub/rails4.1/test/mailers/.keep +0 -0
- data/test/stub/rails4.1/test/models/.keep +0 -0
- data/test/stub/rails4.1/test/test_helper.rb +0 -15
- data/test/stub/rails4.1/vendor/assets/javascripts/.keep +0 -0
- data/test/stub/rails4.1/vendor/assets/stylesheets/.keep +0 -0
- data/test/stub/start_error.pl +0 -24
- data/test/stub/upload_data.txt +0 -494
- data/test/stub/wsgi/passenger_wsgi.py +0 -212
- data/test/stub/wsgi/public/.gitignore +0 -0
- data/test/stub/wsgi/tmp/.gitignore +0 -0
- data/test/support/allocate_memory.c +0 -14
- data/test/support/apache2_controller.rb +0 -258
- data/test/support/multipart.rb +0 -62
- data/test/support/nginx_controller.rb +0 -97
- data/test/support/placebo-preloader.rb +0 -88
- data/test/support/test_helper.rb +0 -455
- data/test/support/valgrind.h +0 -2539
- data/test/tut/tut.h +0 -1310
- data/test/tut/tut_reporter.h +0 -256
- data/test/valgrind-osx.supp +0 -7
data/test/oxt/counter.hpp
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
#ifndef _COUNTER_HPP_
|
2
|
-
#define _COUNTER_HPP_
|
3
|
-
|
4
|
-
#include <boost/shared_ptr.hpp>
|
5
|
-
#include <boost/thread.hpp>
|
6
|
-
#include <boost/thread/thread_time.hpp>
|
7
|
-
|
8
|
-
struct Counter;
|
9
|
-
typedef boost::shared_ptr<Counter> CounterPtr;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* A synchronization mechanism with counter-like properties.
|
13
|
-
*
|
14
|
-
* To avoid memory corruption when unit tests fail, one should
|
15
|
-
* never store Counter objects on the stack. Instead, one should
|
16
|
-
* create them on the heap and use CounterPtr smart pointers.
|
17
|
-
*/
|
18
|
-
struct Counter {
|
19
|
-
struct timeout_expired { };
|
20
|
-
|
21
|
-
unsigned int value;
|
22
|
-
boost::mutex mutex;
|
23
|
-
boost::condition_variable cond;
|
24
|
-
|
25
|
-
static CounterPtr create_ptr() {
|
26
|
-
return CounterPtr(new Counter());
|
27
|
-
}
|
28
|
-
|
29
|
-
Counter() {
|
30
|
-
value = 0;
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Wait until other threads have increment this counter to at least wanted_value.
|
35
|
-
* If this doesn't happen within <tt>timeout</tt> miliseconds, then a timeout_expired
|
36
|
-
* exception will be thrown.
|
37
|
-
*/
|
38
|
-
void wait_until(unsigned int wanted_value, unsigned int timeout = 1000) {
|
39
|
-
boost::unique_lock<boost::mutex> l(mutex);
|
40
|
-
while (value < wanted_value) {
|
41
|
-
if (!cond.timed_wait(l, boost::get_system_time() + boost::posix_time::milliseconds(timeout))) {
|
42
|
-
throw timeout_expired();
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
/** Increment the counter by one. */
|
48
|
-
void increment() {
|
49
|
-
boost::unique_lock<boost::mutex> l(mutex);
|
50
|
-
value++;
|
51
|
-
cond.notify_all();
|
52
|
-
}
|
53
|
-
};
|
54
|
-
|
55
|
-
#endif /* _COUNTER_HPP_ */
|
@@ -1,131 +0,0 @@
|
|
1
|
-
#include "../tut/tut.h"
|
2
|
-
#include "counter.hpp"
|
3
|
-
#include <boost/bind.hpp>
|
4
|
-
#include <boost/thread/thread_time.hpp>
|
5
|
-
#include <oxt/dynamic_thread_group.hpp>
|
6
|
-
#include <oxt/system_calls.hpp>
|
7
|
-
#include <unistd.h>
|
8
|
-
|
9
|
-
using namespace boost;
|
10
|
-
using namespace oxt;
|
11
|
-
|
12
|
-
namespace tut {
|
13
|
-
struct dynamic_thread_group_test {
|
14
|
-
dynamic_thread_group group;
|
15
|
-
};
|
16
|
-
|
17
|
-
DEFINE_TEST_GROUP(dynamic_thread_group_test);
|
18
|
-
|
19
|
-
TEST_METHOD(1) {
|
20
|
-
// It has 0 threads in the beginning.
|
21
|
-
ensure_equals(group.num_threads(), 0u);
|
22
|
-
}
|
23
|
-
|
24
|
-
static void wait_until_done(CounterPtr parent_counter, CounterPtr child_counter) {
|
25
|
-
// Tell parent thread that this thread has started.
|
26
|
-
parent_counter->increment();
|
27
|
-
|
28
|
-
// Wait until parent says that we can quit.
|
29
|
-
child_counter->wait_until(1);
|
30
|
-
}
|
31
|
-
|
32
|
-
TEST_METHOD(2) {
|
33
|
-
// Test whether newly created threads are added to the thread
|
34
|
-
// group, and whether they are automatically removed from the
|
35
|
-
// thread group upon termination.
|
36
|
-
|
37
|
-
// Start 3 'f' threads.
|
38
|
-
CounterPtr f_parent_counter = Counter::create_ptr();
|
39
|
-
CounterPtr f_child_counter = Counter::create_ptr();
|
40
|
-
boost::function<void()> f(boost::bind(wait_until_done, f_parent_counter, f_child_counter));
|
41
|
-
group.create_thread(f);
|
42
|
-
group.create_thread(f);
|
43
|
-
group.create_thread(f);
|
44
|
-
|
45
|
-
// Start 1 'g' thread.
|
46
|
-
CounterPtr g_parent_counter = Counter::create_ptr();
|
47
|
-
CounterPtr g_child_counter = Counter::create_ptr();
|
48
|
-
boost::function<void()> g(boost::bind(wait_until_done, g_parent_counter, g_child_counter));
|
49
|
-
group.create_thread(g);
|
50
|
-
|
51
|
-
f_parent_counter->wait_until(3); // Wait until all 'f' threads have started.
|
52
|
-
g_parent_counter->wait_until(1); // Wait until the 'g' thread has started.
|
53
|
-
|
54
|
-
ensure_equals("There are 4 threads in the group", group.num_threads(), 4u);
|
55
|
-
|
56
|
-
// Tell all 'f' threads that they can quit now.
|
57
|
-
f_child_counter->increment();
|
58
|
-
usleep(25000); // Sleep time must be large enough for Valgrind.
|
59
|
-
ensure_equals(group.num_threads(), 1u);
|
60
|
-
|
61
|
-
// Tell the 'g' thread that it can quit now.
|
62
|
-
g_child_counter->increment();
|
63
|
-
usleep(25000); // Sleep time must be large enough for Valgrind.
|
64
|
-
ensure_equals(group.num_threads(), 0u);
|
65
|
-
}
|
66
|
-
|
67
|
-
static void sleep_and_set_true(CounterPtr counter, volatile bool *flag) {
|
68
|
-
// Tell parent thread that this thread has started.
|
69
|
-
counter->increment();
|
70
|
-
try {
|
71
|
-
syscalls::usleep(5000000);
|
72
|
-
} catch (thread_interrupted &) {
|
73
|
-
*flag = true;
|
74
|
-
}
|
75
|
-
}
|
76
|
-
|
77
|
-
TEST_METHOD(3) {
|
78
|
-
// interrupt_and_join_all() works.
|
79
|
-
|
80
|
-
// Create two threads.
|
81
|
-
CounterPtr counter = Counter::create_ptr();
|
82
|
-
volatile bool flag1 = false;
|
83
|
-
volatile bool flag2 = false;
|
84
|
-
boost::function<void ()> f(boost::bind(sleep_and_set_true, counter, &flag1));
|
85
|
-
boost::function<void ()> g(boost::bind(sleep_and_set_true, counter, &flag2));
|
86
|
-
group.create_thread(f);
|
87
|
-
group.create_thread(g);
|
88
|
-
// Wait until both threads have started.
|
89
|
-
counter->wait_until(2);
|
90
|
-
|
91
|
-
// Now interrupt and join them.
|
92
|
-
group.interrupt_and_join_all();
|
93
|
-
// Both threads should have received a thread interruption
|
94
|
-
// request and terminated as a result.
|
95
|
-
ensure_equals(flag1, true);
|
96
|
-
ensure_equals(flag2, true);
|
97
|
-
ensure_equals(group.num_threads(), 0u);
|
98
|
-
}
|
99
|
-
|
100
|
-
static void do_nothing(unsigned int max) {
|
101
|
-
unsigned int i;
|
102
|
-
for (i = 0; i < max; i++) { }
|
103
|
-
}
|
104
|
-
|
105
|
-
static void create_threads(dynamic_thread_group *group) {
|
106
|
-
for (int i = 1000; i >= 0; i--) {
|
107
|
-
boost::function<void ()> f(boost::bind(do_nothing, i * 1000));
|
108
|
-
group->create_thread(f, "", 256 * 1024);
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
|
-
static void interrupt_group(dynamic_thread_group *group) {
|
113
|
-
for (int i = 0; i < 1000; i++) {
|
114
|
-
group->interrupt_and_join_all();
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
TEST_METHOD(4) {
|
119
|
-
// Stress test.
|
120
|
-
oxt::thread thr1(boost::bind(create_threads, &group));
|
121
|
-
oxt::thread thr2(boost::bind(interrupt_group, &group));
|
122
|
-
thr1.join();
|
123
|
-
thr2.join();
|
124
|
-
group.interrupt_and_join_all();
|
125
|
-
ensure_equals(group.num_threads(), 0u);
|
126
|
-
}
|
127
|
-
|
128
|
-
TEST_METHOD(5) {
|
129
|
-
// If the thread function crashes then it will still be correctly removed from the pool.
|
130
|
-
}
|
131
|
-
}
|
data/test/oxt/oxt_test_main.cpp
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#include "../tut/tut.h"
|
2
|
-
#include "../tut/tut_reporter.h"
|
3
|
-
#include <oxt/initialize.hpp>
|
4
|
-
#include <oxt/system_calls.hpp>
|
5
|
-
#include <signal.h>
|
6
|
-
#include <cstdlib>
|
7
|
-
|
8
|
-
namespace tut {
|
9
|
-
test_runner_singleton runner;
|
10
|
-
}
|
11
|
-
|
12
|
-
int main() {
|
13
|
-
tut::reporter reporter;
|
14
|
-
tut::runner.get().set_callback(&reporter);
|
15
|
-
signal(SIGPIPE, SIG_IGN);
|
16
|
-
setenv("RAILS_ENV", "production", 1);
|
17
|
-
setenv("TESTING_PASSENGER", "1", 1);
|
18
|
-
oxt::initialize();
|
19
|
-
oxt::setup_syscall_interruption_support();
|
20
|
-
try {
|
21
|
-
tut::runner.get().run_tests();
|
22
|
-
} catch (const std::exception &ex) {
|
23
|
-
std::cerr << "Exception raised: " << ex.what() << std::endl;
|
24
|
-
return 1;
|
25
|
-
}
|
26
|
-
return 0;
|
27
|
-
}
|
data/test/oxt/spin_lock_test.cpp
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
#include "../tut/tut.h"
|
2
|
-
#include <boost/bind.hpp>
|
3
|
-
#include <boost/thread.hpp>
|
4
|
-
#include <oxt/spin_lock.hpp>
|
5
|
-
|
6
|
-
using namespace boost;
|
7
|
-
using namespace oxt;
|
8
|
-
|
9
|
-
namespace tut {
|
10
|
-
struct spin_lock_test {
|
11
|
-
boost::mutex continue_mutex;
|
12
|
-
boost::condition_variable continue_cond;
|
13
|
-
bool continue_ok;
|
14
|
-
spin_lock lock;
|
15
|
-
volatile unsigned int counter;
|
16
|
-
|
17
|
-
spin_lock_test() {
|
18
|
-
counter = 0;
|
19
|
-
continue_ok = false;
|
20
|
-
}
|
21
|
-
|
22
|
-
void loop_increment(unsigned int inc) {
|
23
|
-
{
|
24
|
-
boost::mutex::scoped_lock l1(continue_mutex);
|
25
|
-
while (!continue_ok) {
|
26
|
-
continue_cond.wait(l1);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
for (unsigned int i = 0; i < inc; i++) {
|
31
|
-
spin_lock::scoped_lock l2(lock);
|
32
|
-
counter++;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
};
|
36
|
-
|
37
|
-
DEFINE_TEST_GROUP(spin_lock_test);
|
38
|
-
|
39
|
-
TEST_METHOD(1) {
|
40
|
-
boost::thread thr1(boost::bind(&spin_lock_test::loop_increment, this, 100000));
|
41
|
-
boost::thread thr2(boost::bind(&spin_lock_test::loop_increment, this, 100000));
|
42
|
-
boost::thread thr3(boost::bind(&spin_lock_test::loop_increment, this, 100000));
|
43
|
-
boost::thread thr4(boost::bind(&spin_lock_test::loop_increment, this, 100000));
|
44
|
-
|
45
|
-
{
|
46
|
-
boost::mutex::scoped_lock l(continue_mutex);
|
47
|
-
continue_ok = true;
|
48
|
-
continue_cond.notify_all();
|
49
|
-
}
|
50
|
-
|
51
|
-
thr1.join();
|
52
|
-
thr2.join();
|
53
|
-
thr3.join();
|
54
|
-
thr4.join();
|
55
|
-
|
56
|
-
ensure_equals(counter, 400000u);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
@@ -1,39 +0,0 @@
|
|
1
|
-
#include "../tut/tut.h"
|
2
|
-
#include <boost/bind.hpp>
|
3
|
-
#include <oxt/thread.hpp>
|
4
|
-
#include <oxt/system_calls.hpp>
|
5
|
-
#include <unistd.h>
|
6
|
-
#include <ctime>
|
7
|
-
|
8
|
-
using namespace oxt;
|
9
|
-
using namespace std;
|
10
|
-
using namespace boost;
|
11
|
-
|
12
|
-
namespace tut {
|
13
|
-
struct syscall_interruption_test {
|
14
|
-
};
|
15
|
-
|
16
|
-
DEFINE_TEST_GROUP(syscall_interruption_test);
|
17
|
-
|
18
|
-
struct SleepFunction {
|
19
|
-
void operator()() {
|
20
|
-
syscalls::usleep(6000000);
|
21
|
-
}
|
22
|
-
};
|
23
|
-
|
24
|
-
TEST_METHOD(1) {
|
25
|
-
// System call interruption works.
|
26
|
-
SleepFunction s;
|
27
|
-
oxt::thread thr(s);
|
28
|
-
usleep(20000);
|
29
|
-
|
30
|
-
time_t begin, end, time_spent_in_thread;
|
31
|
-
begin = time(NULL);
|
32
|
-
thr.interrupt_and_join();
|
33
|
-
end = time(NULL);
|
34
|
-
time_spent_in_thread = end - begin;
|
35
|
-
|
36
|
-
ensure(time_spent_in_thread <= 2);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
@@ -1,145 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
PhusionPassenger.require_passenger_lib 'debug_logging'
|
3
|
-
require 'stringio'
|
4
|
-
require 'tmpdir'
|
5
|
-
require 'fileutils'
|
6
|
-
|
7
|
-
module PhusionPassenger
|
8
|
-
|
9
|
-
describe DebugLogging do
|
10
|
-
after :each do
|
11
|
-
DebugLogging.log_level = DEFAULT_LOG_LEVEL
|
12
|
-
DebugLogging.log_file = nil
|
13
|
-
DebugLogging.stderr_evaluator = nil
|
14
|
-
FileUtils.rm_rf(@tmpdir) if @tmpdir
|
15
|
-
end
|
16
|
-
|
17
|
-
class MyClass
|
18
|
-
include DebugLogging
|
19
|
-
end
|
20
|
-
|
21
|
-
def use_log_file!
|
22
|
-
@tmpdir = Dir.mktmpdir
|
23
|
-
@log_file = "#{@tmpdir}/debug.log"
|
24
|
-
DebugLogging.log_file = @log_file
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#debug" do
|
28
|
-
it "doesn't print the message if log level is LVL_INFO" do
|
29
|
-
use_log_file!
|
30
|
-
DebugLogging.log_level = LVL_INFO
|
31
|
-
DebugLogging.debug("hello")
|
32
|
-
File.exist?(@log_file).should be_false
|
33
|
-
end
|
34
|
-
|
35
|
-
it "prints the message if log level is LVL_DEBUG" do
|
36
|
-
use_log_file!
|
37
|
-
DebugLogging.log_level = LVL_DEBUG
|
38
|
-
DebugLogging.debug("hello")
|
39
|
-
File.exist?(@log_file).should be_true
|
40
|
-
end
|
41
|
-
|
42
|
-
it "prints the message if log level is greater than LVL_DEBUG" do
|
43
|
-
use_log_file!
|
44
|
-
DebugLogging.log_level = LVL_DEBUG2
|
45
|
-
DebugLogging.debug("hello")
|
46
|
-
File.exist?(@log_file).should be_true
|
47
|
-
end
|
48
|
-
|
49
|
-
it "prints the location of the calling function" do
|
50
|
-
use_log_file!
|
51
|
-
DebugLogging.log_level = LVL_DEBUG
|
52
|
-
DebugLogging.debug("hello")
|
53
|
-
File.read(@log_file).should include("debug_logging_spec.rb")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "prints to STDERR by default" do
|
57
|
-
io = StringIO.new
|
58
|
-
DebugLogging.log_level = LVL_DEBUG
|
59
|
-
DebugLogging.stderr_evaluator = lambda { io }
|
60
|
-
DebugLogging.debug("hello")
|
61
|
-
io.string.should include("hello")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "reopens the log file handle if it has been closed" do
|
65
|
-
use_log_file!
|
66
|
-
DebugLogging.log_level = LVL_DEBUG
|
67
|
-
DebugLogging.debug("hello")
|
68
|
-
DebugLogging._log_device.close
|
69
|
-
DebugLogging.debug("world")
|
70
|
-
File.read(@log_file).should include("world")
|
71
|
-
end
|
72
|
-
|
73
|
-
it "also works as included method" do
|
74
|
-
use_log_file!
|
75
|
-
DebugLogging.log_level = LVL_DEBUG
|
76
|
-
MyClass.new.send(:debug, "hello")
|
77
|
-
File.read(@log_file).should include("hello")
|
78
|
-
end
|
79
|
-
|
80
|
-
it "is private when included" do
|
81
|
-
MyClass.private_method_defined?(:debug)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe "#trace" do
|
86
|
-
specify "#trace(x, ...) doesn't print the message if the log level is lower than LVL_INFO + x" do
|
87
|
-
use_log_file!
|
88
|
-
DebugLogging.log_level = LVL_INFO + 1
|
89
|
-
DebugLogging.trace(2, "hello")
|
90
|
-
File.exist?(@log_file).should be_false
|
91
|
-
end
|
92
|
-
|
93
|
-
specify "#trace(x, ...) prints the message if the log level equals LVL_INFO + 2" do
|
94
|
-
use_log_file!
|
95
|
-
DebugLogging.log_level = LVL_INFO + 2
|
96
|
-
DebugLogging.trace(2, "hello")
|
97
|
-
File.exist?(@log_file).should be_true
|
98
|
-
end
|
99
|
-
|
100
|
-
specify "#trace(x, ...) prints the message if the log level is greater than LVL_INFO + 3" do
|
101
|
-
use_log_file!
|
102
|
-
DebugLogging.log_level = LVL_INFO + 3
|
103
|
-
DebugLogging.trace(2, "hello")
|
104
|
-
File.exist?(@log_file).should be_true
|
105
|
-
end
|
106
|
-
|
107
|
-
specify "#trace prints the location of the calling function" do
|
108
|
-
io = StringIO.new
|
109
|
-
DebugLogging.log_level = LVL_DEBUG
|
110
|
-
DebugLogging.stderr_evaluator = lambda { io }
|
111
|
-
DebugLogging.trace(1, "hello")
|
112
|
-
io.string.should include("hello")
|
113
|
-
end
|
114
|
-
|
115
|
-
it "prints to STDERR by default" do
|
116
|
-
io = StringIO.new
|
117
|
-
DebugLogging.log_level = LVL_DEBUG
|
118
|
-
DebugLogging.stderr_evaluator = lambda { io }
|
119
|
-
DebugLogging.trace(1, "hello")
|
120
|
-
io.string.should include("hello")
|
121
|
-
end
|
122
|
-
|
123
|
-
it "reopens the log file handle if it has been closed" do
|
124
|
-
use_log_file!
|
125
|
-
DebugLogging.log_level = LVL_DEBUG
|
126
|
-
DebugLogging.trace(1, "hello")
|
127
|
-
DebugLogging._log_device.close
|
128
|
-
DebugLogging.trace(1, "world")
|
129
|
-
File.read(@log_file).should include("world")
|
130
|
-
end
|
131
|
-
|
132
|
-
it "also works as included method" do
|
133
|
-
use_log_file!
|
134
|
-
DebugLogging.log_level = LVL_DEBUG
|
135
|
-
MyClass.new.send(:trace, 1, "hello")
|
136
|
-
File.read(@log_file).should include("hello")
|
137
|
-
end
|
138
|
-
|
139
|
-
it "is private when included" do
|
140
|
-
MyClass.private_method_defined?(:trace)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
end # module PhusionPassenger
|