assertSoftware.py 80.1 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 32
import unittest

33 34 35 36 37 38 39 40 41 42
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

43 44 45
# List of libraries which are acceptable to be linked in globally
ACCEPTABLE_GLOBAL_LIB_LIST = (
  # 32 bit Linux
46 47
	'/usr/lib/libstdc++.so',
 	'/lib/libgcc_s.so',
48 49 50 51 52 53 54
  '/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
55
  '/lib/libresolv.so',
56
  '/lib/librt.so',
57 58
  '/lib/libutil.so',
  # 64 bit Linux
59 60
	'/lib64/libgcc_s.so',
	'/usr/lib64/libstdc++.so',
61 62 63 64 65 66 67
  '/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
68
  '/lib64/libresolv.so',
69
  '/lib64/librt.so',
70 71 72 73 74
  '/lib64/libutil.so',
  # Arch independed Linux
  'linux-vdso.so',
)

75 76 77 78 79
SKIP_PART_LIST = (
  'parts/boost-lib-download',
  'parts/openoffice-bin',
  'parts/openoffice-bin__unpack__',
)
80

81 82
def readElfAsDict(f):
  """Reads ELF information from file"""
83 84
  popen = subprocess.Popen(['readelf', '-d', os.path.join(*f.split('/'))],
      stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
85 86
  result = popen.communicate()[0]
  if popen.returncode != 0:
Łukasz Nowak's avatar
Łukasz Nowak committed
87
    raise AssertionError(result)
88
  library_list = []
89 90
  rpath_list = []
  runpath_list = []
91 92
  for l in result.split('\n'):
    if '(NEEDED)' in l:
Łukasz Nowak's avatar
Łukasz Nowak committed
93
      library_list.append(l.split(':')[1].strip(' []').split('.so')[0])
94
    elif '(RPATH)' in l:
95
      rpath_list = [q.rstrip('/') for q in l.split(':',1)[1].strip(' []').split(':')]
96
    elif '(RUNPATH)' in l:
97
      runpath_list = [q.rstrip('/') for q in l.split(':',1)[1].strip(' []').split(':')]
98 99
  if len(runpath_list) == 0:
    runpath_list = rpath_list
100 101
  elif len(rpath_list) != 0 and runpath_list != rpath_list:
    raise ValueError('RPATH and RUNPATH are different.')
102
  return dict(
Łukasz Nowak's avatar
Łukasz Nowak committed
103 104
    library_list=sorted(library_list),
    runpath_list=sorted(runpath_list)
105 106
  )

107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
def readLddInfoList(f):
  popen = subprocess.Popen(['ldd', f], stdout=subprocess.PIPE,
      stderr=subprocess.STDOUT)
  link_list = []
  a = link_list.append
  result = popen.communicate()[0]
  if 'not a dynamic executable' in result:
    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)
127 128
    elif 'warning: you do not have execution permission for' in line:
      pass
Łukasz Nowak's avatar
Łukasz Nowak committed
129 130 131
    elif 'No such file or directory' in line:
      # ignore broken links
      pass
132 133 134 135 136
    elif line:
      # /lib64/ld-linux-x86-64.so.2 (0x00007f77fd400000)
      a(line.split()[0])
  return link_list

137 138 139 140 141
class AssertSoftwareMixin(unittest.TestCase):
  def assertEqual(self, first, second, msg=None):
    try:
      return unittest.TestCase.assertEqual(self, first, second, msg=msg)
    except unittest.TestCase.failureException:
142
      if isinstance(first, list) and \
143
          isinstance(second, list):
144
        err = ''
145 146
        for elt in first:
          if elt not in second:
147
            err += '- %s\n' % elt
148 149
        for elt in second:
          if elt not in first:
150 151
            err += '+ %s\n' % elt
        if err == '':
152 153
          raise
        else:
154 155 156 157
          if msg:
            msg = '%s: Lists are different:\n%s' % (msg, err)
          else:
            msg = 'Lists are different:\n%s' % err
158 159 160 161
          raise unittest.TestCase.failureException, msg
      else:
        raise

162 163 164 165 166 167 168 169 170 171 172 173 174 175
  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

176
class AssertSoftwareRunable(AssertSoftwareMixin):
177 178 179 180 181 182 183 184 185 186 187 188
  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'))

