@@ -59,7 +59,7 @@ def rootify_path(path):
5959 return path
6060
6161def execute (args , test , output_log ):
62- os .environ ["NINEPM_TEST_NAME" ] = test ['name ' ]
62+ os .environ ["NINEPM_TEST_NAME" ] = test ['unix_name ' ]
6363 proc = subprocess .Popen ([test ['case' ]] + args , stdout = subprocess .PIPE )
6464 skip_suite = False
6565 test_skip = False
@@ -133,6 +133,7 @@ def run_onfail(args, test):
133133
134134 onfail = {}
135135 onfail ['case' ] = os .path .join (dirname , test ['onfail' ])
136+ onfail ['unix_name' ] = 'onfail'
136137 onfail ['name' ] = 'onfail'
137138
138139 print ("\n {}Running onfail \" {}\" for test {}{}" . format (pcolor .cyan , test ['onfail' ],
@@ -190,10 +191,17 @@ def run_test(args, test):
190191def prefix_name (name ):
191192 global TEST_CNT
192193 TEST_CNT += 1
193- return str (TEST_CNT ).zfill (4 ) + "-" + name .replace (" " , "-" )
194+ # Normalize name for filesystem safety: replace spaces and remove/replace special chars
195+ normalized = name .lower ().replace (" " , "-" ).replace ("." , "" ).replace ("<" , "" ).replace (">" , "" ).replace ("?" , "" )
196+ return str (TEST_CNT ).zfill (4 ) + "-" + normalized
194197
195- def gen_name (filename ):
196- return prefix_name (os .path .basename (filename ))
198+ def gen_name (filepath ):
199+ return os .path .basename (filepath )
200+
201+ def gen_unix_name (filename ):
202+ base = os .path .basename (filename )
203+ name_without_ext = os .path .splitext (base )[0 ]
204+ return prefix_name (name_without_ext )
197205
198206def gen_outfile (name ):
199207 return os .path .join ("output" , os .path .splitext (name )[0 ] + ".log" )
@@ -242,8 +250,10 @@ def parse_suite(suite_path, parent_suite_path, options, settings, name=None):
242250 suite_dirname = os .path .dirname (suite_path )
243251
244252 if name :
245- suite ['name' ] = prefix_name (name )
253+ suite ['unix_name' ] = prefix_name (name )
254+ suite ['name' ] = name
246255 else :
256+ suite ['unix_name' ] = gen_unix_name (suite_path )
247257 suite ['name' ] = gen_name (suite_path )
248258
249259 if not os .path .isfile (suite_path ):
@@ -276,11 +286,13 @@ def parse_suite(suite_path, parent_suite_path, options, settings, name=None):
276286 case = {}
277287
278288 if 'name' in entry :
279- case ['name' ] = prefix_name (entry ['name' ])
289+ case ['unix_name' ] = prefix_name (entry ['name' ])
290+ case ['name' ] = entry ['name' ]
280291 else :
292+ case ['unix_name' ] = gen_unix_name (entry ['case' ])
281293 case ['name' ] = gen_name (entry ['case' ])
282294
283- case ['outfile' ] = gen_outfile (case ['name ' ])
295+ case ['outfile' ] = gen_outfile (case ['unix_name ' ])
284296
285297 if 'opts' in entry :
286298 opts = [o .replace ('<base>' , suite_dirname ) for o in entry ['opts' ]]
@@ -330,7 +342,7 @@ def write_report_result_tree(file, includes, data, depth):
330342 string += f"{ stars } "
331343 string += f" { resultfmt (test )} "
332344 if 'outfile' in test :
333- string += f" <<output-{ test ['name ' ]} ,{ test ['name' ]} >>"
345+ string += f" <<output-{ test ['unix_name ' ]} ,{ test ['name' ]} >>"
334346 else :
335347 string += f" { test ['name' ]} "
336348
@@ -359,7 +371,7 @@ def write_report_output(file, data, depth, is_first=True):
359371 file .write ("\n <<<\n " )
360372
361373 # Test heading is always from 'name:' in the suite file
362- file .write (f"\n [[output-{ test ['name ' ]} ]]\n " )
374+ file .write (f"\n [[output-{ test ['unix_name ' ]} ]]\n " )
363375 file .write (f"\n === { resultfmt (test )} { test ['name' ]} \n " )
364376
365377 # Skip headnig from test spec.
@@ -787,9 +799,10 @@ def create_base_suite(args):
787799 suite ['suite' ].append (parse_suite (fpath , "command-line" , args .option , {}))
788800 else :
789801 test = {}
790- test ['case' ] = fpath
802+ test ['case' ] = fpath
803+ test ['unix_name' ] = gen_unix_name (filename )
791804 test ['name' ] = gen_name (filename )
792- test ['outfile' ] = gen_outfile (test ['name ' ])
805+ test ['outfile' ] = gen_outfile (test ['unix_name ' ])
793806
794807 if args .option :
795808 test ["options" ] = args .option
0 commit comments