Skip to content

Commit 48d4df7

Browse files
committed
Adds failing test for smaps pathnames with whitespace
1 parent b06706c commit 48d4df7

File tree

1 file changed

+36
-0
lines changed
  • lading/src/observer/linux/procfs/memory

1 file changed

+36
-0
lines changed

lading/src/observer/linux/procfs/memory/smaps.rs

+36
Original file line numberDiff line numberDiff line change
@@ -731,4 +731,40 @@ VmFlags: rd ex mr mw me de sd";
731731

732732
let _region = Region::from_str(region).expect("Parsing failed");
733733
}
734+
735+
#[test]
736+
fn test_pathnames_with_whitespace() {
737+
let region =
738+
"7514356d1000-7514356d3000 rw-p 00000000 00:00 0 [anon: glibc: loader malloc]
739+
Size: 8 kB
740+
KernelPageSize: 4 kB
741+
MMUPageSize: 4 kB
742+
Rss: 8 kB
743+
Pss: 8 kB
744+
Pss_Dirty: 8 kB
745+
Shared_Clean: 0 kB
746+
Shared_Dirty: 0 kB
747+
Private_Clean: 0 kB
748+
Private_Dirty: 8 kB
749+
Referenced: 8 kB
750+
Anonymous: 8 kB
751+
KSM: 0 kB
752+
LazyFree: 0 kB
753+
AnonHugePages: 0 kB
754+
ShmemPmdMapped: 0 kB
755+
FilePmdMapped: 0 kB
756+
Shared_Hugetlb: 0 kB
757+
Private_Hugetlb: 0 kB
758+
Swap: 0 kB
759+
SwapPss: 0 kB
760+
Locked: 0 kB
761+
THPeligible: 0
762+
ProtectionKey: 0
763+
VmFlags: rd wr mr mw me ac sd";
764+
let parsed_region = Region::from_str(region).expect("Parsing failed");
765+
766+
assert!(parsed_region
767+
.pathname
768+
.contains("anon: glibc: loader malloc"));
769+
}
734770
}

0 commit comments

Comments
 (0)