189 190 191 192 193 194
  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 ('))

195 196 197 198 199 200 201 202 203 204 205 206 207
  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'))

  def test_Flare(self):
    stdout, stderr = subprocess.Popen(["parts/flare/bin/flarei", "-v"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
    self.assertTrue(stdout.startswith('flare'))

208
  def test_rdiff_backup(self):
209 210
    stdout, stderr = subprocess.Popen(["bin/rdiff-backup", "-V"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
211 212 213
    self.assertEqual(stderr, '')
    self.assertEqual(stdout.strip(), 'rdiff-backup 1.0.5')

214 215 216 217 218 219 220 221 222 223 224 225
  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)

226 227 228 229 230 231
  def test_w3m(self):
    stdout, stderr = subprocess.Popen(["parts/w3m/bin/w3m", "-V"],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
    self.assertEqual(stderr, '')
    self.assertTrue(stdout.startswith('w3m version w3m/0.5.2'))

232
class AssertMysql50Tritonn(AssertSoftwareMixin):
233 234
  def test_ld_mysqld(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/libexec/mysqld')
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libdl',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'librt',
      'libsenna',
      'libssl',
      'libstdc++',
      'libz',
      ]), elf_dict['library_list'])
250 251
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
252 253 254 255 256 257 258
        software in [
          'ncurses',
          'openssl',
          'readline',
          'senna',
          'zlib',
          ]]
259 260 261 262
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqlmanager(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/libexec/mysqlmanager')
263 264 265 266 267 268 269 270 271 272 273 274
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'libssl',
      'libstdc++',
      'libz',
      ]),
275 276 277
      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
278 279 280 281 282 283
        software in [
          'ncurses',
          'zlib',
          'readline',
          'openssl',
          ]]
284
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
285

286 287
  def test_ld_libmysqlclient_r(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/lib/mysql/libmysqlclient_r.so')
288 289 290 291 292 293 294 295 296 297
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libm',
      'libnsl',
      'libpthread',
      'libssl',
      'libz',
      ]),
298 299 300
      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
301 302 303 304 305 306
        software in [
          'ncurses',
          'openssl',
          'readline',
          'zlib',
          ]]
307 308 309 310
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libmysqlclient(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/lib/mysql/libmysqlclient.so')
311 312 313 314 315 316 317 318 319
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libm',
      'libnsl',
      'libssl',
      'libz',
      ]),
320 321 322
      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
323 324 325 326 327 328
        software in [
          'ncurses',
          'openssl',
          'readline',
          'zlib',
          ]]
329 330 331 332
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_sphinx(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/lib/mysql/sphinx.so')
333 334 335 336 337 338 339 340 341
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libgcc_s',
      'libm',
      'libnsl',
      'libpthread',
      'libstdc++',
      ]),
342 343 344
      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
345 346 347 348 349 350
        software in [
          'ncurses',
          'openssl',
          'readline',
          'zlib',
          ]]
351 352
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

353 354
  def test_ld_mysql(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/bin/mysql')
355 356 357 358 359 360 361 362 363 364 365 366 367 368
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libmysqlclient',
      'libncurses',
      'libnsl',
      'libreadline',
      'libssl',
      'libstdc++',
      'libz',
      ]), elf_dict['library_list'])
369 370
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
371 372 373 374 375 376
        software in [
          'ncurses',
          'zlib',
          'readline',
          'openssl',
          ]]
377 378
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql'))
379 380 381 382
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqladmin(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/bin/mysqladmin')
383 384 385 386 387 388 389 390 391 392 393 394
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libcrypto',
      'libgcc_s',
      'libm',
      'libmysqlclient',
      'libnsl',
      'libssl',
      'libstdc++',
      'libz',
      ]), elf_dict['library_list'])
395 396
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
397 398 399 400 401 402
        software in [
          'ncurses',
          'openssl',
          'readline',
          'zlib',
          ]]
403 404 405 406 407 408 409 410 411 412 413 414 415
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql'))
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqldump(self):
    elf_dict = readElfAsDict('parts/mysql-tritonn-5.0/bin/mysqldump')
    self.assertEqual(sorted(['libc', 'libcrypt', 'libcrypto', 'libm',
      'libmysqlclient', 'libnsl', 'libssl', 'libz']), 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
        software in ['ncurses', 'zlib', 'readline', 'openssl']]
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-tritonn-5.0', 'lib', 'mysql'))
416 417
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

418
class AssertMysql51(AssertSoftwareMixin):
419 420
  def test_ld_mysqld(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/libexec/mysqld')
421 422
    self.assertEqual(sorted(['libc', 'libcrypt', 'libdl', 'libgcc_s', 'libm', 'libnsl',
      'libpthread', 'libstdc++', 'libz']), elf_dict['library_list'])
423 424 425 426 427 428 429 430
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
        software in ['ncurses', 'zlib', 'readline']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqlmanager(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/libexec/mysqlmanager')
    self.assertEqual(sorted(['libc', 'libcrypt', 'libgcc_s', 'libm', 'libnsl',
431
      'libpthread', 'libstdc++', 'libz']), elf_dict['library_list'])
432 433 434 435 436 437 438
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
        software in ['ncurses', 'zlib', 'readline']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libmysqlclient_r(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/lib/mysql/libmysqlclient_r.so')
439
    self.assertEqual(sorted(['libc', 'libz', 'libcrypt', 'libm', 'libnsl', 'libpthread']),
440 441 442
      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
443
        software in ['ncurses', 'zlib', 'readline']]
444 445 446 447
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libmysqlclient(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/lib/mysql/libmysqlclient.so')
448
    self.assertEqual(sorted(['libc', 'libz', 'libcrypt', 'libm', 'libnsl', 'libpthread']),
449 450 451
      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
452 453 454 455 456 457
        software in ['ncurses', 'readline', 'zlib']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysql(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/bin/mysql')
    self.assertEqual(sorted(['libc', 'libz', 'libcrypt', 'libgcc_s', 'libm',
458
      'libmysqlclient', 'libncurses', 'libnsl', 'libpthread', 'libreadline',
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
      'libstdc++']), 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
        software in ['ncurses', 'zlib', 'readline']]
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-5.1', 'lib', 'mysql'))
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqladmin(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/bin/mysqladmin')
    self.assertEqual(sorted(['libc', 'libz', 'libcrypt', 'libgcc_s', 'libm',
      'libmysqlclient', 'libnsl', 'libpthread', 'libstdc++']),
      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
        software in ['ncurses', 'zlib', 'readline']]
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-5.1', 'lib', 'mysql'))
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_mysqldump(self):
    elf_dict = readElfAsDict('parts/mysql-5.1/bin/mysqldump')
    self.assertEqual(sorted(['libc', 'libz', 'libcrypt', 'libm', 'libmysqlclient',
      'libnsl', 'libpthread']), 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
        software in ['ncurses', 'zlib', 'readline']]
    expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir),
      'parts', 'mysql-5.1', 'lib', 'mysql'))
488 489
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

Łukasz Nowak's avatar
Łukasz Nowak committed
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
class AssertSqlite3(AssertSoftwareMixin):
  """Tests for built memcached"""

  def test_ld_bin_sqlite3(self):
    elf_dict = readElfAsDict('parts/sqlite3/bin/sqlite3')
    self.assertEqual(sorted(['libpthread', 'libc', 'libdl', 'libsqlite3']),
        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
        software in ['sqlite3']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsqlite3(self):
    elf_dict = readElfAsDict('parts/sqlite3/lib/libsqlite3.so')
    self.assertEqual(sorted(['libpthread', 'libc', 'libdl']),
        elf_dict['library_list'])
    self.assertEqual([], elf_dict['runpath_list'])

508
class AssertMemcached(AssertSoftwareMixin):
509 510 511
  """Tests for built memcached"""

  def test_ld_memcached(self):
512
    """Checks proper linking to libevent from memcached"""
513 514 515 516 517 518 519
    elf_dict = readElfAsDict('parts/memcached/bin/memcached')
    self.assertEqual(sorted(['libpthread', 'libevent-1.4', 'libc']),
        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
        software in ['libevent']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
520

521 522 523 524 525 526 527
class AssertSubversion(AssertSoftwareMixin):
  """Tests for built subversion"""
  def test_ld_svn(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svn')
    self.assertEqual(sorted(['libsvn_client-1', 'libsvn_wc-1', 'libsvn_ra-1',
      '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',
528
      'libsvn_delta-1', 'libsvn_subr-1', 'libsqlite3', 'libxml2',
529
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
530
      'libz', 'libssl', 'libcrypto', 'libsvn_ra_neon-1',
531
      'libc', 'libcrypt', 'libdl', 'libm',
532
      'libpthread', 'libneon'
533 534 535 536
      ]),
        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
537
        software in ['apache', 'libexpat', 'openssl', 'neon', 'libxml2',
538
                     'sqlite3', 'subversion', 'zlib', 'libuuid']]
539 540 541 542 543 544 545 546 547 548 549 550
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svnadmin(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svnadmin')
    self.assertEqual(sorted(['libsvn_repos-1', 'libsvn_fs-1',
      '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',
      ]),
        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
551 552
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
Łukasz Nowak's avatar
Łukasz Nowak committed
553 554 555 556 557 558 559 560 561 562 563 564
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svndumpfilter(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svndumpfilter')
    self.assertEqual(sorted(['libsvn_repos-1', 'libsvn_fs-1',
      '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',
      ]),
        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
565 566
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
Łukasz Nowak's avatar
Łukasz Nowak committed
567 568 569 570 571 572 573 574 575 576 577 578
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svnlook(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svnlook')
    self.assertEqual(sorted(['libsvn_repos-1', 'libsvn_fs-1', 'libsvn_diff-1',
      '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',
      ]),
        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
579 580
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
Łukasz Nowak's avatar
Łukasz Nowak committed
581 582 583 584 585 586 587 588 589 590 591 592
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svnserve(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svnserve')
    self.assertEqual(sorted(['libsvn_repos-1', 'libsvn_fs-1', 'libsvn_ra_svn-1',
      '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',
      ]),
        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
593 594
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
Łukasz Nowak's avatar
Łukasz Nowak committed
595 596 597 598
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svnsync(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svnsync')
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625
    self.assertEqual(sorted([
      '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',
Łukasz Nowak's avatar
Łukasz Nowak committed
626 627 628 629
      ]),
        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
630 631 632 633 634 635 636 637 638 639 640
        software in [
          'apache',
          'libexpat',
          'libuuid',
          'libxml2',
          'neon',
          'openssl',
          'sqlite3',
          'subversion',
          'zlib',
          ]]
Łukasz Nowak's avatar
Łukasz Nowak committed
641 642 643 644 645 646 647 648 649 650 651 652
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_svnversion(self):
    elf_dict = readElfAsDict('parts/subversion/bin/svnversion')
    self.assertEqual(sorted(['libsvn_diff-1', 'libsvn_wc-1',
      'libsvn_delta-1', 'libsvn_subr-1', 'libsqlite3',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libz', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
653 654
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
655 656 657 658 659 660 661 662 663 664 665 666
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_client(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_client-1.so')
    self.assertEqual(sorted(['libsvn_diff-1', 'libsvn_wc-1',
      'libsvn_delta-1', 'libsvn_subr-1', 'libsvn_ra-1',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
667 668
        software in ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
          'libuuid', 'neon']]
669 670 671 672 673 674 675 676 677 678 679 680
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_delta(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_delta-1.so')
    self.assertEqual(sorted([
      'libsvn_subr-1', 'libz',
      'libaprutil-1', 'libapr-1', 'libuuid', 'librt', 'libexpat',
      'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
681 682
        software in ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
          'libuuid', 'neon']]
683 684 685 686 687 688 689 690 691 692 693
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_diff(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_diff-1.so')
    self.assertEqual(sorted([
      'libsvn_subr-1', 'libaprutil-1', 'libapr-1', 'libuuid', 'librt',
      'libexpat', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
694 695
        software in ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
          'libuuid', 'neon']]
696 697 698 699
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_fs(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_fs-1.so')
700 701 702 703 704 705 706 707 708 709 710 711
    self.assertEqual(sorted([
      'libapr-1',
      'libc',
      'libcrypt',
      'libdl',
      'libpthread',
      'librt',
      'libsvn_delta-1',
      'libsvn_fs_fs-1',
      'libsvn_fs_util-1',
      'libsvn_subr-1',
      'libuuid',
712 713 714 715
      ]),
        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
716 717 718 719 720 721 722 723
        software in [
          'apache',
          'libuuid',
          'neon',
          'sqlite3',
          'subversion',
          'zlib',
          ]]
724 725 726 727 728 729 730 731 732 733 734
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_fs_fs(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_fs_fs-1.so')
    self.assertEqual(sorted(['libsvn_delta-1', 'libaprutil-1', 'libexpat',
      'libsvn_fs_util-1', 'libsvn_subr-1', 'libapr-1', 'libuuid', 'librt',
      'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
735 736
        software in ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
          'libuuid', 'neon']]
737 738 739 740 741 742 743 744 745 746 747
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_fs_util(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_fs_util-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libexpat',
      'libsvn_subr-1', 'libapr-1', 'libuuid', 'librt',
      'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
748 749
        software in ['apache', 'libexpat', 'sqlite3', 'subversion', 'zlib',
          'libuuid', 'neon']]
750 751 752 753 754
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_ra(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_ra-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libsvn_delta-1', 'libsvn_fs-1',
755
      'libsvn_ra_local-1', 'libsvn_ra_neon-1', 'libsvn_ra_svn-1',
756 757 758 759 760 761
      'libsvn_repos-1', 'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
762 763
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
764 765 766 767 768 769 770 771 772 773 774
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_ra_local(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_ra_local-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libsvn_delta-1', 'libsvn_fs-1',
      'libsvn_repos-1', 'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
775 776
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
777 778
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

779 780
  def test_ld_libsvn_ra_neon(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_ra_neon-1.so')
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
    self.assertEqual(sorted([
      'libapr-1',
      'libaprutil-1',
      'libc',
      'libcrypt',
      'libcrypto',
      'libdl',
      'libexpat',
      'libm',
      'libneon',
      'libpthread',
      'librt',
      'libssl',
      'libsvn_delta-1',
      'libsvn_subr-1',
      'libuuid',
      'libxml2',
798
      'libz',
799 800 801 802
      ]),
        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
803 804 805 806 807 808 809 810 811 812 813
        software in [
          'apache',
          'libexpat',
          'libuuid',
          'libxml2',
          'neon',
          'openssl',
          'sqlite3',
          'subversion',
          'zlib',
          ]]
814 815 816 817 818 819 820 821 822 823 824
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_ra_svn(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_ra_svn-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libsvn_delta-1',
      'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
825 826
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
827 828 829 830 831 832 833 834 835 836 837
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_repos(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_repos-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libsvn_delta-1',
      'libexpat', 'libsvn_subr-1', 'libapr-1', 'libuuid', 'libsvn_fs-1',
      'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
838 839
        software in ['apache', 'libexpat',
                     'sqlite3', 'subversion', 'zlib', 'libuuid', 'neon']]
840 841 842 843 844 845 846 847 848 849 850
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_subr(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_subr-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libexpat', 'libapr-1',
      'libuuid', 'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      'libsqlite3', 'libz',
      ]),
        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
851 852
        software in ['apache', 'libexpat',
                     'sqlite3', 'zlib', 'libuuid', 'neon']]
853 854 855 856 857 858 859 860 861 862 863
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_libsvn_wc(self):
    elf_dict = readElfAsDict('parts/subversion/lib/libsvn_wc-1.so')
    self.assertEqual(sorted(['libaprutil-1', 'libexpat', 'libapr-1',
      'libsvn_delta-1', 'libsvn_diff-1', 'libsvn_subr-1',
      'libuuid', 'librt', 'libc', 'libcrypt', 'libdl', 'libpthread',
      ]),
        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
864 865
        software in ['apache', 'libexpat', 'subversion',
                     'sqlite3', 'zlib', 'libuuid', 'neon']]
866 867
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

868 869 870 871
class AssertNeon(AssertSoftwareMixin):
  """Tests for built neon"""
  def test_ld_libneon(self):
    elf_dict = readElfAsDict('parts/neon/lib/libneon.so')
872
    self.assertEqual(sorted([
Łukasz Nowak's avatar
Łukasz Nowak committed
873 874 875 876 877 878 879
      'libc',
      'libcrypto',
      'libdl',
      'libm',
      'libssl',
      'libxml2',
      'libz',
880 881 882 883
      ]),
        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
Łukasz Nowak's avatar
Łukasz Nowak committed
884 885 886 887 888
        software in [
          'libxml2',
          'openssl',
          'zlib',
          ]]
889 890
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
  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 (
          '-Wl,-rpath',
          '-lcrypto',
          '-ldl',
          '-lm',
          '-lneon',
          '-lpthread',
          '-lssl',
          '-lxml2',
          '-lz',
          ):
        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)

924
class AssertPythonMysql(AssertSoftwareMixin):
925 926 927 928 929 930 931 932 933 934
  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)
        self.assertEqual(sorted(['libc', 'libcrypt', 'libcrypto', 'libm',
          'libmysqlclient_r', 'libnsl', 'libpthread', 'libssl', 'libz']),
          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
935 936
            software in ['zlib', 'openssl']]
        expected_rpath_list.append(os.path.join(os.path.abspath(os.curdir), 'parts', 'mysql-tritonn-5.0', 'lib', 'mysql'))
937
        self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
938

939
class AssertApache(AssertSoftwareMixin):
Łukasz Nowak's avatar
Łukasz Nowak committed
940
  """Tests for built apache"""
941

942
  def test_ld_libaprutil1(self):
943
    """Checks proper linking of libaprutil-1.so"""
944
    elf_dict = readElfAsDict('parts/apache/lib/libaprutil-1.so')
Łukasz Nowak's avatar
Łukasz Nowak committed
945
    self.assertEqual(sorted(['libexpat', 'libapr-1', 'librt', 'libcrypt',
946
      'libpthread', 'libdl', 'libc', 'libuuid']), elf_dict['library_list'])
Łukasz Nowak's avatar
Łukasz Nowak committed
947 948
    soft_dir = os.path.join(os.path.abspath(os.curdir), 'parts')
    expected_rpath_list = [os.path.join(soft_dir, software, 'lib') for
949
        software in ['apache', 'zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
Łukasz Nowak's avatar
Łukasz Nowak committed
950
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
951

952 953 954
  def test_ld_libapr1(self):
    """Checks proper linking of libapr-1.so"""
    elf_dict = readElfAsDict('parts/apache/lib/libapr-1.so')
955
    self.assertEqual(sorted(['librt', 'libcrypt', 'libuuid',
956 957 958
      'libpthread', 'libdl', 'libc']), 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
959
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
960 961
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

962
  def test_modules(self):
963
    required_module_list = sorted([q.strip() for q in """
Łukasz Nowak's avatar
Łukasz Nowak committed
964 965 966 967 968
      actions_module
      alias_module
      asis_module
      auth_basic_module
      auth_digest_module
969
      authn_alias_module
Łukasz Nowak's avatar
Łukasz Nowak committed
970
      authn_anon_module
971
      authn_dbd_module
Łukasz Nowak's avatar
Łukasz Nowak committed
972 973 974
      authn_dbm_module
      authn_default_module
      authn_file_module
975
      authz_dbm_module
Łukasz Nowak's avatar
Łukasz Nowak committed
976 977 978 979
      authz_default_module
      authz_groupfile_module
      authz_host_module
      authz_owner_module
980
      authz_svn_module
Łukasz Nowak's avatar
Łukasz Nowak committed
981 982 983 984
      authz_user_module
      autoindex_module
      bucketeer_module
      cache_module
985
      case_filter_in_module
Łukasz Nowak's avatar
Łukasz Nowak committed
986 987 988 989 990
      case_filter_module
      cern_meta_module
      cgi_module
      cgid_module
      charset_lite_module
991 992 993 994 995
      core_module
      dav_fs_module
      dav_module
      dav_svn_module
      dbd_module
Łukasz Nowak's avatar
Łukasz Nowak committed
996 997 998 999 1000 1001 1002 1003 1004 1005
      deflate_module
      dir_module
      disk_cache_module
      dumpio_module
      echo_module
      env_module
      expires_module
      ext_filter_module
      filter_module
      headers_module
1006
      http_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1007
      ident_module
1008 1009 1010
      imagemap_module
      include_module
      info_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1011 1012 1013
      log_config_module
      log_forensic_module
      logio_module
1014 1015
      mime_magic_module
      mime_module
1016
      mpm_prefork_module
1017 1018 1019 1020
      negotiation_module
      optional_fn_export_module
      optional_fn_import_module
      optional_hook_export_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1021
      optional_hook_import_module
1022
      proxy_ajp_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1023 1024
      proxy_balancer_module
      proxy_connect_module
1025
      proxy_ftp_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1026 1027
      proxy_http_module
      proxy_module
1028 1029
      proxy_scgi_module
      reqtimeout_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1030 1031
      rewrite_module
      setenvif_module
1032
      so_module
1033
      speling_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1034 1035 1036 1037
      ssl_module
      status_module
      substitute_module
      unique_id_module
1038
      userdir_module
Łukasz Nowak's avatar
Łukasz Nowak committed
1039 1040 1041
      usertrack_module
      version_module
      vhost_alias_module
1042 1043 1044 1045 1046 1047 1048
    """.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')])
    self.assertEqual(loaded_module_list, required_module_list)
1049

1050 1051 1052 1053 1054 1055 1056 1057
  def test_ld_module_mod_actions(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_actions.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

Łukasz Nowak's avatar
Łukasz Nowak committed
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 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
  def test_ld_module_mod_alias(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_alias.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_asis(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_asis.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_auth_basic(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_auth_basic.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_auth_digest(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_auth_digest.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_alias(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_alias.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_anon(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_anon.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_dbd(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_dbd.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_dbm(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_dbm.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_default(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_default.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authn_file(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authn_file.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_dbm(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_dbm.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_default(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_default.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_groupfile(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_groupfile.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_host(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_host.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_owner(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_owner.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_authz_user(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_authz_user.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_autoindex(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_autoindex.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_bucketeer(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_bucketeer.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_cache(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_cache.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_case_filter(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_case_filter.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_case_filter_in(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_case_filter_in.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_cern_meta(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_cern_meta.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_cgi(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_cgi.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_cgid(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_cgid.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_charset_lite(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_charset_lite.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_dav(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_dav.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_dav_fs(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_dav_fs.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

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 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 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 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627
  def test_ld_module_mod_dbd(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_dbd.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_deflate(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_deflate.so')
    self.assertEqual(sorted(['libpthread', 'libc', 'libz']),
        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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_dir(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_dir.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_disk_cache(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_disk_cache.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_dumpio(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_dumpio.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_echo(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_echo.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_env(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_env.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_expires(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_expires.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_ext_filter(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_ext_filter.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_filter(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_filter.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_headers(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_headers.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_ident(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_ident.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_imagemap(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_imagemap.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_include(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_include.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_info(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_info.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_log_config(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_log_config.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_log_forensic(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_log_forensic.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_logio(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_logio.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_mime(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_mime.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_mime_magic(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_mime_magic.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_negotiation(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_negotiation.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_optional_fn_export(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_optional_fn_export.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_optional_fn_import(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_optional_fn_import.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_optional_hook_export(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_optional_hook_export.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_optional_hook_import(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_optional_hook_import.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_ajp(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_ajp.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_balancer(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_balancer.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_connect(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_connect.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_ftp(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_ftp.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_http(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_http.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_proxy_scgi(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_proxy_scgi.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_reqtimeout(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_reqtimeout.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_rewrite(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_rewrite.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_setenvif(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_setenvif.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_speling(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_speling.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_ssl(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_ssl.so')
    self.assertEqual(sorted(['libpthread', 'libc', 'libcrypto', 'libdl',
      'libssl', 'libz']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_status(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_status.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_substitute(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_substitute.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_unique_id(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_unique_id.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_userdir(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_userdir.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_usertrack(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_usertrack.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_version(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_version.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_module_mod_vhost_alias(self):
    elf_dict = readElfAsDict('parts/apache/modules/mod_vhost_alias.so')
    self.assertEqual(sorted(['libpthread', 'libc']), 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
        software in ['zlib', 'openssl', 'libuuid', 'libexpat', 'pcre']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1628
class AssertItools(AssertSoftwareMixin):
1629 1630 1631 1632 1633 1634 1635 1636 1637
  def test_ld_parserso(self):
    elf_dict = readElfAsDict('parts/itools/lib/itools/xml/parser.so')
    self.assertEqual(sorted(['libc', 'libglib-2.0', 'libpthread']),
        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
        software in ['glib']]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1638
class AssertOpenssl(AssertSoftwareMixin):
Łukasz Nowak's avatar
Łukasz Nowak committed
1639
  def test_ld_openssl(self):
1640
    elf_dict = readElfAsDict('parts/openssl/bin/openssl')
1641
    self.assertEqual(sorted(['libc', 'libcrypto', 'libdl', 'libssl']),
1642 1643 1644
        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
1645
        software in ['openssl']]
1646 1647
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1648
class AssertCyrusSasl(AssertSoftwareMixin):
1649 1650
  def test_ld_pluginviewer(self):
    elf_dict = readElfAsDict('parts/cyrus-sasl/sbin/pluginviewer')
1651 1652 1653 1654
    self.assertEqual(sorted([
      'libc',
      'libdl',
      'libresolv',
1655
      'libsasl2',
1656 1657 1658 1659 1660
      ]),
        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
        software in [
1661 1662
          'cyrus-sasl',
          'zlib',
1663 1664 1665
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1666 1667
  def test_ld_libsasl2(self):
    elf_dict = readElfAsDict('parts/cyrus-sasl/lib/libsasl2.so')
1668 1669
    self.assertEqual(sorted([
      'libc',
1670
      'libdl',
1671 1672 1673 1674 1675 1676 1677 1678 1679
      'libresolv',
      ]),
        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
        software in [
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1680 1681
  def test_ld_sasl2_libanonymous(self):
    elf_dict = readElfAsDict('parts/cyrus-sasl/lib/sasl2/libanonymous.so')
1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692
    self.assertEqual(sorted([
      'libc',
      'libresolv',
      ]),
        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
        software in [
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1693 1694
  def test_ld_sasl2_libcrammd5(self):
    elf_dict = readElfAsDict('parts/cyrus-sasl/lib/sasl2/libcrammd5.so')
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
    self.assertEqual(sorted([
      'libc',
      'libresolv',
      ]),
        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
        software in [
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_sasl2_libplain(self):
    elf_dict = readElfAsDict('parts/cyrus-sasl/lib/sasl2/libplain.so')
    self.assertEqual(sorted([
      'libc',
      'libcrypt',
      'libresolv',
      ]),
        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
        software in [
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742
class AssertPython26(AssertSoftwareMixin):
  def test_ld_dyn_locale(self):
    elf_dict = readElfAsDict('parts/python2.6/lib/python2.6/lib-dynload/_locale.so')
    self.assertEqual(sorted([
      'libc',
      'libintl',
      'libpthread',
      ]),
        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
        software in [
          'bzip2',
          'gdbm',
          'gettext',
          'libdb',
          'ncurses',
          'openssl',
          'readline',
          'sqlite3',
          'zlib',
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
1743

Łukasz Nowak's avatar
Łukasz Nowak committed
1744 1745 1746 1747 1748 1749 1750 1751 1752 1753
class AssertGettext(AssertSoftwareMixin):
  def test_ld_libintl(self):
    elf_dict = readElfAsDict('parts/gettext/lib/libintl.so')
    self.assertEqual(sorted([
      'libc',
      ]),
        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
        software in [
1754
          'libxml2',
Łukasz Nowak's avatar
Łukasz Nowak committed
1755 1756 1757
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1758
class AssertLibxslt(AssertSoftwareMixin):
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1759
  def test_ld_xsltproc(self):
1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
    elf_dict = readElfAsDict('parts/libxslt/bin/xsltproc')
    self.assertEqual(sorted([
      'libc',
      'libdl',
      'libexslt',
      'libm',
      'libxml2',
      'libxslt',
      'libz',
      ]),
        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
        software in [
          'libxml2',
          'libxslt',
          'zlib',
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

class AssertW3m(AssertSoftwareMixin):
Kazuhiko Shiozaki's avatar
Kazuhiko Shiozaki committed
1781
  def test_ld_w3m(self):
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804
    elf_dict = readElfAsDict('parts/w3m/bin/w3m')
    self.assertEqual(sorted([
      'libc',
      'libdl',
      'libcrypto',
      'libgc',
      'libm',
      'libncurses',
      'libnsl',
      'libpthread',
      'libssl',
      ]),
        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
        software in [
          'garbage-collector',
          'ncurses',
          'openssl',
          'zlib',
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845
class AssertVarnish(AssertSoftwareMixin):
  def test_ld_varnishd(self):
    elf_dict = readElfAsDict('parts/varnish-2.1/sbin/varnishd')
    self.assertEqual(sorted([
      'libc',
      'libdl',
      'libm',
      'libnsl',
      'libpthread',
      'libvarnish',
      'libvarnishcompat',
      'libvcl',
      ]),
        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
        software in [
          'ncurses',
          'varnish-2.1',
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

  def test_ld_varnishtop(self):
    elf_dict = readElfAsDict('parts/varnish-2.1/bin/varnishtop')
    self.assertEqual(sorted([
      'libc',
      'libncurses',
      'libpthread',
      'libvarnish',
      'libvarnishapi',
      'libvarnishcompat',
      ]),
        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
        software in [
          'ncurses',
          'varnish-2.1',
          ]]
    self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])

1846 1847
class AssertElfLinkedInternally(AssertSoftwareMixin):
  def test(self):
Łukasz Nowak's avatar
Łukasz Nowak committed
1848
    return
1849 1850 1851 1852
    result_dict = {}
    root = os.path.join(os.path.abspath(os.curdir), 'parts')
    for dirpath, dirlist, filelist in os.walk(root):
      for filename in filelist:
1853 1854 1855
        # skip some not needed places
        if any([q in dirpath for q in SKIP_PART_LIST]):
          continue
1856 1857 1858 1859 1860 1861 1862 1863 1864
        filename = os.path.join(dirpath, filename)
        link_list = readLddInfoList(filename)
        bad_link_list = [q for q in link_list if not q.startswith(root) \
                          and not any([q.startswith(k) for k in ACCEPTABLE_GLOBAL_LIB_LIST])]
        if len(bad_link_list):
          result_dict[filename] = bad_link_list
    self.assertSoftwareDictEmpty(result_dict)


1865 1866
if __name__ == '__main__':
  unittest.main()