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
@@ -1,331 +0,0 @@
|
|
1
|
-
#include "TestSupport.h"
|
2
|
-
#include "Utils/FileChangeChecker.h"
|
3
|
-
#include "Utils/SystemTime.h"
|
4
|
-
#include <unistd.h>
|
5
|
-
|
6
|
-
using namespace Passenger;
|
7
|
-
using namespace std;
|
8
|
-
|
9
|
-
namespace tut {
|
10
|
-
struct FileChangeCheckerTest {
|
11
|
-
FileChangeCheckerTest() {
|
12
|
-
}
|
13
|
-
|
14
|
-
~FileChangeCheckerTest() {
|
15
|
-
unlink("test.txt");
|
16
|
-
unlink("test2.txt");
|
17
|
-
SystemTime::release();
|
18
|
-
}
|
19
|
-
};
|
20
|
-
|
21
|
-
DEFINE_TEST_GROUP(FileChangeCheckerTest);
|
22
|
-
|
23
|
-
TEST_METHOD(1) {
|
24
|
-
// If a file is checked for the first time, then it
|
25
|
-
// returns whether the file exists.
|
26
|
-
FileChangeChecker checker(10);
|
27
|
-
touchFile("test.txt");
|
28
|
-
ensure(checker.changed("test.txt"));
|
29
|
-
ensure(!checker.changed("test2.txt"));
|
30
|
-
}
|
31
|
-
|
32
|
-
TEST_METHOD(2) {
|
33
|
-
// If a file is checked for the first time, and its
|
34
|
-
// directory is not accessible, then false is returned.
|
35
|
-
if (geteuid() != 0) {
|
36
|
-
// Root can read everything so no point in
|
37
|
-
// testing if we're running as root.
|
38
|
-
|
39
|
-
FileChangeChecker checker(10);
|
40
|
-
TempDir d("test.tmp");
|
41
|
-
touchFile("test.tmp/test.txt");
|
42
|
-
|
43
|
-
runShellCommand("chmod a= test.tmp");
|
44
|
-
ensure(!checker.changed("test.tmp/test.txt"));
|
45
|
-
|
46
|
-
// Should still be false.
|
47
|
-
ensure(!checker.changed("test.tmp/test.txt"));
|
48
|
-
|
49
|
-
// Now make it accessible again...
|
50
|
-
runShellCommand("chmod u=rwx test.tmp");
|
51
|
-
ensure(checker.changed("test.tmp/test.txt"));
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
TEST_METHOD(3) {
|
56
|
-
// File is not changed if it didn't exist and
|
57
|
-
// still doesn't exist.
|
58
|
-
FileChangeChecker checker(10);
|
59
|
-
|
60
|
-
checker.changed("test.txt");
|
61
|
-
ensure("test.txt not changed", !checker.changed("test.txt"));
|
62
|
-
|
63
|
-
checker.changed("test2.txt");
|
64
|
-
ensure("test2.txt not changed", !checker.changed("test2.txt"));
|
65
|
-
}
|
66
|
-
|
67
|
-
TEST_METHOD(4) {
|
68
|
-
// File is not changed if its ctime and mtime didn't change.
|
69
|
-
FileChangeChecker checker(10);
|
70
|
-
|
71
|
-
touchFile("test.txt");
|
72
|
-
checker.changed("test.txt");
|
73
|
-
ensure(!checker.changed("test.txt"));
|
74
|
-
|
75
|
-
touchFile("test2.txt");
|
76
|
-
checker.changed("test2.txt");
|
77
|
-
ensure(!checker.changed("test2.txt"));
|
78
|
-
}
|
79
|
-
|
80
|
-
TEST_METHOD(5) {
|
81
|
-
// File is changed if it didn't exist but has now been created.
|
82
|
-
FileChangeChecker checker(10);
|
83
|
-
|
84
|
-
checker.changed("test.txt");
|
85
|
-
checker.changed("test2.txt");
|
86
|
-
touchFile("test.txt");
|
87
|
-
touchFile("test2.txt");
|
88
|
-
ensure(checker.changed("test.txt"));
|
89
|
-
ensure(checker.changed("test2.txt"));
|
90
|
-
}
|
91
|
-
|
92
|
-
TEST_METHOD(6) {
|
93
|
-
// File is not changed if existed and has now been deleted.
|
94
|
-
FileChangeChecker checker(10);
|
95
|
-
|
96
|
-
touchFile("test.txt");
|
97
|
-
checker.changed("test.txt");
|
98
|
-
unlink("test.txt");
|
99
|
-
ensure("test.txt is not considered changed if it has been deleted",
|
100
|
-
!checker.changed("test.txt"));
|
101
|
-
|
102
|
-
touchFile("test2.txt");
|
103
|
-
checker.changed("test2.txt");
|
104
|
-
unlink("test2.txt");
|
105
|
-
ensure("test2.txt is not considered changed if it has been deleted",
|
106
|
-
!checker.changed("test2.txt"));
|
107
|
-
}
|
108
|
-
|
109
|
-
TEST_METHOD(7) {
|
110
|
-
// File is changed if its mtime changed.
|
111
|
-
FileChangeChecker checker(1);
|
112
|
-
|
113
|
-
touchFile("test.txt", 5);
|
114
|
-
checker.changed("test.txt");
|
115
|
-
touchFile("test.txt", 10);
|
116
|
-
ensure("First check: changed", checker.changed("test.txt"));
|
117
|
-
ensure("Second check: unchanged", !checker.changed("test.txt"));
|
118
|
-
|
119
|
-
touchFile("test2.txt", 5);
|
120
|
-
checker.changed("test2.txt");
|
121
|
-
touchFile("test2.txt", 10);
|
122
|
-
ensure("First check test2.txt: changed", checker.changed("test2.txt"));
|
123
|
-
ensure("Second check test2.txt: unchanged", !checker.changed("test2.txt"));
|
124
|
-
}
|
125
|
-
|
126
|
-
TEST_METHOD(8) {
|
127
|
-
// If a file is not checked for the first time and its
|
128
|
-
// information is still in the cache, but the directory
|
129
|
-
// in which the file lives is now suddenly inaccessible,
|
130
|
-
// then false is returned.
|
131
|
-
if (geteuid() != 0) {
|
132
|
-
// Root can read everything so no point in
|
133
|
-
// testing if we're running as root.
|
134
|
-
|
135
|
-
FileChangeChecker checker(10);
|
136
|
-
TempDir d("test.tmp");
|
137
|
-
touchFile("test.tmp/test.txt", 1);
|
138
|
-
checker.changed("test.tmp/test.txt");
|
139
|
-
|
140
|
-
touchFile("test.tmp/test.txt", 2);
|
141
|
-
runShellCommand("chmod a= test.tmp");
|
142
|
-
ensure("First check returns false", !checker.changed("test.tmp/test.txt"));
|
143
|
-
|
144
|
-
// Now make it accessible again...
|
145
|
-
runShellCommand("chmod u=rwx test.tmp");
|
146
|
-
ensure("Second check returns true", checker.changed("test.tmp/test.txt"));
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
TEST_METHOD(9) {
|
151
|
-
// Throttling works.
|
152
|
-
SystemTime::force(5);
|
153
|
-
|
154
|
-
FileChangeChecker checker(1);
|
155
|
-
checker.changed("test.txt", 3);
|
156
|
-
touchFile("test.txt");
|
157
|
-
ensure(!checker.changed("test.txt", 3));
|
158
|
-
|
159
|
-
SystemTime::force(6);
|
160
|
-
ensure(!checker.changed("test.txt", 3));
|
161
|
-
|
162
|
-
SystemTime::force(8);
|
163
|
-
ensure(checker.changed("test.txt", 3));
|
164
|
-
ensure(!checker.changed("test.txt", 3));
|
165
|
-
}
|
166
|
-
|
167
|
-
TEST_METHOD(10) {
|
168
|
-
// Test scenario involving multiple files.
|
169
|
-
FileChangeChecker checker(10);
|
170
|
-
|
171
|
-
checker.changed("test.txt");
|
172
|
-
checker.changed("test2.txt");
|
173
|
-
checker.changed("test3.txt");
|
174
|
-
|
175
|
-
touchFile("test2.txt", 1);
|
176
|
-
ensure(!checker.changed("test.txt"));
|
177
|
-
ensure(checker.changed("test2.txt"));
|
178
|
-
ensure(!checker.changed("test3.txt"));
|
179
|
-
|
180
|
-
touchFile("test.txt", 2);
|
181
|
-
touchFile("test3.txt", 3);
|
182
|
-
ensure(checker.changed("test.txt"));
|
183
|
-
ensure(!checker.changed("test2.txt"));
|
184
|
-
ensure(checker.changed("test3.txt"));
|
185
|
-
}
|
186
|
-
|
187
|
-
TEST_METHOD(11) {
|
188
|
-
// Different filenames are treated as different files.
|
189
|
-
FileChangeChecker checker(10);
|
190
|
-
checker.changed("test.txt");
|
191
|
-
checker.changed("./test.txt");
|
192
|
-
touchFile("test.txt", 1);
|
193
|
-
ensure(checker.changed("test.txt"));
|
194
|
-
ensure(checker.changed("./test.txt"));
|
195
|
-
}
|
196
|
-
|
197
|
-
TEST_METHOD(12) {
|
198
|
-
if (geteuid() != 0) {
|
199
|
-
// Root can read everything so no point in
|
200
|
-
// testing if we're running as root.
|
201
|
-
|
202
|
-
FileChangeChecker checker(10);
|
203
|
-
TempDir d("test.tmp");
|
204
|
-
touchFile("test.tmp/test.txt", 1);
|
205
|
-
|
206
|
-
checker.changed("test.tmp/test.txt");
|
207
|
-
touchFile("test.tmp/test.txt", 2);
|
208
|
-
runShellCommand("chmod a= test.tmp");
|
209
|
-
ensure("(1)", !checker.changed("test.tmp/test.txt"));
|
210
|
-
runShellCommand("chmod u=rwx test.tmp");
|
211
|
-
ensure("(2)", checker.changed("test.tmp/test.txt"));
|
212
|
-
}
|
213
|
-
}
|
214
|
-
|
215
|
-
TEST_METHOD(13) {
|
216
|
-
// Size limitation works.
|
217
|
-
FileChangeChecker checker(2);
|
218
|
-
touchFile("test.txt", 1);
|
219
|
-
touchFile("test2.txt", 2);
|
220
|
-
touchFile("test3.txt", 3);
|
221
|
-
|
222
|
-
checker.changed("test.txt");
|
223
|
-
checker.changed("test2.txt");
|
224
|
-
checker.changed("test3.txt");
|
225
|
-
|
226
|
-
// test.txt is now removed from the file list.
|
227
|
-
|
228
|
-
unlink("test.txt");
|
229
|
-
unlink("test2.txt");
|
230
|
-
unlink("test3.txt");
|
231
|
-
ensure("test2.txt is still in the file list", checker.knows("test2.txt"));
|
232
|
-
ensure("test2.txt is not considered changed", !checker.changed("test2.txt"));
|
233
|
-
ensure("test3.txt is still in the file list", checker.knows("test3.txt"));
|
234
|
-
ensure("test3.txt is not considered changed", !checker.changed("test3.txt"));
|
235
|
-
ensure("test.txt is removed from the file list", !checker.knows("test.txt"));
|
236
|
-
}
|
237
|
-
|
238
|
-
TEST_METHOD(14) {
|
239
|
-
// Increasing the file list size dynamically works.
|
240
|
-
FileChangeChecker checker(2);
|
241
|
-
touchFile("test.txt", 1);
|
242
|
-
touchFile("test2.txt", 2);
|
243
|
-
touchFile("test3.txt", 3);
|
244
|
-
|
245
|
-
checker.changed("test.txt");
|
246
|
-
checker.changed("test2.txt");
|
247
|
-
checker.changed("test3.txt");
|
248
|
-
|
249
|
-
// test.txt is now removed from the file list.
|
250
|
-
|
251
|
-
checker.setMaxSize(3);
|
252
|
-
unlink("test.txt");
|
253
|
-
unlink("test2.txt");
|
254
|
-
unlink("test3.txt");
|
255
|
-
|
256
|
-
ensure("test.txt is removed from the file list", !checker.knows("test.txt"));
|
257
|
-
// The above changed() call should not remove test2.txt from the file list.
|
258
|
-
ensure("test2.txt is still in the file list", checker.knows("test2.txt"));
|
259
|
-
ensure("test3.txt is still in the file list", checker.knows("test3.txt"));
|
260
|
-
|
261
|
-
checker.changed("test.txt");
|
262
|
-
checker.changed("test4.txt");
|
263
|
-
ensure("test2.txt is removed from the file list, again", !checker.knows("test2.txt"));
|
264
|
-
}
|
265
|
-
|
266
|
-
TEST_METHOD(16) {
|
267
|
-
// Decreasing the file list size dynamically works, and will
|
268
|
-
// remove the oldest entries.
|
269
|
-
FileChangeChecker checker(4);
|
270
|
-
checker.changed("test.txt");
|
271
|
-
checker.changed("test2.txt");
|
272
|
-
checker.changed("test3.txt");
|
273
|
-
checker.changed("test4.txt");
|
274
|
-
|
275
|
-
checker.setMaxSize(2);
|
276
|
-
ensure(!checker.knows("test.txt"));
|
277
|
-
ensure(!checker.knows("test2.txt"));
|
278
|
-
ensure(checker.knows("test3.txt"));
|
279
|
-
ensure(checker.knows("test4.txt"));
|
280
|
-
|
281
|
-
checker.changed("test.txt");
|
282
|
-
ensure(!checker.knows("test3.txt"));
|
283
|
-
}
|
284
|
-
|
285
|
-
TEST_METHOD(17) {
|
286
|
-
// An initial maxSize of 0 makes the file list's size unlimited.
|
287
|
-
FileChangeChecker checker(0);
|
288
|
-
checker.changed("test.txt");
|
289
|
-
checker.changed("test2.txt");
|
290
|
-
checker.changed("test3.txt");
|
291
|
-
checker.changed("test4.txt");
|
292
|
-
|
293
|
-
ensure(checker.knows("test.txt"));
|
294
|
-
ensure(checker.knows("test2.txt"));
|
295
|
-
ensure(checker.knows("test3.txt"));
|
296
|
-
ensure(checker.knows("test4.txt"));
|
297
|
-
}
|
298
|
-
|
299
|
-
TEST_METHOD(18) {
|
300
|
-
// Dynamically setting the file list size to 0 makes
|
301
|
-
// the file list's size unlimited.
|
302
|
-
FileChangeChecker checker(2);
|
303
|
-
checker.changed("test.txt");
|
304
|
-
checker.changed("test2.txt");
|
305
|
-
checker.setMaxSize(0);
|
306
|
-
checker.changed("test3.txt");
|
307
|
-
checker.changed("test4.txt");
|
308
|
-
|
309
|
-
ensure(checker.knows("test.txt"));
|
310
|
-
ensure(checker.knows("test2.txt"));
|
311
|
-
ensure(checker.knows("test3.txt"));
|
312
|
-
ensure(checker.knows("test4.txt"));
|
313
|
-
}
|
314
|
-
|
315
|
-
TEST_METHOD(19) {
|
316
|
-
// Changing the file list size dynamically from 0 to non-0 works;
|
317
|
-
// it removes the oldest entries, if necessary.
|
318
|
-
FileChangeChecker checker(0);
|
319
|
-
checker.changed("test.txt");
|
320
|
-
checker.changed("test2.txt");
|
321
|
-
checker.changed("test3.txt");
|
322
|
-
checker.changed("test4.txt");
|
323
|
-
checker.changed("test5.txt");
|
324
|
-
checker.setMaxSize(2);
|
325
|
-
ensure(!checker.knows("test.txt"));
|
326
|
-
ensure(!checker.knows("test2.txt"));
|
327
|
-
ensure(!checker.knows("test3.txt"));
|
328
|
-
ensure(checker.knows("test4.txt"));
|
329
|
-
ensure(checker.knows("test5.txt"));
|
330
|
-
}
|
331
|
-
}
|
@@ -1,69 +0,0 @@
|
|
1
|
-
#include "TestSupport.h"
|
2
|
-
#include "FileDescriptor.h"
|
3
|
-
#include <cerrno>
|
4
|
-
|
5
|
-
using namespace Passenger;
|
6
|
-
|
7
|
-
namespace tut {
|
8
|
-
struct FileDescriptorTest {
|
9
|
-
int pipes[2];
|
10
|
-
|
11
|
-
FileDescriptorTest() {
|
12
|
-
pipe(pipes);
|
13
|
-
}
|
14
|
-
|
15
|
-
~FileDescriptorTest() {
|
16
|
-
if (pipes[0] != -1) {
|
17
|
-
close(pipes[0]);
|
18
|
-
}
|
19
|
-
if (pipes[1] != -1) {
|
20
|
-
close(pipes[1]);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
};
|
24
|
-
|
25
|
-
DEFINE_TEST_GROUP(FileDescriptorTest);
|
26
|
-
|
27
|
-
TEST_METHOD(1) {
|
28
|
-
// Test constructors.
|
29
|
-
FileDescriptor f;
|
30
|
-
ensure_equals("An empty FileDescriptor has value -1",
|
31
|
-
f, -1);
|
32
|
-
|
33
|
-
int fd = pipes[0];
|
34
|
-
pipes[0] = -1;
|
35
|
-
f = FileDescriptor(fd);
|
36
|
-
ensure_equals("FileDescriptor takes the value of its constructor argument",
|
37
|
-
f, fd);
|
38
|
-
}
|
39
|
-
|
40
|
-
TEST_METHOD(2) {
|
41
|
-
// It closes the underlying file descriptor when the last
|
42
|
-
// instance is destroyed.
|
43
|
-
int reader = pipes[0];
|
44
|
-
pipes[0] = -1;
|
45
|
-
{
|
46
|
-
FileDescriptor f(reader);
|
47
|
-
{
|
48
|
-
FileDescriptor f2(f);
|
49
|
-
}
|
50
|
-
ensure("File descriptor is not closed if there are still live copies",
|
51
|
-
write(pipes[1], "x", 1) != -1);
|
52
|
-
}
|
53
|
-
ensure("File descriptor is closed if the last live copy is dead",
|
54
|
-
write(pipes[1], "x", 1) == -1);
|
55
|
-
}
|
56
|
-
|
57
|
-
TEST_METHOD(3) {
|
58
|
-
// Calling close() will close the underlying file descriptor for all instances.
|
59
|
-
int reader = pipes[0];
|
60
|
-
pipes[0] = -1;
|
61
|
-
|
62
|
-
FileDescriptor f(reader);
|
63
|
-
FileDescriptor f2(f);
|
64
|
-
f.close();
|
65
|
-
ensure_equals(f, -1);
|
66
|
-
ensure_equals(f2, -1);
|
67
|
-
ensure(write(pipes[1], "x", 1) == -1);
|
68
|
-
}
|
69
|
-
}
|
@@ -1,433 +0,0 @@
|
|
1
|
-
#include "TestSupport.h"
|
2
|
-
#include "agents/LoggingAgent/FilterSupport.h"
|
3
|
-
|
4
|
-
#include <boost/bind.hpp>
|
5
|
-
#include <boost/shared_ptr.hpp>
|
6
|
-
#include <oxt/thread.hpp>
|
7
|
-
#include <set>
|
8
|
-
|
9
|
-
using namespace Passenger;
|
10
|
-
using namespace Passenger::FilterSupport;
|
11
|
-
using namespace std;
|
12
|
-
using namespace oxt;
|
13
|
-
|
14
|
-
namespace tut {
|
15
|
-
struct FilterSupportTest {
|
16
|
-
SimpleContext ctx;
|
17
|
-
|
18
|
-
bool eval(const StaticString &source, bool debug = false) {
|
19
|
-
return Filter(source, debug).run(ctx);
|
20
|
-
}
|
21
|
-
|
22
|
-
bool validate(const StaticString &source) {
|
23
|
-
try {
|
24
|
-
Filter f(source);
|
25
|
-
return true;
|
26
|
-
} catch (const SyntaxError &) {
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
};
|
31
|
-
|
32
|
-
DEFINE_TEST_GROUP_WITH_LIMIT(FilterSupportTest, 100);
|
33
|
-
|
34
|
-
/******** Generic tests *******/
|
35
|
-
|
36
|
-
TEST_METHOD(1) {
|
37
|
-
// Filter source cannot be blank.
|
38
|
-
|
39
|
-
try {
|
40
|
-
Filter f("");
|
41
|
-
fail("SyntaxError expected for empty filter source");
|
42
|
-
} catch (const SyntaxError &) {
|
43
|
-
// Success.
|
44
|
-
}
|
45
|
-
|
46
|
-
try {
|
47
|
-
Filter f(" ");
|
48
|
-
fail("SyntaxError expected for blank filter source");
|
49
|
-
} catch (const SyntaxError &) {
|
50
|
-
// Success.
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
TEST_METHOD(2) {
|
55
|
-
// Test support for various fields.
|
56
|
-
ctx.uri = "foo";
|
57
|
-
ctx.controller = "bar";
|
58
|
-
ctx.responseTime = 800;
|
59
|
-
ctx.status = "200 OK";
|
60
|
-
ctx.statusCode = 201;
|
61
|
-
ctx.gcTime = 30;
|
62
|
-
ensure(eval(
|
63
|
-
"uri == 'foo' "
|
64
|
-
" && response_time == 800"
|
65
|
-
" && response_time_without_gc == 770"
|
66
|
-
" && status == '200 OK'"
|
67
|
-
" && status_code == 201"
|
68
|
-
" && gc_time == 30"
|
69
|
-
));
|
70
|
-
}
|
71
|
-
|
72
|
-
|
73
|
-
/******** String and regexp tests *******/
|
74
|
-
|
75
|
-
TEST_METHOD(5) {
|
76
|
-
// Test string comparison
|
77
|
-
Filter f("uri == \"hello world\"");
|
78
|
-
ctx.uri = "hello world";
|
79
|
-
ensure("(1)", f.run(ctx));
|
80
|
-
ctx.uri = "something else";
|
81
|
-
ensure("(2)", !f.run(ctx));
|
82
|
-
}
|
83
|
-
|
84
|
-
TEST_METHOD(6) {
|
85
|
-
// Test string negative comparison
|
86
|
-
Filter f("uri != \"hello world\"");
|
87
|
-
ctx.uri = "hello world";
|
88
|
-
ensure("(1)", !f.run(ctx));
|
89
|
-
ctx.uri = "something else";
|
90
|
-
ensure("(2)", f.run(ctx));
|
91
|
-
}
|
92
|
-
|
93
|
-
TEST_METHOD(7) {
|
94
|
-
// Test string regexp matching
|
95
|
-
Filter f("uri =~ /hello world/");
|
96
|
-
ctx.uri = "hello world";
|
97
|
-
ensure("(1)", f.run(ctx));
|
98
|
-
ctx.uri = "hello";
|
99
|
-
ensure("(2)", !f.run(ctx));
|
100
|
-
}
|
101
|
-
|
102
|
-
TEST_METHOD(8) {
|
103
|
-
// Test advanced string regexp matching
|
104
|
-
Filter f("uri =~ /(hello|world)\\nhi/");
|
105
|
-
ctx.uri = "hello\nhi";
|
106
|
-
ensure("(1)", f.run(ctx));
|
107
|
-
ctx.uri = "world\nhi";
|
108
|
-
ensure("(2)", f.run(ctx));
|
109
|
-
ctx.uri = "hello\n";
|
110
|
-
ensure("(3)", !f.run(ctx));
|
111
|
-
}
|
112
|
-
|
113
|
-
TEST_METHOD(9) {
|
114
|
-
// Regexp matching is case-sensitive by default.
|
115
|
-
Filter f("uri =~ /Hello World/");
|
116
|
-
ctx.uri = "hello world";
|
117
|
-
ensure(!f.run(ctx));
|
118
|
-
}
|
119
|
-
|
120
|
-
TEST_METHOD(10) {
|
121
|
-
// Regexp matching can be made case-insensitive.
|
122
|
-
Filter f("uri =~ /Hello World/i");
|
123
|
-
ctx.uri = "hello world";
|
124
|
-
ensure(f.run(ctx));
|
125
|
-
}
|
126
|
-
|
127
|
-
TEST_METHOD(11) {
|
128
|
-
// Left operand may be a literal.
|
129
|
-
Filter f("\"hello\" == \"hello\"");
|
130
|
-
ensure("(1)", f.run(ctx));
|
131
|
-
|
132
|
-
f = Filter("\"hello\" == \"world\"");
|
133
|
-
ensure("(2)", !f.run(ctx));
|
134
|
-
}
|
135
|
-
|
136
|
-
TEST_METHOD(12) {
|
137
|
-
// Right operand may be a field.
|
138
|
-
Filter f("\"hello\" == uri");
|
139
|
-
ctx.uri = "hello";
|
140
|
-
ensure("(1)", f.run(ctx));
|
141
|
-
|
142
|
-
f = Filter("\"hello\" == uri");
|
143
|
-
ctx.uri = "world";
|
144
|
-
ensure("(2)", !f.run(ctx));
|
145
|
-
}
|
146
|
-
|
147
|
-
TEST_METHOD(13) {
|
148
|
-
// String syntax supports \\, \n, \r, \t
|
149
|
-
ctx.uri = "hello\r\n\tworld\\";
|
150
|
-
ensure(Filter("uri == \"hello\\r\\n\\tworld\\\\\"").run(ctx));
|
151
|
-
}
|
152
|
-
|
153
|
-
TEST_METHOD(14) {
|
154
|
-
// Strings can also start and end with single quote characters.
|
155
|
-
ctx.uri = "hello world";
|
156
|
-
ensure(Filter("uri == 'hello world'").run(ctx));
|
157
|
-
}
|
158
|
-
|
159
|
-
TEST_METHOD(15) {
|
160
|
-
// String begin and end quote characters must match.
|
161
|
-
try {
|
162
|
-
(void) Filter("uri == 'hello world\"");
|
163
|
-
fail("Syntax error expected");
|
164
|
-
} catch (const SyntaxError &) {
|
165
|
-
// Pass.
|
166
|
-
}
|
167
|
-
try {
|
168
|
-
(void) Filter("uri == \"hello world'");
|
169
|
-
fail("Syntax error expected");
|
170
|
-
} catch (const SyntaxError &) {
|
171
|
-
// Pass.
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
TEST_METHOD(16) {
|
176
|
-
// Regular expressions can also start with %r{ and end with }.
|
177
|
-
ctx.uri = "hello world";
|
178
|
-
ensure(Filter("uri =~ %r{hello}").run(ctx));
|
179
|
-
try {
|
180
|
-
(void) Filter("uri =~ /hello}");
|
181
|
-
fail("Syntax error expected");
|
182
|
-
} catch (const SyntaxError &) {
|
183
|
-
// Pass.
|
184
|
-
}
|
185
|
-
try {
|
186
|
-
(void) Filter("uri =~ %r{hello/");
|
187
|
-
fail("Syntax error expected");
|
188
|
-
} catch (const SyntaxError &) {
|
189
|
-
// Pass.
|
190
|
-
}
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
/******** Integer tests *******/
|
195
|
-
|
196
|
-
TEST_METHOD(20) {
|
197
|
-
// Test integer equality comparison
|
198
|
-
Filter f("response_time == 10");
|
199
|
-
ctx.responseTime = 10;
|
200
|
-
ensure("(1)", f.run(ctx));
|
201
|
-
ctx.responseTime = 11;
|
202
|
-
ensure("(2)", !f.run(ctx));
|
203
|
-
}
|
204
|
-
|
205
|
-
TEST_METHOD(21) {
|
206
|
-
// Test integer inequality comparison
|
207
|
-
Filter f("response_time != 10");
|
208
|
-
ctx.responseTime = 10;
|
209
|
-
ensure("(1)", !f.run(ctx));
|
210
|
-
ctx.responseTime = 11;
|
211
|
-
ensure("(2)", f.run(ctx));
|
212
|
-
}
|
213
|
-
|
214
|
-
TEST_METHOD(22) {
|
215
|
-
// Test integer larger than comparison
|
216
|
-
Filter f("response_time > 10");
|
217
|
-
ctx.responseTime = 11;
|
218
|
-
ensure("(1)", f.run(ctx));
|
219
|
-
ctx.responseTime = 10;
|
220
|
-
ensure("(2)", !f.run(ctx));
|
221
|
-
}
|
222
|
-
|
223
|
-
TEST_METHOD(23) {
|
224
|
-
// Test integer larger than or equals comparison
|
225
|
-
Filter f("response_time >= 10");
|
226
|
-
ctx.responseTime = 10;
|
227
|
-
ensure("(1)", f.run(ctx));
|
228
|
-
ctx.responseTime = 9;
|
229
|
-
ensure("(2)", !f.run(ctx));
|
230
|
-
}
|
231
|
-
|
232
|
-
TEST_METHOD(24) {
|
233
|
-
// Test integer smaller than comparison
|
234
|
-
Filter f("response_time < 10");
|
235
|
-
ctx.responseTime = 9;
|
236
|
-
ensure("(1)", f.run(ctx));
|
237
|
-
ctx.responseTime = 10;
|
238
|
-
ensure("(2)", !f.run(ctx));
|
239
|
-
}
|
240
|
-
|
241
|
-
TEST_METHOD(25) {
|
242
|
-
// Test integer smaller than or equals comparison
|
243
|
-
Filter f("response_time <= 10");
|
244
|
-
ctx.responseTime = 10;
|
245
|
-
ensure("(1)", f.run(ctx));
|
246
|
-
ctx.responseTime = 11;
|
247
|
-
ensure("(2)", !f.run(ctx));
|
248
|
-
}
|
249
|
-
|
250
|
-
TEST_METHOD(26) {
|
251
|
-
// Negative integers work
|
252
|
-
ctx.responseTime = -23;
|
253
|
-
ensure(Filter("response_time == -23").run(ctx));
|
254
|
-
}
|
255
|
-
|
256
|
-
TEST_METHOD(27) {
|
257
|
-
// Left operand may be a literal.
|
258
|
-
ensure("(1)", Filter("2 == 2").run(ctx));
|
259
|
-
ensure("(2)", !Filter("2 != 2").run(ctx));
|
260
|
-
ensure("(3)", Filter("1 < 2").run(ctx));
|
261
|
-
ensure("(4)", !Filter("1 < 0").run(ctx));
|
262
|
-
ensure("(5)", Filter("1 <= 1").run(ctx));
|
263
|
-
ensure("(6)", !Filter("1 <= 0").run(ctx));
|
264
|
-
ensure("(7)", Filter("2 > 1").run(ctx));
|
265
|
-
ensure("(8)", !Filter("2 > 2").run(ctx));
|
266
|
-
ensure("(9)", Filter("2 >= 2").run(ctx));
|
267
|
-
ensure("(10)", !Filter("2 >= 3").run(ctx));
|
268
|
-
}
|
269
|
-
|
270
|
-
TEST_METHOD(28) {
|
271
|
-
// Right operand may be a field.
|
272
|
-
ctx.responseTime = 2;
|
273
|
-
ensure("(1)", Filter("2 == response_time").run(ctx));
|
274
|
-
ensure("(2)", !Filter("2 != 2").run(ctx));
|
275
|
-
|
276
|
-
ensure("(3)", Filter("1 < response_time").run(ctx));
|
277
|
-
ctx.responseTime = 0;
|
278
|
-
ensure("(4)", !Filter("1 < response_time").run(ctx));
|
279
|
-
|
280
|
-
ctx.responseTime = 1;
|
281
|
-
ensure("(5)", Filter("1 <= response_time").run(ctx));
|
282
|
-
ctx.responseTime = 0;
|
283
|
-
ensure("(6)", !Filter("1 <= response_time").run(ctx));
|
284
|
-
|
285
|
-
ctx.responseTime = 1;
|
286
|
-
ensure("(7)", Filter("2 > response_time").run(ctx));
|
287
|
-
ctx.responseTime = 2;
|
288
|
-
ensure("(8)", !Filter("2 > response_time").run(ctx));
|
289
|
-
|
290
|
-
ensure("(9)", Filter("2 >= response_time").run(ctx));
|
291
|
-
ctx.responseTime = 3;
|
292
|
-
ensure("(10)", !Filter("2 >= response_time").run(ctx));
|
293
|
-
}
|
294
|
-
|
295
|
-
|
296
|
-
/******** Boolean and expression combination tests *******/
|
297
|
-
|
298
|
-
TEST_METHOD(30) {
|
299
|
-
ensure("(1)", Filter("true").run(ctx));
|
300
|
-
ensure("(2)", !Filter("false").run(ctx));
|
301
|
-
ensure("(3)", Filter("true && 1 == 1").run(ctx));
|
302
|
-
ensure("(4)", Filter("true || 1 == 0").run(ctx));
|
303
|
-
ensure("(5)", !Filter("false && 1 == 1").run(ctx));
|
304
|
-
ensure("(6)", !Filter("false || 1 == 0").run(ctx));
|
305
|
-
ensure("(7)", Filter("false || 1 == 1").run(ctx));
|
306
|
-
}
|
307
|
-
|
308
|
-
TEST_METHOD(31) {
|
309
|
-
ensure(Filter("true == true").run(ctx));
|
310
|
-
ensure(!Filter("true == false").run(ctx));
|
311
|
-
ensure(Filter("true != false").run(ctx));
|
312
|
-
ensure(!Filter("true != true").run(ctx));
|
313
|
-
|
314
|
-
ensure(Filter("false == false").run(ctx));
|
315
|
-
ensure(!Filter("false == true").run(ctx));
|
316
|
-
ensure(Filter("false != true").run(ctx));
|
317
|
-
ensure(!Filter("false != false").run(ctx));
|
318
|
-
}
|
319
|
-
|
320
|
-
TEST_METHOD(32) {
|
321
|
-
ensure("(1)", eval("true && true && true"));
|
322
|
-
ensure("(2)", !eval("true && true && false"));
|
323
|
-
ensure("(3)", !eval("true && false && false"));
|
324
|
-
ensure("(4)", !eval("false && false && false"));
|
325
|
-
ensure("(5)", !eval("false && true && false"));
|
326
|
-
ensure("(6)", !eval("false && false && true"));
|
327
|
-
ensure("(7)", !eval("false && true && false"));
|
328
|
-
|
329
|
-
ensure("(8)", eval("true || true || true"));
|
330
|
-
ensure("(9)", eval("true || true || false"));
|
331
|
-
ensure("(10)", eval("true || false || false"));
|
332
|
-
ensure("(11)", !eval("false || false || false"));
|
333
|
-
ensure("(12)", eval("false || true || false"));
|
334
|
-
ensure("(13)", eval("false || false || true"));
|
335
|
-
ensure("(14)", eval("false || true || false"));
|
336
|
-
|
337
|
-
ensure("(15)", eval("false || true && true"));
|
338
|
-
ensure("(16)", !eval("true || false && false"));
|
339
|
-
ensure("(17)", eval("true || (false && false)"));
|
340
|
-
|
341
|
-
ctx.uri = "foo";
|
342
|
-
ctx.responseTime = 10;
|
343
|
-
ensure("(20)", eval("uri == 'foo' && (response_time == 1 || response_time == 10)"));
|
344
|
-
ensure("(21)", eval("(uri == 'foo' && response_time == 1) || response_time == 10"));
|
345
|
-
}
|
346
|
-
|
347
|
-
|
348
|
-
/******** Error tests *******/
|
349
|
-
|
350
|
-
TEST_METHOD(40) {
|
351
|
-
// < does not work if left operand is a string
|
352
|
-
ensure(!validate("'' < 1"));
|
353
|
-
// < does not work if right operand is a string
|
354
|
-
ensure(!validate("1 < ''"));
|
355
|
-
|
356
|
-
// <= does not work if left operand is a string
|
357
|
-
ensure(!validate("'' <= 1"));
|
358
|
-
// <= does not work if right operand is a string
|
359
|
-
ensure(!validate("1 <= ''"));
|
360
|
-
|
361
|
-
// > does not work if left operand is a string
|
362
|
-
ensure(!validate("'' > 1"));
|
363
|
-
// > does not work if right operand is a string
|
364
|
-
ensure(!validate("1 > ''"));
|
365
|
-
|
366
|
-
// >= does not work if left operand is a string
|
367
|
-
ensure(!validate("'' >= 1"));
|
368
|
-
// >= does not work if right operand is a string
|
369
|
-
ensure(!validate("1 >= ''"));
|
370
|
-
|
371
|
-
// =~ does not work if left operand is not a string
|
372
|
-
ensure(!validate("1 =~ //"));
|
373
|
-
ensure(!validate("// =~ //"));
|
374
|
-
ensure(!validate("false =~ //"));
|
375
|
-
// =~ does not work if right operand is not a regexp
|
376
|
-
ensure(!validate("'' =~ ''"));
|
377
|
-
ensure(!validate("'' =~ 1"));
|
378
|
-
ensure(!validate("'' =~ false"));
|
379
|
-
}
|
380
|
-
|
381
|
-
TEST_METHOD(41) {
|
382
|
-
// Source must evaluate to a boolean.
|
383
|
-
ensure(!validate("1"));
|
384
|
-
ensure(!validate("'hello'"));
|
385
|
-
ensure(!validate("/abc/"));
|
386
|
-
}
|
387
|
-
|
388
|
-
|
389
|
-
/******** ContextFromLog tests *******/
|
390
|
-
|
391
|
-
TEST_METHOD(50) {
|
392
|
-
// It extracts information from the logs
|
393
|
-
ContextFromLog ctx(
|
394
|
-
"1234-abcd 1234 0 BEGIN: request processing (1235, 10, 10)\n"
|
395
|
-
"1234-abcd 1240 1 URI: /foo\n"
|
396
|
-
"1234-abcd 1241 2 Controller action: HomeController#index\n"
|
397
|
-
"1234-abcd 1242 3 Status: 200 OK\n"
|
398
|
-
"1234-abcd 1243 4 Initial GC time: 1\n"
|
399
|
-
"1234-abcd 1244 5 Final GC time: 10\n"
|
400
|
-
"1234-abcd 2234 10 END: request processing (2234, 10, 10)\n"
|
401
|
-
);
|
402
|
-
ensure_equals(ctx.getURI(), "/foo");
|
403
|
-
ensure_equals(ctx.getController(), "HomeController");
|
404
|
-
ensure_equals(ctx.getResponseTime(), 46655);
|
405
|
-
ensure_equals(ctx.getStatus(), "200 OK");
|
406
|
-
ensure_equals(ctx.getStatusCode(), 200);
|
407
|
-
ensure_equals(ctx.getGcTime(), 9);
|
408
|
-
}
|
409
|
-
|
410
|
-
TEST_METHOD(51) {
|
411
|
-
// It ignores empty lines and invalid lines
|
412
|
-
ContextFromLog ctx(
|
413
|
-
"\n"
|
414
|
-
"\n"
|
415
|
-
" \n"
|
416
|
-
"1234-abcd 1234 0 URI: /foo\n"
|
417
|
-
"URI: /bar\n"
|
418
|
-
"\n"
|
419
|
-
);
|
420
|
-
ensure_equals(ctx.getURI(), "/foo");
|
421
|
-
}
|
422
|
-
|
423
|
-
TEST_METHOD(52) {
|
424
|
-
// If the begin or end "request processing" event is not available
|
425
|
-
// then it derives the response time from the entire transaction.
|
426
|
-
ContextFromLog ctx(
|
427
|
-
"1234-abcd 1234 0 ATTACH\n"
|
428
|
-
"1234-abcd 1235 1 BEGIN: request processing (1235, 10, 10)\n"
|
429
|
-
"1234-abcd 1236 2 DETACH\n"
|
430
|
-
);
|
431
|
-
ensure_equals(ctx.getResponseTime(), 2);
|
432
|
-
}
|
433
|
-
}
|