diff options
Diffstat (limited to 'tests/ts/lib')
-rwxr-xr-x | tests/ts/lib/procfs | 57 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/1/cmdline | bin | 0 -> 7 bytes | |||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/1/comm | 1 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/1/stat | 1 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/2/cmdline | bin | 0 -> 10 bytes | |||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/2/comm | 2 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/2/stat | 2 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/3/cmdline | bin | 0 -> 11 bytes | |||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/3/comm | 1 | ||||
-rw-r--r-- | tests/ts/lib/procfs-data/proc/3/stat | 1 | ||||
-rwxr-xr-x | tests/ts/lib/timeutils | 24 |
11 files changed, 89 insertions, 0 deletions
diff --git a/tests/ts/lib/procfs b/tests/ts/lib/procfs new file mode 100755 index 0000000..998aa39 --- /dev/null +++ b/tests/ts/lib/procfs @@ -0,0 +1,57 @@ +#!/bin/bash +# +# Copyright (C) 2022 Thomas Weißschuh <thomas@t-8ch.de> +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +TS_TOPDIR="${0%/*}/../.." +TS_DESC="procfs library" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_PROCFS" + +test_data="$TS_SELF/procfs-data" +test_cmd() { + "$TS_HELPER_PROCFS" --prefix "$test_data" "$@" \ + 2>> "$TS_ERRLOG" \ + | sed -e 's/ UID: .*/ UID: [redacted]/' \ + >> "$TS_OUTPUT" +} + +ts_init_subtest "one-process" + +test_cmd --one 1 +test_cmd --one 2 +test_cmd --one 3 + +ts_finalize_subtest + + +ts_init_subtest "stat-nth" + +test_cmd --stat-nth 1 1 +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 + +test_cmd --stat-nth 3 1 +test_cmd --stat-nth 3 4 + +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lib/procfs-data/proc/1/cmdline b/tests/ts/lib/procfs-data/proc/1/cmdline Binary files differnew file mode 100644 index 0000000..2baeb31 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/1/cmdline diff --git a/tests/ts/lib/procfs-data/proc/1/comm b/tests/ts/lib/procfs-data/proc/1/comm new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/1/comm @@ -0,0 +1 @@ +test diff --git a/tests/ts/lib/procfs-data/proc/1/stat b/tests/ts/lib/procfs-data/proc/1/stat new file mode 100644 index 0000000..35cb1bd --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/1/stat @@ -0,0 +1 @@ +373850 (test) S 373752 373850 373752 34835 373850 4194304 83 0 0 0 0 0 0 0 20 0 1 0 6164479 2543616 320 18446744073709551615 94138801930240 94138801930657 140720370008720 0 0 0 0 0 0 1 0 0 17 1 0 0 0 0 0 94138801941968 94138801942568 94138832138240 140720370011239 140720370011246 140720370011246 140720370012145 0 diff --git a/tests/ts/lib/procfs-data/proc/2/cmdline b/tests/ts/lib/procfs-data/proc/2/cmdline Binary files differnew file mode 100644 index 0000000..5ca4218 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/2/cmdline 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 0000000..3bd1f0e --- /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 0000000..250e579 --- /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 diff --git a/tests/ts/lib/procfs-data/proc/3/cmdline b/tests/ts/lib/procfs-data/proc/3/cmdline Binary files differnew file mode 100644 index 0000000..4840b32 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/3/cmdline diff --git a/tests/ts/lib/procfs-data/proc/3/comm b/tests/ts/lib/procfs-data/proc/3/comm new file mode 100644 index 0000000..57bf5bb --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/3/comm @@ -0,0 +1 @@ +foo )bar diff --git a/tests/ts/lib/procfs-data/proc/3/stat b/tests/ts/lib/procfs-data/proc/3/stat new file mode 100644 index 0000000..4b5f575 --- /dev/null +++ b/tests/ts/lib/procfs-data/proc/3/stat @@ -0,0 +1 @@ +4102 (foo )bar) S 1165 4102 1165 34818 4102 4194304 80 0 0 0 0 0 0 0 20 0 1 0 61909 2543616 215 18446744073709551615 94697631760384 94697631760801 140728832669632 0 0 0 0 0 0 1 0 0 17 0 0 0 0 0 0 94697631772112 94697631772712 94697662554112 140728832670811 140728832670822 140728832670822 140728832671725 0 diff --git a/tests/ts/lib/timeutils b/tests/ts/lib/timeutils new file mode 100755 index 0000000..13ec68b --- /dev/null +++ b/tests/ts/lib/timeutils @@ -0,0 +1,24 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de> +# +# This file may be distributed under the terms of the +# GNU Lesser General Public License. +# +TS_TOPDIR="${0%/*}/../.." +TS_DESC="timeutils library" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_TIMEUTILS" + +ts_init_subtest "timestamp" + +"$TS_HELPER_TIMEUTILS" --unittest-timestamp 2> "$TS_ERRLOG" + +ts_finalize_subtest + +ts_finalize |