]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Use logdir for config file in wpas_config_file
authorJouni Malinen <j@w1.fi>
Sat, 7 Jan 2017 20:30:50 +0000 (22:30 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 7 Jan 2017 22:10:57 +0000 (00:10 +0200)
This reduces use of /tmp for test case specific dynamically created
files.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_wpas_config.py

index 4110916e740d098aed4b53707b4fa911144f676d..5d2902697ebed7a4d52a21144b81921abf72cfbc 100644 (file)
@@ -40,11 +40,18 @@ def check_config(config):
         raise Exception("Missing ip_addr_end")
     return data
 
-def test_wpas_config_file(dev):
+def test_wpas_config_file(dev, apdev, params):
     """wpa_supplicant config file parsing/writing"""
-    config = "/tmp/test_wpas_config_file.conf"
+    config = os.path.join(params['logdir'], 'wpas_config_file.conf')
     if os.path.exists(config):
-        os.remove(config)
+        try:
+            os.remove(config)
+        except:
+            pass
+        try:
+            os.rmdir(config)
+        except:
+            pass
 
     wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
     try:
@@ -147,14 +154,6 @@ def test_wpas_config_file(dev):
             raise Exception("SAVE_CONFIG (global) succeeded unexpectedly")
 
     finally:
-        try:
-            os.remove(config)
-        except:
-            pass
-        try:
-            os.remove(config + ".tmp")
-        except:
-            pass
         try:
             os.rmdir(config)
         except: