@@ -90,6 +90,19 @@ def require_tools(*tools: str) -> None:
9090 raise SystemExit (f"Missing required release tool(s): { ', ' .join (missing )} " )
9191
9292
93+ def bounded_int_env (name : str , default : int , * , minimum : int , maximum : int ) -> str :
94+ value = os .environ .get (name , str (default )).strip ()
95+ try :
96+ parsed = int (value )
97+ except ValueError :
98+ raise SystemExit (f"{ name } must be an integer between { minimum } and { maximum } " ) from None
99+
100+ if not minimum <= parsed <= maximum :
101+ raise SystemExit (f"{ name } must be an integer between { minimum } and { maximum } " )
102+
103+ return str (parsed )
104+
105+
93106def allowed_leak_match (line : str ) -> bool :
94107 return any (allowed in line for allowed in ALLOWED_LEAK_MATCHES )
95108
@@ -424,9 +437,14 @@ def run_build_checks(python: Path) -> None:
424437
425438
426439def run_headless_pipewire_runtime_smoke (python : Path ) -> None :
427- timeout = os .environ .get ("MINI_EQ_HEADLESS_PIPEWIRE_TIMEOUT" , "35" )
428- cycles = os .environ .get ("MINI_EQ_HEADLESS_PIPEWIRE_CYCLES" , "2" )
429- audio_duration = os .environ .get ("MINI_EQ_HEADLESS_PIPEWIRE_AUDIO_DURATION" , "90" )
440+ timeout = bounded_int_env ("MINI_EQ_HEADLESS_PIPEWIRE_TIMEOUT" , 35 , minimum = 1 , maximum = 600 )
441+ cycles = bounded_int_env ("MINI_EQ_HEADLESS_PIPEWIRE_CYCLES" , 2 , minimum = 1 , maximum = 20 )
442+ audio_duration = bounded_int_env (
443+ "MINI_EQ_HEADLESS_PIPEWIRE_AUDIO_DURATION" ,
444+ 90 ,
445+ minimum = 1 ,
446+ maximum = 3600 ,
447+ )
430448 run (
431449 [
432450 python ,
0 commit comments