4747 yaml .add_representer (folded_unicode , folded_unicode_representer )
4848 yaml .add_representer (literal_unicode , literal_unicode_representer )
4949
50+ # --------------------------------------------------------------------
51+ class RuntestError (Exception ):
52+ def __init__ (self , message ):
53+ super ().__init__ (message )
54+
5055# --------------------------------------------------------------------
5156@clib .asynccontextmanager
5257async def awaitable (the ):
@@ -172,6 +177,7 @@ def _options():
172177
173178 for test in [x for x in config .sections () if x .startswith ('test-' )]:
174179 scenario = Object ()
180+ scenario .name = test
175181 scenario .args = config .get (test , 'args' ).split ()
176182 scenario .okdirs = config .get (test , 'okdirs' )
177183 scenario .kodirs = config .get (test , 'kodirs' )
@@ -342,8 +348,7 @@ class Gather:
342348 try :
343349 scripts = os .listdir (obj .src )
344350 except OSError as e :
345- logging .warning ("cannot scan `%s': %s" % (obj .src , e ))
346- return []
351+ raise RuntestError (f"cannot scan `{ obj .src } ': { e } " )
347352 scripts = sorted ([x for x in scripts if re .search (r'\.eca?$' , x )])
348353
349354 def config (filename ):
@@ -361,14 +366,24 @@ class Gather:
361366 def for1 (x ):
362367 aout = []
363368 if x .startswith ('!' ):
369+ if not os .path .isdir (x [1 :]):
370+ raise RuntestError (
371+ f"in scenario `{ scenario .name } ', directory `{ x [1 :]} ' does not exist"
372+ )
364373 aout .append (x [1 :])
365374 for root , dnames , _ in os .walk (x [1 :]):
366375 aout .extend ([os .path .join (root , x ) for x in dnames ])
367376 else :
368- aout .extend (glob .glob (x ))
377+ xs = glob .glob (x )
378+ if not xs :
379+ raise RuntestError (
380+ f"in scenario `{ scenario .name } ', no match for `%s'" % x
381+ )
382+ aout .extend (xs )
369383 return aout
370384
371- dirs = [for1 (x ) for x in re .split (r'\s+' , dirs )]
385+ dirs = filter (lambda s : s != "" , re .split (r'\s+' , dirs ))
386+ dirs = [for1 (x ) for x in dirs ]
372387 return list (itertools .chain .from_iterable (dirs ))
373388
374389 dirs = []
@@ -838,7 +853,11 @@ async def _main():
838853 )
839854 exit (1 )
840855
841- allscripts = Gather .gatherall (options .scenarios , options .targets )
856+ try :
857+ allscripts = Gather .gatherall (options .scenarios , options .targets )
858+ except RuntestError as e :
859+ logging .error (e )
860+ exit (2 )
842861
843862 listener = None
844863 if sys .stdout .isatty ():
0 commit comments