commit:     d91b6f03ce75a70edb8c8eb95715c304fd19fe3c
Author:     Jakov Smolic <jakov.smolic <AT> sartura <DOT> hr>
AuthorDate: Fri Sep 18 10:41:07 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Oct  7 08:41:26 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d91b6f03

net-vpn/6tunnel: fix tests

Closes: https://bugs.gentoo.org/728610
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Jakov Smolic <jakov.smolic <AT> sartura.hr>
Closes: https://github.com/gentoo/gentoo/pull/17585
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 net-vpn/6tunnel/6tunnel-0.13.ebuild           |  7 +++-
 net-vpn/6tunnel/files/6tunnel-0.13-test.patch | 56 +++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/net-vpn/6tunnel/6tunnel-0.13.ebuild 
b/net-vpn/6tunnel/6tunnel-0.13.ebuild
index 2947248fbba..0719d63523d 100644
--- a/net-vpn/6tunnel/6tunnel-0.13.ebuild
+++ b/net-vpn/6tunnel/6tunnel-0.13.ebuild
@@ -5,9 +5,12 @@ EAPI=7
 
 DESCRIPTION="TCP proxy for applications that don't speak IPv6"
 HOMEPAGE="https://github.com/wojtekka/6tunnel";
-SRC_URI="https://github.com/wojtekka/${PN}/releases/download/${PV}/${P}.tar.gz";
+SRC_URI="https://github.com/wojtekka/6tunnel/releases/download/${PV}/${P}.tar.gz";
 
 LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~s390 ~x86"
-IUSE=""
+
+PATCHES=(
+       "${FILESDIR}/${P}-test.patch"
+)

diff --git a/net-vpn/6tunnel/files/6tunnel-0.13-test.patch 
b/net-vpn/6tunnel/files/6tunnel-0.13-test.patch
new file mode 100644
index 00000000000..1cac66ea73c
--- /dev/null
+++ b/net-vpn/6tunnel/files/6tunnel-0.13-test.patch
@@ -0,0 +1,56 @@
+From 9e4119f03f57eec67b97dddbf09d363b638791dc Mon Sep 17 00:00:00 2001
+From: Wojtek Kaniewski <[email protected]>
+Date: Fri, 18 Sep 2020 20:36:19 +0200
+Subject: [PATCH] Move test script to Python 3
+
+---
+ test.py | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/test.py b/test.py
+index c56feca..4a754bd 100755
+--- a/test.py
++++ b/test.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ import os
+ import socket
+@@ -8,7 +8,7 @@ import select
+ (SUCCESS, COMMAND_FAIL, CONNECT_FAIL, DISCONNECT, ACCEPT_FAIL, DATA_MISMATCH) 
= range(6)
+ labels = ["success", "command fail", "connection fail", "disconnection", 
"accept fail", "data mismatch"]
+ 
+-def test(expect, client_af, server_af, from_ip, to_ip, args="", 
client_sends_first="NICK nick\r\n", server_receives="NICK nick\r\n", 
app_responds="", app_inserts="", server_sends_then=":localhost 001 nick 
:Welcome\r\n"):
++def test(expect, client_af, server_af, from_ip, to_ip, args="", 
client_sends_first=b"NICK nick\r\n", server_receives=b"NICK nick\r\n", 
app_responds=b"", app_inserts=b"", server_sends_then=b":localhost 001 nick 
:Welcome\r\n"):
+     # Open and close a socket to get random port available
+ 
+     client_sock = socket.socket(client_af, socket.SOCK_STREAM, 0)
+@@ -26,7 +26,7 @@ def test(expect, client_af, server_af, from_ip, to_ip, 
args="", client_sends_fir
+     server_port = server_sock.getsockname()[1]
+ 
+     all_args = "-1 %s %d %s %d" % (args, client_port, to_ip, server_port)
+-    print "Running with %s" % all_args
++    print ("Running with %s" % all_args)
+     if os.system("./6tunnel " + all_args) != 0:
+         if expect != COMMAND_FAIL:
+             raise Exception("expected %s yet command failed" % labels[expect])
+@@ -139,11 +139,11 @@ test(COMMAND_FAIL, socket.AF_INET6, socket.AF_INET6, 
'::1', '::1', '-6 -s 127.0.
+ 
+ # Test IRC password options
+ 
+-test(SUCCESS, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-I 
password', app_inserts="PASS password\r\n")
++test(SUCCESS, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-I 
password', app_inserts=b"PASS password\r\n")
+ 
+-test(ACCEPT_FAIL, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first="NICK nick\r\n")
++test(ACCEPT_FAIL, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first=b"NICK nick\r\n")
+ 
+-test(ACCEPT_FAIL, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first="PASS invalid\r\nNICK nick\r\n", 
app_responds=":6tunnel 464 * :Password incorrect\r\n")
++test(ACCEPT_FAIL, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first=b"PASS invalid\r\nNICK nick\r\n", 
app_responds=b":6tunnel 464 * :Password incorrect\r\n")
+ 
+-test(SUCCESS, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first="PASS password\r\nNICK nick\r\n")
++test(SUCCESS, socket.AF_INET, socket.AF_INET6, '127.0.0.1', '::1', '-i 
password', client_sends_first=b"PASS password\r\nNICK nick\r\n")
+ 
+-- 
+2.26.2
+

Reply via email to