assertSoftware.py 72.7 KB
Newer Older
Łukasz Nowak's avatar
Łukasz Nowak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
##############################################################################
#
# Copyright (c) 2008-2010 Nexedi SA and Contributors. All Rights Reserved.
#                    Lukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################
28

Łukasz Nowak's avatar
Łukasz Nowak committed
29 30
import os
import subprocess
31
from glob import glob
32
import unittest
33
from distutils import util
34

35 36 37 38 39 40 41 42 43 44
try:
  any([True])
except NameError:
  # there is no any in python2.4
  def any(l):
    for q in l:
      if q:
        return True
    return False

45 46 47 48 49 50 51 52
# checking if Zope-2.8 flavour or Zope-2.12 flavour
# BBB it is adhoc, but all tests in this file will be soon merged into
# each buildout configuration.
parts_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
if os.path.exists('%s/zope-2.8' % parts_dir):
  python_version = '2.4'
else:
  python_version = '2.6'
53

54 55 56
# List of libraries which are acceptable to be linked in globally
ACCEPTABLE_GLOBAL_LIB_LIST = (
  # 32 bit Linux
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
57 58
  '/usr/lib/libstdc++.so',
  '/lib/libgcc_s.so',
59 60 61 62 63 64 65
  '/lib/ld-linux.so',
  '/lib/libc.so',
  '/lib/libcrypt.so',
  '/lib/libdl.so',
  '/lib/libm.so',
  '/lib/libnsl.so',
  '/lib/libpthread.so',
Łukasz Nowak's avatar
Łukasz Nowak committed
66
  '/lib/libresolv.so',
67
  '/lib/librt.so',
68
  '/lib/libutil.so',
69 70 71 72 73 74 75 76 77 78 79
  # i686 Mandriva
  '/lib/i686/libgcc_s.so',
  '/lib/i686/ld-linux.so',
  '/lib/i686/libc.so',
  '/lib/i686/libcrypt.so',
  '/lib/i686/libdl.so',
  '/lib/i686/libm.so',
  '/lib/i686/libnsl.so',
  '/lib/i686/libpthread.so',
  '/lib/i686/libresolv.so',
  '/lib/i686/librt.so',
80 81 82 83 84 85 86 87 88 89
  # i686 debian
  '/lib/tls/i686/cmov/libc.so',
  '/lib/tls/i686/cmov/libcrypt.so',
  '/lib/tls/i686/cmov/libdl.so',
  '/lib/tls/i686/cmov/libm.so',
  '/lib/tls/i686/cmov/libnsl.so',
  '/lib/tls/i686/cmov/libpthread.so',
  '/lib/tls/i686/cmov/libresolv.so',
  '/lib/tls/i686/cmov/librt.so',
  '/lib/tls/i686/cmov/libutil.so',
90
  # 64 bit Linux
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
91 92
  '/lib64/libgcc_s.so',
  '/usr/lib64/libstdc++.so',
93 94 95 96 97 98 99
  '/lib64/ld-linux-x86-64.so',
  '/lib64/libc.so',
  '/lib64/libcrypt.so',
  '/lib64/libdl.so',
  '/lib64/libm.so',
  '/lib64/libnsl.so',
  '/lib64/libpthread.so',
Łukasz Nowak's avatar
Łukasz Nowak committed
100
  '/lib64/libresolv.so',
101
  '/lib64/librt.so',
102 103
  '/lib64/libutil.so',
  # Arch independed Linux
104
  'linux-gate.so',
105 106 107
  'linux-vdso.so',
)

108 109 110 111
IGNORABLE_LINKED_LIB_LIST = (
  'libdl',
)

112 113
SKIP_PART_LIST = (
  'parts/boost-lib-download',
114
  'parts/mariadb__compile__',
115 116
  'parts/libreoffice-bin',
  'parts/libreoffice-bin__unpack__',
117
  'parts/products-erp5',
118
)
119

120 121
def readElfAsDict(f):
  """Reads ELF information from file"""
