On 07/09/2012 01:06 PM, Cleber Rosa wrote: > On 07/05/2012 02:47 PM, Lucas Meneghel Rodrigues wrote: >> On Thu, Jul 5, 2012 at 2:03 PM, lei yang <yanglei.f...@gmail.com> wrote: >>> On Fri, Jul 6, 2012 at 12:33 AM, Qingtang Zhou <qz...@redhat.com> wrote: >>>> * On 2012-07-06 00:12:43 +0800, lei yang (yanglei.f...@gmail.com) wrote: >>>>> Hi list, >>>>> >>>>> some of my tests met below issue,seems a python2.7 issue, >>>>> >>>>> File "/autotest/client/virt/kvm_vm.py", line 2133, in migrate >>>>> self.send_fd(fd_src, mig_fd_name) >>>>> File "/autotest/client/shared/error.py", line 138, in new_fn >>>>> return fn(*args, **kwargs) >>>>> File "/autotest/client/virt/kvm_vm.py", line 2046, in send_fd >>>>> self.monitor.cmd("getfd %s" % (fd_name), fd=fd) >>>>> File "/autotest/client/virt/kvm_monitor.py", line 324, in cmd >>>>> self._passfd = virt_passfd_setup.import_passfd() >>>>> File "/autotest/client/virt/virt_passfd_setup.py", line 41, in >>>>> import_passfd >>>>> passfd_setup() >>>>> File "/autotest/client/virt/virt_passfd_setup.py", line 28, in >>>>> passfd_setup >>>>> objects = c.compile(SOURCES, include_dirs=[PYTHON_HEADERS], >>>>> extra_postargs=['-fPIC']) >>>>> File "/usr/lib64/python2.7/distutils/ccompiler.py", line 624, in >>>>> compile >>>>> self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) >>>>> File "/usr/lib64/python2.7/distutils/unixccompiler.py", line 180, >>>>> in _compile >>>>> raise CompileError, msg >>>>> CompileError: command 'cc' failed with exit status 1 >>>>> >>>>> you can reproduce it with "migrate.with_blkdebug.fd" test cases >>>>> how could I handle this, any workaround? >> What happens here is the following: Code necessary to pass around file >> descriptors from the test to qemu needs a custom c extension, that has >> to be compiled on demand and it's shipped under client/virt/passfd.c, >> if I recall correctly. If there's no c compiler/some compiler error >> while trying to compile the code, this error will be thrown. > ^ Being the one to blame for this code, I just want to ACK this > explanation by Lucas. > >> So, it's likely that you don't have a compiler in the test machine. If >> you can't afford to have a working toolchain in the host, then you >> have to skip this test. > ^ Yes, no way around it. Either have a compiler and Python header > files, or skip the test. Whenever we move to Python 3k, this code will > be dropped.
BTW, I did attempt to write a sendmsg() function using ctypes + libc, but it was not really straightforward because of the data structures layout. If anyone feels braver than myself, here's my initial draft: import os import sys if (sys.version_info[0] == 2 and sys.version_info[1] >= 5): import ctypes def get_libc(): libc_paths = ['/lib/libc.so.6', ] for lib_path in libc_paths: if os.path.exists(lib_path): return ctypes.cdll.LoadLibrary(lib_path) # # Original iovec structure # # struct iovec # { # void *iov_base; /* Pointer to data. */ # size_t iov_len; /* Length of data. */ # }; class iovec(ctypes.Structure): _fields_ = [("iov_base", ctypes.c_void_p), ("iov_len", ctypes.c_uint)] # # Original msgh structure # # struct msghdr # { # void *msg_name; /* Address to send to/receive from. */ # socklen_t msg_namelen; /* Length of address data. */ # struct iovec *msg_iov; /* Vector of data to send/receive into. */ # size_t msg_iovlen; /* Number of elements in the vector. */ # void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ # size_t msg_controllen; /* Ancillary data buffer length. # !! The type should be socklen_t but the # definition of the kernel is incompatible # with this. */ # int msg_flags; /* Flags on received message. */ # }; class msghdr(ctypes.Structure): _fields_ = [("msg_name", ctypes.c_void_p), ("msg_namelen", ctypes.c_uint), ("msg_iov", ctypes.POINTER(iovec)), ("msg_iovlen", ctypes.c_uint), ("msg_control", ctypes.c_void_p), ("msg_controllen", ctypes.c_uint)] if __name__ == '__main__': libc = get_libc() sendmsg = libc.sendmsg > >> Let me know what works out for you, >> >> Lucas >> > > _______________________________________________ > Autotest mailing list > Autotest@test.kernel.org > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest