summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2020-05-07 23:34:55 -0400
committerMike Gilbert <floppym@gentoo.org>2020-05-07 23:34:55 -0400
commit92957d0a4e66217194d92beb864ef7b9f2c04cbb (patch)
tree46d4f37ab1734607ec27d29903946f41d7e05234
parentprofiles/package.mask: remove rackspace-novaclient related packages (diff)
downloadgentoo-92957d0a.tar.gz
gentoo-92957d0a.tar.bz2
gentoo-92957d0a.zip
net-libs/socket_wrapper: enable unit tests
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
-rw-r--r--net-libs/socket_wrapper/files/1.2.4-tests-pid.patch47
-rw-r--r--net-libs/socket_wrapper/socket_wrapper-1.2.3.ebuild14
2 files changed, 59 insertions, 2 deletions
diff --git a/net-libs/socket_wrapper/files/1.2.4-tests-pid.patch b/net-libs/socket_wrapper/files/1.2.4-tests-pid.patch
new file mode 100644
index 000000000000..49aca70becdf
--- /dev/null
+++ b/net-libs/socket_wrapper/files/1.2.4-tests-pid.patch
@@ -0,0 +1,47 @@
+From a70e32fa9d60adde861618c91618a3be80f07c22 Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Thu, 7 May 2020 23:28:50 -0400
+Subject: [PATCH] tests: do not truncate pid to 16 bits
+
+On Linux, pid_t is a 32-bit type, and the kernel permits pids up to 22
+bits in length.
+
+Signed-off-by: Mike Gilbert <floppym@gentoo.org>
+---
+ tests/torture.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/tests/torture.c b/tests/torture.c
+index e55ebcf..8524138 100644
+--- a/tests/torture.c
++++ b/tests/torture.c
+@@ -255,8 +255,7 @@ void torture_teardown_socket_dir(void **state)
+ void torture_teardown_echo_srv(void **state)
+ {
+ struct torture_state *s = *state;
+- char buf[8] = {0};
+- long int tmp;
++ char buf[11] = {0};
+ ssize_t rc;
+ pid_t pid;
+ int fd;
+@@ -277,13 +276,12 @@ void torture_teardown_echo_srv(void **state)
+
+ buf[sizeof(buf) - 1] = '\0';
+
+- tmp = strtol(buf, NULL, 10);
+- if (tmp == 0 || tmp > 0xFFFF || errno == ERANGE) {
++ errno = 0;
++ pid = strtol(buf, NULL, 10);
++ if (pid == 0 || errno != 0) {
+ goto done;
+ }
+
+- pid = (pid_t)(tmp & 0xFFFF);
+-
+ for (count = 0; count < 10; count++) {
+ /* Make sure the daemon goes away! */
+ kill(pid, SIGTERM);
+--
+2.26.2
+
diff --git a/net-libs/socket_wrapper/socket_wrapper-1.2.3.ebuild b/net-libs/socket_wrapper/socket_wrapper-1.2.3.ebuild
index a34e9de9815d..6f4bafee216f 100644
--- a/net-libs/socket_wrapper/socket_wrapper-1.2.3.ebuild
+++ b/net-libs/socket_wrapper/socket_wrapper-1.2.3.ebuild
@@ -14,5 +14,15 @@ KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ppc ppc64 sparc x86"
IUSE="test"
RESTRICT="!test? ( test )"
-DEPEND=""
-RDEPEND="${DEPEND}"
+BDEPEND="test? ( >=dev-util/cmocka-1.1.0 )"
+
+PATCHES=(
+ "${FILESDIR}"/1.2.4-tests-pid.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DUNIT_TESTING=$(usex test ON OFF)
+ )
+ cmake-multilib_src_configure
+}