From 37df1775addfd74dbaf1261a975d17e8434cb6a7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 4 Feb 2019 16:46:31 +0200 Subject: [PATCH] tests: Read sigma_dut-ap.conf as binary data for python3 compatibility Sending UTF-8 encoded data to logger file is currently not working properly, so create a separate binary file with a copy of sigma_dut-ap.conf instead to work with both python2 and python3. Signed-off-by: Jouni Malinen --- tests/hwsim/test_sigma_dut.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_sigma_dut.py b/tests/hwsim/test_sigma_dut.py index d4f416ecb..716d1be7d 100644 --- a/tests/hwsim/test_sigma_dut.py +++ b/tests/hwsim/test_sigma_dut.py @@ -2618,6 +2618,8 @@ def test_sigma_dut_ap_hs20(dev, apdev, params): """sigma_dut controlled AP with Hotspot 2.0 parameters""" logdir = os.path.join(params['logdir'], "sigma_dut_ap_hs20.sigma-hostapd") + conffile = os.path.join(params['logdir'], + "sigma_dut_ap_hs20.sigma-conf") with HWSimRadio() as (radio, iface): sigma = start_sigma_dut(iface, hostapd_logdir=logdir, debug=True) try: @@ -2636,8 +2638,9 @@ def test_sigma_dut_ap_hs20(dev, apdev, params): sigma_dut_cmd_check("ap_set_hs2,NAME,AP,WLAN_TAG,2,OSU,1") sigma_dut_cmd_check("ap_config_commit,NAME,AP") - with open("/tmp/sigma_dut-ap.conf", "r") as f: - logger.debug("hostapd.conf from sigma_dut:\n" + f.read()) + with open("/tmp/sigma_dut-ap.conf", "rb") as f: + with open(conffile, "wb") as f2: + f2.write(f.read()) sigma_dut_cmd_check("ap_reset_default") finally: