77def check_ps_output (stdout ):
88 """
99 Check that the ps output contains:
10- 1. The header line with PID, TTY, STAT, TIME, COMMAND
11- 2. At least one "mysplit 4" process with T ( stopped) status
10+ 1. The header line (more flexible format checking)
11+ 2. At least one "mysplit 4" process with stopped status (T, T+, Ts, etc.)
1212 3. The shell process itself
1313 """
1414 lines = stdout .strip ().split ("\n " )
@@ -25,25 +25,27 @@ def check_ps_output(stdout):
2525
2626 ps_output = lines [ps_output_start :]
2727
28- # Check header
29- if not ps_output or not re .match (
30- r"\s*PID\s+TTY\s+STAT\s+TIME\s+COMMAND" , ps_output [0 ]
28+ # Check header - more flexible now
29+ if not ps_output or not (
30+ all (col in ps_output [0 ].upper () for col in ["PID" , "TTY" , "STAT" , "TIME" ])
31+ and any (col in ps_output [0 ].upper () for col in ["COMMAND" , "CMD" ])
3132 ):
3233 return False , "Missing or invalid ps output header"
3334
34- # Check for stopped mysplit processes
35+ # Check for stopped mysplit processes - support more status formats
3536 mysplit_stopped = False
3637
3738 for line in ps_output [1 :]: # Skip header
3839 if not line .strip ():
3940 continue
4041
41- # Look for stopped mysplit processes (STAT should be T)
42- if "./mysplit 4" in line and re .search (r"\bT\b" , line ):
42+ # Look for stopped mysplit processes with various stop status indicators
43+ if "./mysplit 4" in line and re .search (r'\b(T|Ts|T\+|STOPPED)\b' , line , re . IGNORECASE ):
4344 mysplit_stopped = True
45+ break
4446
4547 if not mysplit_stopped :
46- return False , "No stopped mysplit processes found (STAT should be T) "
48+ return False , "No stopped mysplit processes found"
4749
4850 return True , "PS output correctly shows stopped processes"
4951
0 commit comments