Skip to contentSkip to conversation

scripts/test_list: Create dir if it doesn't exist

PATCH Superseded Bhanuprakash Modem 2 participants 2 messages May 5, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/test_list: Create dir if it doesn't exist

To generate the testlist create the destination dir if it doesn't exist.

---
 scripts/test_list.py | 3 +++
 1 file changed, 3 insertions(+)
scripts/test_list.py +3 -0
index 1c5e195eb..9ae1cd154 100755
@@ -1149,6 +1149,9 @@ class TestList:
             fname = directory + "/" + test_prefix + fname + ".testlist"
             fname = re.sub(r"[\s_]+", "-", fname)
 
+            if not os.path.exists(directory):
+                os.makedirs(directory)
+
             with open(fname, 'w', encoding='utf8') as handler:
                 for sub in test_subtests[test]:
                     handler.write (f"{sub}\n")
Signature · 1 line
2.40.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · On Fri, 5 May 2023 11:44:31 +0530 Bhanuprakash Modem…

To generate the testlist create the destination dir if it doesn't exist.

---
 scripts/test_list.py | 3 +++
 1 file changed, 3 insertions(+)
scripts/test_list.py +0 -0
index 1c5e195eb..9ae1cd154 100755

scripts/test_list.py class TestList: · line 1154

Quoted 6 lines
scripts/test_list.py +3 -0
@@ -1149,6 +1149,9 @@ class TestList:
             fname = directory + "/" + test_prefix + fname + ".testlist"
             fname = re.sub(r"[\s_]+", "-", fname)
 
+            if not os.path.exists(directory):
+                os.makedirs(directory)
+

Don't need to have it inside the for loop, as the directory is the same for all test lists.

After moving it to be before the "for test in test_subtests.keys():" loop:

Regards,
Mauro