]> git.proxmox.com Git - swtpm.git/commitdiff
tests: use send1msg() in place of sendmsg() for older twisted versions
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 29 Sep 2017 23:48:31 +0000 (19:48 -0400)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Sat, 30 Sep 2017 00:03:14 +0000 (20:03 -0400)
Use the send1msg() ot the twisted sendmsg package since sendmsg()
is only supported in more recent versions of twisted.

Following this we also don't need to install a recent version of twisted
via pip on Travis, which runs Ubuntu 14.04.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
.travis.yml
tests/test_setdatafd.py

index 129741dfefaea7fc50569d0ca4f2a7af8877f66c..aba6b3d78794d685db42fd6db3703ceba8f5480d 100644 (file)
@@ -8,8 +8,7 @@ before_install:
 - sudo apt-get -y install pep8
 - pep8 $(find . -type f | grep -E "\.py$")
 - sudo apt-get -y install automake autoconf libtool libssl-dev sed make gawk sed bash
-  dh-exec
-- sudo pip install twisted
+  dh-exec python-twisted
 - git clone https://github.com/stefanberger/libtpms
 - cd libtpms
 - git checkout origin/tpm2-preview.rev146 -b tpm2-preview.rev146
index 114432ab10646f152fe2c345f218e24fd6ac871b..70b4c394d351aefe26645c87219e23647c45e2ed 100755 (executable)
@@ -57,10 +57,10 @@ def test_SetDatafd():
         ctrlfd.connect(sock_path)
         print("Sending data fd over ctrl fd...")
         if sys.version_info[0] < 3:
-            sendmsg.sendmsg(ctrlfd, str(cmd_set_data_fd),
-                            [(socket.SOL_SOCKET,
-                              sendmsg.SCM_RIGHTS,
-                              struct.pack("i", _fd.fileno()))])
+            sendmsg.send1msg(ctrlfd.fileno(), str(cmd_set_data_fd), 0,
+                             [(socket.SOL_SOCKET,
+                               sendmsg.SCM_RIGHTS,
+                               struct.pack("i", _fd.fileno()))])
         else:
             ctrlfd.sendmsg([cmd_set_data_fd],
                            [(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)])