def test_compile(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     self.copy_build_pack(bp.bp_dir)
     try:
         output = ''
         output = bp._compile()
         self.assert_exists(self.build_dir, 'snake')
         self.assert_exists(self.build_dir, 'snake', 'snake.html')
         self.assert_exists(self.build_dir, '.bp')
         self.assert_exists(self.build_dir, '.procs')
         self.assert_exists(self.build_dir, 'start.sh')
         # check release command
         with open(os.path.join(self.build_dir, '.procs')) as fp:
             procs = [l.strip() for l in fp.readlines()]
         eq_(1, len(procs))
         eq_(True, procs[0].startswith('web:'))
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
 def test_compile(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     self.copy_build_pack(bp.bp_dir)
     try:
         output = ''
         output = bp._compile()
         self.assert_exists(self.build_dir, 'META-INF')
         self.assert_exists(self.build_dir, 'WEB-INF')
         self.assert_exists(self.build_dir, '.bp')
         self.assert_exists(self.build_dir, '.profile.d/bp_env_vars.sh')
         self.assert_exists(self.build_dir, '.procs')
         self.assert_exists(self.build_dir, '.java-buildpack')
         self.assert_exists(self.build_dir, '.java-buildpack.log')
         self.assert_exists(self.build_dir, 'start.sh')
         # check release command
         with open(os.path.join(self.build_dir, '.procs')) as fp:
             procs = [l.strip() for l in fp.readlines()]
         eq_(1, len(procs))
         eq_(True, procs[0].startswith('web:'))
         eq_(True, procs[0].find('http.port=$PORT') >= 0)
         eq_(True, procs[0].find('MetaspaceSize=64M') >= 0)
         eq_(True, procs[0].find('OnOutOfMemoryError') >= 0)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 3
0
 def test_detect_with_asp_net_app(self):
     shutil.copytree('tests/data/app-asp-net', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         bp._detect().strip()
     except Exception, e:
         print e.output
         assert re.match('no', e.output)
Exemplo n.º 4
0
 def test_detect_with_asp_net_app(self):
     shutil.copytree('tests/data/app-asp-net', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "fixtures",
                                                   "tests"))
     try:
         bp._detect().strip()
     except Exception, e:
         print e.output
         assert re.match('no', e.output)
Exemplo n.º 5
0
 def test_detect_static(self):
     shutil.copytree('tests/data/app-3', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         assert re.match('php*', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         raise
Exemplo n.º 6
0
 def test_detect_static(self):
     shutil.copytree('tests/data/app-3', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         eq_('STATIC', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         raise
Exemplo n.º 7
0
 def test_detect_php(self):
     shutil.copytree('tests/data/app-2', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         eq_('PHP', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 8
0
 def test_detect_with_invalid_json(self):
     shutil.copytree('tests/data/app-invalid-json', self.build_dir)
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir,
         'WEBDIR': 'htdocs'
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "fixtures",
                                                   "tests"))
     try:
         output = bp._detect().strip()
         assert re.match('php*', output)
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
Exemplo n.º 9
0
 def setUp(self):
     self.dh = DirectoryHelper()
     (self.build_dir, self.cache_dir,
      self.temp_dir) = self.dh.create_bp_env(self.app_name)
     self.bp = BuildPack(
         {
             'BUILD_DIR': self.build_dir,
             'CACHE_DIR': self.cache_dir,
             'TMPDIR': self.temp_dir
         }, '.')
     self.dh.copy_build_pack_to(self.bp.bp_dir)
     self.dh.register_to_delete(self.bp.bp_dir)
     self.opts = OptionsHelper(
         os.path.join(self.bp.bp_dir, 'defaults', 'options.json'))
     self.opts.set_download_url('http://localhost:5000/binaries/{STACK}')
def compile(install):
    ctx = install.builder._ctx
    # setup logs director for bp
    os.makedirs(os.path.join(ctx['BUILD_DIR'], 'logs'))
    # read links file
    with open(os.path.join(ctx['BUILD_DIR'], 'download-list.txt')) as fp:
        links = [line.strip() for line in fp.readlines()]
    log.info("Loaded %d downloads.", len(links))
    # download links
    for link in links:
        log.debug("Preparing to download [%s]", link)
        if link.startswith('http'):
            download(install, link)
        else:
            print 'Not sure how to handle [%s], skipping.' % link
    log.info("All downloads complete.")
    # read build pack
    with open(os.path.join(ctx['BUILD_DIR'], 'build-pack.txt')) as fp:
        bp_link = fp.read().strip()
    log.info("Running build pack [%s]", bp_link)
    if bp_link.find('#') >= 0:
        (bp_link, bp_ver) = bp_link.split('#')
        bp = BuildPack(ctx, bp_link, bp_ver)
    else:
        bp = BuildPack(ctx, bp_link)
    # run build pack
    log.info("Cloning build pack")
    bp._clone()
    log.info("Compiling build pack")
    bp._compile()
    # save output from release
    log.info("Running release script")
    release_path = os.path.join(tempfile.gettempdir(), 'release.out')
    with open(release_path, 'wt') as fp:
        result = bp._release()
        log.debug("Build pack release returned [%s]", result)
        fp.write(result)
    log.debug("Compile done.")
    return 0
Exemplo n.º 11
0
    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({'name': 'app-name-1'})
        bp = BuildPack(
            {
                'BUILD_DIR': self.build_dir,
                'CACHE_DIR': self.cache_dir,
            }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'hhvm')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(16,
                len([l for l in outputLines if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/hhvm/etc"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/hhvm', lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(2, len(lines))
                eq_(
                    'httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_(
                    'hhvm: $HOME/hhvm/hhvm --mode server -c '
                    '$HOME/hhvm/etc/config.hdf', lines[1])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                               'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                               'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'hhvm')
            self.assert_exists(self.build_dir, 'hhvm', 'hhvm')
            self.assert_exists(self.build_dir, 'hhvm', 'etc', 'config.hdf')
            self.assert_exists(self.build_dir, 'hhvm', 'libmemcached.so.11')
            self.assert_exists(self.build_dir, 'hhvm', 'libevent-1.4.so.2.2.0')
            self.assert_exists(self.build_dir, 'hhvm', 'libevent-1.4.so.2')
            self.assert_exists(self.build_dir, 'hhvm',
                               'libboost_system.so.1.55.0')
            self.assert_exists(self.build_dir, 'hhvm',
                               'libc-client.so.2007e.0')
            self.assert_exists(self.build_dir, 'hhvm', 'libstdc++.so.6')
            self.assert_exists(self.build_dir, 'hhvm', 'libMagickWand.so.2')
            self.assert_exists(self.build_dir, 'hhvm', 'libicui18n.so.48')
            # Test NewRelic (should not be installed with HHVM)
            eq_(False, os.path.exists(os.path.join(self.build_dir,
                                                   'newrelic')))
        except Exception, e:
            print str(e)
            if hasattr(e, 'output'):
                print e.output
            if output:
                print output
            raise
Exemplo n.º 12
0
    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({'name': 'app-name-1'})
        bp = BuildPack(
            {
                'BUILD_DIR': self.build_dir,
                'CACHE_DIR': self.cache_dir,
            }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'php')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(22,
                len([l for l in outputLines if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib', lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(3, len(lines))
                eq_(
                    'httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_(
                    'php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                    '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                    lines[1])
                eq_('php-fpm-logs: tail -F $HOME/logs/php-fpm.log', lines[2])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                               'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                               'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'php')
            self.assert_exists(self.build_dir, 'php', 'etc')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
            self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
            self.assert_exists(self.build_dir, 'php', 'bin')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'bz2.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'zlib.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'curl.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'mcrypt.so')
            # Test NewRelic
            self.assert_exists(self.build_dir, 'newrelic')
            self.assert_exists(self.build_dir, 'newrelic', 'daemon',
                               'newrelic-daemon.x64')
            self.assert_exists(self.build_dir, 'newrelic', 'agent', 'x64',
                               'newrelic-20100525.so')
            with open(os.path.join(self.build_dir, 'php', 'etc', 'php.ini'),
                      'rt') as php_ini:
                lines = php_ini.readlines()
            extn_path = '@{HOME}/newrelic/agent/x64/newrelic-20100525.so'
            eq_(True, lines.index('extension=%s\n' % extn_path) >= 0)
            eq_(True, lines.index('[newrelic]\n') >= 0)
            eq_(True, lines.index('newrelic.license=JUNK_LICENSE\n') >= 0)
            eq_(True, lines.index('newrelic.appname=app-name-1\n') >= 0)
        except Exception, e:
            print str(e)
            if hasattr(e, 'output'):
                print e.output
            if output:
                print output
            raise
Exemplo n.º 13
0
 def test_compile_httpd(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server
     self.set_web_server(os.path.join(bp.bp_dir,
                                       'defaults',
                                       'options.json'),
                          'httpd')
     try:
         output = ''
         output = bp._compile()
         outputLines = output.split('\n')
         eq_(21, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(2, len(lines))
             eq_('[email protected]', lines[0])
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib',
                 lines[1])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_('httpd: $HOME/httpd/bin/apachectl -f '
                 '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                 lines[0])
             eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf"', lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Check htdocs and config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test HTTPD
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'httpd')
         self.assert_exists(self.build_dir, 'httpd', 'conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
         self.assert_exists(self.build_dir, 'httpd', 'conf',
                            'extra', 'httpd-modules.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf',
                            'extra', 'httpd-remoteip.conf')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_core.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_host.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_dir.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_env.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_log_config.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mime.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mpm_event.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy_fcgi.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_reqtimeout.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_unixd.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_remoteip.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_rewrite.so')
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php-cgi')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 14
0
 def test_compile_stand_alone(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server & php version
     optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
     self.set_web_server(optsFile, 'none')
     self.set_php_version(optsFile, '5.4.26-dev')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(6, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(1, len([l for l in outputLines if l.startswith('No Web')]))
         eq_(1, len([l for l in outputLines if l.startswith('Installing PHP')]))
         eq_(1, len([l for l in outputLines if l.find('php-cli') >= 0]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(4, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
             eq_('$HOME/.bp/bin/start', lines[3])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib',
                 lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(1, len(lines))
             eq_('php-app: $HOME/php/bin/php -c "$HOME/php/etc" '
                 'app.php', lines[0])
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php')
         self.assert_exists(self.build_dir, 'php', 'bin', 'phar.phar')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 15
0
 def test_compile_nginx(self):
     bp = BuildPack({
         'BUILD_DIR': self.build_dir,
         'CACHE_DIR': self.cache_dir
     }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.', bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries",
                                                   "env",
                                                   "tests"))
     # set web server
     self.set_web_server(os.path.join(bp.bp_dir,
                                       'defaults',
                                       'options.json'),
                          'nginx')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(7, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/nginx/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib',
                 lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_('nginx: $HOME/nginx/sbin/nginx -c '
                 '"$HOME/nginx/conf/nginx.conf"', lines[0])
             eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf"', lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Test htdocs & config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test NGINX
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'nginx')
         self.assert_exists(self.build_dir, 'nginx', 'conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'fastcgi_params')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-logging.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'http-php.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'mime.types')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx-workers.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'server-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'server-locations.conf')
         self.assert_exists(self.build_dir, 'nginx', 'logs')
         self.assert_exists(self.build_dir, 'nginx', 'sbin')
         self.assert_exists(self.build_dir, 'nginx', 'sbin', 'nginx')
         with open(os.path.join(self.build_dir,
                                'nginx',
                                'conf',
                                'http-php.conf')) as fin:
             data = fin.read()
             eq_(-1, data.find('#{PHP_FPM_LISTEN}'))
             eq_(-1, data.find('{TMPDIR}'))
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php-cgi')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 16
0
    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({
            'name': 'app-name-1'
        })
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        # simulate clone, makes debugging easier
        os.rmdir(bp.bp_dir)
        shutil.copytree('.', bp.bp_dir,
                        ignore=shutil.ignore_patterns("binaries",
                                                      "env",
                                                      "tests"))
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'hhvm')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(16, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/hhvm/etc"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/hhvm',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(2, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('hhvm: $HOME/hhvm/hhvm --mode server -c '
                    '$HOME/hhvm/etc/config.hdf', lines[1])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'hhvm')
            self.assert_exists(self.build_dir, 'hhvm', 'hhvm')
            self.assert_exists(self.build_dir, 'hhvm', 'etc', 'config.hdf')
            self.assert_exists(self.build_dir, 'hhvm', 'libmemcached.so.11')
            self.assert_exists(self.build_dir, 'hhvm', 'libevent-1.4.so.2.2.0')
            self.assert_exists(self.build_dir, 'hhvm', 'libevent-1.4.so.2')
            self.assert_exists(self.build_dir, 'hhvm',
                               'libboost_system.so.1.55.0')
            self.assert_exists(self.build_dir, 'hhvm',
                               'libc-client.so.2007e.0')
            self.assert_exists(self.build_dir, 'hhvm', 'libstdc++.so.6')
            self.assert_exists(self.build_dir, 'hhvm', 'libMagickWand.so.2')
            self.assert_exists(self.build_dir, 'hhvm', 'libicui18n.so.48')
            # Test NewRelic (should not be installed with HHVM)
            eq_(False,
                os.path.exists(os.path.join(self.build_dir, 'newrelic')))
        except Exception, e:
            print str(e)
            if hasattr(e, 'output'):
                print e.output
            if output:
                print output
            raise
Exemplo n.º 17
0
    def test_compile_httpd_with_newrelic(self):
        os.environ['NEWRELIC_LICENSE'] = 'JUNK_LICENSE'
        os.environ['VCAP_APPLICATION'] = json.dumps({
            'name': 'app-name-1'
        })
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'php')
        self._set_web_server(optsFile, 'httpd')

        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(22, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(3, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                    '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                    lines[1])
                eq_('php-fpm-logs: tail -F $HOME/logs/php-fpm.log',
                    lines[2])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'php')
            self.assert_exists(self.build_dir, 'php', 'etc')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
            self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
            self.assert_exists(self.build_dir, 'php', 'bin')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'bz2.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'zlib.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'curl.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'mcrypt.so')
            # Test NewRelic
            self.assert_exists(self.build_dir, 'newrelic')
            self.assert_exists(self.build_dir, 'newrelic', 'daemon',
                               'newrelic-daemon.x64')
            self.assert_exists(self.build_dir, 'newrelic', 'agent', 'x64',
                               'newrelic-20100525.so')
            with open(os.path.join(self.build_dir,
                                   'php', 'etc', 'php.ini'), 'rt') as php_ini:
                lines = php_ini.readlines()
            extn_path = '@{HOME}/newrelic/agent/x64/newrelic-20100525.so'
            eq_(True, lines.index('extension=%s\n' % extn_path) >= 0)
            eq_(True, lines.index('[newrelic]\n') >= 0)
            eq_(True, lines.index('newrelic.license=JUNK_LICENSE\n') >= 0)
            eq_(True, lines.index('newrelic.appname=app-name-1\n') >= 0)
        except Exception, e:
            print str(e)
            if hasattr(e, 'output'):
                print e.output
            if output:
                print output
            raise
Exemplo n.º 18
0
    def test_compile_php_with_codizy(self):
        #os.environ['BP_DEBUG'] = 'True'
        os.environ['CODIZY_INSTALL'] = 'True'
        bp = BuildPack({
            'BUILD_DIR': self.build_dir,
            'CACHE_DIR': self.cache_dir,
        }, '.')
        self.copy_build_pack(bp.bp_dir)
        # set php & web server
        optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
        self._set_php(optsFile, 'php')
        self._set_web_server(optsFile, 'httpd')
        try:
            output = ''
            output = bp._compile()
            outputLines = output.split('\n')
            eq_(28, len([l for l in outputLines
                         if l.startswith('Downloaded')]))
            eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
            eq_(True, outputLines[-1].startswith('Finished:'))
            # Test scripts and config
            self.assert_exists(self.build_dir, 'start.sh')
            with open(os.path.join(self.build_dir, 'start.sh')) as start:
                lines = [line.strip() for line in start.readlines()]
                eq_(5, len(lines))
                eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
                eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
                eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
                eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
                eq_('$HOME/.bp/bin/start', lines[4])
            # Check scripts and bp are installed
            self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
            self.assert_exists(self.build_dir, '.bp', 'lib')
            bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                    'build_pack_utils')
            eq_(22, len(os.listdir(bpu_path)))
            self.assert_exists(bpu_path, 'utils.py')
            self.assert_exists(bpu_path, 'process.py')
            # Check env and procs files
            self.assert_exists(self.build_dir, '.env')
            self.assert_exists(self.build_dir, '.procs')
            with open(os.path.join(self.build_dir, '.env')) as env:
                lines = [line.strip() for line in env.readlines()]
                eq_(2, len(lines))
                eq_('[email protected]', lines[0])
                eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib',
                    lines[1])
            with open(os.path.join(self.build_dir, '.procs')) as procs:
                lines = [line.strip() for line in procs.readlines()]
                eq_(3, len(lines))
                eq_('httpd: $HOME/httpd/bin/apachectl -f '
                    '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                    lines[0])
                eq_('php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                    '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                    lines[1])
                eq_('php-fpm-logs: tail -F $HOME/logs/php-fpm.log',
                    lines[2])

            # Check htdocs and config
            self.assert_exists(self.build_dir, 'htdocs')
            self.assert_exists(self.build_dir, '.bp-config')
            self.assert_exists(self.build_dir, '.bp-config', 'options.json')
            # Test HTTPD
            self.assert_exists(self.build_dir)
            self.assert_exists(self.build_dir, 'httpd')
            self.assert_exists(self.build_dir, 'httpd', 'conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-modules.conf')
            self.assert_exists(self.build_dir, 'httpd', 'conf',
                               'extra', 'httpd-remoteip.conf')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_core.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_authz_host.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_dir.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_env.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_log_config.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mime.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_mpm_event.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_proxy_fcgi.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_reqtimeout.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_unixd.so')
            self.assert_exists(self.build_dir, 'httpd', 'modules',
                               'mod_remoteip.so')
            # Test PHP
            self.assert_exists(self.build_dir, 'php')
            self.assert_exists(self.build_dir, 'php', 'etc')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
            self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
            self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
            self.assert_exists(self.build_dir, 'php', 'bin')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'bz2.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'zlib.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'curl.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'mcrypt.so')
            # Test Codizy
            self.assert_exists(self.build_dir, 'codizy')
            self.assert_exists(self.build_dir, 'codizy', 'client',
                               'application', 'setup.php')
            self.assert_exists(self.build_dir, 'codizy', 'client',
                               'application', 'class', 'Codizy_utils.php')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'xhprof.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'ioncube.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'codizy.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'curl.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'gettext.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'mbstring.so')
            self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                               'extensions', 'no-debug-non-zts-20100525',
                               'openssl.so')
            with open(os.path.join(self.build_dir,
                                   'php', 'etc', 'php.ini'), 'rt') as php_ini:
                lines = php_ini.readlines()
            auto_prepend_line = [line for line in lines
                                 if line.startswith('auto_prepend_file')][0]
            eq_('auto_prepend_file = '
                '@{HOME}/codizy/client/application/setup.php\n',
                auto_prepend_line)
        except Exception, e:
            print str(e)
            if hasattr(e, 'output'):
                print e.output
            if output:
                print output
            raise
Exemplo n.º 19
0
 def test_compile_httpd(self):
     bp = BuildPack(
         {
             'BUILD_DIR': self.build_dir,
             'CACHE_DIR': self.cache_dir
         }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.',
                     bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries", "env",
                                                   "tests"))
     # set web server
     self.set_web_server(
         os.path.join(bp.bp_dir, 'defaults', 'options.json'), 'httpd')
     try:
         output = ''
         output = bp._compile()
         outputLines = output.split('\n')
         eq_(21,
             len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/httpd/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(2, len(lines))
             eq_('[email protected]', lines[0])
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib', lines[1])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_(
                 'httpd: $HOME/httpd/bin/apachectl -f '
                 '"$HOME/httpd/conf/httpd.conf" -k start -DFOREGROUND',
                 lines[0])
             eq_(
                 'php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                 lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Check htdocs and config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test HTTPD
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'httpd')
         self.assert_exists(self.build_dir, 'httpd', 'conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'httpd.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                            'httpd-modules.conf')
         self.assert_exists(self.build_dir, 'httpd', 'conf', 'extra',
                            'httpd-remoteip.conf')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_core.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_authz_host.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_dir.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_env.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_log_config.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mime.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_mpm_event.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_proxy_fcgi.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_reqtimeout.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_unixd.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_remoteip.so')
         self.assert_exists(self.build_dir, 'httpd', 'modules',
                            'mod_rewrite.so')
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 20
0
 def test_compile_stand_alone(self):
     bp = BuildPack(
         {
             'BUILD_DIR': self.build_dir,
             'CACHE_DIR': self.cache_dir
         }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.',
                     bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries", "env",
                                                   "tests"))
     # set web server & php version
     optsFile = os.path.join(bp.bp_dir, 'defaults', 'options.json')
     self.set_web_server(optsFile, 'none')
     self.set_php_version(optsFile, '5.4.27')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(6, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(1, len([l for l in outputLines if l.startswith('No Web')]))
         eq_(
             1,
             len([l for l in outputLines
                  if l.startswith('Installing PHP')]))
         eq_(1, len([l for l in outputLines if l.find('php-cli') >= 0]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(4, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[2])
             eq_('$HOME/.bp/bin/start', lines[3])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib', lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(1, len(lines))
             eq_('php-app: $HOME/php/bin/php -c "$HOME/php/etc" '
                 'app.php', lines[0])
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'bin', 'php')
         self.assert_exists(self.build_dir, 'php', 'bin', 'phar.phar')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise
Exemplo n.º 21
0
 def test_compile_nginx(self):
     bp = BuildPack(
         {
             'BUILD_DIR': self.build_dir,
             'CACHE_DIR': self.cache_dir
         }, '.')
     # simulate clone, makes debugging easier
     os.rmdir(bp.bp_dir)
     shutil.copytree('.',
                     bp.bp_dir,
                     ignore=shutil.ignore_patterns("binaries", "env",
                                                   "tests"))
     # set web server
     self.set_web_server(
         os.path.join(bp.bp_dir, 'defaults', 'options.json'), 'nginx')
     try:
         output = ''
         output = bp._compile()
         # Test Output
         outputLines = output.split('\n')
         eq_(7, len([l for l in outputLines if l.startswith('Downloaded')]))
         eq_(2, len([l for l in outputLines if l.startswith('Installing')]))
         eq_(True, outputLines[-1].startswith('Finished:'))
         # Test scripts and config
         self.assert_exists(self.build_dir, 'start.sh')
         with open(os.path.join(self.build_dir, 'start.sh')) as start:
             lines = [line.strip() for line in start.readlines()]
             eq_(5, len(lines))
             eq_('export PYTHONPATH=$HOME/.bp/lib', lines[0])
             eq_('$HOME/.bp/bin/rewrite "$HOME/nginx/conf"', lines[1])
             eq_('$HOME/.bp/bin/rewrite "$HOME/php/etc"', lines[2])
             eq_('$HOME/.bp/bin/rewrite "$HOME/.env"', lines[3])
             eq_('$HOME/.bp/bin/start', lines[4])
         # Check scripts and bp are installed
         self.assert_exists(self.build_dir, '.bp', 'bin', 'rewrite')
         self.assert_exists(self.build_dir, '.bp', 'lib')
         bpu_path = os.path.join(self.build_dir, '.bp', 'lib',
                                 'build_pack_utils')
         eq_(22, len(os.listdir(bpu_path)))
         self.assert_exists(bpu_path, 'utils.py')
         self.assert_exists(bpu_path, 'process.py')
         # Check env and procs files
         self.assert_exists(self.build_dir, '.env')
         self.assert_exists(self.build_dir, '.procs')
         with open(os.path.join(self.build_dir, '.env')) as env:
             lines = [line.strip() for line in env.readlines()]
             eq_(1, len(lines))
             eq_('LD_LIBRARY_PATH=@LD_LIBRARY_PATH:@HOME/php/lib', lines[0])
         with open(os.path.join(self.build_dir, '.procs')) as procs:
             lines = [line.strip() for line in procs.readlines()]
             eq_(3, len(lines))
             eq_(
                 'nginx: $HOME/nginx/sbin/nginx -c '
                 '"$HOME/nginx/conf/nginx.conf"', lines[0])
             eq_(
                 'php-fpm: $HOME/php/sbin/php-fpm -p "$HOME/php/etc" -y '
                 '"$HOME/php/etc/php-fpm.conf" -c "$HOME/php/etc"',
                 lines[1])
             eq_('php-fpm-logs: tail -F $HOME/../logs/php-fpm.log',
                 lines[2])
         # Test htdocs & config
         self.assert_exists(self.build_dir, 'htdocs')
         self.assert_exists(self.build_dir, '.bp-config')
         self.assert_exists(self.build_dir, '.bp-config', 'options.json')
         # Test NGINX
         self.assert_exists(self.build_dir)
         self.assert_exists(self.build_dir, 'nginx')
         self.assert_exists(self.build_dir, 'nginx', 'conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'fastcgi_params')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'http-logging.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'http-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'http-php.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'mime.types')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'nginx-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'nginx-workers.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf', 'nginx.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'server-defaults.conf')
         self.assert_exists(self.build_dir, 'nginx', 'conf',
                            'server-locations.conf')
         self.assert_exists(self.build_dir, 'nginx', 'logs')
         self.assert_exists(self.build_dir, 'nginx', 'sbin')
         self.assert_exists(self.build_dir, 'nginx', 'sbin', 'nginx')
         with open(
                 os.path.join(self.build_dir, 'nginx', 'conf',
                              'http-php.conf')) as fin:
             data = fin.read()
             eq_(-1, data.find('#{PHP_FPM_LISTEN}'))
             eq_(-1, data.find('{TMPDIR}'))
         # Test PHP
         self.assert_exists(self.build_dir, 'php')
         self.assert_exists(self.build_dir, 'php', 'etc')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php-fpm.conf')
         self.assert_exists(self.build_dir, 'php', 'etc', 'php.ini')
         self.assert_exists(self.build_dir, 'php', 'sbin', 'php-fpm')
         self.assert_exists(self.build_dir, 'php', 'bin')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'bz2.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'zlib.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'curl.so')
         self.assert_exists(self.build_dir, 'php', 'lib', 'php',
                            'extensions', 'no-debug-non-zts-20100525',
                            'mcrypt.so')
     except Exception, e:
         print str(e)
         if hasattr(e, 'output'):
             print e.output
         if output:
             print output
         raise