mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
tests: Use python3 compatible range operation
This patch is made by using 2to3 command. $ find . -name *.py | xargs 2to3 -f xrange -w -n Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
35d8c2545e
commit
330f2dd6bb
@ -83,7 +83,7 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
|
|||||||
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr1, tos)
|
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr1, tos)
|
||||||
if send_len is not None:
|
if send_len is not None:
|
||||||
cmd += " len=" + str(send_len)
|
cmd += " len=" + str(send_len)
|
||||||
for i in xrange(broadcast_retry_c):
|
for i in range(broadcast_retry_c):
|
||||||
try:
|
try:
|
||||||
if dev1group:
|
if dev1group:
|
||||||
dev1.group_request(cmd)
|
dev1.group_request(cmd)
|
||||||
@ -135,7 +135,7 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
|
|||||||
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr2, tos)
|
cmd = "DATA_TEST_TX ff:ff:ff:ff:ff:ff {} {}".format(addr2, tos)
|
||||||
if send_len is not None:
|
if send_len is not None:
|
||||||
cmd += " len=" + str(send_len)
|
cmd += " len=" + str(send_len)
|
||||||
for i in xrange(broadcast_retry_c):
|
for i in range(broadcast_retry_c):
|
||||||
try:
|
try:
|
||||||
if dev2group:
|
if dev2group:
|
||||||
dev2.group_request(cmd)
|
dev2.group_request(cmd)
|
||||||
@ -221,7 +221,7 @@ def test_connectivity_p2p_sta(dev1, dev2, dscp=None, tos=None):
|
|||||||
def test_connectivity_sta(dev1, dev2, dscp=None, tos=None):
|
def test_connectivity_sta(dev1, dev2, dscp=None, tos=None):
|
||||||
test_connectivity(dev1, dev2, dscp, tos)
|
test_connectivity(dev1, dev2, dscp, tos)
|
||||||
|
|
||||||
(PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL) = range(4)
|
(PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL) = list(range(4))
|
||||||
|
|
||||||
def set_powersave(dev, val):
|
def set_powersave(dev, val):
|
||||||
phy = dev.get_driver_status_field("phyname")
|
phy = dev.get_driver_status_field("phyname")
|
||||||
|
@ -21,12 +21,12 @@ import os
|
|||||||
TYPE_WWAN,
|
TYPE_WWAN,
|
||||||
TYPE_GPS,
|
TYPE_GPS,
|
||||||
TYPE_FM,
|
TYPE_FM,
|
||||||
TYPE_NFC) = range(9)
|
TYPE_NFC) = list(range(9))
|
||||||
|
|
||||||
(_OP_ADD,
|
(_OP_ADD,
|
||||||
_OP_DEL,
|
_OP_DEL,
|
||||||
_OP_CHANGE,
|
_OP_CHANGE,
|
||||||
_OP_CHANGE_ALL) = range(4)
|
_OP_CHANGE_ALL) = list(range(4))
|
||||||
|
|
||||||
_type_names = {
|
_type_names = {
|
||||||
TYPE_ALL: "all",
|
TYPE_ALL: "all",
|
||||||
|
@ -368,7 +368,7 @@ def test_wmediumd_path_rann(dev, apdev, params):
|
|||||||
raise Exception("No captured data found\n")
|
raise Exception("No captured data found\n")
|
||||||
lines = out.splitlines()
|
lines = out.splitlines()
|
||||||
prev = float(lines[len(lines) - 1])
|
prev = float(lines[len(lines) - 1])
|
||||||
for i in reversed(range(1, len(lines) - 1)):
|
for i in reversed(list(range(1, len(lines) - 1))):
|
||||||
now = float(lines[i])
|
now = float(lines[i])
|
||||||
if prev - now < 1.0 or 3.0 < prev - now:
|
if prev - now < 1.0 or 3.0 < prev - now:
|
||||||
raise Exception("RANN interval " + str(prev - now) +
|
raise Exception("RANN interval " + str(prev - now) +
|
||||||
|
Loading…
Reference in New Issue
Block a user