From ecb069c7bbb85cc5ecd3003384d5b4be0c98f1c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 9 Nov 2010 13:13:04 +0000
Subject: [PATCH]  - check mysql python heavily

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40105 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 buildout/tests/assertSoftware.py | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/buildout/tests/assertSoftware.py b/buildout/tests/assertSoftware.py
index 9fd325ea8d..c6d602450f 100644
--- a/buildout/tests/assertSoftware.py
+++ b/buildout/tests/assertSoftware.py
@@ -202,17 +202,6 @@ class AssertSoftwareRunable(unittest.TestCase):
     self.assertEqual(stderr, '')
     self.assertTrue(stdout.startswith('w3m version w3m/0.5.2'))
 
-  def test_MySQLdb(self):
-    """Checks proper linking to mysql library from MySQLdb egg"""
-    error_list = []
-    for d in os.listdir('develop-eggs'):
-      if d.startswith('MySQL_python'):
-        path = os.path.join('develop-eggs', d, '_mysql.so')
-        if os.system("ldd %s | grep -q 'parts/mysql-tritonn-5.0/lib/my"
-            "sql/libmysqlclient_r.so'" % path) != 0:
-          error_list.append(path)
-    self.assertEqual(error_list, [])
-
 class AssertMysql50Tritonn(unittest.TestCase):
   def test_tritonn_senna(self):
     """Senna as an library"""
@@ -234,6 +223,21 @@ class AssertMemcached(unittest.TestCase):
     self.assertEqual(sorted(expected_rpath_list), elf_dict['rpath_list'])
     self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
 
+class AssertPythonMysql(unittest.TestCase):
+  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
+            software in ['mysql-tritonn-5.0', 'zlib', 'openssl']]
+        self.assertEqual(sorted(expected_rpath_list), elf_dict['rpath_list'])
+        self.assertEqual(sorted(expected_rpath_list), elf_dict['runpath_list'])
+
 class AssertApache(unittest.TestCase):
   """Tests for built apache"""
 
-- 
2.30.9