summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-10-21 19:52:06 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-21 18:32:58 +0000
commit1556b3ad7d96ff4a54101f6b8fbdc1738da6667e (patch)
tree93c47679a69727c308c80ea53d792f0a7377fc07 /test
parent22674295747965759806231c8e5beb4b1d7fa96a (diff)
classify: tests to support python3
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I8af6ee6e5239f0836978baa063a18a01c610279f
Diffstat (limited to 'test')
-rw-r--r--test/run_tests.py2
-rw-r--r--test/test_classifier_ip6.py15
2 files changed, 12 insertions, 5 deletions
diff --git a/test/run_tests.py b/test/run_tests.py
index e6a182c016b..b6c178f234f 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -760,7 +760,7 @@ if __name__ == '__main__':
% (min_req_shm >> 20))
else:
extra_shm = shm_free - min_req_shm
- shm_max_processes += extra_shm / shm_per_process
+ shm_max_processes += extra_shm // shm_per_process
concurrent_tests = min(cpu_count(), shm_max_processes)
print('Found enough resources to run tests with %s cores'
% concurrent_tests)
diff --git a/test/test_classifier_ip6.py b/test/test_classifier_ip6.py
index ea6adcb713f..0522520d309 100644
--- a/test/test_classifier_ip6.py
+++ b/test/test_classifier_ip6.py
@@ -190,11 +190,18 @@ class TestClassifier(VppTestCase):
:param int dst_port: destination port number "x"
"""
if src_ip:
- src_ip = binascii.hexlify(socket.inet_pton(
- socket.AF_INET6, src_ip))
+ if sys.version_info[0] == 2:
+ src_ip = binascii.hexlify(socket.inet_pton(
+ socket.AF_INET6, src_ip))
+ else:
+ src_ip = socket.inet_pton(socket.AF_INET6, src_ip).hex()
+
if dst_ip:
- dst_ip = binascii.hexlify(socket.inet_pton(
- socket.AF_INET6, dst_ip))
+ if sys.version_info[0] == 2:
+ dst_ip = binascii.hexlify(socket.inet_pton(
+ socket.AF_INET6, dst_ip))
+ else:
+ dst_ip = socket.inet_pton(socket.AF_INET6, dst_ip).hex()
return ('{!s:0>14}{!s:0>34}{!s:0>32}{!s:0>4}{!s:0>4}'.format(
hex(nh)[2:], src_ip, dst_ip, hex(src_port)[2:],