]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Read sigma_dut-ap.conf as binary data for python3 compatibility
authorJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 14:46:31 +0000 (16:46 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 4 Feb 2019 14:46:31 +0000 (16:46 +0200)
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 <j@w1.fi>
tests/hwsim/test_sigma_dut.py

index d4f416ecbe38f9aa923865217fed408ce55f7753..716d1be7d4e679b4aa38c85226e9da53c1956bec 100644 (file)
@@ -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: