[Erp5-report] r40092 luke - /erp5/trunk/buildout/tests/assertSoftware.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Nov 9 13:43:52 CET 2010
Author: luke
Date: Tue Nov 9 13:43:51 2010
New Revision: 40092
URL: http://svn.erp5.org?rev=40092&view=rev
Log:
- start to use readelf to check ELF files
Modified:
erp5/trunk/buildout/tests/assertSoftware.py
Modified: erp5/trunk/buildout/tests/assertSoftware.py
URL: http://svn.erp5.org/erp5/trunk/buildout/tests/assertSoftware.py?rev=40092&r1=40091&r2=40092&view=diff
==============================================================================
--- erp5/trunk/buildout/tests/assertSoftware.py [utf8] (original)
+++ erp5/trunk/buildout/tests/assertSoftware.py [utf8] Tue Nov 9 13:43:51 2010
@@ -12,6 +12,27 @@ def createCleanList(s):
"""
return sorted([q.strip() for q in s.split() if len(q.strip()) > 0])
+def readElfAsDict(f):
+ """Reads ELF information from file"""
+ popen = subprocess.Popen(['readelf', '-d', f], stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ result = popen.communicate()[0]
+ if popen.returncode != 0:
+ return False
+ library_list = []
+ for l in result.split('\n'):
+ if '(NEEDED)' in l:
+ library_list.append(l.split(':')[1].strip(' []'))
+ elif '(RPATH)' in l:
+ rpath_list = l.split(':',1)[1].strip(' []').split(':')
+ elif '(RUNPATH)' in l:
+ runpath_list = l.split(':',1)[1].strip(' []').split(':')
+ return dict(
+ library_list=library_list,
+ rpath_list=rpath_list,
+ runpath_list=runpath_list
+ )
+
class AssertPythonSoftware(unittest.TestCase):
"""Asserts that python related software is in good shape."""
@@ -186,6 +207,14 @@ class AssertMysql50Tritonn(unittest.Test
class AssertApache(unittest.TestCase):
"""Tests for built apache"""
+ def test_ld_libaprutil1(self):
+ """Checks proper linking"""
+ elf_dict = readElfAsDict('parts/apache/lib/libaprutil-1.so')
+ for lib in ['libexpat', 'libapr-1', 'librt',
+ 'libcrypt', 'libpthread', 'libdl', 'libc']:
+ self.assertEqual(1, len([q for q in elf_dict['library_list'] if
+ q.startswith(lib+'.')]), 'No %r found' % lib)
+
def test_modules(self):
"""Checks for availability of apache modules"""
required_module_list = createCleanList("""
More information about the Erp5-report
mailing list