@ -103,6 +103,16 @@ def test_top_apps_versionsnummer_als_dateiname_nutzt_comm(tmp_path: Path):
assert top_apps ( 5 , tmp_path ) == [ App ( " claude " , 500 * 1024 ) ]
def test_top_apps_abgeschnittenes_utf8_in_comm_und_status ( tmp_path : Path ) :
# Der Kernel kürzt comm byteweise auf 15 Bytes – auch mitten in einem Umlaut
make_proc ( tmp_path , 1 , exe = None , comm = None , rss_kb = 100 )
( tmp_path / " 1 " / " comm " ) . write_bytes ( b " abcdefghijklmn \xc3 \n " )
( tmp_path / " 1 " / " status " ) . write_bytes ( b " Name: \t abcdefghijklmn \xc3 \n VmRSS: \t 100 kB \n " )
apps = top_apps ( 5 , tmp_path )
assert [ a . size for a in apps ] == [ 100 * 1024 ]
assert apps [ 0 ] . name . startswith ( " abcdefghijklmn " )
def test_top_apps_ueberspringt_kernel_threads_und_verschwundene ( tmp_path : Path ) :
# Kernel-Thread: kein exe, leeres smaps_rollup, kein VmRSS
make_proc ( tmp_path , 2 , exe = None , comm = " kworker/0:1 " , smaps_text = " " )