tests: Decode Popen() output values for python3
Explicit conversion to str is needed here for python3 compatibility. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
45b0b88f80
commit
04fa9fc7fd
6 changed files with 18 additions and 17 deletions
|
@ -4224,7 +4224,7 @@ def ica_ocsp(cert, md="-sha256"):
|
|||
"-cert", cert, "-no_nonce", "-text" ]
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
res = cmd.stdout.read() + "\n" + cmd.stderr.read()
|
||||
res = cmd.stdout.read().decode() + "\n" + cmd.stderr.read().decode()
|
||||
cmd.stdout.close()
|
||||
cmd.stderr.close()
|
||||
cmd.wait()
|
||||
|
@ -4241,7 +4241,7 @@ def ica_ocsp(cert, md="-sha256"):
|
|||
"-text" ]
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
res = cmd.stdout.read() + "\n" + cmd.stderr.read()
|
||||
res = cmd.stdout.read().decode() + "\n" + cmd.stderr.read().decode()
|
||||
cmd.stdout.close()
|
||||
cmd.stderr.close()
|
||||
cmd.wait()
|
||||
|
@ -6028,7 +6028,7 @@ def test_ap_wpa2_eap_sim_db(dev, apdev, params):
|
|||
cmd = subprocess.Popen(['../../hostapd/hlr_auc_gw',
|
||||
'-m', fname, data],
|
||||
stdout=subprocess.PIPE)
|
||||
res = cmd.stdout.read().strip()
|
||||
res = cmd.stdout.read().decode().strip()
|
||||
cmd.stdout.close()
|
||||
logger.debug("hlr_auc_gw response: " + res)
|
||||
socket.sendto(res, self.client_address)
|
||||
|
@ -6465,7 +6465,7 @@ def test_ap_wpa2_eap_psk_mac_addr_change(dev, apdev):
|
|||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
|
||||
cmd = subprocess.Popen(['ps', '-eo', 'pid,command'], stdout=subprocess.PIPE)
|
||||
res = cmd.stdout.read()
|
||||
res = cmd.stdout.read().decode()
|
||||
cmd.stdout.close()
|
||||
pid = 0
|
||||
for p in res.splitlines():
|
||||
|
|
|
@ -4564,7 +4564,7 @@ def send_arp(dev, dst_ll="ff:ff:ff:ff:ff:ff", src_ll=None, opcode=1,
|
|||
|
||||
def get_permanent_neighbors(ifname):
|
||||
cmd = subprocess.Popen(['ip', 'nei'], stdout=subprocess.PIPE)
|
||||
res = cmd.stdout.read()
|
||||
res = cmd.stdout.read().decode()
|
||||
cmd.stdout.close()
|
||||
return [ line for line in res.splitlines() if "PERMANENT" in line and ifname in line ]
|
||||
|
||||
|
@ -4678,13 +4678,13 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
|
|||
time.sleep(0.1)
|
||||
|
||||
brcmd = subprocess.Popen(['brctl', 'show'], stdout=subprocess.PIPE)
|
||||
res = brcmd.stdout.read()
|
||||
res = brcmd.stdout.read().decode()
|
||||
brcmd.stdout.close()
|
||||
logger.info("Bridge setup: " + res)
|
||||
|
||||
brcmd = subprocess.Popen(['brctl', 'showstp', 'ap-br0'],
|
||||
stdout=subprocess.PIPE)
|
||||
res = brcmd.stdout.read()
|
||||
res = brcmd.stdout.read().decode()
|
||||
brcmd.stdout.close()
|
||||
logger.info("Bridge showstp: " + res)
|
||||
|
||||
|
@ -4873,7 +4873,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
|
|||
if ebtables:
|
||||
cmd = subprocess.Popen(['ebtables', '-L', '--Lc'],
|
||||
stdout=subprocess.PIPE)
|
||||
res = cmd.stdout.read()
|
||||
res = cmd.stdout.read().decode()
|
||||
cmd.stdout.close()
|
||||
logger.info("ebtables results:\n" + res)
|
||||
|
||||
|
@ -5024,13 +5024,13 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
|
|||
time.sleep(0.1)
|
||||
|
||||
brcmd = subprocess.Popen(['brctl', 'show'], stdout=subprocess.PIPE)
|
||||
res = brcmd.stdout.read()
|
||||
res = brcmd.stdout.read().decode()
|
||||
brcmd.stdout.close()
|
||||
logger.info("Bridge setup: " + res)
|
||||
|
||||
brcmd = subprocess.Popen(['brctl', 'showstp', 'ap-br0'],
|
||||
stdout=subprocess.PIPE)
|
||||
res = brcmd.stdout.read()
|
||||
res = brcmd.stdout.read().decode()
|
||||
brcmd.stdout.close()
|
||||
logger.info("Bridge showstp: " + res)
|
||||
|
||||
|
@ -5130,7 +5130,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
|
|||
if ebtables:
|
||||
cmd = subprocess.Popen(['ebtables', '-L', '--Lc'],
|
||||
stdout=subprocess.PIPE)
|
||||
res = cmd.stdout.read()
|
||||
res = cmd.stdout.read().decode()
|
||||
cmd.stdout.close()
|
||||
logger.info("ebtables results:\n" + res)
|
||||
|
||||
|
|
|
@ -3905,7 +3905,7 @@ def test_ap_wps_wpa_cli_action(dev, apdev, test_params):
|
|||
|
||||
arg = [ 'ps', 'ax' ]
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
|
||||
out = cmd.communicate()[0]
|
||||
out = cmd.communicate()[0].decode()
|
||||
cmd.wait()
|
||||
logger.debug("Processes:\n" + out)
|
||||
if "wpa_cli -P %s -B -i %s" % (pidfile, dev[0].ifname) not in out:
|
||||
|
@ -3931,7 +3931,7 @@ def test_ap_wps_wpa_cli_action(dev, apdev, test_params):
|
|||
|
||||
arg = [ 'ps', 'ax' ]
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
|
||||
out = cmd.communicate()[0]
|
||||
out = cmd.communicate()[0].decode()
|
||||
cmd.wait()
|
||||
logger.debug("Remaining processes:\n" + out)
|
||||
if "wpa_cli -P %s -B -i %s" % (pidfile, dev[0].ifname) in out:
|
||||
|
|
|
@ -5280,8 +5280,8 @@ def run_busctl(service, obj):
|
|||
cmd.wait()
|
||||
logger.info("busctl stdout:\n%s" % out[0].strip())
|
||||
if len(out[1]) > 0:
|
||||
logger.info("busctl stderr: %s" % out[1].strip())
|
||||
if "Duplicate property" in out[1]:
|
||||
logger.info("busctl stderr: %s" % out[1].decode().strip())
|
||||
if "Duplicate property" in out[1].decode():
|
||||
raise Exception("Duplicate property")
|
||||
|
||||
def test_dbus_introspect_busctl(dev, apdev):
|
||||
|
|
|
@ -1617,7 +1617,7 @@ def test_wpas_ctrl_wait(dev, apdev, test_params):
|
|||
prg = '../../wpa_supplicant/wpa_supplicant'
|
||||
arg = [ prg ]
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE)
|
||||
out = cmd.communicate()[0]
|
||||
out = cmd.communicate()[0].decode()
|
||||
cmd.wait()
|
||||
tracing = "Linux tracing" in out
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ def _test_mesh_open_rssi_threshold(dev, apdev, value, expected):
|
|||
|
||||
cmd = subprocess.Popen([ "iw", "dev", dev[0].ifname, "get", "mesh_param",
|
||||
"mesh_rssi_threshold" ], stdout=subprocess.PIPE)
|
||||
mesh_rssi_threshold = int(cmd.stdout.read().split(" ")[0])
|
||||
mesh_rssi_threshold = int(cmd.stdout.read().decode().split(" ")[0])
|
||||
|
||||
dev[0].mesh_group_remove()
|
||||
check_mesh_group_removed(dev[0])
|
||||
|
@ -1181,6 +1181,7 @@ def _test_mesh_open_vht_160(dev, apdev):
|
|||
reg = cmd.stdout.read()
|
||||
found = False
|
||||
for entry in reg.splitlines():
|
||||
entry = entry.decode()
|
||||
if "@ 160)" in entry and "DFS" not in entry:
|
||||
found = True
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue