File tree 1 file changed +19
-3
lines changed
src/ethereum_spec_tools/evm_tools/t8n
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 3
3
"""
4
4
5
5
import argparse
6
+ import fnmatch
6
7
import json
7
8
import os
8
9
from functools import partial
@@ -251,10 +252,25 @@ def run_blockchain_test(self) -> None:
251
252
252
253
def run (self ) -> int :
253
254
"""Run the transition and provide the relevant outputs"""
254
- # Clean out files from the output directory
255
+ # Clear files that may have been created in a previous
256
+ # run of the t8n tool.
257
+ # Define the specific files and pattern to delete
258
+ files_to_delete = [
259
+ self .options .output_result ,
260
+ self .options .output_alloc ,
261
+ self .options .output_body ,
262
+ ]
263
+ pattern_to_delete = "trace-*.jsonl"
264
+
265
+ # Iterate through the directory
255
266
for file in os .listdir (self .options .output_basedir ):
256
- if file .endswith (".json" ) or file .endswith (".jsonl" ):
257
- os .remove (os .path .join (self .options .output_basedir , file ))
267
+ file_path = os .path .join (self .options .output_basedir , file )
268
+
269
+ # Check if the file matches the specific names or the pattern
270
+ if file in files_to_delete or fnmatch .fnmatch (
271
+ file , pattern_to_delete
272
+ ):
273
+ os .remove (file_path )
258
274
259
275
try :
260
276
if self .options .state_test :
You can’t perform that action at this time.
0 commit comments