#!/usr/bin/python
#
-# Copyright (C) 2014 Simo Sorce <simo@redhat.com>
-#
-# see file 'COPYING' for use and warranty information
-#
-# 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 3 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, see <http://www.gnu.org/licenses/>.
+# Copyright (C) 2014 Ipsilon project Contributors, for license see COPYING
import argparse
import inspect
import os
import sys
import subprocess
+import time
import traceback
+from helpers.common import WRAP_HOSTNAME # pylint: disable=relative-import
logger = None
else:
raise ValueError('Socket Wrappers not available')
+ pkgcfg = subprocess.Popen(['pkg-config', '--exists', 'nss_wrapper'])
+ pkgcfg.wait()
+ if pkgcfg.returncode != 0:
+ if wrappers == 'auto':
+ return {}
+ else:
+ raise ValueError('Nss Wrappers not available')
+
wrapdir = os.path.join(base, 'wrapdir')
os.mkdir(wrapdir)
- wenv = {'LD_PRELOAD': 'libsocket_wrapper.so',
+ hosts_file = os.path.join(base, 'hosts')
+ with open(hosts_file, 'w+') as f:
+ f.write('127.0.0.9 %s\n' % WRAP_HOSTNAME)
+
+ wenv = {'LD_PRELOAD': 'libsocket_wrapper.so libnss_wrapper.so',
'SOCKET_WRAPPER_DIR': wrapdir,
- 'SOCKET_WRAPPER_DEFAULT_IFACE': '9'}
+ 'SOCKET_WRAPPER_DEFAULT_IFACE': '9',
+ 'SOCKET_WRAPPER_DEBUGLEVEL': '1',
+ 'NSS_WRAPPER_HOSTNAME': WRAP_HOSTNAME,
+ 'NSS_WRAPPER_HOSTS': hosts_file}
return wenv
env = try_wrappers(test.testdir, args['wrappers'])
env['PYTHONPATH'] = test.rootdir
+ env['TESTDIR'] = test.testdir
try:
test.setup_servers(env)
finally:
test.wait()
+ # Wait until all of the sockets are closed by the OS
+ time.sleep(0.5)
print "FINISHED"