From e83ced9250082be03f848e7ee4ea270e878380c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 24 Dec 2022 16:53:32 +0000 Subject: [PATCH] lib: procfs: add parsing cmd containing newline --- tests/expected/lib/procfs-one-process | 6 ++++++ tests/expected/lib/procfs-stat-nth | 2 ++ tests/ts/lib/procfs | 4 ++++ tests/ts/lib/procfs-data/proc/2/cmdline | Bin 0 -> 10 bytes tests/ts/lib/procfs-data/proc/2/comm | 2 ++ tests/ts/lib/procfs-data/proc/2/stat | 2 ++ 6 files changed, 16 insertions(+) create mode 100644 tests/ts/lib/procfs-data/proc/2/cmdline create mode 100644 tests/ts/lib/procfs-data/proc/2/comm create mode 100644 tests/ts/lib/procfs-data/proc/2/stat diff --git a/tests/expected/lib/procfs-one-process b/tests/expected/lib/procfs-one-process index a8ecf79514..62c89c7209 100644 --- a/tests/expected/lib/procfs-one-process +++ b/tests/expected/lib/procfs-one-process @@ -2,3 +2,9 @@ UID: [redacted] CMDLINE: './test' COMM: 'test' +2 + UID: [redacted] + CMDLINE: './foo +bar' + COMM: 'foo +bar' diff --git a/tests/expected/lib/procfs-stat-nth b/tests/expected/lib/procfs-stat-nth index c6c333ab06..e9d2bab139 100644 --- a/tests/expected/lib/procfs-stat-nth +++ b/tests/expected/lib/procfs-stat-nth @@ -1,2 +1,4 @@ 1: 1th 373850 1: 4th 373752 +2: 1th 1583 +2: 4th 1165 diff --git a/tests/ts/lib/procfs b/tests/ts/lib/procfs index 0d0c812c3b..4f272e80e6 100755 --- a/tests/ts/lib/procfs +++ b/tests/ts/lib/procfs @@ -33,6 +33,7 @@ test_cmd() { ts_init_subtest "one-process" test_cmd --one 1 +test_cmd --one 2 ts_finalize_subtest @@ -44,6 +45,9 @@ test_cmd --stat-nth 1 2 test_cmd --stat-nth 1 3 test_cmd --stat-nth 1 4 +test_cmd --stat-nth 2 1 +test_cmd --stat-nth 2 4 + ts_finalize_subtest ts_finalize diff --git a/tests/ts/lib/procfs-data/proc/2/cmdline b/tests/ts/lib/procfs-data/proc/2/cmdline new file mode 100644 index 0000000000000000000000000000000000000000..5ca4218fd0e31897043de72a903caa33a8bd10ca GIT binary patch literal 10 Rc-qs`Ps`8eN=htZ000mX0^tAv literal 0 Hc-jL100001 diff --git a/tests/ts/lib/procfs-data/proc/2/comm b/tests/ts/lib/procfs-data/proc/2/comm new file mode 100644 index 0000000000..3bd1f0e297 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/2/comm @@ -0,0 +1,2 @@ +foo +bar diff --git a/tests/ts/lib/procfs-data/proc/2/stat b/tests/ts/lib/procfs-data/proc/2/stat new file mode 100644 index 0000000000..250e5791f9 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/2/stat @@ -0,0 +1,2 @@ +1583 (foo +bar) S 1165 1583 1165 34818 1583 4194304 82 0 0 0 0 0 0 0 20 0 1 0 17487 2543616 215 18446744073709551615 93858497511424 93858497511841 140729173273328 0 0 0 0 0 0 1 0 0 17 0 0 0 0 0 0 93858497523152 93858497523752 93858527924224 140729173281886 140729173281896 140729173281896 140729173282798 0 -- 2.47.3