122 123
  popen = subprocess.Popen(['readelf', '-d', os.path.join(*f.split('/'))],
      stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
124 125
  result = popen.communicate()[0]
  if popen.returncode != 0:
Łukasz Nowak's avatar
Łukasz Nowak committed
126
    raise AssertionError(result)
127
  library_list = []
128 129
  rpath_list = []
  runpath_list = []
130 131
  for l in result.split('\n'):
    if '(NEEDED)' in l:
Łukasz Nowak's avatar
Łukasz Nowak committed
132
      library_list.append(l.split(':')[1].strip(' []').split('.so')[0])
133
    elif '(RPATH)' in l:
134
      rpath_list = [q.rstrip('/') for q in l.split(':',1)[1].strip(' []').split(':')]
135
    elif '(RUNPATH)' in l:
136
      runpath_list = [q.rstrip('/') for q in l.split(':',1)[1].strip(' []').split(':')]
137 138
  if len(runpath_list) == 0:
    runpath_list = rpath_list
139 140
  elif len(rpath_list) != 0 and runpath_list != rpath_list:
    raise ValueError('RPATH and RUNPATH are different.')
141
  return dict(
Łukasz Nowak's avatar
Łukasz Nowak committed
142 143
    library_list=sorted(library_list),
    runpath_list=sorted(runpath_list)
144 145
  )

146 147 148 149 150 151
def readLddInfoList(f):
  popen = subprocess.Popen(['ldd', f], stdout=subprocess.PIPE,
      stderr=subprocess.STDOUT)
  link_list = []
  a = link_list.append
  result = popen.communicate()[0]
Nicolas Dumazet's avatar
Nicolas Dumazet committed
152
  if 'not a dynamic executable' in result or 'cannot read header' in result:
153 154 155 156 157 158 159 160 161 162 163 164 165
    return link_list
  for line in result.split('\n'):
    line = line.strip()
    if '=>' in line:
      lib, path = line.split('=>')
      lib = lib.strip()
      path = path.strip()
      if lib in path:
        # libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f77fcebf000)
        a(path.split()[0])
      else:
        # linux-vdso.so.1 =>  (0x00007fffa7fff000)
        a(lib)
166 167
    elif 'warning: you do not have execution permission for' in line:
      pass
Łukasz Nowak's avatar
Łukasz Nowak committed
168 169 170
    elif 'No such file or directory' in line:
      # ignore broken links
      pass
171 172 173 174 175
    elif line:
      # /lib64/ld-linux-x86-64.so.2 (0x00007f77fd400000)
      a(line.split()[0])
  return link_list

176
class AssertSoftwareMixin(unittest.TestCase):
177
  def getDevelopEggName(self, name, version):
178
    return '%s-%s-py%s-%s.egg' % (name, version, python_version,
179 180
                                util.get_platform())

181 182 183 184
  def assertEqual(self, first, second, msg=None):
    try:
      return unittest.TestCase.assertEqual(self, first, second, msg=msg)
    except unittest.TestCase.failureException:
185
      if isinstance(first, list) and \
186
          isinstance(second, list):
187
        err = ''
188 189
        for elt in first:
          if elt not in second:
190
            err += '- %s\n' % elt
191 192
        for elt in second:
          if elt not in first:
193 194
            err += '+ %s\n' % elt
        if err == '':
195 196
          raise
        else:
197 198 199 200
          if msg:
            msg = '%s: Lists are different:\n%s' % (msg, err)
          else:
            msg = 'Lists are different:\n%s' % err
201 202 203 204
          raise unittest.TestCase.failureException, msg
      else:
        raise

205 206
  def assertLibraryList(self, path, library_list=None, software_list=None,
                        additional_runpath_list=None):
207
    parts_name = getattr(self, 'parts_name', 'parts')
208 209
    elf_dict = readElfAsDict(path)
    if library_list is not None:
210 211 212 213 214 215 216
      expected_library_list = elf_dict['library_list']
      for lib in IGNORABLE_LINKED_LIB_LIST:
        if lib in library_list:
          library_list.remove(lib)
        if lib in expected_library_list:
          expected_library_list.remove(lib)
      self.assertEqual(sorted(library_list), expected_library_list, path)
217
    if software_list is not None:
218
      soft_dir = os.path.join(os.path.abspath(os.curdir), parts_name)
219 220 221 222 223 224
      runpath_list = [os.path.join(soft_dir, software, 'lib') for
        software in software_list]
      if additional_runpath_list is not None:
        runpath_list.extend(additional_runpath_list)
      self.assertEqual(sorted(runpath_list), elf_dict['runpath_list'], path)

225 226 227 228 229 230 231 232 233 234 235 236 237 238
  def assertSoftwareDictEmpty(self, first, msg=None):
    try:
      return unittest.TestCase.assertEqual(self, first, {}, msg)
    except unittest.TestCase.failureException:
      if msg is None:
        msg = ''
        for path, wrong_link_list in first.iteritems():
          msg += '%s:\n' % path
          msg += '\n'.join(['\t' + q for q in sorted(wrong_link_list)]) + '\n'
        msg = 'Bad linked software:\n%s' % msg
        raise unittest.TestCase.failureException, msg
      else:
        raise

239
class AssertSoftwareRunable(AssertSoftwareMixin):
240 241 242 243 244 245 246 247 248 249 250 251
  def test_HaProxy(self):
    stdout, stderr = subprocess.Popen(["parts/haproxy/sbin/haproxy", "-v"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
    self.assertTrue(stdout.startswith('HA-Proxy'))

  def test_Apache(self):
    stdout, stderr = subprocess.Popen(["parts/apache/bin/httpd", "-v"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
    self.assertTrue(stdout.startswith('Server version: Apache'))

252 253 254 255 256 257
  def test_Varnish(self):
    stdout, stderr = subprocess.Popen(["parts/varnish/sbin/varnishd", "-V"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stdout, '')
    self.assertTrue(stderr.startswith('varnishd ('))

258 259 260 261 262 263 264
  def test_TokyoCabinet(self):
    stdout, stderr = subprocess.Popen(["parts/tokyocabinet/bin/tcamgr",
      "version"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
    self.assertTrue(stdout.startswith('Tokyo Cabinet'))

265
  def test_rdiff_backup(self):
266 267
    stdout, stderr = subprocess.Popen(["bin/rdiff-backup", "-V"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
268 269 270
    self.assertEqual(stderr, '')
    self.assertEqual(stdout.strip(), 'rdiff-backup 1.0.5')

271 272 273 274 275 276 277 278 279 280 281 282
  def test_imagemagick(self):
    binary_list = [ 'animate', 'composite', 'convert', 'identify', 'mogrify',
        'stream', 'compare', 'conjure', 'display', 'import', 'montage']
    base = os.path.join('parts', 'imagemagick', 'bin')
    error_list = []
    for binary in binary_list:
      stdout, stderr = subprocess.Popen([os.path.join(base, binary), "-version"],
          stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
      if 'Version: ImageMagick' not in stdout:
        error_list.append(binary)
    self.assertEqual([], error_list)

283 284 285 286
  def test_w3m(self):
    stdout, stderr = subprocess.Popen(["parts/w3m/bin/w3m", "-V"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
287
    self.assertTrue(stdout.startswith('w3m version w3m/0.5.3'))
288

289
class AssertMysql50Tritonn(AssertSoftwareMixin):
290
  def test_ld_mysqld(self):
291
    self.assertLibraryList('parts/mysql-tritonn-5.0/libexec/mysqld', [
292 293 294 295 296 297 298 299 300 301 302 303 304
      'libc',
      'libcrypt',
      'libcrypto',
      'libdl',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'librt',
      'libsenna',
      'libssl',
      'libstdc++',
      'libz',
305 306 307 308 309 310 311
      ], [
      'ncurses',
      'openssl',
      'readline',
      'senna',
      'zlib',
      ])
312 313

  def test_ld_mysqlmanager(self):
314
    self.assertLibraryList('parts/mysql-tritonn-5.0/libexec/mysqlmanager', [
315 316 317 318 319 320 321 322 323 324
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'libssl',
      'libstdc++',
      'libz',
325 326 327 328 329 330
      ], [
      'ncurses',
      'zlib',
      'readline',
      'openssl',
      ])
331

332
  def test_ld_libmysqlclient_r(self):
333
    self.assertLibraryList('parts/mysql-tritonn-5.0/lib/mysql/libmysqlclient_r.so', [
334 335 336 337 338 339 340 341
      'libc',
      'libcrypt',
      'libcrypto',
      'libm',
      'libnsl',
      'libpthread',
      'libssl',
      'libz',
342 343 344 345 346 347
      ], [
      'ncurses',
      'openssl',
      'readline',
      'zlib',
      ])
348 349

  def test_ld_libmysqlclient(self):
350
    self.assertLibraryList('parts/mysql-tritonn-5.0/lib/mysql/libmysqlclient.so', [
351 352 353 354 355 356 357
      'libc',
      'libcrypt',
      'libcrypto',
      'libm',
      'libnsl',
      'libssl',
      'libz',
358 359 360 361 362 363
      ], [
      'ncurses',
      'openssl',
      'readline',
      'zlib',
      ])
364 365

  def test_ld_sphinx(self):
366
    self.assertLibraryList('parts/mysql-tritonn-5.0/lib/mysql/sphinx.so', [
367 368 369 370 371 372 373
      'libc',
      'libcrypt',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'libstdc++',
374 375 376 377 378 379
      ], [
      'ncurses',
      'openssl',
      'readline',
      'zlib',
      ])
380

381
  def test_ld_mysql(self):
382
    self.assertLibraryList('parts/mysql-tritonn-5.0/bin/mysql', [
383 384 385 386 387 388 389 390 391 392 393 394
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libmysqlclient',
      'libncurses',
      'libnsl',
      'libreadline',
      'libssl',
      'libstdc++',
      'libz',
395 396 397 398 399 400 401
      ], [
      'ncurses',
      'zlib',
      'readline',
      'openssl',
      ], [os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql')])
402 403

  def test_ld_mysqladmin(self):
404
    self.assertLibraryList('parts/mysql-tritonn-5.0/bin/mysqladmin', [
405 406 407 408 409 410 411 412 413 414
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libmysqlclient',
      'libnsl',
      'libssl',
      'libstdc++',
      'libz',
415 416 417 418 419 420 421
      ], [
      'ncurses',
      'openssl',
      'readline',
      'zlib',
      ], [os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql')])
422 423

  def test_ld_mysqldump(self):
424 425 426
    self.assertLibraryList('parts/mysql-tritonn-5.0/bin/mysqldump', ['libc', 'libcrypt', 'libcrypto', 'libm',
      'libmysqlclient', 'libnsl', 'libssl', 'libz'], ['ncurses', 'zlib', 'readline', 'openssl'], [os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql')])
427

428
class AssertMariadb(AssertSoftwareMixin):
429
  def test_ld_mysqld(self):
430 431
    self.assertLibraryList('parts/mariadb/libexec/mysqld', ['libc', 'libcrypt', 'libdl', 'libgcc_s', 'libm', 'libnsl',
      'libpthread', 'librt', 'libstdc++', 'libz'], ['ncurses', 'zlib', 'readline'])
432 433

  def test_ld_mysqlmanager(self):
434 435
    self.assertLibraryList('parts/mariadb/libexec/mysqlmanager', ['libc', 'libcrypt', 'libdl', 'libgcc_s', 'libm', 'libnsl',
      'libpthread', 'librt', 'libstdc++', 'libz'], ['ncurses', 'zlib', 'readline'])
436 437

  def test_ld_libmysqlclient_r(self):
Nicolas Dumazet's avatar
Nicolas Dumazet committed
438
    self.assertLibraryList('parts/mariadb/lib/mysql/libmysqlclient_r.so', ['libc', 'libdl', 'librt', 'libz', 'libcrypt', 'libm', 'libnsl', 'libpthread'], ['ncurses', 'zlib', 'readline'])
439 440

  def test_ld_libmysqlclient(self):
Nicolas Dumazet's avatar
Nicolas Dumazet committed
441
    self.assertLibraryList('parts/mariadb/lib/mysql/libmysqlclient.so', ['libc', 'libdl', 'librt', 'libz', 'libcrypt', 'libm', 'libnsl', 'libpthread'], ['ncurses', 'readline', 'zlib'])
442 443

  def test_ld_mysql(self):
444
    self.assertLibraryList('parts/mariadb/bin/mysql', ['libc', 'libdl', 'librt', 'libz', 'libcrypt', 'libgcc_s', 'libm',
445
      'libmysqlclient', 'libncursesw', 'libnsl', 'libpthread', 'libreadline',
446 447
      'libstdc++'], ['ncurses', 'zlib', 'readline'],
                           [os.path.join(os.path.abspath(os.curdir),
448
      'parts', 'mariadb', 'lib', 'mysql')])
449 450

  def test_ld_mysqladmin(self):
451
    self.assertLibraryList('parts/mariadb/bin/mysqladmin', ['libc', 'libdl', 'librt', 'libz', 'libcrypt', 'libgcc_s', 'libm',
452 453
      'libmysqlclient', 'libnsl', 'libpthread', 'libstdc++'], ['ncurses', 'zlib', 'readline'],
                           [os.path.join(os.path.abspath(os.curdir),
454
      'parts', 'mariadb', 'lib', 'mysql')])
455 456

  def test_ld_mysqldump(self):
457
    self.assertLibraryList('parts/mariadb/bin/mysqldump', ['libc', 'libdl', 'librt', 'libz', 'libcrypt', 'libm', 'libmysqlclient',
Nicolas Dumazet's avatar
Nicolas Dumazet committed
458
      'libnsl', 'libpthread'], ['ncurses', 'zlib', 'readline'],
459
                           [os.path.join(os.path.abspath(os.curdir),
460
      'parts', 'mariadb', 'lib', 'mysql')])
461

Łukasz Nowak's avatar
Łukasz Nowak committed
462 463 464 465
class AssertSqlite3(AssertSoftwareMixin):
  """Tests for built memcached"""

  def test_ld_bin_sqlite3(self):
466 467 468 469
    self.assertLibraryList('parts/sqlite3/bin/sqlite3', ['libpthread', 'libc', 'libdl', 'libsqlite3', 'libreadline', 'libncurses'],
                           ['sqlite3'],
       [ os.path.join(os.path.abspath(os.curdir), 'parts', 'readline', 'lib'),
         os.path.join(os.path.abspath(os.curdir), 'parts', 'ncurses', 'lib')])
Łukasz Nowak's avatar
Łukasz Nowak committed
470 471

  def test_ld_libsqlite3(self):
472 473 474
    self.assertLibraryList('parts/sqlite3/lib/libsqlite3.so', ['libpthread', 'libc', 'libdl'], [],
       [ os.path.join(os.path.abspath(os.curdir), 'parts', 'readline', 'lib'),
         os.path.join(os.path.abspath(os.curdir), 'parts', 'ncurses', 'lib')])
Łukasz Nowak's avatar
Łukasz Nowak committed
475

476
class AssertMemcached(AssertSoftwareMixin):
477 478 479
  """Tests for built memcached"""

  def test_ld_memcached(self):
480
    """Checks proper linking to libevent from memcached"""
481
    self.assertLibraryList('parts/memcached/bin/memcached', ['libpthread', 'libevent-1.4', 'libc'], ['libevent'])
482

483 484 485
class AssertSubversion(AssertSoftwareMixin):
  """Tests for built subversion"""
  def test_ld_svn(self):
486
    self.assertLibraryList('parts/subversion/bin/svn', ['libsvn_client-1', 'libsvn_wc-1', 'libsvn_ra-1',
487 488
      'libsvn_diff-1', 'libsvn_ra_local-1', 'libsvn_repos-1', 'libsvn_fs-1',
      'libsvn_fs_fs-1', 'libsvn_fs_util-1', 'libsvn_ra_svn-1',
489
      'libsvn_delta-1', 'libsvn_subr-1', 'libsqlite3', 'libxml2',
490
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
491
      'libz', 'libssl', 'libcrypto', 'libsvn_ra_neon-1',
492
      'libc', 'libcrypt', 'libdl', 'libm',
493
      'libpthread', 'libneon'
494 495
      ], ['apache', 'libexpat', 'openssl', 'neon', 'libxml2',
                     'sqlite3', 'subversion', 'zlib', 'libuuid'])
496 497

  def test_ld_svnadmin(self):
498
    self.assertLibraryList('parts/subversion/bin/svnadmin', ['libsvn_repos-1', 'libsvn_fs-1',
499 500 501
      'libsvn_fs_fs-1', 'libsvn_fs_util-1', 'libsvn_delta-1', 'libsvn_subr-1',
      'libsqlite3', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
502 503
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
Łukasz Nowak's avatar
Łukasz Nowak committed
504 505

  def test_ld_svndumpfilter(self):
506
    self.assertLibraryList('parts/subversion/bin/svndumpfilter', ['libsvn_repos-1', 'libsvn_fs-1',
Łukasz Nowak's avatar
Łukasz Nowak committed
507 508 509
      'libsvn_fs_fs-1', 'libsvn_fs_util-1', 'libsvn_delta-1', 'libsvn_subr-1',
      'libsqlite3', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
510 511
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
Łukasz Nowak's avatar
Łukasz Nowak committed
512 513

  def test_ld_svnlook(self):
514
    self.assertLibraryList('parts/subversion/bin/svnlook', ['libsvn_repos-1', 'libsvn_fs-1', 'libsvn_diff-1',
Łukasz Nowak's avatar
Łukasz Nowak committed
515 516 517
      'libsvn_fs_fs-1', 'libsvn_fs_util-1', 'libsvn_delta-1', 'libsvn_subr-1',
      'libsqlite3', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
518 519
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
Łukasz Nowak's avatar
Łukasz Nowak committed
520 521

  def test_ld_svnserve(self):
522
    self.assertLibraryList('parts/subversion/bin/svnserve', ['libsvn_repos-1', 'libsvn_fs-1', 'libsvn_ra_svn-1',
Łukasz Nowak's avatar
Łukasz Nowak committed
523 524 525
      'libsvn_fs_fs-1', 'libsvn_fs_util-1', 'libsvn_delta-1', 'libsvn_subr-1',
      'libsqlite3', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
526 527
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
Łukasz Nowak's avatar
Łukasz Nowak committed
528 529

  def test_ld_svnsync(self):
530
    self.assertLibraryList('parts/subversion/bin/svnsync', [
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
      'libapr-1',
      'libaprutil-1',
      'libc',
      'libcrypt',
      'libcrypto',
      'libdl',
      'libexpat',
      'libm',
      'libneon',
      'libpthread',
      'librt',
      'libsqlite3',
      'libssl',
      'libsvn_delta-1',
      'libsvn_fs-1',
      'libsvn_fs_fs-1',
      'libsvn_fs_util-1',
      'libsvn_ra-1',
      'libsvn_ra_local-1',
      'libsvn_ra_neon-1',
      'libsvn_ra_svn-1',
      'libsvn_repos-1',
      'libsvn_subr-1',
      'libuuid',
      'libxml2',
      'libz',
557 558 559 560 561 562 563 564 565 566 567
      ], [
      'apache',
      'libexpat',
      'libuuid',
      'libxml2',
      'neon',
      'openssl',
      'sqlite3',
      'subversion',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
568 569

  def test_ld_svnversion(self):
570
    self.assertLibraryList('parts/subversion/bin/svnversion', ['libsvn_diff-1', 'libsvn_wc-1',
Łukasz Nowak's avatar
Łukasz Nowak committed
571 572 573
      'libsvn_delta-1', 'libsvn_subr-1', 'libsqlite3',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
574 575
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
576 577

  def test_ld_libsvn_client(self):
578
    self.assertLibraryList('parts/subversion/lib/libsvn_client-1.so', ['libsvn_diff-1', 'libsvn_wc-1',
579 580 581
      'libsvn_delta-1', 'libsvn_subr-1', 'libsvn_ra-1',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libc', 'libcrypt', 'libdl', 'libpthread',
582 583
      ], ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
      'libuuid', 'neon'])
584 585

  def test_ld_libsvn_delta(self):
586
    self.assertLibraryList('parts/subversion/lib/libsvn_delta-1.so', [
587 588 589
      'libsvn_subr-1', 'libz',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libc', 'libcrypt', 'libdl', 'libpthread',
590 591
      ], ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
      'libuuid', 'neon'])
592 593

  def test_ld_libsvn_diff(self):
594
    self.assertLibraryList('parts/subversion/lib/libsvn_diff-1.so', [
595 596
      'libsvn_subr-1', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libc', 'libcrypt', 'libdl', 'libpthread',
597 598
      ], ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
      'libuuid', 'neon'])
599 600

  def test_ld_libsvn_fs(self):
601
    self.assertLibraryList('parts/subversion/lib/libsvn_fs-1.so', [
602 603 604 605 606 607 608 609 610 611 612
      'libapr-1',
      'libc',
      'libcrypt',
      'libdl',
      'libpthread',
      'librt',
      'libsvn_delta-1',
      'libsvn_fs_fs-1',
      'libsvn_fs_util-1',
      'libsvn_subr-1',
      'libuuid',
613 614 615 616 617 618 619 620
      ], [
      'apache',
      'libuuid',
      'neon',
      'sqlite3',
      'subversion',
      'zlib',
      ])
621 622

  def test_ld_libsvn_fs_fs(self):
623
    self.assertLibraryList('parts/subversion/lib/libsvn_fs_fs-1.so', ['libsvn_delta-1', 'libaprutil-1', 'libexpat',
624 625
      'libsvn_fs_util-1', 'libsvn_subr-1', 'libapr-1', 'libuuid', 'librt',
      'libc', 'libcrypt', 'libdl', 'libpthread',
626 627
      ], ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
      'libuuid', 'neon'])
628 629

  def test_ld_libsvn_fs_util(self):
630
    self.assertLibraryList('parts/subversion/lib/libsvn_fs_util-1.so', ['libaprutil-1', 'libexpat',
631 632
      'libsvn_subr-1', 'libapr-1', 'libuuid', 'librt',
      'libc', 'libcrypt', 'libdl', 'libpthread',
633 634
      ], ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
      'libuuid', 'neon'])
635 636

  def test_ld_libsvn_ra(self):
637
    self.assertLibraryList('parts/subversion/lib/libsvn_ra-1.so', ['libaprutil-1', 'libsvn_delta-1', 'libsvn_fs-1',
638
      'libsvn_ra_local-1', 'libsvn_ra_neon-1', 'libsvn_ra_svn-1',
639 640
      'libsvn_repos-1', 'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
641 642
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
643 644

  def test_ld_libsvn_ra_local(self):
645
    self.assertLibraryList('parts/subversion/lib/libsvn_ra_local-1.so', ['libaprutil-1', 'libsvn_delta-1', 'libsvn_fs-1',
646 647
      'libsvn_repos-1', 'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
648 649
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
650

651
  def test_ld_libsvn_ra_neon(self):
652
    self.assertLibraryList('parts/subversion/lib/libsvn_ra_neon-1.so', [
653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
      'libapr-1',
      'libaprutil-1',
      'libc',
      'libcrypt',
      'libcrypto',
      'libdl',
      'libexpat',
      'libm',
      'libneon',
      'libpthread',
      'librt',
      'libssl',
      'libsvn_delta-1',
      'libsvn_subr-1',
      'libuuid',
      'libxml2',
669
      'libz',
670 671 672 673 674 675 676 677 678 679 680
      ], [
      'apache',
      'libexpat',
      'libuuid',
      'libxml2',
      'neon',
      'openssl',
      'sqlite3',
      'subversion',
      'zlib',
      ])
681 682

  def test_ld_libsvn_ra_svn(self):
683
    self.assertLibraryList('parts/subversion/lib/libsvn_ra_svn-1.so', ['libaprutil-1', 'libsvn_delta-1',
684 685
      'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
686 687
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
688 689

  def test_ld_libsvn_repos(self):
690
    self.assertLibraryList('parts/subversion/lib/libsvn_repos-1.so', ['libaprutil-1', 'libsvn_delta-1',
691 692
      'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid', 'libsvn_fs-1',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
693 694
      ], ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon'])
695 696

  def test_ld_libsvn_subr(self):
697
    self.assertLibraryList('parts/subversion/lib/libsvn_subr-1.so', ['libaprutil-1', 'libexpat', 'libapr-1',
698 699
      'libuuid', 'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      'libsqlite3', 'libz',
700 701
      ], ['apache', 'libexpat',
                     'sqlite3', 'zlib', 'libuuid', 'neon'])
702 703

  def test_ld_libsvn_wc(self):
704
    self.assertLibraryList('parts/subversion/lib/libsvn_wc-1.so', ['libaprutil-1', 'libexpat', 'libapr-1',
705 706
      'libsvn_delta-1', 'libsvn_diff-1', 'libsvn_subr-1',
      'libuuid', 'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
707 708
      ], ['apache', 'libexpat', 'subversion',
                     'sqlite3', 'zlib', 'libuuid', 'neon'])
709

710 711 712
class AssertNeon(AssertSoftwareMixin):
  """Tests for built neon"""
  def test_ld_libneon(self):
713
    self.assertLibraryList('parts/neon/lib/libneon.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
714 715 716 717 718 719 720
      'libc',
      'libcrypto',
      'libdl',
      'libm',
      'libssl',
      'libxml2',
      'libz',
721 722 723 724 725
      ], [
      'libxml2',
      'openssl',
      'zlib',
      ])
726

727 728 729 730 731 732 733 734 735 736
  def test_neonconfig(self):
    popen = subprocess.Popen([os.path.join('parts', 'neon', 'bin', 'neon-config'),
      '--libs'],
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    result = popen.communicate()[0]
    self.assertEqual(0, popen.returncode, result)
    result_left = []
    for l in result.split():
      # let's remove acceptable parameters
      if l in (
737 738 739 740 741 742 743 744 745
      '-Wl,-rpath',
      '-lcrypto',
      '-ldl',
      '-lm',
      '-lneon',
      '-lpthread',
      '-lssl',
      '-lxml2',
      '-lz',
746 747 748 749 750 751 752 753 754 755 756 757 758 759
          ):
        continue
      if 'parts/neon/lib' in l:
        continue
      if 'parts/zlib/lib' in l:
        continue
      if 'parts/libxml2/lib' in l:
        continue
      if 'parts/openssl/lib' in l:
        continue
      result_left.append(l)
    # whatever left is wrong
    self.assertEqual([], result_left)

760
class AssertPythonMysql(AssertSoftwareMixin):
761 762 763 764 765
  def test_ld_mysqlso(self):
    for d in os.listdir('develop-eggs'):
      if d.startswith('MySQL_python'):
        path = os.path.join('develop-eggs', d, '_mysql.so')
        elf_dict = readElfAsDict(path)
766 767
        self.assertEqual(sorted(['libc', 'libcrypt', 'libm',
      'libmysqlclient_r', 'libnsl', 'libpthread', 'librt', 'libz']),
768 769 770
          elf_dict['library_list'])
        soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
        expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
771
            software in ['zlib', 'openssl']]
772
        expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir), 'parts', 'mariadb', 'lib', 'mysql'))
773
        self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
774

775
class AssertApache(AssertSoftwareMixin):
Łukasz Nowak's avatar
Łukasz Nowak committed
776
  """Tests for built apache"""
777

778 779 780 781 782 783 784 785 786 787
  apache_rpath = [
      'gdbm',
      'libexpat',
      'libuuid',
      'openssl',
      'pcre',
      'sqlite3',
      'zlib',
  ]

788
  def test_ld_libaprutil1(self):
789
    self.assertLibraryList('parts/apache/lib/libaprutil-1.so', ['libexpat', 'libapr-1', 'librt', 'libcrypt',
790
      'libpthread', 'libdl', 'libc', 'libuuid'],
791
      self.apache_rpath + ['apache'])
792

793
  def test_ld_libapr1(self):
794
    self.assertLibraryList('parts/apache/lib/libapr-1.so', ['librt', 'libcrypt', 'libuuid',
795
      'libpthread', 'libdl', 'libc'], self.apache_rpath)
796

797
  def test_modules(self):
798
    required_module_list = sorted([q.strip() for q in """
Łukasz Nowak's avatar
Łukasz Nowak committed
799 800 801 802 803
      actions_module
      alias_module
      asis_module
      auth_basic_module
      auth_digest_module
804
      authn_alias_module
Łukasz Nowak's avatar
Łukasz Nowak committed
805
      authn_anon_module
806
      authn_dbd_module
Łukasz Nowak's avatar
Łukasz Nowak committed
807 808 809
      authn_dbm_module
      authn_default_module
      authn_file_module
810
      authz_dbm_module
Łukasz Nowak's avatar
Łukasz Nowak committed
811 812 813 814 815 816 817 818
      authz_default_module
      authz_groupfile_module
      authz_host_module
      authz_owner_module
      authz_user_module
      autoindex_module
      bucketeer_module
      cache_module
819
      case_filter_in_module
Łukasz Nowak's avatar
Łukasz Nowak committed
820 821 822 823 824
      case_filter_module
      cern_meta_module
      cgi_module
      cgid_module
      charset_lite_module
825 826 827 828
      core_module
      dav_fs_module
      dav_module
      dbd_module
Łukasz Nowak's avatar
Łukasz Nowak committed
829 830 831 832 833 834 835 836 837 838
      deflate_module
      dir_module
      disk_cache_module
      dumpio_module
      echo_module
      env_module
      expires_module
      ext_filter_module
      filter_module
      headers_module
839
      http_module
Łukasz Nowak's avatar
Łukasz Nowak committed
840
      ident_module
841 842 843
      imagemap_module
      include_module
      info_module
Łukasz Nowak's avatar
Łukasz Nowak committed
844 845 846
      log_config_module
      log_forensic_module
      logio_module
847 848
      mime_magic_module
      mime_module
849
      mpm_prefork_module
850 851 852 853
      negotiation_module
      optional_fn_export_module
      optional_fn_import_module
      optional_hook_export_module
Łukasz Nowak's avatar
Łukasz Nowak committed
854
      optional_hook_import_module
855
      proxy_ajp_module
Łukasz Nowak's avatar
Łukasz Nowak committed
856 857
      proxy_balancer_module
      proxy_connect_module
858
      proxy_ftp_module
Łukasz Nowak's avatar
Łukasz Nowak committed
859 860
      proxy_http_module
      proxy_module
861 862
      proxy_scgi_module
      reqtimeout_module
Łukasz Nowak's avatar
Łukasz Nowak committed
863 864
      rewrite_module
      setenvif_module
865
      so_module
866
      speling_module
Łukasz Nowak's avatar
Łukasz Nowak committed
867 868 869 870
      ssl_module
      status_module
      substitute_module
      unique_id_module
871
      userdir_module
Łukasz Nowak's avatar
Łukasz Nowak committed
872 873 874
      usertrack_module
      version_module
      vhost_alias_module
875 876 877 878 879 880
    """.split() if len(q.strip()) > 0])
    popen = subprocess.Popen(['parts/apache/bin/httpd', '-M'],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    result = popen.communicate()[0]
    loaded_module_list = sorted([module_name for module_name in result.split()
                          if module_name.endswith('module')])
881
    self.assertEqual(required_module_list, loaded_module_list)
882

883
  def test_ld_module_mod_actions(self):
884
    self.assertLibraryList('parts/apache/modules/mod_actions.so', ['libpthread', 'libc'], self.apache_rpath)
885

Łukasz Nowak's avatar
Łukasz Nowak committed
886
  def test_ld_module_mod_alias(self):
887
    self.assertLibraryList('parts/apache/modules/mod_alias.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
888 889

  def test_ld_module_mod_asis(self):
890
    self.assertLibraryList('parts/apache/modules/mod_asis.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
891 892

  def test_ld_module_mod_auth_basic(self):
893
    self.assertLibraryList('parts/apache/modules/mod_auth_basic.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
894 895

  def test_ld_module_mod_auth_digest(self):
896
    self.assertLibraryList('parts/apache/modules/mod_auth_digest.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
897 898

  def test_ld_module_mod_authn_alias(self):
899
    self.assertLibraryList('parts/apache/modules/mod_authn_alias.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
900 901

  def test_ld_module_mod_authn_anon(self):
902
    self.assertLibraryList('parts/apache/modules/mod_authn_anon.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
903 904

  def test_ld_module_mod_authn_dbd(self):
905
    self.assertLibraryList('parts/apache/modules/mod_authn_dbd.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
906 907

  def test_ld_module_mod_authn_dbm(self):
908
    self.assertLibraryList('parts/apache/modules/mod_authn_dbm.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
909 910

  def test_ld_module_mod_authn_default(self):
911
    self.assertLibraryList('parts/apache/modules/mod_authn_default.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
912 913

  def test_ld_module_mod_authn_file(self):
914
    self.assertLibraryList('parts/apache/modules/mod_authn_file.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
915 916

  def test_ld_module_mod_authz_dbm(self):
917
    self.assertLibraryList('parts/apache/modules/mod_authz_dbm.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
918 919

  def test_ld_module_mod_authz_default(self):
920
    self.assertLibraryList('parts/apache/modules/mod_authz_default.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
921 922

  def test_ld_module_mod_authz_groupfile(self):
923
    self.assertLibraryList('parts/apache/modules/mod_authz_groupfile.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
924 925

  def test_ld_module_mod_authz_host(self):
926
    self.assertLibraryList('parts/apache/modules/mod_authz_host.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
927 928

  def test_ld_module_mod_authz_owner(self):
929
    self.assertLibraryList('parts/apache/modules/mod_authz_owner.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
930 931

  def test_ld_module_mod_authz_user(self):
932
    self.assertLibraryList('parts/apache/modules/mod_authz_user.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
933 934

  def test_ld_module_mod_autoindex(self):
935
    self.assertLibraryList('parts/apache/modules/mod_autoindex.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
936 937

  def test_ld_module_mod_bucketeer(self):
938
    self.assertLibraryList('parts/apache/modules/mod_bucketeer.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
939 940

  def test_ld_module_mod_cache(self):
941
    self.assertLibraryList('parts/apache/modules/mod_cache.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
942 943

  def test_ld_module_mod_case_filter(self):
944
    self.assertLibraryList('parts/apache/modules/mod_case_filter.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
945 946

  def test_ld_module_mod_case_filter_in(self):
947
    self.assertLibraryList('parts/apache/modules/mod_case_filter_in.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
948 949

  def test_ld_module_mod_cern_meta(self):
950
    self.assertLibraryList('parts/apache/modules/mod_cern_meta.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
951 952

  def test_ld_module_mod_cgi(self):
953
    self.assertLibraryList('parts/apache/modules/mod_cgi.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
954 955

  def test_ld_module_mod_cgid(self):
956
    self.assertLibraryList('parts/apache/modules/mod_cgid.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
957 958

  def test_ld_module_mod_charset_lite(self):
959
    self.assertLibraryList('parts/apache/modules/mod_charset_lite.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
960 961

  def test_ld_module_mod_dav(self):
962
    self.assertLibraryList('parts/apache/modules/mod_dav.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
963 964

  def test_ld_module_mod_dav_fs(self):
965
    self.assertLibraryList('parts/apache/modules/mod_dav_fs.so', ['libpthread', 'libc'], self.apache_rpath)
Łukasz Nowak's avatar
Łukasz Nowak committed
966

967
  def test_ld_module_mod_dbd(self):
968
    self.assertLibraryList('parts/apache/modules/mod_dbd.so', ['libpthread', 'libc'], self.apache_rpath)
969 970

  def test_ld_module_mod_deflate(self):
971
    self.assertLibraryList('parts/apache/modules/mod_deflate.so', ['libpthread', 'libc', 'libz'], self.apache_rpath)
972 973

  def test_ld_module_mod_dir(self):
974
    self.assertLibraryList('parts/apache/modules/mod_dir.so', ['libpthread', 'libc'], self.apache_rpath)
975 976

  def test_ld_module_mod_disk_cache(self):
977
    self.assertLibraryList('parts/apache/modules/mod_disk_cache.so', ['libpthread', 'libc'], self.apache_rpath)
978 979

  def test_ld_module_mod_dumpio(self):
980
    self.assertLibraryList('parts/apache/modules/mod_dumpio.so', ['libpthread', 'libc'], self.apache_rpath)
981 982

  def test_ld_module_mod_echo(self):
983
    self.assertLibraryList('parts/apache/modules/mod_echo.so', ['libpthread', 'libc'], self.apache_rpath)
984 985

  def test_ld_module_mod_env(self):
986
    self.assertLibraryList('parts/apache/modules/mod_env.so', ['libpthread', 'libc'], self.apache_rpath)
987 988

  def test_ld_module_mod_expires(self):
989
    self.assertLibraryList('parts/apache/modules/mod_expires.so', ['libpthread', 'libc'], self.apache_rpath)
990 991

  def test_ld_module_mod_ext_filter(self):
992
    self.assertLibraryList('parts/apache/modules/mod_ext_filter.so', ['libpthread', 'libc'], self.apache_rpath)
993 994

  def test_ld_module_mod_filter(self):
995
    self.assertLibraryList('parts/apache/modules/mod_filter.so', ['libpthread', 'libc'], self.apache_rpath)
996 997

  def test_ld_module_mod_headers(self):
998
    self.assertLibraryList('parts/apache/modules/mod_headers.so', ['libpthread', 'libc'], self.apache_rpath)
999 1000

  def test_ld_module_mod_ident(self):
1001
    self.assertLibraryList('parts/apache/modules/mod_ident.so', ['libpthread', 'libc'], self.apache_rpath)
1002 1003

  def test_ld_module_mod_imagemap(self):
1004
    self.assertLibraryList('parts/apache/modules/mod_imagemap.so', ['libpthread', 'libc'], self.apache_rpath)
1005 1006

  def test_ld_module_mod_include(self):
1007
    self.assertLibraryList('parts/apache/modules/mod_include.so', ['libpthread', 'libc'], self.apache_rpath)
1008 1009

  def test_ld_module_mod_info(self):
1010
    self.assertLibraryList('parts/apache/modules/mod_info.so', ['libpthread', 'libc'], self.apache_rpath)
1011 1012

  def test_ld_module_mod_log_config(self):
1013
    self.assertLibraryList('parts/apache/modules/mod_log_config.so', ['libpthread', 'libc'], self.apache_rpath)
1014 1015

  def test_ld_module_mod_log_forensic(self):
1016
    self.assertLibraryList('parts/apache/modules/mod_log_forensic.so', ['libpthread', 'libc'], self.apache_rpath)
1017 1018

  def test_ld_module_mod_logio(self):
1019
    self.assertLibraryList('parts/apache/modules/mod_logio.so', ['libpthread', 'libc'], self.apache_rpath)
1020 1021

  def test_ld_module_mod_mime(self):
1022
    self.assertLibraryList('parts/apache/modules/mod_mime.so', ['libpthread', 'libc'], self.apache_rpath)
1023 1024

  def test_ld_module_mod_mime_magic(self):
1025
    self.assertLibraryList('parts/apache/modules/mod_mime_magic.so', ['libpthread', 'libc'], self.apache_rpath)
1026 1027

  def test_ld_module_mod_negotiation(self):
1028
    self.assertLibraryList('parts/apache/modules/mod_negotiation.so', ['libpthread', 'libc'], self.apache_rpath)
1029 1030

  def test_ld_module_mod_optional_fn_export(self):
1031
    self.assertLibraryList('parts/apache/modules/mod_optional_fn_export.so', ['libpthread', 'libc'], self.apache_rpath)
1032 1033

  def test_ld_module_mod_optional_fn_import(self):
1034
    self.assertLibraryList('parts/apache/modules/mod_optional_fn_import.so', ['libpthread', 'libc'], self.apache_rpath)
1035 1036

  def test_ld_module_mod_optional_hook_export(self):
1037
    self.assertLibraryList('parts/apache/modules/mod_optional_hook_export.so', ['libpthread', 'libc'], self.apache_rpath)
1038 1039

  def test_ld_module_mod_optional_hook_import(self):
1040
    self.assertLibraryList('parts/apache/modules/mod_optional_hook_import.so', ['libpthread', 'libc'], self.apache_rpath)
1041 1042

  def test_ld_module_mod_proxy(self):
1043
    self.assertLibraryList('parts/apache/modules/mod_proxy.so', ['libpthread', 'libc'], self.apache_rpath)
1044 1045

  def test_ld_module_mod_proxy_ajp(self):
1046
    self.assertLibraryList('parts/apache/modules/mod_proxy_ajp.so', ['libpthread', 'libc'], self.apache_rpath)
1047 1048

  def test_ld_module_mod_proxy_balancer(self):
1049
    self.assertLibraryList('parts/apache/modules/mod_proxy_balancer.so', ['libpthread', 'libc'], self.apache_rpath)
1050 1051

  def test_ld_module_mod_proxy_connect(self):
1052
    self.assertLibraryList('parts/apache/modules/mod_proxy_connect.so', ['libpthread', 'libc'], self.apache_rpath)
1053 1054

  def test_ld_module_mod_proxy_ftp(self):
1055
    self.assertLibraryList('parts/apache/modules/mod_proxy_ftp.so', ['libpthread', 'libc'], self.apache_rpath)
1056 1057

  def test_ld_module_mod_proxy_http(self):
1058
    self.assertLibraryList('parts/apache/modules/mod_proxy_http.so', ['libpthread', 'libc'], self.apache_rpath)
1059 1060

  def test_ld_module_mod_proxy_scgi(self):
1061
    self.assertLibraryList('parts/apache/modules/mod_proxy_scgi.so', ['libpthread', 'libc'], self.apache_rpath)
1062 1063

  def test_ld_module_mod_reqtimeout(self):
1064
    self.assertLibraryList('parts/apache/modules/mod_reqtimeout.so', ['libpthread', 'libc'], self.apache_rpath)
1065 1066

  def test_ld_module_mod_rewrite(self):
1067
    self.assertLibraryList('parts/apache/modules/mod_rewrite.so', ['libpthread', 'libc'], self.apache_rpath)
1068 1069

  def test_ld_module_mod_setenvif(self):
1070 1071
    self.assertLibraryList('parts/apache/modules/mod_setenvif.so', ['libpthread', 'libc'],
        self.apache_rpath)
1072 1073

  def test_ld_module_mod_speling(self):
1074 1075
    self.assertLibraryList('parts/apache/modules/mod_speling.so', ['libpthread', 'libc'],
        self.apache_rpath)
1076 1077

  def test_ld_module_mod_ssl(self):
1078 1079 1080 1081 1082 1083 1084
    self.assertLibraryList('parts/apache/modules/mod_ssl.so',[
      'libc',
      'libcrypto',
      'libdl',
      'libpthread',
      'libssl',
      ], self.apache_rpath)
1085 1086

  def test_ld_module_mod_status(self):
1087 1088
    self.assertLibraryList('parts/apache/modules/mod_status.so', ['libpthread', 'libc'],
        self.apache_rpath)
1089 1090

  def test_ld_module_mod_substitute(self):
1091 1092
    self.assertLibraryList('parts/apache/modules/mod_substitute.so', ['libpthread', 'libc'],
        self.apache_rpath)
1093 1094

  def test_ld_module_mod_unique_id(self):
1095 1096
    self.assertLibraryList('parts/apache/modules/mod_unique_id.so', ['libpthread', 'libc'],
        self.apache_rpath)
1097 1098

  def test_ld_module_mod_userdir(self):
1099 1100
    self.assertLibraryList('parts/apache/modules/mod_userdir.so', ['libpthread', 'libc'],
        self.apache_rpath)
1101 1102

  def test_ld_module_mod_usertrack(self):
1103 1104
    self.assertLibraryList('parts/apache/modules/mod_usertrack.so', ['libpthread', 'libc'],
        self.apache_rpath)
1105 1106

  def test_ld_module_mod_version(self):
1107 1108
    self.assertLibraryList('parts/apache/modules/mod_version.so', ['libpthread', 'libc'],
        self.apache_rpath)
1109 1110

  def test_ld_module_mod_vhost_alias(self):
1111
    self.assertLibraryList('parts/apache/modules/mod_vhost_alias.so', ['libpthread', 'libc'], self.apache_rpath)
1112

1113 1114 1115 1116 1117
  def test_ld_apr_dbd_sqlite3(self):
    self.assertLibraryList('parts/apache/lib/apr-util-1/apr_dbd_sqlite3.so', [
      'libc',
      'libpthread',
      'libsqlite3',
Łukasz Nowak's avatar
Łukasz Nowak committed
1118
      ], self.apache_rpath)
1119

1120
class AssertOpenssl(AssertSoftwareMixin):
Łukasz Nowak's avatar
Łukasz Nowak committed
1121
  def test_ld_openssl(self):
1122
    self.assertLibraryList('parts/openssl/bin/openssl', ['libc', 'libcrypto', 'libdl', 'libssl'], ['openssl'])
1123

1124
class AssertCyrusSasl(AssertSoftwareMixin):
1125
  def test_ld_pluginviewer(self):
1126
    self.assertLibraryList('parts/cyrus-sasl/sbin/pluginviewer', [
1127 1128 1129
      'libc',
      'libdl',
      'libresolv',
1130
      'libsasl2',
1131 1132 1133 1134
      ], [
      'cyrus-sasl',
      'zlib',
      ])
1135

1136
  def test_ld_libsasl2(self):
1137
    self.assertLibraryList('parts/cyrus-sasl/lib/libsasl2.so', [
1138
      'libc',
1139
      'libdl',
1140
      'libresolv',
1141 1142
      ], [
      ])
1143

1144
  def test_ld_sasl2_libanonymous(self):
1145
    self.assertLibraryList('parts/cyrus-sasl/lib/sasl2/libanonymous.so', [
1146 1147
      'libc',
      'libresolv',
1148 1149
      ], [
      ])
1150

1151
  def test_ld_sasl2_libcrammd5(self):
1152
    self.assertLibraryList('parts/cyrus-sasl/lib/sasl2/libcrammd5.so', [
1153 1154
      'libc',
      'libresolv',
1155 1156
      ], [
      ])
1157 1158

  def test_ld_sasl2_libplain(self):
1159
    self.assertLibraryList('parts/cyrus-sasl/lib/sasl2/libplain.so', [
1160 1161 1162
      'libc',
      'libcrypt',
      'libresolv',
1163 1164
      ], [
      ])
1165

Łukasz Nowak's avatar
Łukasz Nowak committed
1166 1167
class AssertGettext(AssertSoftwareMixin):
  def test_ld_libintl(self):
1168
    self.assertLibraryList('parts/gettext/lib/libintl.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
1169
      'libc',
1170 1171 1172 1173 1174
      ], [
      'libxml2',
      'ncurses',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
1175 1176

  def test_ld_libasprintf(self):
1177
    self.assertLibraryList('parts/gettext/lib/libasprintf.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
1178 1179 1180 1181
      'libc',
      'libgcc_s',
      'libm',
      'libstdc++',
1182 1183 1184 1185 1186
      ], [
      'libxml2',
      'ncurses',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
1187 1188

  def test_ld_libgettextlib(self):
1189
    self.assertLibraryList('parts/gettext/lib/libgettextlib.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
1190 1191 1192 1193 1194 1195 1196
      'libc',
      'libdl',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
1197 1198 1199 1200 1201 1202
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
1203 1204

  def test_ld_libgettextpo(self):
1205
    self.assertLibraryList('parts/gettext/lib/libgettextpo.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
1206 1207
      'libc',
      'libintl',
1208 1209 1210 1211 1212 1213
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
1214 1215

  def test_ld_libgettextsrc(self):
1216
    self.assertLibraryList('parts/gettext/lib/libgettextsrc.so', [
Łukasz Nowak's avatar
Łukasz Nowak committed
1217 1218 1219 1220 1221 1222 1223 1224
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
1225 1226 1227 1228 1229 1230
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])
Łukasz Nowak's avatar
Łukasz Nowak committed
1231

Łukasz Nowak's avatar
Łukasz Nowak committed
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389
  def _test_ld_gettext_bin(self, bin):
    self.assertLibraryList(bin, [
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libgettextsrc-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_envsubst(self):
    self.assertLibraryList('parts/gettext/bin/envsubst', [
      'libc',
      'libintl',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_gettext(self):
    self.assertLibraryList('parts/gettext/bin/gettext', [
      'libc',
      'libintl',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_msgattrib(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgattrib')

  def test_ld_msgcat(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgcat')

  def test_ld_msgcmp(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgcmp')

  def test_ld_msgcomm(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgcomm')

  def test_ld_msgconv(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgconv')

  def test_ld_msgen(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgen')

  def test_ld_msgexec(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgexec')

  def test_ld_msgfilter(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgfilter')

  def test_ld_msgfmt(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgfmt')

  def test_ld_msggrep(self):
    self.assertLibraryList('parts/gettext/bin/msggrep', [
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libgettextsrc-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_msginit(self):
    self.assertLibraryList('parts/gettext/bin/msginit', [
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libgettextsrc-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_msgmerge(self):
    self.assertLibraryList('parts/gettext/bin/msgmerge', [
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libgettextsrc-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_msgunfmt(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msgunfmt')

  def test_ld_msguniq(self):
    self._test_ld_gettext_bin('parts/gettext/bin/msguniq')

  def test_ld_ngettext(self):
    self.assertLibraryList('parts/gettext/bin/ngettext', [
      'libc',
      'libintl',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_recode_sr_latin(self):
    self.assertLibraryList('parts/gettext/bin/recode-sr-latin', [
      'libc',
      'libdl',
      'libgettextlib-0.18.1',
      'libintl',
      'libm',
      'libncurses',
      'libxml2',
      'libz',
      ], [
      'gettext',
      'libxml2',
      'ncurses',
      'zlib',
      ])

  def test_ld_xgettext(self):
    self._test_ld_gettext_bin('parts/gettext/bin/xgettext')

1390
class AssertLibxslt(AssertSoftwareMixin):
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1391
  def test_ld_xsltproc(self):
1392
    self.assertLibraryList('parts/libxslt/bin/xsltproc', [
1393 1394 1395 1396 1397 1398 1399
      'libc',
      'libdl',
      'libexslt',
      'libm',
      'libxml2',
      'libxslt',
      'libz',
1400 1401 1402 1403 1404
      ], [
      'libxml2',
      'libxslt',
      'zlib',
      ])
1405

1406 1407 1408 1409
class AssertNcurses(AssertSoftwareMixin):
  def test_ld_ncurses(self):
    self.assertLibraryList('parts/ncurses/lib/libncurses.so', [
      'libc',
1410
      'libdl',
1411 1412 1413 1414 1415 1416
      ], [
      'ncurses',
      ])
  def test_ld_ncursesw(self):
    self.assertLibraryList('parts/ncurses/lib/libncursesw.so', [
      'libc',
1417
      'libdl',
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428
      ], [
      'ncurses',
      ])
  def test_ld_reset(self):
    self.assertLibraryList('parts/ncurses/bin/reset', [
      'libc',
      'libncursesw',
      ], [
      'ncurses',
      ])

1429
class AssertW3m(AssertSoftwareMixin):
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1430
  def test_ld_w3m(self):
1431
    self.assertLibraryList('parts/w3m/bin/w3m', [
1432 1433 1434 1435 1436 1437
      'libc',
      'libcrypto',
      'libgc',
      'libm',
      'libncurses',
      'libssl',
1438 1439 1440 1441 1442 1443
      ], [
      'garbage-collector',
      'ncurses',
      'openssl',
      'zlib',
      ])
1444

1445 1446
class AssertVarnish(AssertSoftwareMixin):
  def test_ld_varnishd(self):
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459
    self.assertLibraryList('parts/varnish/sbin/varnishd', [
      'libc',
      'libdl',
      'libm',
      'libnsl',
      'libpthread',
      'libvarnish',
      'libvarnishcompat',
      'libvcl',
      ], [
      'ncurses',
      'varnish',
      ])
1460
    self.assertLibraryList('parts/varnish-2.1/sbin/varnishd', [
1461 1462 1463 1464 1465 1466 1467 1468
      'libc',
      'libdl',
      'libm',
      'libnsl',
      'libpthread',
      'libvarnish',
      'libvarnishcompat',
      'libvcl',
1469 1470 1471 1472
      ], [
      'ncurses',
      'varnish-2.1',
      ])
1473 1474

  def test_ld_varnishtop(self):
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485
    self.assertLibraryList('parts/varnish/bin/varnishtop', [
      'libc',
      'libncurses',
      'libpthread',
      'libvarnish',
      'libvarnishapi',
      'libvarnishcompat',
      ], [
      'ncurses',
      'varnish',
      ])
1486
    self.assertLibraryList('parts/varnish-2.1/bin/varnishtop', [
1487 1488 1489 1490 1491 1492
      'libc',
      'libncurses',
      'libpthread',
      'libvarnish',
      'libvarnishapi',
      'libvarnishcompat',
1493 1494 1495 1496
      ], [
      'ncurses',
      'varnish-2.1',
      ])
1497

1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517
  def test_ld_libvarnish(self):
    self.assertLibraryList('parts/varnish/lib/libvarnish.so', [
      'libc',
      'libm',
      'libnsl',
      'librt',
      ], [
      'ncurses',
      ])
    self.assertLibraryList('parts/varnish-2.1/lib/libvarnish.so', [
      'libc',
      'libm',
      'libnsl',
      'libpcre',
      'librt',
      ], [
      'ncurses',
      'pcre',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544
class AssertLibrsync(AssertSoftwareMixin):
  def test_ld_rdiff(self):
    self.assertLibraryList('parts/librsync/bin/rdiff', [
      'libbz2',
      'libc',
      'libpopt',
      'librsync',
      'libz',
      ], [
      'bzip2',
      'librsync',
      'popt',
      'zlib',
      ])

  def test_ld_librsync(self):
    self.assertLibraryList('parts/librsync/lib/librsync.so', [
      'libbz2',
      'libc',
      'libpopt',
      'libz',
      ], [
      'bzip2',
      'popt',
      'zlib',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1545 1546 1547 1548 1549 1550 1551
class AssertPopt(AssertSoftwareMixin):
  def test_ld_libpopt(self):
    self.assertLibraryList('parts/popt/lib/libpopt.so', [
      'libc',
      ], [
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564
class AssertBzip2(AssertSoftwareMixin):
  def test_ld_bzip2(self):
    self.assertLibraryList('parts/bzip2/bin/bzip2', [
      'libc',
      ], [
      ])

  def test_ld_libbz2(self):
    self.assertLibraryList('parts/bzip2/lib/libbz2.so', [
      'libc',
      ], [
      ])

1565 1566
class AssertPysvn(AssertSoftwareMixin):
  def test_ld_pysvn(self):
1567
    self.assertLibraryList('develop-eggs/%s/pysvn/_pysvn_%s.so' % (
1568
      self.getDevelopEggName('pysvn', '1.7.4nxd006'),
1569
      python_version.replace('.', '_')), [
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581
      'libc',
      'libgcc_s',
      'libm',
      'libresolv',
      'libstdc++',
      'libsvn_client-1',
      'libsvn_diff-1',
      'libsvn_repos-1',
      ], [
      'subversion'
      ])

1582 1583
class AssertLxml(AssertSoftwareMixin):
  def test_ld_etree_so(self):
1584
    egg_name = self.getDevelopEggName('lxml', '2.2.8')
1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600
    python_version_major, python_version_minor = util.sys.version_info[0:2]
    self.assertLibraryList('develop-eggs/%s/lxml/etree.so' % (egg_name), [
      'libc',
      'libexslt',
      'libm',
      'libpthread',
      'libxml2',
      'libxslt',
      'libz',
      ], [
      'libxml2',
      'libxslt',
      'zlib',
      ])

  def test_ld_objectify_so(self):
1601
    egg_name = self.getDevelopEggName('lxml', '2.2.8')
1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616
    python_version_major, python_version_minor = util.sys.version_info[0:2]
    self.assertLibraryList('develop-eggs/%s/lxml/objectify.so' % (egg_name), [
      'libc',
      'libexslt',
      'libm',
      'libpthread',
      'libxml2',
      'libxslt',
      'libz',
      ], [
      'libxml2',
      'libxslt',
      'zlib',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1617 1618 1619 1620 1621 1622 1623 1624
class AssertFile(AssertSoftwareMixin):
  def test_ld_file(self):
    self.assertLibraryList('parts/file/bin/file', [
      'libc',
      'libmagic',
      'libz',
      ], [
      'file',
1625
      'zlib',
Łukasz Nowak's avatar
Łukasz Nowak committed
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635
      ])

  def test_ld_libmagic(self):
    self.assertLibraryList('parts/file/lib/libmagic.so', [
      'libc',
      'libz',
      ], [
      'zlib',
      ])

1636
class AssertImagemagick(AssertSoftwareMixin):
1637
  core_lib_list = [
1638 1639 1640
      'libbz2',
      'libc',
      'libdl',
1641 1642
      'libexpat',
      'libfontconfig',
Łukasz Nowak's avatar
Łukasz Nowak committed
1643
      'libfreetype',
1644 1645 1646
      'libjasper',
      'libjbig',
      'libjpeg',
1647
      'libltdl',
Łukasz Nowak's avatar
Łukasz Nowak committed
1648
      'libm',
1649
      'libpng15',
1650
      'libpthread',
1651
      'libtiff',
1652 1653 1654
      'libz',
      ]

1655
  core_rpath_list = [
1656
      'bzip2',
1657
      'fontconfig',
Łukasz Nowak's avatar
Łukasz Nowak committed
1658
      'freetype',
1659 1660
      'jasper',
      'jbigkit',
1661
      'libexpat',
1662
      'libjpeg',
1663
      'libpng',
1664
      'libtiff',
1665
      'libtool',
Łukasz Nowak's avatar
Łukasz Nowak committed
1666
      'zlib',
1667 1668
      ]

Łukasz Nowak's avatar
Łukasz Nowak committed
1669 1670 1671 1672
  lib_rpath_list = core_rpath_list + [
      'imagemagick',
      ]

1673 1674 1675 1676
  lib_lib_list = core_lib_list + [
      'libMagickCore',
      ]

Łukasz Nowak's avatar
Łukasz Nowak committed
1677 1678
  bin_lib_list = lib_lib_list + [
      'libMagickWand',
1679 1680
      ]

1681 1682
  def test_ld_libMagickCore(self):
    self.assertLibraryList('parts/imagemagick/lib/libMagickCore.so',
1683
      self.core_lib_list, self.core_rpath_list)
1684 1685 1686 1687 1688

  def test_ld_libMagickWand(self):
    self.assertLibraryList('parts/imagemagick/lib/libMagickWand.so',
      self.lib_lib_list, self.lib_rpath_list)

Łukasz Nowak's avatar
Łukasz Nowak committed
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732
  def test_ld_animate(self):
    self.assertLibraryList('parts/imagemagick/bin/animate',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_compare(self):
    self.assertLibraryList('parts/imagemagick/bin/compare',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_composite(self):
    self.assertLibraryList('parts/imagemagick/bin/composite',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_conjure(self):
    self.assertLibraryList('parts/imagemagick/bin/conjure',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_convert(self):
    self.assertLibraryList('parts/imagemagick/bin/convert',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_display(self):
    self.assertLibraryList('parts/imagemagick/bin/display',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_identify(self):
    self.assertLibraryList('parts/imagemagick/bin/identify',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_import(self):
    self.assertLibraryList('parts/imagemagick/bin/import',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_mogrify(self):
    self.assertLibraryList('parts/imagemagick/bin/mogrify',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_montage(self):
    self.assertLibraryList('parts/imagemagick/bin/montage',
      self.bin_lib_list, self.lib_rpath_list)

  def test_ld_stream(self):
    self.assertLibraryList('parts/imagemagick/bin/stream',
      self.bin_lib_list, self.lib_rpath_list)

Łukasz Nowak's avatar
Łukasz Nowak committed
1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743
class AssertJbigkit(AssertSoftwareMixin):
  def test_ld_libjbig(self):
    self.assertLibraryList('parts/jbigkit/lib/libjbig.so',[
      'libc',
      ], [])

  def test_ld_libjbig85(self):
    self.assertLibraryList('parts/jbigkit/lib/libjbig85.so',[
      'libc',
      ], [])

Łukasz Nowak's avatar
Łukasz Nowak committed
1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774
class AssertLibtiff(AssertSoftwareMixin):
  def test_ld_libtiff(self):
    self.assertLibraryList('parts/libtiff/lib/libtiff.so', [
      'libc',
      'libjbig',
      'libjpeg',
      'libm',
      'libz',
      ], [
      'jbigkit',
      'libjpeg',
      'zlib',
      ])

  def test_ld_libtiffxx(self):
    self.assertLibraryList('parts/libtiff/lib/libtiffxx.so', [
      'libc',
      'libgcc_s',
      'libjbig',
      'libjpeg',
      'libm',
      'libstdc++',
      'libtiff',
      'libz',
      ], [
      'jbigkit',
      'libjpeg',
      'libtiff',
      'zlib',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1775 1776 1777 1778 1779 1780
class AssertLibjpeg(AssertSoftwareMixin):
  def test_ld_libjpeg(self):
    self.assertLibraryList('parts/libjpeg/lib/libjpeg.so',[
      'libc',
      ], [])

Łukasz Nowak's avatar
Łukasz Nowak committed
1781
class AssertLibpng(AssertSoftwareMixin):
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797
  def test_ld_libpng12(self):
    self.assertLibraryList('parts/libpng12/lib/libpng12.so',[
      'libc',
      'libm',
      'libz',
      ], [
      'zlib',
      ])
    self.assertLibraryList('parts/libpng12/lib/libpng.so',[
      'libc',
      'libm',
      'libz',
      ], [
      'zlib',
      ])

1798 1799
  def test_ld_libpng15(self):
    self.assertLibraryList('parts/libpng/lib/libpng15.so',[
Łukasz Nowak's avatar
Łukasz Nowak committed
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813
      'libc',
      'libm',
      'libz',
      ], [
      'zlib',
      ])
    self.assertLibraryList('parts/libpng/lib/libpng.so',[
      'libc',
      'libm',
      'libz',
      ], [
      'zlib',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1814 1815 1816 1817 1818 1819 1820 1821 1822 1823
class AssertJasper(AssertSoftwareMixin):
  def test_ld_libjasper(self):
    self.assertLibraryList('parts/jasper/lib/libjasper.so',[
      'libc',
      'libjpeg',
      'libm',
      ], [
      'libjpeg',
      ])

1824 1825 1826 1827 1828 1829 1830 1831 1832
class AssertFreetype(AssertSoftwareMixin):
  def test_ld_libfreetype(self):
    self.assertLibraryList('parts/freetype/lib/libfreetype.so',[
      'libc',
      'libz',
      ], [
      'zlib',
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1833 1834 1835 1836 1837 1838 1839 1840 1841
class AssertGhostscript(AssertSoftwareMixin):
  def test_ld_gs(self):
    self.assertLibraryList('parts/ghostscript/bin/gs',[
      'libc',
      'libdl',
      'libfontconfig',
      'libm',
      'libpthread',
      'libstdc++',
1842
      'libtiff',
Łukasz Nowak's avatar
Łukasz Nowak committed
1843 1844
      ], [
      'fontconfig',
1845 1846
      'libjpeg',
      'libtiff',
Łukasz Nowak's avatar
Łukasz Nowak committed
1847 1848
      ])

Łukasz Nowak's avatar
Łukasz Nowak committed
1849 1850 1851 1852
class AssertFontconfig(AssertSoftwareMixin):
  core_lib_list = [
      'libc',
      'libfreetype',
1853 1854
      'libm',
      'libxml2',
Łukasz Nowak's avatar
Łukasz Nowak committed
1855 1856 1857 1858
      'libz',
      ]
  core_rpath_list = [
      'freetype',
1859
      'libxml2',
Łukasz Nowak's avatar
Łukasz Nowak committed
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893
      'zlib',
      ]

  def test_ld_libfontconfig(self):
    self.assertLibraryList('parts/fontconfig/lib/libfontconfig.so',
        self.core_lib_list, self.core_rpath_list)

  lib_list = core_lib_list + ['libfontconfig']
  rpath_list = core_rpath_list + ['fontconfig']

  def test_ld_fccache(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-cache', self.lib_list,
        self.rpath_list)

  def test_ld_fccat(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-cat', self.lib_list,
        self.rpath_list)

  def test_ld_fclist(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-list', self.lib_list,
        self.rpath_list)

  def test_ld_fcmatch(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-match', self.lib_list,
        self.rpath_list)

  def test_ld_fcquery(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-query', self.lib_list,
        self.rpath_list)

  def test_ld_fcscan(self):
    self.assertLibraryList('parts/fontconfig/bin/fc-scan', self.lib_list,
        self.rpath_list)

Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910
class AssertSphinx(AssertSoftwareMixin):
  core_lib_list = [
      'libc',
      'libexpat',
      'libgcc_s',
      'libm',
      'libmysqlclient',
      'libpthread',
      'librt',
      'libstdc++',
      'libz',
      ]
  core_rpath_list = [
      'libexpat',
      'zlib'
      ]
  core_additional_rpath_list = [
1911
      os.path.join(os.path.abspath(os.curdir), 'parts', 'mariadb', 'lib', 'mysql')
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1912 1913 1914 1915 1916 1917
      ]

  def test_ld_sphinx(self):
    for i in ('indexer', 'indextool', 'search', 'searchd', 'spelldump'):
      self.assertLibraryList('parts/sphinx/bin/%s' % i,
        self.core_lib_list, self.core_rpath_list, self.core_additional_rpath_list)
Łukasz Nowak's avatar
Łukasz Nowak committed
1918

Łukasz Nowak's avatar
Łukasz Nowak committed
1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998
class AssertOpenldap(AssertSoftwareMixin):
  core_lib_list = [
      'libc',
      'libresolv',
      ]

  core_rpath_list = [
      'cyrus-sasl',
      'openssl',
      ]

  lib_lib_list = core_lib_list + [
      'libcrypto',
      'liblber-2.4',
      'libsasl2',
      'libssl',
      ]

  lib_rpath_list = core_rpath_list + [
      'openldap',
      ]

  bin_lib_list = core_lib_list + [
      'libcrypto',
      'libdl',
      'libsasl2',
      'libssl',
      ]

  bin_rpath_list = core_rpath_list

  def test_ld_liblber(self):
    self.assertLibraryList('parts/openldap/lib/liblber.so',
        self.core_lib_list,
        self.core_rpath_list)

  def test_ld_libldap(self):
    self.assertLibraryList('parts/openldap/lib/libldap.so',
      self.lib_lib_list, self.lib_rpath_list)

  def test_ld_libldap_r(self):
    self.assertLibraryList('parts/openldap/lib/libldap_r.so',
      self.lib_lib_list + ['libpthread'], self.lib_rpath_list)

  def test_ld_ldapcompare(self):
    self.assertLibraryList('parts/openldap/bin/ldapcompare',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapdelete(self):
    self.assertLibraryList('parts/openldap/bin/ldapdelete',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapexop(self):
    self.assertLibraryList('parts/openldap/bin/ldapexop',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapmodify(self):
    self.assertLibraryList('parts/openldap/bin/ldapmodify',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapmodrdn(self):
    self.assertLibraryList('parts/openldap/bin/ldapmodrdn',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldappasswd(self):
    self.assertLibraryList('parts/openldap/bin/ldappasswd',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapsearch(self):
    self.assertLibraryList('parts/openldap/bin/ldapsearch',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapurl(self):
    self.assertLibraryList('parts/openldap/bin/ldapurl',
      self.bin_lib_list, self.bin_rpath_list)

  def test_ld_ldapwhoami(self):
    self.assertLibraryList('parts/openldap/bin/ldapwhoami',
      self.bin_lib_list, self.bin_rpath_list)

Łukasz Nowak's avatar
Łukasz Nowak committed
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133
class AssertGlib(AssertSoftwareMixin):
  core_lib_list = [
      'libc',
      'libintl',
      ]

  core_rpath_list = [
      'gettext',
      'zlib',
      ]

  rpath_list = [
      'gettext',
      'glib',
      'zlib',
      ]

  def test_ld_libglib(self):
    self.assertLibraryList('parts/glib/lib/libglib-2.0.so',
        self.core_lib_list, self.core_rpath_list)

  def test_ld_libgmodule(self):
    self.assertLibraryList('parts/glib/lib/libgmodule-2.0.so',
      self.core_lib_list + [
      'libdl',
      'libglib-2.0',
      ], self.rpath_list)

  def test_ld_libgobject(self):
    self.assertLibraryList('parts/glib/lib/libgobject-2.0.so',
      self.core_lib_list + [
      'libglib-2.0',
      'libgthread-2.0',
      'libpthread',
      'librt',
      ], self.rpath_list)

  def test_ld_libgthread(self):
    self.assertLibraryList('parts/glib/lib/libgthread-2.0.so',
      self.core_lib_list + [
      'libglib-2.0',
      'libpthread',
      'librt',
      ], self.rpath_list)

  def test_ld_libgio(self):
    self.assertLibraryList('parts/glib/lib/libgio-2.0.so',
      self.core_lib_list + [
      'libdl',
      'libglib-2.0',
      'libgmodule-2.0',
      'libgobject-2.0',
      'libgthread-2.0',
      'libpthread',
      'libresolv',
      'librt',
      'libz',
      ], self.rpath_list)

  def test_ld_gdbus(self):
    self.assertLibraryList('parts/glib/bin/gdbus',
      self.core_lib_list + [
      'libdl',
      'libgio-2.0',
      'libglib-2.0',
      'libgmodule-2.0',
      'libgobject-2.0',
      'libgthread-2.0',
      'libpthread',
      'libresolv',
      'librt',
      'libz',
      ], self.rpath_list)

  def test_ld_gioquerymodules(self):
    self.assertLibraryList('parts/glib/bin/gio-querymodules',
      self.core_lib_list + [
      'libdl',
      'libgio-2.0',
      'libglib-2.0',
      'libgmodule-2.0',
      'libgobject-2.0',
      'libgthread-2.0',
      'libpthread',
      'libresolv',
      'librt',
      'libz',
      ], self.rpath_list)

  def test_ld_glibcompileschemas(self):
    self.assertLibraryList('parts/glib/bin/glib-compile-schemas',
      self.core_lib_list + [
      'libglib-2.0',
      ], self.rpath_list)

  def test_ld_glibgenmarshal(self):
    self.assertLibraryList('parts/glib/bin/glib-genmarshal',
      self.core_lib_list + [
      'libglib-2.0',
      'libgthread-2.0',
      'libpthread',
      'librt',
      ], self.rpath_list)

  def test_ld_gobjectquery(self):
    self.assertLibraryList('parts/glib/bin/gobject-query',
      self.core_lib_list + [
      'libglib-2.0',
      'libgobject-2.0',
      'libgthread-2.0',
      'libpthread',
      'librt',
      ], self.rpath_list)

  def test_ld_gsettings(self):
    self.assertLibraryList('parts/glib/bin/gsettings',
      self.core_lib_list + [
      'libdl',
      'libgio-2.0',
      'libglib-2.0',
      'libgmodule-2.0',
      'libgobject-2.0',
      'libgthread-2.0',
      'libpthread',
      'libresolv',
      'librt',
      'libz',
      ], self.rpath_list)

  def test_ld_gtester(self):
    self.assertLibraryList('parts/glib/bin/gtester',
      self.core_lib_list + [
      'libglib-2.0',
      ], self.rpath_list)

2134 2135 2136 2137 2138 2139 2140 2141
class AssertLibuuid(AssertSoftwareMixin):
  def test_ld_libuuid(self):
    self.assertLibraryList('parts/libuuid/lib/libuuid.so',
      [
      'libc',
      ],
      [])

Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171
class AssertGraphviz(AssertSoftwareMixin):
  def test_ld_dot(self):
    self.assertLibraryList('parts/graphviz/bin/dot', [
      'libc',
      'libcdt',
      'libdl',
      'libgraph',
      'libgvc',
      'libm',
      'libpathplan',
      'libxdot',
      'libz',
      ], [
      'zlib',
      'graphviz',
      ])
  def test_ld_libgvc(self):
    self.assertLibraryList('parts/graphviz/lib/libgvc.so', [
      'libc',
      'libcdt',
      'libdl',
      'libgraph',
      'libm',
      'libpathplan',
      'libxdot',
      'libz',
      ], [
      'zlib',
      'graphviz',
      ])
2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183
  def test_ld_libgvplugin_gd(self):
    self.assertLibraryList('parts/graphviz/lib/graphviz/libgvplugin_gd.so', [
      'libc',
      'libcdt',
      'libdl',
      'libexpat',
      'libfontconfig',
      'libfreetype',
      'libgvc',
      'libgraph',
      'libm',
      'libpathplan',
2184
      'libpng15',
2185 2186 2187 2188 2189 2190 2191 2192 2193 2194
      'libxdot',
      'libz',
      ], [
      'fontconfig',
      'freetype',
      'graphviz',
      'libexpat',
      'libpng',
      'zlib',
      ])
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2195

Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2196
class AssertPkgconfig(AssertSoftwareMixin):
Kazuhiko Shiozaki's avatar
typo.  
Kazuhiko Shiozaki committed
2197
  def test_ld_pkgconfig(self):
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208
    self.assertLibraryList('parts/pkgconfig/bin/pkg-config', [
      'libc',
      'libglib-2.0',
      'libintl',
      'libpopt',
      ], [
      'gettext',
      'glib',
      'popt',
      ])

Jérome Perrin's avatar
Jérome Perrin committed
2209 2210 2211 2212 2213 2214 2215
class AssertM4(AssertSoftwareMixin):
  def test_ld_pkgconfig(self):
    self.assertLibraryList('parts/m4/bin/m4', [
      'libc',
      ], [
      ])

2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246
class AssertStunnel(AssertSoftwareMixin):
  def test_ld_stunnel(self):
    self.assertLibraryList('parts/stunnel/bin/stunnel', [
      'libc',
      'libcrypto',
      'libdl',
      'libnsl',
      'libpthread',
      'libssl',
      'libutil',
      'libz',
      ], [
      'openssl',
      'zlib',
      ])

  def test_ld_libstunnel(self):
    self.assertLibraryList('parts/stunnel/lib/stunnel/libstunnel.so', [
      'libc',
      'libcrypto',
      'libdl',
      'libnsl',
      'libpthread',
      'libssl',
      'libutil',
      'libz',
      ], [
      'openssl',
      'zlib',
      ])

2247 2248 2249 2250 2251 2252 2253
class AssertPython27(AssertSoftwareMixin):
  # .2 could be read from current buildout
  parts_name = 'rebootstrap.2.parts'
  python_path = parts_name + '/python2.7'
  rpath_list = [
      'bzip2',
      'gdbm',
2254
      'gettext',
2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270
      'ncurses',
      'openssl',
      'readline',
      'sqlite3',
      'zlib',
      ]
  def test_ld_dyn_dbm(self):
    self.assertLibraryList(self.python_path+'/lib/python2.7/lib-dynload/dbm.so', [
      'libc',
      'libgdbm',
      'libgdbm_compat',
      'libpthread',
      ], self.rpath_list)
  def test_ld_dyn_locale(self):
    self.assertLibraryList(self.python_path+'/lib/python2.7/lib-dynload/_locale.so', [
      'libc',
2271
      'libintl',
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297
      'libpthread',
      ], self.rpath_list)
  def test_ld_dyn_readline(self):
    self.assertLibraryList(self.python_path+'/lib/python2.7/lib-dynload/readline.so', [
      'libc',
      'libncursesw',
      'libreadline',
      'libpthread',
      ], self.rpath_list)
  def test_ld_dyn_sqlite3(self):
    self.assertLibraryList(self.python_path+'/lib/python2.7/lib-dynload/_sqlite3.so', [
      'libc',
      'libsqlite3',
      'libpthread',
      ], self.rpath_list)
  def test_ld_dyn_ssl(self):
    self.assertLibraryList(self.python_path+'/lib/python2.7/lib-dynload/_ssl.so', [
      'libc',
      'libssl',
      'libcrypto',
      'libpthread',
      ], self.rpath_list)
  def test_no_failed_ext_lib(self):
    self.assertEquals([],
                      glob(self.python_path+'/lib/python2.7/lib-dynload/*_failed.so'))

2298 2299 2300 2301
# tests for Zope-2.12 buildout only
if python_version >= '2.6':
  class AssertPython26(AssertSoftwareMixin):
    # .1 could be read from current buildout
2302
    parts_name = 'parts'
2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350
    python_path = parts_name + '/python%s' % python_version
    rpath_list = [
        'bzip2',
        'gdbm',
        'gettext',
        'ncurses',
        'openssl',
        'readline',
        'sqlite3',
        'zlib',
        ]
    def test_ld_dyn_dbm(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/dbm.so' % python_version, [
        'libc',
        'libgdbm',
        'libgdbm_compat',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_locale(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/_locale.so' % python_version, [
        'libc',
        'libintl',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_readline(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/readline.so' % python_version, [
        'libc',
        'libncursesw',
        'libreadline',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_sqlite3(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/_sqlite3.so' % python_version, [
        'libc',
        'libsqlite3',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_ssl(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/_ssl.so' % python_version, [
        'libc',
        'libssl',
        'libcrypto',
        'libpthread',
        ], self.rpath_list)
    def test_no_failed_ext_lib(self):
      self.assertEquals([],
                        glob(self.python_path+'/lib/python%s/lib-dynload/*_failed.so' % python_version))

2351 2352 2353 2354
  class AssertItools(AssertSoftwareMixin):
    def test_ld_parserso(self):
      self.assertLibraryList('parts/itools/lib/itools/xml/parser.so', ['libc', 'libglib-2.0', 'libpthread'], ['glib'])

2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402
  class AssertCurl(AssertSoftwareMixin):
    def test_ld_curl(self):
      self.assertLibraryList('parts/curl/bin/curl', [
        'libc',
        'libcurl',
        'librt',
        'libz',
        ], [
        'curl',
        'openssl',
        'zlib',
        ])
    def test_ld_libcurl(self):
      self.assertLibraryList('parts/curl/lib/libcurl.so', [
        'libc',
        'libcrypto',
        'libdl',
        'librt',
        'libssl',
        'libz',
        ], [
        'openssl',
        'zlib',
        ])

  class AssertGit(AssertSoftwareMixin):
    def test_ld_git(self):
      self.assertLibraryList('parts/git/bin/git', [
        'libc',
        'libcrypto',
        'libpthread',
        'libz',
        ], [
        'openssl',
        'zlib',
        ])
    def test_ld_git_http_fetch(self):
      self.assertLibraryList('parts/git/libexec/git-core/git-http-fetch', [
        'libc',
        'libcrypto',
        'libcurl',
        'libpthread',
        'libz',
        ], [
        'curl',
        'openssl',
        'zlib',
        ])
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2403 2404 2405 2406
# tests for Zope-8 buildout only
elif python_version == '2.4':
  class AssertPython24(AssertSoftwareMixin):
    # .1 could be read from current buildout
2407
    parts_name = 'parts'
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434
    python_path = parts_name + '/python%s' % python_version
    rpath_list = [
        'bzip2',
        'gdbm',
        'gettext',
        'ncurses',
        'openssl',
        'readline',
        'sqlite3',
        'zlib',
        ]
    def test_ld_dyn_dbm(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/dbm.so' % python_version, [
        'libc',
        'libgdbm',
        'libgdbm_compat',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_locale(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/_locale.so' % python_version, [
        'libc',
        'libintl',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_readline(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/readline.so' % python_version, [
        'libc',
2435
        'libncursesw',
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448
        'libreadline',
        'libpthread',
        ], self.rpath_list)
    def test_ld_dyn_ssl(self):
      self.assertLibraryList(self.python_path+'/lib/python%s/lib-dynload/_ssl.so' % python_version, [
        'libc',
        'libssl',
        'libcrypto',
        'libpthread',
        ], self.rpath_list)
    def test_no_failed_ext_lib(self):
      self.assertEquals([],
                        glob(self.python_path+'/lib/python%s/lib-dynload/*_failed.so' % python_version))
2449

2450 2451 2452 2453 2454
  class AssertItools(AssertSoftwareMixin):
    def test_ld_parserso(self):
      egg_name = self.getDevelopEggName('itools', '0.20.8')
      self.assertLibraryList('develop-eggs/%s/itools/xml/parser.so' % (egg_name), ['libc', 'libglib-2.0', 'libpthread'], ['glib'])

2455
class AssertElfLinkedInternally(AssertSoftwareMixin):
Rafael Monnerat's avatar
Rafael Monnerat committed
2456
  def test(self):
2457
    result_dict = {}
2458 2459 2460 2461
    parts_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    develop_eggs_dir = os.path.join(os.path.abspath(os.curdir), 'develop-eggs')
    for root in (parts_dir, develop_eggs_dir):
      for dirpath, dirlist, filelist in os.walk(root):
2462 2463 2464 2465 2466

        # stuff in parts/*/share/ will only be static things
        if 'share' in dirpath or '.svn' in dirpath:
          continue

2467 2468 2469 2470
        for filename in filelist:
          # skip some not needed places
          if any([q in dirpath for q in SKIP_PART_LIST]):
            continue
2471 2472 2473 2474 2475 2476 2477 2478

          # we only care about two kind of files:
          # 1. files without extensions
          # 2. .so files
          spl = filename.rsplit('.', 1)
          if len(spl) > 1 and 'so' not in spl:
            continue

2479 2480 2481 2482 2483 2484
          filename = os.path.join(dirpath, filename)
          link_list = readLddInfoList(filename)
          bad_link_list = [q for q in link_list if not q.startswith(parts_dir) \
                            and not any([q.startswith(k) for k in ACCEPTABLE_GLOBAL_LIB_LIST])]
          if len(bad_link_list):
            result_dict[filename] = bad_link_list
2485 2486 2487
    self.assertSoftwareDictEmpty(result_dict)


2488 2489
if __name__ == '__main__':
  unittest.main()