22
22
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
# To run the native packaging tests:
26
# rake debian:dev debian:dev:reinstall
27
# rvmsudo env LOCATIONS_INI=/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini \
28
# rspec -f s -c test/integration_tests/native_packaging_spec.rb
25
30
# Ensure that the natively installed tools are in PATH.
26
31
ENV['PATH'] = "/usr/bin:#{ENV['PATH']}"
27
32
LOCATIONS_INI = ENV['LOCATIONS_INI']
28
33
abort "Please set the LOCATIONS_INI environment variable to the right locations.ini" if !LOCATIONS_INI
35
source_root = File.expand_path("../..", File.dirname(__FILE__))
36
$LOAD_PATH.unshift("#{source_root}/lib")
37
require 'phusion_passenger'
30
42
BINDIR = "/usr/bin"
31
43
SBINDIR = "/usr/sbin"
32
INCLUDEDIR = "/usr/share/passenger/include"
33
NGINX_ADDON_DIR = "/usr/share/passenger/ngx_http_passenger_module"
34
DOCDIR = "/usr/share/doc/ruby-passenger"
35
RESOURCESDIR = "/usr/share/passenger"
36
RUBY_EXTENSION_SOURCE_DIR = "/usr/share/passenger/ruby_extension_source"
37
AGENTS_DIR = "/usr/lib/passenger/agents"
44
INCLUDEDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/include"
45
NGINX_ADDON_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ngx_http_passenger_module"
46
DOCDIR = "/usr/share/doc/passenger"
47
RESOURCESDIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}"
48
RUBY_EXTENSION_SOURCE_DIR = "/usr/share/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/ruby_extension_source"
49
AGENTS_DIR = "/usr/lib/#{PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME}/agents"
38
50
APACHE2_MODULE_PATH = "/usr/lib/apache2/modules/mod_passenger.so"
40
52
describe "A natively packaged Phusion Passenger" do
51
63
return capture_output("which #{command}")
68
abort "Command failed: #{command.join(' ')}"
54
72
specify "locations.ini only refers to existent filesystem locations" do
55
73
File.read(LOCATIONS_INI).split("\n").each do |line|
65
specify "passenger-install-nginx-module is in #{BINDIR}" do
66
which("passenger-install-nginx-module").should == "#{BINDIR}/passenger-install-nginx-module"
69
83
specify "passenger-status is in #{SBINDIR}" do
70
84
which("passenger-status").should == "#{SBINDIR}/passenger-status"
122
136
system("passenger-config --natively-packaged").should be_true
139
it "recognizes the install as coming from an official package" do
140
system("passenger-config --installed-from-release-package").should be_true
143
it "recognizes the system's Apache" do
144
output = capture_output("passenger-config --detect-apache2")
145
output.gsub!(/.*Final autodetection results\n/m, '')
146
output.scan(/\* Found Apache .*\!/).size.should == 1
147
output.should include("apxs2 : /usr/bin/apxs2\n")
148
output.should include("Main executable: /usr/sbin/apache2\n")
149
output.should include("Control command: /usr/sbin/apache2ctl\n")
150
output.should include("Config file : /etc/apache2/apache2.conf\n")
151
output.should include("Error log file : /var/log/apache2/error.log\n")
152
output.should include(%Q{
153
To start, stop or restart this specific Apache version:
154
/usr/sbin/apache2ctl start
155
/usr/sbin/apache2ctl stop
156
/usr/sbin/apache2ctl restart})
157
output.should include(%Q{
158
To troubleshoot, please read the logs in this file:
159
/var/log/apache2/error.log})
125
162
it "shows the directory to the runtime library headers" do
126
163
capture_output("passenger-config --includedir").should == INCLUDEDIR
167
204
output.should include("PassengerRoot #{LOCATIONS_INI}")
208
describe "passenger-install-nginx-module" do
209
it "is in #{BINDIR}" do
210
which("passenger-install-nginx-module").should == "#{BINDIR}/passenger-install-nginx-module"
213
it "is able to compile Nginx" do
214
Dir.mktmpdir do |path|
215
output = capture_output("passenger-install-nginx-module --auto --prefix=#{path} --auto-download 2>&1")
216
output.should include("passenger_root #{LOCATIONS_INI};")
217
File.exist?("#{path}/sbin/nginx").should be_true
222
describe "Passenger Standalone" do
223
it "is in #{BINDIR}" do
224
which("passenger").should == "#{BINDIR}/passenger"
228
Dir.mktmpdir do |dir|
229
File.chmod(0755, dir)
231
File.open("config.ru", "w") do |f|
233
app = lambda do |env|
234
[200, { "Content-Type" => "text/plain" }, ["ok"]]
241
sh("passenger start --no-compile-runtime -p 4000 -d >/dev/null")
243
open("http://127.0.0.1:4000/") do |f|
244
f.read.should == "ok"
247
sh("passenger stop -p 4000")