diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:30 +0000 |
commit | c61e14d3a8412cd50d98aab604e607692c844c8a (patch) | |
tree | 4925aca0e6b64c8664ea2f3fdfa99a52dc93d5da /tests | |
parent | Adding upstream version 2.39.3. (diff) | |
download | util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.tar.xz util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.zip |
Adding upstream version 2.40.upstream/2.40
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
440 files changed, 9645 insertions, 724 deletions
diff --git a/tests/Makemodule.am b/tests/Makemodule.am index d5422be..3a66f27 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -15,11 +15,13 @@ CLEAN_LOCALS += clean-local-tests TESTS_OPTIONS = --nonroot --show-diff TESTS_PARALLEL = --parallel +TESTS_COMPONENTS = TESTS_COMMAND = $(top_srcdir)/tests/run.sh \ --srcdir=$(abs_top_srcdir) \ --builddir=$(abs_top_builddir) \ $(TESTS_PARALLEL) \ - $(TESTS_OPTIONS) + $(TESTS_OPTIONS) \ + $(TESTS_COMPONENTS) check-local-tests: $(check_PROGRAMS) $(AM_V_GEN) $(TESTS_COMMAND) diff --git a/tests/commands.sh b/tests/commands.sh index 8dfb135..cb8013e 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -2,8 +2,10 @@ TS_TESTUSER=${TS_TESTUSER:-"nobody"} # helpers +TS_HELPER_BOILERPLATE="${ts_helpersdir}test_boilerplate" TS_HELPER_BYTESWAP="${ts_helpersdir}test_byteswap" TS_HELPER_CPUSET="${ts_helpersdir}test_cpuset" +TS_HELPER_CAP="${ts_helpersdir}test_cap" TS_HELPER_DMESG="${ts_helpersdir}test_dmesg" TS_HELPER_ENOSYS="${ts_helpersdir}test_enosys" TS_HELPER_ISLOCAL="${ts_helpersdir}test_islocal" @@ -13,14 +15,23 @@ TS_HELPER_LIBFDISK_MKPART="${ts_helpersdir}sample-fdisk-mkpart" TS_HELPER_LIBMOUNT_CONTEXT="${ts_helpersdir}test_mount_context" TS_HELPER_LIBFDISK_MKPART_FULLSPEC="${ts_helpersdir}sample-fdisk-mkpart-fullspec" TS_HELPER_LIBFDISK_SCRIPT_FUZZ="${ts_helpersdir}test_fdisk_script_fuzz" +TS_HELPER_LIBLASTLOG2_DLOPEN="${ts_helpersdir}test_lastlog2_dlopen" +TS_HELPER_LIBLASTLOG2_PAM_LASTLOG2_OUTPUT="${ts_helpersdir}test_lastlog2_pam_lastlog2_output" +TS_HELPER_LIBLASTLOG2_REMOVE_ENTRY="${ts_helpersdir}test_lastlog2_remove_entry" +TS_HELPER_LIBLASTLOG2_RENAME_USER="${ts_helpersdir}test_lastlog2_rename_user" +TS_HELPER_LIBLASTLOG2_WRITE_READ_USER="${ts_helpersdir}test_lastlog2_write_read_user" +TS_HELPER_LIBLASTLOG2_Y2038_LL2_READ_ALL="${ts_helpersdir}test_lastlog2_y2038_ll2_read_all" +TS_HELPER_LIBLASTLOG2_Y2038_SQLITE2_TIME="${ts_helpersdir}test_lastlog2_y2038_sqlite3_time" TS_HELPER_LIBMOUNT_LOCK="${ts_helpersdir}test_mount_lock" TS_HELPER_LIBMOUNT_OPTSTR="${ts_helpersdir}test_mount_optstr" +TS_HELPER_LIBMOUNT_OPTLIST="${ts_helpersdir}test_mount_optlist" TS_HELPER_LIBMOUNT_TABDIFF="${ts_helpersdir}test_mount_tab_diff" TS_HELPER_LIBMOUNT_TAB="${ts_helpersdir}test_mount_tab" TS_HELPER_LIBMOUNT_UPDATE="${ts_helpersdir}test_mount_tab_update" TS_HELPER_LIBMOUNT_UTILS="${ts_helpersdir}test_mount_utils" TS_HELPER_LIBMOUNT_DEBUG="${ts_helpersdir}test_mount_debug" TS_HELPER_LIBMOUNT_FUZZ="${ts_helpersdir}test_mount_fuzz" +TS_HELPER_LIBSMARTCOLS_CONTINUOUS_JSON="${ts_helpersdir}sample-scols-continuous-json" TS_HELPER_LIBSMARTCOLS_FROMFILE="${ts_helpersdir}sample-scols-fromfile" TS_HELPER_LIBSMARTCOLS_TITLE="${ts_helpersdir}sample-scols-title" TS_HELPER_PYLIBMOUNT_CONTEXT="$top_srcdir/libmount/python/test_mount_context.py" @@ -60,7 +71,9 @@ TS_CMD_COLCRT=${TS_CMD_COLCRT:-"${ts_commandsdir}colcrt"} TS_CMD_COLRM=${TS_CMD_COLRM:-"${ts_commandsdir}colrm"} TS_CMD_COL=${TS_CMD_COL:-"${ts_commandsdir}col"} TS_CMD_COLUMN=${TS_CMD_COLUMN:-"${ts_commandsdir}column"} +TS_CMD_ENOSYS=${TS_CMD_ENOSYS-"${ts_commandsdir}enosys"} TS_CMD_EJECT=${TS_CMD_EJECT-"${ts_commandsdir}eject"} +TS_CMD_EXCH=${TS_CMD_EXCH-"${ts_commandsdir}exch"} TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"${ts_commandsdir}fallocate"} TS_CMD_FDISK=${TS_CMD_FDISK-"${ts_commandsdir}fdisk"} TS_CMD_FLOCK=${TS_CMD_FLOCK-"${ts_commandsdir}flock"} @@ -85,8 +98,10 @@ TS_CMD_LINE=${TS_CMD_LINE-"${ts_commandsdir}line"} TS_CMD_LOOK=${TS_CMD_LOOK-"${ts_commandsdir}look"} TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"${ts_commandsdir}losetup"} TS_CMD_LSBLK=${TS_CMD_LSBLK-"${ts_commandsdir}lsblk"} +TS_CMD_LSCLOCKS=${TS_CMD_LSCPU-"${ts_commandsdir}lsclocks"} TS_CMD_LSCPU=${TS_CMD_LSCPU-"${ts_commandsdir}lscpu"} TS_CMD_LSFD=${TS_CMD_LSFD-"${ts_commandsdir}lsfd"} +TS_CMD_LSLOCKS=${TS_CMD_LSLOCKS-"${ts_commandsdir}lslocks"} TS_CMD_LSMEM=${TS_CMD_LSMEM-"${ts_commandsdir}lsmem"} TS_CMD_LSNS=${TS_CMD_LSNS-"${ts_commandsdir}lsns"} TS_CMD_MCOOKIE=${TS_CMD_MCOOKIE-"${ts_commandsdir}mcookie"} @@ -105,6 +120,8 @@ TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"${ts_commandsdir}script"} TS_CMD_SCRIPTREPLAY=${TS_CMD_SCRIPTREPLAY-"${ts_commandsdir}scriptreplay"} TS_CMD_SCRIPTLIVE=${TS_CMD_SCRIPTLIVE-"${ts_commandsdir}scriptlive"} TS_CMD_SETARCH=${TS_CMD_SETARCH-"${ts_commandsdir}setarch"} +TS_CMD_SETPGID=${TS_CMD_SETPGID-"${ts_commandsdir}setpgid"} +TS_CMD_SETPRIV=${TS_CMD_SETPRIV-"${ts_commandsdir}setpriv"} TS_CMD_SETSID=${TS_CMD_SETSID-"${ts_commandsdir}setsid"} TS_CMD_SWAPLABEL=${TS_CMD_SWAPLABEL:-"${ts_commandsdir}swaplabel"} TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"${ts_commandsdir}swapoff"} diff --git a/tests/expected/blkid/low-probe-bcache-B b/tests/expected/blkid/low-probe-bcache-B index 7396632..2753678 100644 --- a/tests/expected/blkid/low-probe-bcache-B +++ b/tests/expected/blkid/low-probe-bcache-B @@ -1,4 +1,6 @@ +ID_FS_BLOCK_SIZE=4096 ID_FS_TYPE=bcache ID_FS_USAGE=other ID_FS_UUID=8fb7f716-4c19-4517-bfbb-6f4a2becad60 ID_FS_UUID_ENC=8fb7f716-4c19-4517-bfbb-6f4a2becad60 +ID_FS_VERSION=1 diff --git a/tests/expected/blkid/low-probe-bcache-C b/tests/expected/blkid/low-probe-bcache-C index b3c5f88..da4b314 100644 --- a/tests/expected/blkid/low-probe-bcache-C +++ b/tests/expected/blkid/low-probe-bcache-C @@ -1,4 +1,6 @@ +ID_FS_BLOCK_SIZE=4096 ID_FS_TYPE=bcache ID_FS_USAGE=other ID_FS_UUID=7a343627-ac87-4bf0-b76f-46067cbc9b8c ID_FS_UUID_ENC=7a343627-ac87-4bf0-b76f-46067cbc9b8c +ID_FS_VERSION=0 diff --git a/tests/expected/blkid/low-probe-bcache-journal b/tests/expected/blkid/low-probe-bcache-journal index c46ba22..cfff870 100644 --- a/tests/expected/blkid/low-probe-bcache-journal +++ b/tests/expected/blkid/low-probe-bcache-journal @@ -1,4 +1,8 @@ +ID_FS_BLOCK_SIZE=4096 +ID_FS_LABEL=journal-cache +ID_FS_LABEL_ENC=journal-cache ID_FS_TYPE=bcache ID_FS_USAGE=other ID_FS_UUID=fc6ea56f-372e-474e-bc5b-2ddc8430ddd1 ID_FS_UUID_ENC=fc6ea56f-372e-474e-bc5b-2ddc8430ddd1 +ID_FS_VERSION=3 diff --git a/tests/expected/blkid/low-probe-swap-luks b/tests/expected/blkid/low-probe-swap-luks new file mode 100644 index 0000000..97cd5de --- /dev/null +++ b/tests/expected/blkid/low-probe-swap-luks @@ -0,0 +1,8 @@ +ID_FS_ENDIANNESS=LITTLE +ID_FS_FSBLOCKSIZE=4096 +ID_FS_FSSIZE=258048 +ID_FS_TYPE=swap +ID_FS_USAGE=other +ID_FS_UUID=0eb5f96f-188d-4d61-9e9c-d89ce8206846 +ID_FS_UUID_ENC=0eb5f96f-188d-4d61-9e9c-d89ce8206846 +ID_FS_VERSION=1 diff --git a/tests/expected/blkid/low-probe-vxfs-be b/tests/expected/blkid/low-probe-vxfs-be new file mode 100644 index 0000000..bede9b6 --- /dev/null +++ b/tests/expected/blkid/low-probe-vxfs-be @@ -0,0 +1,6 @@ +ID_FS_BLOCK_SIZE=512 +ID_FS_ENDIANNESS=BIG +ID_FS_FSBLOCKSIZE=512 +ID_FS_TYPE=vxfs +ID_FS_USAGE=filesystem +ID_FS_VERSION=3 diff --git a/tests/expected/blkid/low-probe-vxfs-le b/tests/expected/blkid/low-probe-vxfs-le new file mode 100644 index 0000000..ba29986 --- /dev/null +++ b/tests/expected/blkid/low-probe-vxfs-le @@ -0,0 +1,6 @@ +ID_FS_BLOCK_SIZE=512 +ID_FS_ENDIANNESS=LITTLE +ID_FS_FSBLOCKSIZE=512 +ID_FS_TYPE=vxfs +ID_FS_USAGE=filesystem +ID_FS_VERSION=3 diff --git a/tests/expected/build-sys/config-all b/tests/expected/build-sys/config-all index 0574f23..88b6e06 100644 --- a/tests/expected/build-sys/config-all +++ b/tests/expected/build-sys/config-all @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-all-devel b/tests/expected/build-sys/config-all-devel index 3e9a720..da9afc1 100644 --- a/tests/expected/build-sys/config-all-devel +++ b/tests/expected/build-sys/config-all-devel @@ -89,6 +89,7 @@ readprofile: renice: rtcwake: setarch: +setpgid: setsid: switch_root: tunelp: diff --git a/tests/expected/build-sys/config-all-non-nls b/tests/expected/build-sys/config-all-non-nls index 0574f23..88b6e06 100644 --- a/tests/expected/build-sys/config-all-non-nls +++ b/tests/expected/build-sys/config-all-non-nls @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-audit b/tests/expected/build-sys/config-audit index bdcd087..749a35b 100644 --- a/tests/expected/build-sys/config-audit +++ b/tests/expected/build-sys/config-audit @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-chfnsh-libuser b/tests/expected/build-sys/config-chfnsh-libuser index 97e1ae6..238c150 100644 --- a/tests/expected/build-sys/config-chfnsh-libuser +++ b/tests/expected/build-sys/config-chfnsh-libuser @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-chfnsh-no-password b/tests/expected/build-sys/config-chfnsh-no-password index 734113e..41bd6c5 100644 --- a/tests/expected/build-sys/config-chfnsh-no-password +++ b/tests/expected/build-sys/config-chfnsh-no-password @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-chfnsh-pam b/tests/expected/build-sys/config-chfnsh-pam index 532013c..17cd06c 100644 --- a/tests/expected/build-sys/config-chfnsh-pam +++ b/tests/expected/build-sys/config-chfnsh-pam @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-core b/tests/expected/build-sys/config-core index a20517c..bb4ac01 100644 --- a/tests/expected/build-sys/config-core +++ b/tests/expected/build-sys/config-core @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-cryptsetup b/tests/expected/build-sys/config-cryptsetup index c4aae45..b21174e 100644 --- a/tests/expected/build-sys/config-cryptsetup +++ b/tests/expected/build-sys/config-cryptsetup @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libcryptsetup libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libcryptsetup libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-devel b/tests/expected/build-sys/config-devel index 5682413..4b44616 100644 --- a/tests/expected/build-sys/config-devel +++ b/tests/expected/build-sys/config-devel @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: libutempter scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: libselinux waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-devel-new-mount b/tests/expected/build-sys/config-devel-new-mount index 9ac8272..8befe4c 100644 --- a/tests/expected/build-sys/config-devel-new-mount +++ b/tests/expected/build-sys/config-devel-new-mount @@ -94,6 +94,7 @@ readprofile: renice: rtcwake: setarch: +setpgid: setsid: switch_root: tunelp: diff --git a/tests/expected/build-sys/config-devel-non-asan b/tests/expected/build-sys/config-devel-non-asan index 5682413..4b44616 100644 --- a/tests/expected/build-sys/config-devel-non-asan +++ b/tests/expected/build-sys/config-devel-non-asan @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: libutempter scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: libselinux waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-devel-non-docs b/tests/expected/build-sys/config-devel-non-docs index 5682413..4b44616 100644 --- a/tests/expected/build-sys/config-devel-non-docs +++ b/tests/expected/build-sys/config-devel-non-docs @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdformat: @@ -109,6 +115,7 @@ script: libutempter scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -123,6 +130,6 @@ unshare: utmpdump: vipw: libselinux waitpid: -wall: +wall: libsystemd whereis: -write: +write: libsystemd diff --git a/tests/expected/build-sys/config-non-libblkid b/tests/expected/build-sys/config-non-libblkid index ed38eb5..0cce945 100644 --- a/tests/expected/build-sys/config-non-libblkid +++ b/tests/expected/build-sys/config-non-libblkid @@ -3,10 +3,13 @@ column: libsmartcols fdisk: libfdisk libreadline libsmartcols libtinfo fincore: libsmartcols irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libfdisk.so.1.1.0: libuuid +liblastlog2.so.2.0.0: libsqlite3 libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -14,6 +17,7 @@ lsirq: libsmartcols lslogins: libsmartcols libsystemd lsmem: libsmartcols mkswap: libuuid +pam_lastlog2.so: prlimit: libsmartcols rfkill: libsmartcols sfdisk: libfdisk libreadline libsmartcols libtinfo @@ -22,7 +26,7 @@ uuidgen: libuuid uuidparse: libsmartcols libuuid wdctl: libsmartcols zramctl: libsmartcols -agetty: +agetty: libsystemd blkdiscard: blkpr: blkzone: @@ -39,6 +43,8 @@ colcrt: colrm: ctrlaltdel: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -82,6 +88,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -94,5 +101,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-libmount b/tests/expected/build-sys/config-non-libmount index 45ff711..ed8895b 100644 --- a/tests/expected/build-sys/config-non-libmount +++ b/tests/expected/build-sys/config-non-libmount @@ -6,11 +6,14 @@ fdisk: libfdisk libreadline libsmartcols libtinfo fincore: libsmartcols findfs: libblkid irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -18,6 +21,7 @@ lsirq: libsmartcols lslogins: libsmartcols libsystemd lsmem: libsmartcols mkswap: libblkid libuuid +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols rfkill: libsmartcols @@ -30,7 +34,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -47,6 +51,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -91,6 +97,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -103,5 +110,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-libs b/tests/expected/build-sys/config-non-libs index b88a6a1..f517ba5 100644 --- a/tests/expected/build-sys/config-non-libs +++ b/tests/expected/build-sys/config-non-libs @@ -1,4 +1,7 @@ -agetty: +lastlog2: liblastlog2 +liblastlog2.so.2.0.0: libsqlite3 +pam_lastlog2.so: +agetty: libsystemd blkdiscard: blkpr: blkzone: @@ -15,6 +18,8 @@ colcrt: colrm: ctrlaltdel: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -59,6 +64,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -71,5 +77,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-libsmartcols b/tests/expected/build-sys/config-non-libsmartcols index 28ff817..6889c74 100644 --- a/tests/expected/build-sys/config-non-libsmartcols +++ b/tests/expected/build-sys/config-non-libsmartcols @@ -1,22 +1,25 @@ blkdiscard: libblkid blkid: libblkid -eject: libmount +eject: libblkid libmount findfs: libblkid fsck: libblkid libmount -fstrim: libmount +fstrim: libblkid libmount +lastlog2: liblastlog2 libsqlite3 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libuuid.so.1.3.0: mkswap: libblkid libuuid -mount: libmount -mountpoint: libmount +mount: libblkid libmount +mountpoint: libblkid libmount +pam_lastlog2.so: pylibmount.so: libblkid libmount swaplabel: libblkid libuuid -umount: libmount +umount: libblkid libmount uuidd: libsystemd libuuid uuidgen: libuuid -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -32,6 +35,8 @@ colcrt: colrm: ctrlaltdel: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -75,6 +80,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -87,5 +93,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-libuuid b/tests/expected/build-sys/config-non-libuuid index 3e5a295..8d19e47 100644 --- a/tests/expected/build-sys/config-non-libuuid +++ b/tests/expected/build-sys/config-non-libuuid @@ -8,11 +8,14 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -24,6 +27,7 @@ lsns: libmount libsmartcols mkswap: libblkid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -36,7 +40,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -53,6 +57,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -97,6 +103,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -109,5 +116,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-nls b/tests/expected/build-sys/config-non-nls index a20517c..bb4ac01 100644 --- a/tests/expected/build-sys/config-non-nls +++ b/tests/expected/build-sys/config-non-nls @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-non-widechar b/tests/expected/build-sys/config-non-widechar index e69de29..56e9f2f 100644 --- a/tests/expected/build-sys/config-non-widechar +++ b/tests/expected/build-sys/config-non-widechar @@ -0,0 +1,4 @@ +pam_lastlog2.so: +fsfreeze: +pivot_root: +switch_root: diff --git a/tests/expected/build-sys/config-selinux b/tests/expected/build-sys/config-selinux index 4d2e5f8..c8aa80c 100644 --- a/tests/expected/build-sys/config-selinux +++ b/tests/expected/build-sys/config-selinux @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libselinux libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libselinux libuuid mount: libmount libselinux mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount libselinux @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-slang b/tests/expected/build-sys/config-slang index 5a3ac99..6b676cc 100644 --- a/tests/expected/build-sys/config-slang +++ b/tests/expected/build-sys/config-slang @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libslang libsmartcols +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkpr: blkzone: blockdev: @@ -61,6 +65,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: flock: @@ -105,6 +111,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -117,5 +124,5 @@ ul: libtinfo unshare: utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/build-sys/config-static b/tests/expected/build-sys/config-static index 92de9d7..10d1052 100644 --- a/tests/expected/build-sys/config-static +++ b/tests/expected/build-sys/config-static @@ -10,13 +10,16 @@ findmnt: libblkid libmount libsmartcols libudev fsck: libblkid libmount fstrim: libmount irqtop: libncursesw libsmartcols libtinfo +lastlog2: liblastlog2 libblkid.so.1.1.0: libfdisk.so.1.1.0: libblkid libuuid +liblastlog2.so.2.0.0: libsqlite3 libmount.so.1.1.0: libblkid libsmartcols.so.1.1.0: libuuid.so.1.3.0: losetup: libsmartcols -lsblk: libblkid libmount libsmartcols libudev +lsblk: libblkid libmount libsmartcols libtinfo libudev +lsclocks: libsmartcols lscpu: libsmartcols lsfd: libsmartcols lsipc: libsmartcols @@ -28,6 +31,7 @@ lsns: libmount libsmartcols mkswap: libblkid libuuid mount: libmount mountpoint: libmount +pam_lastlog2.so: partx: libblkid libsmartcols prlimit: libsmartcols pylibmount.so: libblkid libmount @@ -44,7 +48,7 @@ wdctl: libsmartcols wipefs: libblkid libsmartcols zramctl: libsmartcols addpart: -agetty: +agetty: libsystemd blkid.static: STATIC blkpr: blkzone: @@ -62,6 +66,8 @@ colrm: ctrlaltdel: delpart: dmesg: libtinfo +enosys: +exch: fadvise: fallocate: fdisk.static: STATIC @@ -110,6 +116,7 @@ script: scriptlive: scriptreplay: setarch: +setpgid: setpriv: libcap-ng setsid: setterm: libtinfo @@ -125,5 +132,5 @@ unshare: unshare.static: STATIC utmpdump: waitpid: -wall: +wall: libsystemd whereis: diff --git a/tests/expected/column/table-noheaders b/tests/expected/column/table-noheaders new file mode 100644 index 0000000..5fc905d --- /dev/null +++ b/tests/expected/column/table-noheaders @@ -0,0 +1,6 @@ +AAA BBBB C DDDD +A BBB CCCC DDD +AA BB CCC DD +AAAA B CC D +AA BB CC DD +AAAAA BBB CCC DDDD diff --git a/tests/expected/dmesg/cid-json b/tests/expected/dmesg/cid-json new file mode 100644 index 0000000..8a4d0e2 --- /dev/null +++ b/tests/expected/dmesg/cid-json @@ -0,0 +1,535 @@ +{ + "dmesg": [ + { + "pri": 0, + "time": 0.000000, + "caller": "T0", + "msg": "example[0]" + },{ + "pri": 1, + "time": 1.000000, + "caller": "T1", + "msg": "example[1]" + },{ + "pri": 2, + "time": 8.000000, + "caller": "T2", + "msg": "example[2]" + },{ + "pri": 3, + "time": 27.000000, + "caller": "T3", + "msg": "example[3]" + },{ + "pri": 4, + "time": 64.000000, + "caller": "T4", + "msg": "example[4]" + },{ + "pri": 5, + "time": 125.000000, + "caller": "T5", + "msg": "example[5]" + },{ + "pri": 6, + "time": 216.000000, + "caller": "T6", + "msg": "example[6]" + },{ + "pri": 7, + "time": 343.000000, + "caller": "T7", + "msg": "example[7]" + },{ + "pri": 8, + "time": 512.000000, + "caller": "T8", + "msg": "example[8]" + },{ + "pri": 9, + "time": 729.000000, + "caller": "T9", + "msg": "example[9]" + },{ + "pri": 10, + "time": 1000.000000, + "caller": "T10", + "msg": "example[10]" + },{ + "pri": 11, + "time": 1331.000000, + "caller": "T11", + "msg": "example[11]" + },{ + "pri": 12, + "time": 1728.000000, + "caller": "T12", + "msg": "example[12]" + },{ + "pri": 13, + "time": 2197.000000, + "caller": "T13", + "msg": "example[13]" + },{ + "pri": 14, + "time": 2744.000000, + "caller": "T14", + "msg": "example[14]" + },{ + "pri": 15, + "time": 3375.000000, + "caller": "T15", + "msg": "example[15]" + },{ + "pri": 16, + "time": 4096.000000, + "caller": "T16", + "msg": "example[16]" + },{ + "pri": 17, + "time": 4913.000000, + "caller": "T17", + "msg": "example[17]" + },{ + "pri": 18, + "time": 5832.000000, + "caller": "T18", + "msg": "example[18]" + },{ + "pri": 19, + "time": 6859.000000, + "caller": "T19", + "msg": "example[19]" + },{ + "pri": 20, + "time": 8000.000000, + "caller": "T20", + "msg": "example[20]" + },{ + "pri": 21, + "time": 9261.000000, + "caller": "T21", + "msg": "example[21]" + },{ + "pri": 22, + "time": 10648.000000, + "caller": "T22", + "msg": "example[22]" + },{ + "pri": 23, + "time": 12167.000000, + "caller": "T23", + "msg": "example[23]" + },{ + "pri": 24, + "time": 13824.000000, + "caller": "T24", + "msg": "example[24]" + },{ + "pri": 25, + "time": 15625.000000, + "caller": "T25", + "msg": "example[25]" + },{ + "pri": 26, + "time": 17576.000000, + "caller": "T26", + "msg": "example[26]" + },{ + "pri": 27, + "time": 19683.000000, + "caller": "T27", + "msg": "example[27]" + },{ + "pri": 28, + "time": 21952.000000, + "caller": "T28", + "msg": "example[28]" + },{ + "pri": 29, + "time": 24389.000000, + "caller": "T29", + "msg": "example[29]" + },{ + "pri": 30, + "time": 27000.000000, + "caller": "T10", + "msg": "example[30]" + },{ + "pri": 31, + "time": 29791.000000, + "caller": "T31", + "msg": "example[31]" + },{ + "pri": 32, + "time": 32768.000000, + "caller": "T32", + "msg": "example[32]" + },{ + "pri": 33, + "time": 35937.000000, + "caller": "T33", + "msg": "example[33]" + },{ + "pri": 34, + "time": 39304.000000, + "caller": "T34", + "msg": "example[34]" + },{ + "pri": 35, + "time": 42875.000000, + "caller": "T35", + "msg": "example[35]" + },{ + "pri": 36, + "time": 46656.000000, + "caller": "T36", + "msg": "example[36]" + },{ + "pri": 37, + "time": 50653.000000, + "caller": "T37", + "msg": "example[37]" + },{ + "pri": 38, + "time": 54872.000000, + "caller": "T38", + "msg": "example[38]" + },{ + "pri": 39, + "time": 59319.000000, + "caller": "T39", + "msg": "example[39]" + },{ + "pri": 40, + "time": 64000.000000, + "caller": "T40", + "msg": "example[40]" + },{ + "pri": 41, + "time": 68921.000000, + "caller": "T41", + "msg": "example[41]" + },{ + "pri": 42, + "time": 74088.000000, + "caller": "T42", + "msg": "example[42]" + },{ + "pri": 43, + "time": 79507.000000, + "caller": "T43", + "msg": "example[43]" + },{ + "pri": 44, + "time": 85184.000000, + "caller": "T44", + "msg": "example[44]" + },{ + "pri": 45, + "time": 91125.000000, + "caller": "T45", + "msg": "example[45]" + },{ + "pri": 46, + "time": 97336.000000, + "caller": "T46", + "msg": "example[46]" + },{ + "pri": 47, + "time": 103823.000000, + "caller": "T47", + "msg": "example[47]" + },{ + "pri": 48, + "time": 110592.000000, + "caller": "T48", + "msg": "example[48]" + },{ + "pri": 49, + "time": 117649.000000, + "caller": "T49", + "msg": "example[49]" + },{ + "pri": 50, + "time": 125000.000000, + "caller": "T50", + "msg": "example[50]" + },{ + "pri": 51, + "time": 132651.000000, + "caller": "T51", + "msg": "example[51]" + },{ + "pri": 52, + "time": 140608.000000, + "caller": "T52", + "msg": "example[52]" + },{ + "pri": 53, + "time": 148877.000000, + "caller": "T53", + "msg": "example[53]" + },{ + "pri": 54, + "time": 157464.000000, + "caller": "T54", + "msg": "example[54]" + },{ + "pri": 55, + "time": 166375.000000, + "caller": "T55", + "msg": "example[55]" + },{ + "pri": 56, + "time": 175616.000000, + "caller": "T56", + "msg": "example[56]" + },{ + "pri": 57, + "time": 185193.000000, + "caller": "T57", + "msg": "example[57]" + },{ + "pri": 58, + "time": 195112.000000, + "caller": "T58", + "msg": "example[58]" + },{ + "pri": 59, + "time": 205379.000000, + "caller": "T59", + "msg": "example[59]" + },{ + "pri": 60, + "time": 216000.000000, + "caller": "T60", + "msg": "example[60]" + },{ + "pri": 61, + "time": 226981.000000, + "caller": "T61", + "msg": "example[61]" + },{ + "pri": 62, + "time": 238328.000000, + "caller": "T62", + "msg": "example[62]" + },{ + "pri": 63, + "time": 250047.000000, + "caller": "T63", + "msg": "example[63]" + },{ + "pri": 64, + "time": 262144.000000, + "caller": "T64", + "msg": "example[64]" + },{ + "pri": 65, + "time": 274625.000000, + "caller": "T65", + "msg": "example[65]" + },{ + "pri": 66, + "time": 287496.000000, + "caller": "T66", + "msg": "example[66]" + },{ + "pri": 67, + "time": 300763.000000, + "caller": "T67", + "msg": "example[67]" + },{ + "pri": 68, + "time": 314432.000000, + "caller": "T68", + "msg": "example[68]" + },{ + "pri": 69, + "time": 328509.000000, + "caller": "T69", + "msg": "example[69]" + },{ + "pri": 70, + "time": 343000.000000, + "caller": "T70", + "msg": "example[70]" + },{ + "pri": 71, + "time": 357911.000000, + "caller": "T71", + "msg": "example[71]" + },{ + "pri": 72, + "time": 373248.000000, + "caller": "T72", + "msg": "example[72]" + },{ + "pri": 73, + "time": 389017.000000, + "caller": "T73", + "msg": "example[73]" + },{ + "pri": 74, + "time": 405224.000000, + "caller": "T74", + "msg": "example[74]" + },{ + "pri": 75, + "time": 421875.000000, + "caller": "T75", + "msg": "example[75]" + },{ + "pri": 76, + "time": 438976.000000, + "caller": "T76", + "msg": "example[76]" + },{ + "pri": 77, + "time": 456533.000000, + "caller": "T77", + "msg": "example[77]" + },{ + "pri": 78, + "time": 474552.000000, + "caller": "T78", + "msg": "example[78]" + },{ + "pri": 79, + "time": 493039.000000, + "caller": "T79", + "msg": "example[79]" + },{ + "pri": 80, + "time": 512000.000000, + "caller": "T80", + "msg": "example[80]" + },{ + "pri": 81, + "time": 531441.000000, + "caller": "T81", + "msg": "example[81]" + },{ + "pri": 82, + "time": 551368.000000, + "caller": "T82", + "msg": "example[82]" + },{ + "pri": 83, + "time": 571787.000000, + "caller": "T83", + "msg": "example[83]" + },{ + "pri": 84, + "time": 592704.000000, + "caller": "T84", + "msg": "example[84]" + },{ + "pri": 85, + "time": 614125.000000, + "caller": "T85", + "msg": "example[85]" + },{ + "pri": 86, + "time": 636056.000000, + "caller": "T86", + "msg": "example[86]" + },{ + "pri": 87, + "time": 658503.000000, + "caller": "T87", + "msg": "example[87]" + },{ + "pri": 88, + "time": 681472.000000, + "caller": "T88", + "msg": "example[88]" + },{ + "pri": 89, + "time": 704969.000000, + "caller": "T89", + "msg": "example[89]" + },{ + "pri": 90, + "time": 729000.000000, + "caller": "T90", + "msg": "example[90]" + },{ + "pri": 91, + "time": 753571.000000, + "caller": "T91", + "msg": "example[91]" + },{ + "pri": 92, + "time": 778688.000000, + "caller": "T92", + "msg": "example[92]" + },{ + "pri": 93, + "time": 804357.000000, + "caller": "T93", + "msg": "example[93]" + },{ + "pri": 94, + "time": 830584.000000, + "caller": "T94", + "msg": "example[94]" + },{ + "pri": 95, + "time": 857375.000000, + "caller": "T95", + "msg": "example[95]" + },{ + "pri": 96, + "time": 884736.000000, + "caller": "T96", + "msg": "example[96]" + },{ + "pri": 97, + "time": 912673.000000, + "caller": "T97", + "msg": "example[97]" + },{ + "pri": 98, + "time": 941192.000000, + "caller": "T98", + "msg": "example[98]" + },{ + "pri": 99, + "time": 970299.000000, + "caller": "T99", + "msg": "example[99]" + },{ + "pri": 100, + "time": 1000000.000000, + "caller": "T100", + "msg": "example[100]" + },{ + "pri": 101, + "time": 1030301.000000, + "caller": "T101", + "msg": "example[101]" + },{ + "pri": 102, + "time": 1061208.000000, + "caller": "T102", + "msg": "example[102]" + },{ + "pri": 103, + "time": 1092727.000000, + "caller": "T103", + "msg": "example[103]" + },{ + "pri": 104, + "time": 1124864.000000, + "caller": "T104", + "msg": "example[104]" + },{ + "pri": 150, + "time": 4557523.000000, + "caller": "T105", + "msg": "example[105]" + } + ] +} diff --git a/tests/expected/dmesg/cid-kmsg-colors b/tests/expected/dmesg/cid-kmsg-colors new file mode 100644 index 0000000..d3dbd1e --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-colors @@ -0,0 +1,59 @@ +kern :emerg : [32m[ 0.000000] [0m[T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +kern :alert : [32m[ 0.000001] [0m[T2] [33mCommand line: [0m[7m[31minitrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system[0m +kern :crit : [32m[ 0.000002] [0m[T3] [1m[31mBIOS-provided physical RAM map:[0m +kern :err : [32m[ 0.000003] [0m[T4] [33mBIOS-e820: [0m[31m[mem 0x0000000000000000-0x000000000009efff] usable[0m +kern :warn : [32m[ 0.000004] [0m[T5] [33mBIOS-e820: [0m[1m[mem 0x000000000009f000-0x00000000000bffff] reserved[0m +kern :notice: [32m[ 0.000005] [0m[T6] [33mBIOS-e820: [0m[mem 0x0000000000100000-0x0000000009afffff] usable +kern :info : [32m[ 0.000006] [0m[T7] [33mBIOS-e820: [0m[mem 0x0000000009b00000-0x0000000009dfffff] reserved +kern :debug : [32m[ 0.000007] [0m[T8] [33mBIOS-e820: [0m[mem 0x0000000009e00000-0x0000000009efffff] usable +kern :info : [32m[ 0.000008] [0m[T9] [33mBIOS-e820: [0m[mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +kern :info : [32m[ 0.000009] [0m[T10] [33mBIOS-e820: [0m[mem 0x0000000009f3c000-0x000000004235ffff] usable +kern :info : [32m[ 0.000010] [0m[T11] [33mBIOS-e820: [0m[mem 0x0000000042360000-0x000000004455ffff] reserved +kern :info : [32m[ 0.201607] [0m[T12] [33msmp: [0mBringing up secondary CPUs ... +kern :info : [32m[ 0.201607] [0m[T13] [33msmpboot: [0mx86: Booting SMP configuration: +kern :warn : [32m[ 0.209670] [0m[T14] [1m #1 #3 #5 #7[0m +kern :info : [32m[ 0.212630] [0m[T15] [33msmp: [0mBrought up 1 node, 16 CPUs +kern :notice: [32m[ 0.215936] [0m[T16] [33maudit: [0mtype=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +kern :info : [32m[ 0.215937] [0m[T17] [33mthermal_sys: [0mRegistered thermal governor 'fair_share' +kern :warn : [32m[ 0.215966] [0m[T18] [33mENERGY_PERF_BIAS: [0m[1mSet to 'normal', was 'performance'[0m +kern :info : [32m[ 0.367657] [0m[T19] [33mACPI: [0m\_SB_.PCI0.GP19.NHI1.PWRS: New power resource +kern :info : [32m[ 0.368615] [0m[T20] [33mACPI: [0m\_SB_.PCI0.GP19.XHC4.PWRS: New power resource +kern :info : [32m[ 0.376316] [0m[T21] [33mACPI: [0m\_SB_.PRWL: New power resource +kern :info : [32m[ 0.376343] [0m[T22] [33mACPI: [0m\_SB_.PRWB: New power resource +kern :info : [32m[ 0.377373] [0m[T23] [33mACPI: [0mPCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +kern :info : [32m[ 0.377378] [0m[T24] [33macpi PNP0A08:00: [0m_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +kern :info : [32m[ 0.377569] [0m[T25] [33macpi PNP0A08:00: [0m_OSC: platform does not support [SHPCHotplug AER] +kern :info : [32m[ 0.377933] [0m[T26] [33macpi PNP0A08:00: [0m_OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +kern :info : [32m[ 0.378458] [0m[T27] PCI host bridge to bus 0000:00 +kern :info : [32m[ 0.378459] [0m[T28] [33mpci_bus 0000:00: [0mroot bus resource [io 0x0000-0x0cf7 window] +kern :info : [32m[ 0.378461] [0m[T29] [33mpci_bus 0000:00: [0mroot bus resource [io 0x0d00-0xffff window] +user :notice: [32m[ 9.398562] [0m[T30] user network daemon initialization complete +daemon:info : [32m[ 10.441520] [0m[T31] [33msystemd[1]: [0msystemd 254.7-1.fc39 running in system mode +daemon:info : [32m[ 11.441524] [0m[T32] [33msystemd[1]: [0mDetected architecture x86-64. +daemon:info : [32m[ 12.441525] [0m[T33] [33msystemd[1]: [0mRunning in initrd. +daemon:info : [32m[ 13.541598] [0m[T34] [33msystemd[1]: [0mHostname set to <catalina>. +kern :info : [32m[ 15.641860] [0m[T35] [33musb 3-3: [0mNew USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +kern :err : [32m[ 16.690000] [0m[T36] [33mSerial bus multi instantiate pseudo device driver INT3515:00: [0m[31merror -ENXIO: IRQ index 1 not found.[0m +kern :err : [32m[ 17.710000] [0m[T37] [33msnd_hda_intel 0000:00:1f.3: [0m[31mCORB reset timeout#2, CORBRP = 65535[0m +syslog:info : [32m[ 18.720000] [0m[T38] [33msystemd-journald[723]: [0mReceived client request to flush runtime journal. +syslog:warn : [32m[ 20.740000] [0m[T39] [33msystemd-journald[723]: [0m[1mFile /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.[0m +syslog:info : [32m[ 21.752348] [0m[T40] [33msystemd-journald[723]: [0m/var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +kern :warn : [32m[ 24.761100] [0m[T41] [33mPEFILE: [0m[1mUnsigned PE binary[0m +kern :err : [32m[ 35.768091] [0m[T42] [33msnd_hda_intel 0000:00:1f.3: [0m[31mCORB reset timeout#2, CORBRP = 65535[0m +kern :info : [32m[ 137.791785] [0m[C1] [33musb 3-3.1: [0mdevice firmware changed +kern :info : [32m[ 146.803248] [0m[C2] [33musb 3-3.1: [0mUSB disconnect, device number 44 +kern :info : [32m[ 148.821859] [0m[C3] [33musb 3-3.1: [0mNew USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +kern :info : [32m[ 149.840480] [0m[C4] [33mperf: [0minterrupt took too long (2518 > 2500) +kern :info : [32m[ 150.853128] [0m[C5] [33mperf: [0minterrupt took too long (3217 > 3147) +kern :info : [32m[ 153.859311] [0m[C12] [33mperf: [0minterrupt took too long (3654 > 3239) +kern :info : [32m[ 155.861908] [0m[C123] [33mperf: [0minterrupt took too long (3789 > 3545) +kern :info : [32m[ 158.870434] [0m[C1234] [33mperf: [0minterrupt took too long (3891 > 3647) +kern :info : [32m[ 161.887625] [0m[C12345] [33mperf: [0minterrupt took too long (3947 > 3789) +kern :info : [32m[ 163.898434] [0m[C123456] [33mperf: [0minterrupt took too long (4011 > 3898) +kern :info : [32m[ 166.909842] [0m[C1234567] [33mperf: [0minterrupt took too long (4174 > 3987) +user :warn : [32m[ 169.911147] [0m[T123] [1mUser program Dmesg Test Message at warn priority[0m +user :warn : [32m[ 178.927435] [0m[T1234] [1mUser program Dmesg Test Message at warn priority[0m +user :notice: [32m[ 185.943456] [0m[T12345] User program Dmesg Test Message at notice priority +user :info : [32m[ 189.963238] [0m[T123456] User program Dmesg Test Message at info priority +user :debug : [32m[ 207.987439] [0m[T1234567] User program Dmesg Test Message at debug priority + diff --git a/tests/expected/dmesg/cid-kmsg-console-levels b/tests/expected/dmesg/cid-kmsg-console-levels new file mode 100644 index 0000000..ef2e83c --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-console-levels @@ -0,0 +1,146 @@ +Display console level: -1 +Display console level: 0 +[ 0.000000] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +Display console level: 1 +[ 0.000001] [T2] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system +Display console level: 2 +[ 0.000002] [T3] BIOS-provided physical RAM map: +Display console level: 3 +[ 0.000003] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +[ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +[ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +Display console level: 4 +[ 0.000004] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved +[ 0.209670] [T14] #1 #3 #5 #7 +[ 0.215966] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +[ 20.740000] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +[ 24.761100] [T41] PEFILE: Unsigned PE binary +[ 169.911147] [T123] User program Dmesg Test Message at warn priority +[ 178.927435] [T1234] User program Dmesg Test Message at warn priority +Display console level: 5 +[ 0.000005] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable +[ 0.215936] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +[ 9.398562] [T30] user network daemon initialization complete +[ 185.943456] [T12345] User program Dmesg Test Message at notice priority +Display console level: 6 +[ 0.000006] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved +[ 0.000008] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +[ 0.000009] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable +[ 0.000010] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved +[ 0.201607] [T12] smp: Bringing up secondary CPUs ... +[ 0.201607] [T13] smpboot: x86: Booting SMP configuration: +[ 0.212630] [T15] smp: Brought up 1 node, 16 CPUs +[ 0.215937] [T17] thermal_sys: Registered thermal governor 'fair_share' +[ 0.367657] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +[ 0.368615] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +[ 0.376316] [T21] ACPI: \_SB_.PRWL: New power resource +[ 0.376343] [T22] ACPI: \_SB_.PRWB: New power resource +[ 0.377373] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +[ 0.377378] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +[ 0.377569] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +[ 0.377933] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +[ 0.378458] [T27] PCI host bridge to bus 0000:00 +[ 0.378459] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +[ 0.378461] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +[ 10.441520] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +[ 11.441524] [T32] systemd[1]: Detected architecture x86-64. +[ 12.441525] [T33] systemd[1]: Running in initrd. +[ 13.541598] [T34] systemd[1]: Hostname set to <catalina>. +[ 15.641860] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +[ 18.720000] [T38] systemd-journald[723]: Received client request to flush runtime journal. +[ 21.752348] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +[ 137.791785] [C1] usb 3-3.1: device firmware changed +[ 146.803248] [C2] usb 3-3.1: USB disconnect, device number 44 +[ 148.821859] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +[ 149.840480] [C4] perf: interrupt took too long (2518 > 2500) +[ 150.853128] [C5] perf: interrupt took too long (3217 > 3147) +[ 153.859311] [C12] perf: interrupt took too long (3654 > 3239) +[ 155.861908] [C123] perf: interrupt took too long (3789 > 3545) +[ 158.870434] [C1234] perf: interrupt took too long (3891 > 3647) +[ 161.887625] [C12345] perf: interrupt took too long (3947 > 3789) +[ 163.898434] [C123456] perf: interrupt took too long (4011 > 3898) +[ 166.909842] [C1234567] perf: interrupt took too long (4174 > 3987) +[ 189.963238] [T123456] User program Dmesg Test Message at info priority +Display console level: 7 +[ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +[ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + +Display console level: 8 +Display console level: err+ +[ 0.000000] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +[ 0.000001] [T2] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system +[ 0.000002] [T3] BIOS-provided physical RAM map: +[ 0.000003] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +[ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +[ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +Display console level: emerg+ +[ 0.000000] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +Display console level: +err +[ 0.000003] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +[ 0.000004] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved +[ 0.000005] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable +[ 0.000006] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved +[ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +[ 0.000008] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +[ 0.000009] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable +[ 0.000010] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved +[ 0.201607] [T12] smp: Bringing up secondary CPUs ... +[ 0.201607] [T13] smpboot: x86: Booting SMP configuration: +[ 0.209670] [T14] #1 #3 #5 #7 +[ 0.212630] [T15] smp: Brought up 1 node, 16 CPUs +[ 0.215936] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +[ 0.215937] [T17] thermal_sys: Registered thermal governor 'fair_share' +[ 0.215966] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +[ 0.367657] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +[ 0.368615] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +[ 0.376316] [T21] ACPI: \_SB_.PRWL: New power resource +[ 0.376343] [T22] ACPI: \_SB_.PRWB: New power resource +[ 0.377373] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +[ 0.377378] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +[ 0.377569] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +[ 0.377933] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +[ 0.378458] [T27] PCI host bridge to bus 0000:00 +[ 0.378459] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +[ 0.378461] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +[ 9.398562] [T30] user network daemon initialization complete +[ 10.441520] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +[ 11.441524] [T32] systemd[1]: Detected architecture x86-64. +[ 12.441525] [T33] systemd[1]: Running in initrd. +[ 13.541598] [T34] systemd[1]: Hostname set to <catalina>. +[ 15.641860] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +[ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +[ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 18.720000] [T38] systemd-journald[723]: Received client request to flush runtime journal. +[ 20.740000] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +[ 21.752348] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +[ 24.761100] [T41] PEFILE: Unsigned PE binary +[ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 137.791785] [C1] usb 3-3.1: device firmware changed +[ 146.803248] [C2] usb 3-3.1: USB disconnect, device number 44 +[ 148.821859] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +[ 149.840480] [C4] perf: interrupt took too long (2518 > 2500) +[ 150.853128] [C5] perf: interrupt took too long (3217 > 3147) +[ 153.859311] [C12] perf: interrupt took too long (3654 > 3239) +[ 155.861908] [C123] perf: interrupt took too long (3789 > 3545) +[ 158.870434] [C1234] perf: interrupt took too long (3891 > 3647) +[ 161.887625] [C12345] perf: interrupt took too long (3947 > 3789) +[ 163.898434] [C123456] perf: interrupt took too long (4011 > 3898) +[ 166.909842] [C1234567] perf: interrupt took too long (4174 > 3987) +[ 169.911147] [T123] User program Dmesg Test Message at warn priority +[ 178.927435] [T1234] User program Dmesg Test Message at warn priority +[ 185.943456] [T12345] User program Dmesg Test Message at notice priority +[ 189.963238] [T123456] User program Dmesg Test Message at info priority +[ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + +Display console level: +debug +[ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +[ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + +Display console level: debug +[ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +[ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + +Display console level: + (invalid) +test_dmesg: unknown level '+' diff --git a/tests/expected/dmesg/cid-kmsg-decode b/tests/expected/dmesg/cid-kmsg-decode new file mode 100644 index 0000000..e1cecfa --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-decode @@ -0,0 +1,59 @@ +kern :emerg : [ 0.000000] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +kern :alert : [ 0.000001] [T2] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system +kern :crit : [ 0.000002] [T3] BIOS-provided physical RAM map: +kern :err : [ 0.000003] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +kern :warn : [ 0.000004] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved +kern :notice: [ 0.000005] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable +kern :info : [ 0.000006] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved +kern :debug : [ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +kern :info : [ 0.000008] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +kern :info : [ 0.000009] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable +kern :info : [ 0.000010] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved +kern :info : [ 0.201607] [T12] smp: Bringing up secondary CPUs ... +kern :info : [ 0.201607] [T13] smpboot: x86: Booting SMP configuration: +kern :warn : [ 0.209670] [T14] #1 #3 #5 #7 +kern :info : [ 0.212630] [T15] smp: Brought up 1 node, 16 CPUs +kern :notice: [ 0.215936] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +kern :info : [ 0.215937] [T17] thermal_sys: Registered thermal governor 'fair_share' +kern :warn : [ 0.215966] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +kern :info : [ 0.367657] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +kern :info : [ 0.368615] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +kern :info : [ 0.376316] [T21] ACPI: \_SB_.PRWL: New power resource +kern :info : [ 0.376343] [T22] ACPI: \_SB_.PRWB: New power resource +kern :info : [ 0.377373] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +kern :info : [ 0.377378] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +kern :info : [ 0.377569] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +kern :info : [ 0.377933] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +kern :info : [ 0.378458] [T27] PCI host bridge to bus 0000:00 +kern :info : [ 0.378459] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +kern :info : [ 0.378461] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +user :notice: [ 9.398562] [T30] user network daemon initialization complete +daemon:info : [ 10.441520] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +daemon:info : [ 11.441524] [T32] systemd[1]: Detected architecture x86-64. +daemon:info : [ 12.441525] [T33] systemd[1]: Running in initrd. +daemon:info : [ 13.541598] [T34] systemd[1]: Hostname set to <catalina>. +kern :info : [ 15.641860] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +kern :err : [ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +kern :err : [ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +syslog:info : [ 18.720000] [T38] systemd-journald[723]: Received client request to flush runtime journal. +syslog:warn : [ 20.740000] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +syslog:info : [ 21.752348] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +kern :warn : [ 24.761100] [T41] PEFILE: Unsigned PE binary +kern :err : [ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +kern :info : [ 137.791785] [C1] usb 3-3.1: device firmware changed +kern :info : [ 146.803248] [C2] usb 3-3.1: USB disconnect, device number 44 +kern :info : [ 148.821859] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +kern :info : [ 149.840480] [C4] perf: interrupt took too long (2518 > 2500) +kern :info : [ 150.853128] [C5] perf: interrupt took too long (3217 > 3147) +kern :info : [ 153.859311] [C12] perf: interrupt took too long (3654 > 3239) +kern :info : [ 155.861908] [C123] perf: interrupt took too long (3789 > 3545) +kern :info : [ 158.870434] [C1234] perf: interrupt took too long (3891 > 3647) +kern :info : [ 161.887625] [C12345] perf: interrupt took too long (3947 > 3789) +kern :info : [ 163.898434] [C123456] perf: interrupt took too long (4011 > 3898) +kern :info : [ 166.909842] [C1234567] perf: interrupt took too long (4174 > 3987) +user :warn : [ 169.911147] [T123] User program Dmesg Test Message at warn priority +user :warn : [ 178.927435] [T1234] User program Dmesg Test Message at warn priority +user :notice: [ 185.943456] [T12345] User program Dmesg Test Message at notice priority +user :info : [ 189.963238] [T123456] User program Dmesg Test Message at info priority +user :debug : [ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + diff --git a/tests/expected/dmesg/cid-kmsg-delta b/tests/expected/dmesg/cid-kmsg-delta new file mode 100644 index 0000000..e767b2b --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-delta @@ -0,0 +1,59 @@ +[ 0.000000 < 0.000000>] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +[ 0.000001 < 0.000000>] [T2] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system +[ 0.000002 < 0.000001>] [T3] BIOS-provided physical RAM map: +[ 0.000003 < 0.000001>] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +[ 0.000004 < 0.000001>] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved +[ 0.000005 < 0.000001>] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable +[ 0.000006 < 0.000001>] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved +[ 0.000007 < 0.000001>] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +[ 0.000008 < 0.000001>] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +[ 0.000009 < 0.000001>] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable +[ 0.000010 < 0.000001>] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved +[ 0.201607 < 0.201597>] [T12] smp: Bringing up secondary CPUs ... +[ 0.201607 < 0.000000>] [T13] smpboot: x86: Booting SMP configuration: +[ 0.209670 < 0.008063>] [T14] #1 #3 #5 #7 +[ 0.212630 < 0.002960>] [T15] smp: Brought up 1 node, 16 CPUs +[ 0.215936 < 0.003306>] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +[ 0.215937 < 0.000001>] [T17] thermal_sys: Registered thermal governor 'fair_share' +[ 0.215966 < 0.000029>] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +[ 0.367657 < 0.151691>] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +[ 0.368615 < 0.000958>] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +[ 0.376316 < 0.007701>] [T21] ACPI: \_SB_.PRWL: New power resource +[ 0.376343 < 0.000027>] [T22] ACPI: \_SB_.PRWB: New power resource +[ 0.377373 < 0.001030>] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +[ 0.377378 < 0.000005>] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +[ 0.377569 < 0.000191>] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +[ 0.377933 < 0.000364>] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +[ 0.378458 < 0.000525>] [T27] PCI host bridge to bus 0000:00 +[ 0.378459 < 0.000001>] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +[ 0.378461 < 0.000002>] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +[ 9.398562 < 9.020101>] [T30] user network daemon initialization complete +[ 10.441520 < 1.042958>] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +[ 11.441524 < 1.000004>] [T32] systemd[1]: Detected architecture x86-64. +[ 12.441525 < 1.000001>] [T33] systemd[1]: Running in initrd. +[ 13.541598 < 1.100073>] [T34] systemd[1]: Hostname set to <catalina>. +[ 15.641860 < 2.100262>] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +[ 16.690000 < 1.048140>] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +[ 17.710000 < 1.020000>] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 18.720000 < 1.010000>] [T38] systemd-journald[723]: Received client request to flush runtime journal. +[ 20.740000 < 2.020000>] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +[ 21.752348 < 1.012348>] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +[ 24.761100 < 3.008752>] [T41] PEFILE: Unsigned PE binary +[ 35.768091 < 11.006991>] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 137.791785 < 102.023694>] [C1] usb 3-3.1: device firmware changed +[ 146.803248 < 9.011463>] [C2] usb 3-3.1: USB disconnect, device number 44 +[ 148.821859 < 2.018611>] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +[ 149.840480 < 1.018621>] [C4] perf: interrupt took too long (2518 > 2500) +[ 150.853128 < 1.012648>] [C5] perf: interrupt took too long (3217 > 3147) +[ 153.859311 < 3.006183>] [C12] perf: interrupt took too long (3654 > 3239) +[ 155.861908 < 2.002597>] [C123] perf: interrupt took too long (3789 > 3545) +[ 158.870434 < 3.008526>] [C1234] perf: interrupt took too long (3891 > 3647) +[ 161.887625 < 3.017191>] [C12345] perf: interrupt took too long (3947 > 3789) +[ 163.898434 < 2.010809>] [C123456] perf: interrupt took too long (4011 > 3898) +[ 166.909842 < 3.011408>] [C1234567] perf: interrupt took too long (4174 > 3987) +[ 169.911147 < 3.001305>] [T123] User program Dmesg Test Message at warn priority +[ 178.927435 < 9.016288>] [T1234] User program Dmesg Test Message at warn priority +[ 185.943456 < 7.016021>] [T12345] User program Dmesg Test Message at notice priority +[ 189.963238 < 4.019782>] [T123456] User program Dmesg Test Message at info priority +[ 207.987439 < 18.024201>] [T1234567] User program Dmesg Test Message at debug priority + diff --git a/tests/expected/dmesg/cid-kmsg-facilities b/tests/expected/dmesg/cid-kmsg-facilities new file mode 100644 index 0000000..bacfbd1 --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-facilities @@ -0,0 +1,73 @@ +Display facility list: -1 +Display facility list: 0 +kern :emerg : [ 0.000000] [T1] Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000 +kern :alert : [ 0.000001] [T2] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system +kern :crit : [ 0.000002] [T3] BIOS-provided physical RAM map: +kern :err : [ 0.000003] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable +kern :warn : [ 0.000004] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved +kern :notice: [ 0.000005] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable +kern :info : [ 0.000006] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved +kern :debug : [ 0.000007] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable +kern :info : [ 0.000008] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS +kern :info : [ 0.000009] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable +kern :info : [ 0.000010] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved +kern :info : [ 0.201607] [T12] smp: Bringing up secondary CPUs ... +kern :info : [ 0.201607] [T13] smpboot: x86: Booting SMP configuration: +kern :warn : [ 0.209670] [T14] #1 #3 #5 #7 +kern :info : [ 0.212630] [T15] smp: Brought up 1 node, 16 CPUs +kern :notice: [ 0.215936] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +kern :info : [ 0.215937] [T17] thermal_sys: Registered thermal governor 'fair_share' +kern :warn : [ 0.215966] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +kern :info : [ 0.367657] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +kern :info : [ 0.368615] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +kern :info : [ 0.376316] [T21] ACPI: \_SB_.PRWL: New power resource +kern :info : [ 0.376343] [T22] ACPI: \_SB_.PRWB: New power resource +kern :info : [ 0.377373] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +kern :info : [ 0.377378] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +kern :info : [ 0.377569] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +kern :info : [ 0.377933] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +kern :info : [ 0.378458] [T27] PCI host bridge to bus 0000:00 +kern :info : [ 0.378459] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +kern :info : [ 0.378461] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +kern :info : [ 15.641860] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +kern :err : [ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +kern :err : [ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +kern :warn : [ 24.761100] [T41] PEFILE: Unsigned PE binary +kern :err : [ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +kern :info : [ 137.791785] [C1] usb 3-3.1: device firmware changed +kern :info : [ 146.803248] [C2] usb 3-3.1: USB disconnect, device number 44 +kern :info : [ 148.821859] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30 +kern :info : [ 149.840480] [C4] perf: interrupt took too long (2518 > 2500) +kern :info : [ 150.853128] [C5] perf: interrupt took too long (3217 > 3147) +kern :info : [ 153.859311] [C12] perf: interrupt took too long (3654 > 3239) +kern :info : [ 155.861908] [C123] perf: interrupt took too long (3789 > 3545) +kern :info : [ 158.870434] [C1234] perf: interrupt took too long (3891 > 3647) +kern :info : [ 161.887625] [C12345] perf: interrupt took too long (3947 > 3789) +kern :info : [ 163.898434] [C123456] perf: interrupt took too long (4011 > 3898) +kern :info : [ 166.909842] [C1234567] perf: interrupt took too long (4174 > 3987) +Display facility list: 1 +user :notice: [ 9.398562] [T30] user network daemon initialization complete +user :warn : [ 169.911147] [T123] User program Dmesg Test Message at warn priority +user :warn : [ 178.927435] [T1234] User program Dmesg Test Message at warn priority +user :notice: [ 185.943456] [T12345] User program Dmesg Test Message at notice priority +user :info : [ 189.963238] [T123456] User program Dmesg Test Message at info priority +user :debug : [ 207.987439] [T1234567] User program Dmesg Test Message at debug priority + +Display facility list: 2 +Display facility list: 3 +daemon:info : [ 10.441520] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +daemon:info : [ 11.441524] [T32] systemd[1]: Detected architecture x86-64. +daemon:info : [ 12.441525] [T33] systemd[1]: Running in initrd. +daemon:info : [ 13.541598] [T34] systemd[1]: Hostname set to <catalina>. +Display facility list: 4 +Display facility list: 5 +syslog:info : [ 18.720000] [T38] systemd-journald[723]: Received client request to flush runtime journal. +syslog:warn : [ 20.740000] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +syslog:info : [ 21.752348] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +Display facility list: 6 +Display facility list: 7 +Display facility list: 8 +Display facility list: 9 +Display facility list: 10 +Display facility list: 11 +Display facility list: 12 diff --git a/tests/expected/dmesg/cid-kmsg-indentation b/tests/expected/dmesg/cid-kmsg-indentation new file mode 100644 index 0000000..28c0199 --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-indentation @@ -0,0 +1,28 @@ +[ 0.000000] [T0] line zero +[ 1.000000] [T1] new +[ 2.000000] [T2] two +[ 3.000000] [T3] three +[ 0.000000] [T0] line zero +[ 1.000000] [T1] new +[ 2.000000] [T2] two +[ 3.000000] [T3] three +[< 0.000000>] [T0] line zero +[< 0.000000>] [T1] new +[< 1.000000>] [T2] two +[< 1.000000>] [T3] three +[T0] line zero +[T1] new +[T2] two +[T3] three +[Feb13 23:31] [T0] line zero +[ +0.000000] [T1] new +[ +1.000000] [T2] two +[ +1.000000] [T3] three +[Fri Feb 13 23:31:30 2009] [T0] line zero +[Fri Feb 13 23:31:31 2009] [T1] new +[Fri Feb 13 23:31:32 2009] [T2] two +[Fri Feb 13 23:31:33 2009] [T3] three +2009-02-13T23:31:30,123456+00:00 [T0] line zero +2009-02-13T23:31:31,123456+00:00 [T1] new +2009-02-13T23:31:32,123456+00:00 [T2] two +2009-02-13T23:31:33,123456+00:00 [T3] three diff --git a/tests/expected/dmesg/cid-kmsg-json b/tests/expected/dmesg/cid-kmsg-json new file mode 100644 index 0000000..942506c --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-json @@ -0,0 +1,295 @@ +{ + "dmesg": [ + { + "pri": 0, + "time": 0.000000, + "caller": "T1", + "msg": "Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000" + },{ + "pri": 1, + "time": 0.000001, + "caller": "T2", + "msg": "Command line: initrd=\\ucode.img initrd=\\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system" + },{ + "pri": 2, + "time": 0.000002, + "caller": "T3", + "msg": "BIOS-provided physical RAM map:" + },{ + "pri": 3, + "time": 0.000003, + "caller": "T4", + "msg": "BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable" + },{ + "pri": 4, + "time": 0.000004, + "caller": "T5", + "msg": "BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved" + },{ + "pri": 5, + "time": 0.000005, + "caller": "T6", + "msg": "BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable" + },{ + "pri": 6, + "time": 0.000006, + "caller": "T7", + "msg": "BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved" + },{ + "pri": 7, + "time": 0.000007, + "caller": "T8", + "msg": "BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable" + },{ + "pri": 6, + "time": 0.000008, + "caller": "T9", + "msg": "BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS" + },{ + "pri": 6, + "time": 0.000009, + "caller": "T10", + "msg": "BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable" + },{ + "pri": 6, + "time": 0.000010, + "caller": "T11", + "msg": "BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved" + },{ + "pri": 6, + "time": 0.201607, + "caller": "T12", + "msg": "smp: Bringing up secondary CPUs ..." + },{ + "pri": 6, + "time": 0.201607, + "caller": "T13", + "msg": "smpboot: x86: Booting SMP configuration:" + },{ + "pri": 4, + "time": 0.209670, + "caller": "T14", + "msg": " #1 #3 #5 #7" + },{ + "pri": 6, + "time": 0.212630, + "caller": "T15", + "msg": "smp: Brought up 1 node, 16 CPUs" + },{ + "pri": 5, + "time": 0.215936, + "caller": "T16", + "msg": "audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1" + },{ + "pri": 6, + "time": 0.215937, + "caller": "T17", + "msg": "thermal_sys: Registered thermal governor 'fair_share'" + },{ + "pri": 4, + "time": 0.215966, + "caller": "T18", + "msg": "ENERGY_PERF_BIAS: Set to 'normal', was 'performance'" + },{ + "pri": 6, + "time": 0.367657, + "caller": "T19", + "msg": "ACPI: \\_SB_.PCI0.GP19.NHI1.PWRS: New power resource" + },{ + "pri": 6, + "time": 0.368615, + "caller": "T20", + "msg": "ACPI: \\_SB_.PCI0.GP19.XHC4.PWRS: New power resource" + },{ + "pri": 6, + "time": 0.376316, + "caller": "T21", + "msg": "ACPI: \\_SB_.PRWL: New power resource" + },{ + "pri": 6, + "time": 0.376343, + "caller": "T22", + "msg": "ACPI: \\_SB_.PRWB: New power resource" + },{ + "pri": 6, + "time": 0.377373, + "caller": "T23", + "msg": "ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])" + },{ + "pri": 6, + "time": 0.377378, + "caller": "T24", + "msg": "acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]" + },{ + "pri": 6, + "time": 0.377569, + "caller": "T25", + "msg": "acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]" + },{ + "pri": 6, + "time": 0.377933, + "caller": "T26", + "msg": "acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]" + },{ + "pri": 6, + "time": 0.378458, + "caller": "T27", + "msg": "PCI host bridge to bus 0000:00" + },{ + "pri": 6, + "time": 0.378459, + "caller": "T28", + "msg": "pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]" + },{ + "pri": 6, + "time": 0.378461, + "caller": "T29", + "msg": "pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]" + },{ + "pri": 13, + "time": 9.398562, + "caller": "T30", + "msg": "user network daemon initialization complete" + },{ + "pri": 30, + "time": 10.441520, + "caller": "T31", + "msg": "systemd[1]: systemd 254.7-1.fc39 running in system mode" + },{ + "pri": 30, + "time": 11.441524, + "caller": "T32", + "msg": "systemd[1]: Detected architecture x86-64." + },{ + "pri": 30, + "time": 12.441525, + "caller": "T33", + "msg": "systemd[1]: Running in initrd." + },{ + "pri": 30, + "time": 13.541598, + "caller": "T34", + "msg": "systemd[1]: Hostname set to <catalina>." + },{ + "pri": 6, + "time": 15.641860, + "caller": "T35", + "msg": "usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11" + },{ + "pri": 3, + "time": 16.690000, + "caller": "T36", + "msg": "Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found." + },{ + "pri": 3, + "time": 17.710000, + "caller": "T37", + "msg": "snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535" + },{ + "pri": 46, + "time": 18.720000, + "caller": "T38", + "msg": "systemd-journald[723]: Received client request to flush runtime journal." + },{ + "pri": 44, + "time": 20.740000, + "caller": "T39", + "msg": "systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing." + },{ + "pri": 46, + "time": 21.752348, + "caller": "T40", + "msg": "systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating." + },{ + "pri": 4, + "time": 24.761100, + "caller": "T41", + "msg": "PEFILE: Unsigned PE binary" + },{ + "pri": 3, + "time": 35.768091, + "caller": "T42", + "msg": "snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535" + },{ + "pri": 6, + "time": 137.791785, + "caller": "C1", + "msg": "usb 3-3.1: device firmware changed" + },{ + "pri": 6, + "time": 146.803248, + "caller": "C2", + "msg": "usb 3-3.1: USB disconnect, device number 44" + },{ + "pri": 6, + "time": 148.821859, + "caller": "C3", + "msg": "usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30" + },{ + "pri": 6, + "time": 149.840480, + "caller": "C4", + "msg": "perf: interrupt took too long (2518 > 2500)" + },{ + "pri": 6, + "time": 150.853128, + "caller": "C5", + "msg": "perf: interrupt took too long (3217 > 3147)" + },{ + "pri": 6, + "time": 153.859311, + "caller": "C12", + "msg": "perf: interrupt took too long (3654 > 3239)" + },{ + "pri": 6, + "time": 155.861908, + "caller": "C123", + "msg": "perf: interrupt took too long (3789 > 3545)" + },{ + "pri": 6, + "time": 158.870434, + "caller": "C1234", + "msg": "perf: interrupt took too long (3891 > 3647)" + },{ + "pri": 6, + "time": 161.887625, + "caller": "C12345", + "msg": "perf: interrupt took too long (3947 > 3789)" + },{ + "pri": 6, + "time": 163.898434, + "caller": "C123456", + "msg": "perf: interrupt took too long (4011 > 3898)" + },{ + "pri": 6, + "time": 166.909842, + "caller": "C1234567", + "msg": "perf: interrupt took too long (4174 > 3987)" + },{ + "pri": 12, + "time": 169.911147, + "caller": "T123", + "msg": "User program Dmesg Test Message at warn priority" + },{ + "pri": 12, + "time": 178.927435, + "caller": "T1234", + "msg": "User program Dmesg Test Message at warn priority" + },{ + "pri": 13, + "time": 185.943456, + "caller": "T12345", + "msg": "User program Dmesg Test Message at notice priority" + },{ + "pri": 14, + "time": 189.963238, + "caller": "T123456", + "msg": "User program Dmesg Test Message at info priority" + },{ + "pri": 15, + "time": 207.987439, + "caller": "T1234567", + "msg": "User program Dmesg Test Message at debug priority\n" + } + ] +} diff --git a/tests/expected/dmesg/cid-kmsg-limit b/tests/expected/dmesg/cid-kmsg-limit new file mode 100644 index 0000000..372432d --- /dev/null +++ b/tests/expected/dmesg/cid-kmsg-limit @@ -0,0 +1,31 @@ +[ 0.201607] [T12] smp: Bringing up secondary CPUs ... +[ 0.201607] [T13] smpboot: x86: Booting SMP configuration: +[ 0.209670] [T14] #1 #3 #5 #7 +[ 0.212630] [T15] smp: Brought up 1 node, 16 CPUs +[ 0.215936] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1 +[ 0.215937] [T17] thermal_sys: Registered thermal governor 'fair_share' +[ 0.215966] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' +[ 0.367657] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource +[ 0.368615] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource +[ 0.376316] [T21] ACPI: \_SB_.PRWL: New power resource +[ 0.376343] [T22] ACPI: \_SB_.PRWB: New power resource +[ 0.377373] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) +[ 0.377378] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3] +[ 0.377569] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER] +[ 0.377933] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC] +[ 0.378458] [T27] PCI host bridge to bus 0000:00 +[ 0.378459] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window] +[ 0.378461] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window] +[ 9.398562] [T30] user network daemon initialization complete +[ 10.441520] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode +[ 11.441524] [T32] systemd[1]: Detected architecture x86-64. +[ 12.441525] [T33] systemd[1]: Running in initrd. +[ 13.541598] [T34] systemd[1]: Hostname set to <catalina>. +[ 15.641860] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11 +[ 16.690000] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found. +[ 17.710000] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 +[ 18.720000] [T38] systemd-journald[723]: Received client request to flush runtime journal. +[ 20.740000] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing. +[ 21.752348] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating. +[ 24.761100] [T41] PEFILE: Unsigned PE binary +[ 35.768091] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535 diff --git a/tests/expected/dmesg/colors b/tests/expected/dmesg/colors index 40aca73..7a5035e 100644 --- a/tests/expected/dmesg/colors +++ b/tests/expected/dmesg/colors @@ -94,12 +94,13 @@ ftp :warn : [32m[778688.000000] [0m[1mexample[92][0m ftp :notice: [32m[804357.000000] [0mexample[93] ftp :info : [32m[830584.000000] [0mexample[94] ftp :debug : [32m[857375.000000] [0mexample[95] -[32m[884736.000000] [0mexample[96] -[32m[912673.000000] [0m[7m[31mexample[97][0m -[32m[941192.000000] [0m[1m[31mexample[98][0m -[32m[970299.000000] [0m[31mexample[99][0m -[32m[1000000.000000] [0m[1mexample[100][0m -[32m[1030301.000000] [0mexample[101] -[32m[1061208.000000] [0mexample[102] -[32m[1092727.000000] [0mexample[103] -[32m[1124864.000000] [0mexample[104] +res0 :emerg : [32m[884736.000000] [0mexample[96] +res0 :alert : [32m[912673.000000] [0m[7m[31mexample[97][0m +res0 :crit : [32m[941192.000000] [0m[1m[31mexample[98][0m +res0 :err : [32m[970299.000000] [0m[31mexample[99][0m +res0 :warn : [32m[1000000.000000] [0m[1mexample[100][0m +res0 :notice: [32m[1030301.000000] [0mexample[101] +res0 :info : [32m[1061208.000000] [0mexample[102] +res0 :debug : [32m[1092727.000000] [0mexample[103] +res1 :emerg : [32m[1124864.000000] [0mexample[104] +local2:info : [32m[4557523.000000] [0mexample[105] diff --git a/tests/expected/dmesg/console-levels b/tests/expected/dmesg/console-levels index 43615f8..7229e8c 100644 --- a/tests/expected/dmesg/console-levels +++ b/tests/expected/dmesg/console-levels @@ -11,6 +11,7 @@ [512000.000000] example[80] [681472.000000] example[88] [884736.000000] example[96] +[1124864.000000] example[104] [ 1.000000] example[1] [ 729.000000] example[9] [ 4913.000000] example[17] @@ -89,6 +90,7 @@ [636056.000000] example[86] [830584.000000] example[94] [1061208.000000] example[102] +[4557523.000000] example[105] [ 343.000000] example[7] [ 3375.000000] example[15] [12167.000000] example[23] @@ -154,6 +156,7 @@ [912673.000000] example[97] [941192.000000] example[98] [970299.000000] example[99] +[1124864.000000] example[104] [ 0.000000] example[0] [ 512.000000] example[8] [ 4096.000000] example[16] @@ -167,6 +170,7 @@ [512000.000000] example[80] [681472.000000] example[88] [884736.000000] example[96] +[1124864.000000] example[104] [ 27.000000] example[3] [ 64.000000] example[4] [ 125.000000] example[5] @@ -232,6 +236,7 @@ [1030301.000000] example[101] [1061208.000000] example[102] [1092727.000000] example[103] +[4557523.000000] example[105] [ 343.000000] example[7] [ 3375.000000] example[15] [12167.000000] example[23] diff --git a/tests/expected/dmesg/decode b/tests/expected/dmesg/decode index f3541a6..f8088d0 100644 --- a/tests/expected/dmesg/decode +++ b/tests/expected/dmesg/decode @@ -94,12 +94,13 @@ ftp :warn : [778688.000000] example[92] ftp :notice: [804357.000000] example[93] ftp :info : [830584.000000] example[94] ftp :debug : [857375.000000] example[95] -[884736.000000] example[96] -[912673.000000] example[97] -[941192.000000] example[98] -[970299.000000] example[99] -[1000000.000000] example[100] -[1030301.000000] example[101] -[1061208.000000] example[102] -[1092727.000000] example[103] -[1124864.000000] example[104] +res0 :emerg : [884736.000000] example[96] +res0 :alert : [912673.000000] example[97] +res0 :crit : [941192.000000] example[98] +res0 :err : [970299.000000] example[99] +res0 :warn : [1000000.000000] example[100] +res0 :notice: [1030301.000000] example[101] +res0 :info : [1061208.000000] example[102] +res0 :debug : [1092727.000000] example[103] +res1 :emerg : [1124864.000000] example[104] +local2:info : [4557523.000000] example[105] diff --git a/tests/expected/dmesg/delta b/tests/expected/dmesg/delta index 01dfec3..d90d494 100644 --- a/tests/expected/dmesg/delta +++ b/tests/expected/dmesg/delta @@ -103,3 +103,4 @@ [1061208.000000 <30907.000000>] example[102] [1092727.000000 <31519.000000>] example[103] [1124864.000000 <32137.000000>] example[104] +[4557523.000000 <3432659.000000>] example[105] diff --git a/tests/expected/dmesg/facilities b/tests/expected/dmesg/facilities index 9733e56..d5c4c43 100644 --- a/tests/expected/dmesg/facilities +++ b/tests/expected/dmesg/facilities @@ -94,3 +94,11 @@ [804357.000000] example[93] [830584.000000] example[94] [857375.000000] example[95] +[884736.000000] example[96] +[912673.000000] example[97] +[941192.000000] example[98] +[970299.000000] example[99] +[1000000.000000] example[100] +[1030301.000000] example[101] +[1061208.000000] example[102] +[1092727.000000] example[103] diff --git a/tests/expected/dmesg/json b/tests/expected/dmesg/json new file mode 100644 index 0000000..894d629 --- /dev/null +++ b/tests/expected/dmesg/json @@ -0,0 +1,429 @@ +{ + "dmesg": [ + { + "pri": 0, + "time": 0.000000, + "msg": "example[0]" + },{ + "pri": 1, + "time": 1.000000, + "msg": "example[1]" + },{ + "pri": 2, + "time": 8.000000, + "msg": "example[2]" + },{ + "pri": 3, + "time": 27.000000, + "msg": "example[3]" + },{ + "pri": 4, + "time": 64.000000, + "msg": "example[4]" + },{ + "pri": 5, + "time": 125.000000, + "msg": "example[5]" + },{ + "pri": 6, + "time": 216.000000, + "msg": "example[6]" + },{ + "pri": 7, + "time": 343.000000, + "msg": "example[7]" + },{ + "pri": 8, + "time": 512.000000, + "msg": "example[8]" + },{ + "pri": 9, + "time": 729.000000, + "msg": "example[9]" + },{ + "pri": 10, + "time": 1000.000000, + "msg": "example[10]" + },{ + "pri": 11, + "time": 1331.000000, + "msg": "example[11]" + },{ + "pri": 12, + "time": 1728.000000, + "msg": "example[12]" + },{ + "pri": 13, + "time": 2197.000000, + "msg": "example[13]" + },{ + "pri": 14, + "time": 2744.000000, + "msg": "example[14]" + },{ + "pri": 15, + "time": 3375.000000, + "msg": "example[15]" + },{ + "pri": 16, + "time": 4096.000000, + "msg": "example[16]" + },{ + "pri": 17, + "time": 4913.000000, + "msg": "example[17]" + },{ + "pri": 18, + "time": 5832.000000, + "msg": "example[18]" + },{ + "pri": 19, + "time": 6859.000000, + "msg": "example[19]" + },{ + "pri": 20, + "time": 8000.000000, + "msg": "example[20]" + },{ + "pri": 21, + "time": 9261.000000, + "msg": "example[21]" + },{ + "pri": 22, + "time": 10648.000000, + "msg": "example[22]" + },{ + "pri": 23, + "time": 12167.000000, + "msg": "example[23]" + },{ + "pri": 24, + "time": 13824.000000, + "msg": "example[24]" + },{ + "pri": 25, + "time": 15625.000000, + "msg": "example[25]" + },{ + "pri": 26, + "time": 17576.000000, + "msg": "example[26]" + },{ + "pri": 27, + "time": 19683.000000, + "msg": "example[27]" + },{ + "pri": 28, + "time": 21952.000000, + "msg": "example[28]" + },{ + "pri": 29, + "time": 24389.000000, + "msg": "example[29]" + },{ + "pri": 30, + "time": 27000.000000, + "msg": "example[30]" + },{ + "pri": 31, + "time": 29791.000000, + "msg": "example[31]" + },{ + "pri": 32, + "time": 32768.000000, + "msg": "example[32]" + },{ + "pri": 33, + "time": 35937.000000, + "msg": "example[33]" + },{ + "pri": 34, + "time": 39304.000000, + "msg": "example[34]" + },{ + "pri": 35, + "time": 42875.000000, + "msg": "example[35]" + },{ + "pri": 36, + "time": 46656.000000, + "msg": "example[36]" + },{ + "pri": 37, + "time": 50653.000000, + "msg": "example[37]" + },{ + "pri": 38, + "time": 54872.000000, + "msg": "example[38]" + },{ + "pri": 39, + "time": 59319.000000, + "msg": "example[39]" + },{ + "pri": 40, + "time": 64000.000000, + "msg": "example[40]" + },{ + "pri": 41, + "time": 68921.000000, + "msg": "example[41]" + },{ + "pri": 42, + "time": 74088.000000, + "msg": "example[42]" + },{ + "pri": 43, + "time": 79507.000000, + "msg": "example[43]" + },{ + "pri": 44, + "time": 85184.000000, + "msg": "example[44]" + },{ + "pri": 45, + "time": 91125.000000, + "msg": "example[45]" + },{ + "pri": 46, + "time": 97336.000000, + "msg": "example[46]" + },{ + "pri": 47, + "time": 103823.000000, + "msg": "example[47]" + },{ + "pri": 48, + "time": 110592.000000, + "msg": "example[48]" + },{ + "pri": 49, + "time": 117649.000000, + "msg": "example[49]" + },{ + "pri": 50, + "time": 125000.000000, + "msg": "example[50]" + },{ + "pri": 51, + "time": 132651.000000, + "msg": "example[51]" + },{ + "pri": 52, + "time": 140608.000000, + "msg": "example[52]" + },{ + "pri": 53, + "time": 148877.000000, + "msg": "example[53]" + },{ + "pri": 54, + "time": 157464.000000, + "msg": "example[54]" + },{ + "pri": 55, + "time": 166375.000000, + "msg": "example[55]" + },{ + "pri": 56, + "time": 175616.000000, + "msg": "example[56]" + },{ + "pri": 57, + "time": 185193.000000, + "msg": "example[57]" + },{ + "pri": 58, + "time": 195112.000000, + "msg": "example[58]" + },{ + "pri": 59, + "time": 205379.000000, + "msg": "example[59]" + },{ + "pri": 60, + "time": 216000.000000, + "msg": "example[60]" + },{ + "pri": 61, + "time": 226981.000000, + "msg": "example[61]" + },{ + "pri": 62, + "time": 238328.000000, + "msg": "example[62]" + },{ + "pri": 63, + "time": 250047.000000, + "msg": "example[63]" + },{ + "pri": 64, + "time": 262144.000000, + "msg": "example[64]" + },{ + "pri": 65, + "time": 274625.000000, + "msg": "example[65]" + },{ + "pri": 66, + "time": 287496.000000, + "msg": "example[66]" + },{ + "pri": 67, + "time": 300763.000000, + "msg": "example[67]" + },{ + "pri": 68, + "time": 314432.000000, + "msg": "example[68]" + },{ + "pri": 69, + "time": 328509.000000, + "msg": "example[69]" + },{ + "pri": 70, + "time": 343000.000000, + "msg": "example[70]" + },{ + "pri": 71, + "time": 357911.000000, + "msg": "example[71]" + },{ + "pri": 72, + "time": 373248.000000, + "msg": "example[72]" + },{ + "pri": 73, + "time": 389017.000000, + "msg": "example[73]" + },{ + "pri": 74, + "time": 405224.000000, + "msg": "example[74]" + },{ + "pri": 75, + "time": 421875.000000, + "msg": "example[75]" + },{ + "pri": 76, + "time": 438976.000000, + "msg": "example[76]" + },{ + "pri": 77, + "time": 456533.000000, + "msg": "example[77]" + },{ + "pri": 78, + "time": 474552.000000, + "msg": "example[78]" + },{ + "pri": 79, + "time": 493039.000000, + "msg": "example[79]" + },{ + "pri": 80, + "time": 512000.000000, + "msg": "example[80]" + },{ + "pri": 81, + "time": 531441.000000, + "msg": "example[81]" + },{ + "pri": 82, + "time": 551368.000000, + "msg": "example[82]" + },{ + "pri": 83, + "time": 571787.000000, + "msg": "example[83]" + },{ + "pri": 84, + "time": 592704.000000, + "msg": "example[84]" + },{ + "pri": 85, + "time": 614125.000000, + "msg": "example[85]" + },{ + "pri": 86, + "time": 636056.000000, + "msg": "example[86]" + },{ + "pri": 87, + "time": 658503.000000, + "msg": "example[87]" + },{ + "pri": 88, + "time": 681472.000000, + "msg": "example[88]" + },{ + "pri": 89, + "time": 704969.000000, + "msg": "example[89]" + },{ + "pri": 90, + "time": 729000.000000, + "msg": "example[90]" + },{ + "pri": 91, + "time": 753571.000000, + "msg": "example[91]" + },{ + "pri": 92, + "time": 778688.000000, + "msg": "example[92]" + },{ + "pri": 93, + "time": 804357.000000, + "msg": "example[93]" + },{ + "pri": 94, + "time": 830584.000000, + "msg": "example[94]" + },{ + "pri": 95, + "time": 857375.000000, + "msg": "example[95]" + },{ + "pri": 96, + "time": 884736.000000, + "msg": "example[96]" + },{ + "pri": 97, + "time": 912673.000000, + "msg": "example[97]" + },{ + "pri": 98, + "time": 941192.000000, + "msg": "example[98]" + },{ + "pri": 99, + "time": 970299.000000, + "msg": "example[99]" + },{ + "pri": 100, + "time": 1000000.000000, + "msg": "example[100]" + },{ + "pri": 101, + "time": 1030301.000000, + "msg": "example[101]" + },{ + "pri": 102, + "time": 1061208.000000, + "msg": "example[102]" + },{ + "pri": 103, + "time": 1092727.000000, + "msg": "example[103]" + },{ + "pri": 104, + "time": 1124864.000000, + "msg": "example[104]" + },{ + "pri": 150, + "time": 4557523.000000, + "msg": "example[105]" + } + ] +} diff --git a/tests/expected/dmesg/kmsg-file b/tests/expected/dmesg/kmsg-file new file mode 100644 index 0000000..984588e --- /dev/null +++ b/tests/expected/dmesg/kmsg-file @@ -0,0 +1,185 @@ +{ + "dmesg": [ + { + "pri": 0, + "time": 0.000000, + "msg": "Linux version 6.6.4-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Mon, 04 Dec 2023 00:29:19 +0000" + },{ + "pri": 1, + "time": 0.000001, + "msg": "Command line: initrd=\\ucode.img initrd=\\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system" + },{ + "pri": 2, + "time": 0.000002, + "msg": "BIOS-provided physical RAM map:" + },{ + "pri": 3, + "time": 0.000003, + "msg": "BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable" + },{ + "pri": 4, + "time": 0.000004, + "msg": "BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved" + },{ + "pri": 5, + "time": 0.000005, + "msg": "BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable" + },{ + "pri": 6, + "time": 0.000006, + "msg": "BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved" + },{ + "pri": 7, + "time": 0.000007, + "msg": "BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable" + },{ + "pri": 6, + "time": 0.000008, + "msg": "BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS" + },{ + "pri": 6, + "time": 0.000009, + "msg": "BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable" + },{ + "pri": 6, + "time": 0.000010, + "msg": "BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved" + },{ + "pri": 6, + "time": 0.201607, + "msg": "smp: Bringing up secondary CPUs ..." + },{ + "pri": 6, + "time": 0.201607, + "msg": "smpboot: x86: Booting SMP configuration:" + },{ + "pri": 4, + "time": 0.209670, + "msg": " #1 #3 #5 #7" + },{ + "pri": 6, + "time": 0.212630, + "msg": "smp: Brought up 1 node, 16 CPUs" + },{ + "pri": 5, + "time": 0.215936, + "msg": "audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1" + },{ + "pri": 6, + "time": 0.215937, + "msg": "thermal_sys: Registered thermal governor 'fair_share'" + },{ + "pri": 4, + "time": 0.215966, + "msg": "ENERGY_PERF_BIAS: Set to 'normal', was 'performance'" + },{ + "pri": 6, + "time": 0.367657, + "msg": "ACPI: \\_SB_.PCI0.GP19.NHI1.PWRS: New power resource" + },{ + "pri": 6, + "time": 0.368615, + "msg": "ACPI: \\_SB_.PCI0.GP19.XHC4.PWRS: New power resource" + },{ + "pri": 6, + "time": 0.376316, + "msg": "ACPI: \\_SB_.PRWL: New power resource" + },{ + "pri": 6, + "time": 0.376343, + "msg": "ACPI: \\_SB_.PRWB: New power resource" + },{ + "pri": 6, + "time": 0.377373, + "msg": "ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])" + },{ + "pri": 6, + "time": 0.377378, + "msg": "acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]" + },{ + "pri": 6, + "time": 0.377569, + "msg": "acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]" + },{ + "pri": 6, + "time": 0.377933, + "msg": "acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]" + },{ + "pri": 6, + "time": 0.378458, + "msg": "PCI host bridge to bus 0000:00" + },{ + "pri": 6, + "time": 0.378459, + "msg": "pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]" + },{ + "pri": 6, + "time": 0.378461, + "msg": "pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]" + },{ + "pri": 13, + "time": 9.398562, + "msg": "user network daemon initialization complete" + },{ + "pri": 30, + "time": 10.441520, + "msg": "systemd[1]: systemd 254.7-1.fc39 running in system mode" + },{ + "pri": 30, + "time": 11.441524, + "msg": "systemd[1]: Detected architecture x86-64." + },{ + "pri": 30, + "time": 12.441525, + "msg": "systemd[1]: Running in initrd." + },{ + "pri": 30, + "time": 13.541598, + "msg": "systemd[1]: Hostname set to <catalina>." + },{ + "pri": 6, + "time": 15.641860, + "msg": "usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11" + },{ + "pri": 3, + "time": 16.690000, + "msg": "Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found." + },{ + "pri": 3, + "time": 17.710000, + "msg": "snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535" + },{ + "pri": 46, + "time": 18.820000, + "msg": "systemd-journald[723]: Received client request to flush runtime journal." + },{ + "pri": 44, + "time": 20.840000, + "msg": "systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing." + },{ + "pri": 46, + "time": 21.852348, + "msg": "systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating." + },{ + "pri": 4, + "time": 24.871100, + "msg": "PEFILE: Unsigned PE binary" + },{ + "pri": 3, + "time": 33.918091, + "msg": "snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535" + },{ + "pri": 6, + "time": 144.931785, + "msg": "usb 3-3.1: device firmware changed" + },{ + "pri": 6, + "time": 145.953248, + "msg": "usb 3-3.1: USB disconnect, device number 44" + },{ + "pri": 6, + "time": 147.981859, + "msg": "usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30" + } + ] +} diff --git a/tests/expected/mount/special b/tests/expected/dmesg/timestamp-format index e69de29..e69de29 100644 --- a/tests/expected/mount/special +++ b/tests/expected/dmesg/timestamp-format diff --git a/tests/expected/dmesg/timestamp-format-delta b/tests/expected/dmesg/timestamp-format-delta new file mode 100644 index 0000000..3eb2ddb --- /dev/null +++ b/tests/expected/dmesg/timestamp-format-delta @@ -0,0 +1,106 @@ +2009-02-13T23:31:30,123456+00:00 [< 0.000000>] example[0] +2009-02-13T23:31:31,123456+00:00 [< 0.000000>] example[1] +2009-02-13T23:31:38,123456+00:00 [< 7.000000>] example[2] +2009-02-13T23:31:57,123456+00:00 [< 19.000000>] example[3] +2009-02-13T23:32:34,123456+00:00 [< 37.000000>] example[4] +2009-02-13T23:33:35,123456+00:00 [< 61.000000>] example[5] +2009-02-13T23:35:06,123456+00:00 [< 91.000000>] example[6] +2009-02-13T23:37:13,123456+00:00 [< 127.000000>] example[7] +2009-02-13T23:40:02,123456+00:00 [< 169.000000>] example[8] +2009-02-13T23:43:39,123456+00:00 [< 217.000000>] example[9] +2009-02-13T23:48:10,123456+00:00 [< 271.000000>] example[10] +2009-02-13T23:53:41,123456+00:00 [< 331.000000>] example[11] +2009-02-14T00:00:18,123456+00:00 [< 397.000000>] example[12] +2009-02-14T00:08:07,123456+00:00 [< 469.000000>] example[13] +2009-02-14T00:17:14,123456+00:00 [< 547.000000>] example[14] +2009-02-14T00:27:45,123456+00:00 [< 631.000000>] example[15] +2009-02-14T00:39:46,123456+00:00 [< 721.000000>] example[16] +2009-02-14T00:53:23,123456+00:00 [< 817.000000>] example[17] +2009-02-14T01:08:42,123456+00:00 [< 919.000000>] example[18] +2009-02-14T01:25:49,123456+00:00 [< 1027.000000>] example[19] +2009-02-14T01:44:50,123456+00:00 [< 1141.000000>] example[20] +2009-02-14T02:05:51,123456+00:00 [< 1261.000000>] example[21] +2009-02-14T02:28:58,123456+00:00 [< 1387.000000>] example[22] +2009-02-14T02:54:17,123456+00:00 [< 1519.000000>] example[23] +2009-02-14T03:21:54,123456+00:00 [< 1657.000000>] example[24] +2009-02-14T03:51:55,123456+00:00 [< 1801.000000>] example[25] +2009-02-14T04:24:26,123456+00:00 [< 1951.000000>] example[26] +2009-02-14T04:59:33,123456+00:00 [< 2107.000000>] example[27] +2009-02-14T05:37:22,123456+00:00 [< 2269.000000>] example[28] +2009-02-14T06:17:59,123456+00:00 [< 2437.000000>] example[29] +2009-02-14T07:01:30,123456+00:00 [< 2611.000000>] example[30] +2009-02-14T07:48:01,123456+00:00 [< 2791.000000>] example[31] +2009-02-14T08:37:38,123456+00:00 [< 2977.000000>] example[32] +2009-02-14T09:30:27,123456+00:00 [< 3169.000000>] example[33] +2009-02-14T10:26:34,123456+00:00 [< 3367.000000>] example[34] +2009-02-14T11:26:05,123456+00:00 [< 3571.000000>] example[35] +2009-02-14T12:29:06,123456+00:00 [< 3781.000000>] example[36] +2009-02-14T13:35:43,123456+00:00 [< 3997.000000>] example[37] +2009-02-14T14:46:02,123456+00:00 [< 4219.000000>] example[38] +2009-02-14T16:00:09,123456+00:00 [< 4447.000000>] example[39] +2009-02-14T17:18:10,123456+00:00 [< 4681.000000>] example[40] +2009-02-14T18:40:11,123456+00:00 [< 4921.000000>] example[41] +2009-02-14T20:06:18,123456+00:00 [< 5167.000000>] example[42] +2009-02-14T21:36:37,123456+00:00 [< 5419.000000>] example[43] +2009-02-14T23:11:14,123456+00:00 [< 5677.000000>] example[44] +2009-02-15T00:50:15,123456+00:00 [< 5941.000000>] example[45] +2009-02-15T02:33:46,123456+00:00 [< 6211.000000>] example[46] +2009-02-15T04:21:53,123456+00:00 [< 6487.000000>] example[47] +2009-02-15T06:14:42,123456+00:00 [< 6769.000000>] example[48] +2009-02-15T08:12:19,123456+00:00 [< 7057.000000>] example[49] +2009-02-15T10:14:50,123456+00:00 [< 7351.000000>] example[50] +2009-02-15T12:22:21,123456+00:00 [< 7651.000000>] example[51] +2009-02-15T14:34:58,123456+00:00 [< 7957.000000>] example[52] +2009-02-15T16:52:47,123456+00:00 [< 8269.000000>] example[53] +2009-02-15T19:15:54,123456+00:00 [< 8587.000000>] example[54] +2009-02-15T21:44:25,123456+00:00 [< 8911.000000>] example[55] +2009-02-16T00:18:26,123456+00:00 [< 9241.000000>] example[56] +2009-02-16T02:58:03,123456+00:00 [< 9577.000000>] example[57] +2009-02-16T05:43:22,123456+00:00 [< 9919.000000>] example[58] +2009-02-16T08:34:29,123456+00:00 [<10267.000000>] example[59] +2009-02-16T11:31:30,123456+00:00 [<10621.000000>] example[60] +2009-02-16T14:34:31,123456+00:00 [<10981.000000>] example[61] +2009-02-16T17:43:38,123456+00:00 [<11347.000000>] example[62] +2009-02-16T20:58:57,123456+00:00 [<11719.000000>] example[63] +2009-02-17T00:20:34,123456+00:00 [<12097.000000>] example[64] +2009-02-17T03:48:35,123456+00:00 [<12481.000000>] example[65] +2009-02-17T07:23:06,123456+00:00 [<12871.000000>] example[66] +2009-02-17T11:04:13,123456+00:00 [<13267.000000>] example[67] +2009-02-17T14:52:02,123456+00:00 [<13669.000000>] example[68] +2009-02-17T18:46:39,123456+00:00 [<14077.000000>] example[69] +2009-02-17T22:48:10,123456+00:00 [<14491.000000>] example[70] +2009-02-18T02:56:41,123456+00:00 [<14911.000000>] example[71] +2009-02-18T07:12:18,123456+00:00 [<15337.000000>] example[72] +2009-02-18T11:35:07,123456+00:00 [<15769.000000>] example[73] +2009-02-18T16:05:14,123456+00:00 [<16207.000000>] example[74] +2009-02-18T20:42:45,123456+00:00 [<16651.000000>] example[75] +2009-02-19T01:27:46,123456+00:00 [<17101.000000>] example[76] +2009-02-19T06:20:23,123456+00:00 [<17557.000000>] example[77] +2009-02-19T11:20:42,123456+00:00 [<18019.000000>] example[78] +2009-02-19T16:28:49,123456+00:00 [<18487.000000>] example[79] +2009-02-19T21:44:50,123456+00:00 [<18961.000000>] example[80] +2009-02-20T03:08:51,123456+00:00 [<19441.000000>] example[81] +2009-02-20T08:40:58,123456+00:00 [<19927.000000>] example[82] +2009-02-20T14:21:17,123456+00:00 [<20419.000000>] example[83] +2009-02-20T20:09:54,123456+00:00 [<20917.000000>] example[84] +2009-02-21T02:06:55,123456+00:00 [<21421.000000>] example[85] +2009-02-21T08:12:26,123456+00:00 [<21931.000000>] example[86] +2009-02-21T14:26:33,123456+00:00 [<22447.000000>] example[87] +2009-02-21T20:49:22,123456+00:00 [<22969.000000>] example[88] +2009-02-22T03:20:59,123456+00:00 [<23497.000000>] example[89] +2009-02-22T10:01:30,123456+00:00 [<24031.000000>] example[90] +2009-02-22T16:51:01,123456+00:00 [<24571.000000>] example[91] +2009-02-22T23:49:38,123456+00:00 [<25117.000000>] example[92] +2009-02-23T06:57:27,123456+00:00 [<25669.000000>] example[93] +2009-02-23T14:14:34,123456+00:00 [<26227.000000>] example[94] +2009-02-23T21:41:05,123456+00:00 [<26791.000000>] example[95] +2009-02-24T05:17:06,123456+00:00 [<27361.000000>] example[96] +2009-02-24T13:02:43,123456+00:00 [<27937.000000>] example[97] +2009-02-24T20:58:02,123456+00:00 [<28519.000000>] example[98] +2009-02-25T05:03:09,123456+00:00 [<29107.000000>] example[99] +2009-02-25T13:18:10,123456+00:00 [<29701.000000>] example[100] +2009-02-25T21:43:11,123456+00:00 [<30301.000000>] example[101] +2009-02-26T06:18:18,123456+00:00 [<30907.000000>] example[102] +2009-02-26T15:03:37,123456+00:00 [<31519.000000>] example[103] +2009-02-26T23:59:14,123456+00:00 [<32137.000000>] example[104] +2009-04-07T17:30:13,123456+00:00 [<3432659.000000>] example[105] diff --git a/tests/expected/dmesg/timestamp-format-delta-ctime b/tests/expected/dmesg/timestamp-format-delta-ctime new file mode 100644 index 0000000..a171051 --- /dev/null +++ b/tests/expected/dmesg/timestamp-format-delta-ctime @@ -0,0 +1,106 @@ +[Feb13 23:31] [Fri Feb 13 23:31:30 2009 < 0.000000>] example[0] +[ +0.000000] [Fri Feb 13 23:31:31 2009 < 0.000000>] example[1] +[ +7.000000] [Fri Feb 13 23:31:38 2009 < 7.000000>] example[2] +[ +19.000000] [Fri Feb 13 23:31:57 2009 < 19.000000>] example[3] +[Feb13 23:32] [Fri Feb 13 23:32:34 2009 < 37.000000>] example[4] +[Feb13 23:33] [Fri Feb 13 23:33:35 2009 < 61.000000>] example[5] +[Feb13 23:35] [Fri Feb 13 23:35:06 2009 < 91.000000>] example[6] +[Feb13 23:37] [Fri Feb 13 23:37:13 2009 < 127.000000>] example[7] +[Feb13 23:40] [Fri Feb 13 23:40:02 2009 < 169.000000>] example[8] +[Feb13 23:43] [Fri Feb 13 23:43:39 2009 < 217.000000>] example[9] +[Feb13 23:48] [Fri Feb 13 23:48:10 2009 < 271.000000>] example[10] +[Feb13 23:53] [Fri Feb 13 23:53:41 2009 < 331.000000>] example[11] +[Feb14 00:00] [Sat Feb 14 00:00:18 2009 < 397.000000>] example[12] +[Feb14 00:08] [Sat Feb 14 00:08:07 2009 < 469.000000>] example[13] +[Feb14 00:17] [Sat Feb 14 00:17:14 2009 < 547.000000>] example[14] +[Feb14 00:27] [Sat Feb 14 00:27:45 2009 < 631.000000>] example[15] +[Feb14 00:39] [Sat Feb 14 00:39:46 2009 < 721.000000>] example[16] +[Feb14 00:53] [Sat Feb 14 00:53:23 2009 < 817.000000>] example[17] +[Feb14 01:08] [Sat Feb 14 01:08:42 2009 < 919.000000>] example[18] +[Feb14 01:25] [Sat Feb 14 01:25:49 2009 < 1027.000000>] example[19] +[Feb14 01:44] [Sat Feb 14 01:44:50 2009 < 1141.000000>] example[20] +[Feb14 02:05] [Sat Feb 14 02:05:51 2009 < 1261.000000>] example[21] +[Feb14 02:28] [Sat Feb 14 02:28:58 2009 < 1387.000000>] example[22] +[Feb14 02:54] [Sat Feb 14 02:54:17 2009 < 1519.000000>] example[23] +[Feb14 03:21] [Sat Feb 14 03:21:54 2009 < 1657.000000>] example[24] +[Feb14 03:51] [Sat Feb 14 03:51:55 2009 < 1801.000000>] example[25] +[Feb14 04:24] [Sat Feb 14 04:24:26 2009 < 1951.000000>] example[26] +[Feb14 04:59] [Sat Feb 14 04:59:33 2009 < 2107.000000>] example[27] +[Feb14 05:37] [Sat Feb 14 05:37:22 2009 < 2269.000000>] example[28] +[Feb14 06:17] [Sat Feb 14 06:17:59 2009 < 2437.000000>] example[29] +[Feb14 07:01] [Sat Feb 14 07:01:30 2009 < 2611.000000>] example[30] +[Feb14 07:48] [Sat Feb 14 07:48:01 2009 < 2791.000000>] example[31] +[Feb14 08:37] [Sat Feb 14 08:37:38 2009 < 2977.000000>] example[32] +[Feb14 09:30] [Sat Feb 14 09:30:27 2009 < 3169.000000>] example[33] +[Feb14 10:26] [Sat Feb 14 10:26:34 2009 < 3367.000000>] example[34] +[Feb14 11:26] [Sat Feb 14 11:26:05 2009 < 3571.000000>] example[35] +[Feb14 12:29] [Sat Feb 14 12:29:06 2009 < 3781.000000>] example[36] +[Feb14 13:35] [Sat Feb 14 13:35:43 2009 < 3997.000000>] example[37] +[Feb14 14:46] [Sat Feb 14 14:46:02 2009 < 4219.000000>] example[38] +[Feb14 16:00] [Sat Feb 14 16:00:09 2009 < 4447.000000>] example[39] +[Feb14 17:18] [Sat Feb 14 17:18:10 2009 < 4681.000000>] example[40] +[Feb14 18:40] [Sat Feb 14 18:40:11 2009 < 4921.000000>] example[41] +[Feb14 20:06] [Sat Feb 14 20:06:18 2009 < 5167.000000>] example[42] +[Feb14 21:36] [Sat Feb 14 21:36:37 2009 < 5419.000000>] example[43] +[Feb14 23:11] [Sat Feb 14 23:11:14 2009 < 5677.000000>] example[44] +[Feb15 00:50] [Sun Feb 15 00:50:15 2009 < 5941.000000>] example[45] +[Feb15 02:33] [Sun Feb 15 02:33:46 2009 < 6211.000000>] example[46] +[Feb15 04:21] [Sun Feb 15 04:21:53 2009 < 6487.000000>] example[47] +[Feb15 06:14] [Sun Feb 15 06:14:42 2009 < 6769.000000>] example[48] +[Feb15 08:12] [Sun Feb 15 08:12:19 2009 < 7057.000000>] example[49] +[Feb15 10:14] [Sun Feb 15 10:14:50 2009 < 7351.000000>] example[50] +[Feb15 12:22] [Sun Feb 15 12:22:21 2009 < 7651.000000>] example[51] +[Feb15 14:34] [Sun Feb 15 14:34:58 2009 < 7957.000000>] example[52] +[Feb15 16:52] [Sun Feb 15 16:52:47 2009 < 8269.000000>] example[53] +[Feb15 19:15] [Sun Feb 15 19:15:54 2009 < 8587.000000>] example[54] +[Feb15 21:44] [Sun Feb 15 21:44:25 2009 < 8911.000000>] example[55] +[Feb16 00:18] [Mon Feb 16 00:18:26 2009 < 9241.000000>] example[56] +[Feb16 02:58] [Mon Feb 16 02:58:03 2009 < 9577.000000>] example[57] +[Feb16 05:43] [Mon Feb 16 05:43:22 2009 < 9919.000000>] example[58] +[Feb16 08:34] [Mon Feb 16 08:34:29 2009 <10267.000000>] example[59] +[Feb16 11:31] [Mon Feb 16 11:31:30 2009 <10621.000000>] example[60] +[Feb16 14:34] [Mon Feb 16 14:34:31 2009 <10981.000000>] example[61] +[Feb16 17:43] [Mon Feb 16 17:43:38 2009 <11347.000000>] example[62] +[Feb16 20:58] [Mon Feb 16 20:58:57 2009 <11719.000000>] example[63] +[Feb17 00:20] [Tue Feb 17 00:20:34 2009 <12097.000000>] example[64] +[Feb17 03:48] [Tue Feb 17 03:48:35 2009 <12481.000000>] example[65] +[Feb17 07:23] [Tue Feb 17 07:23:06 2009 <12871.000000>] example[66] +[Feb17 11:04] [Tue Feb 17 11:04:13 2009 <13267.000000>] example[67] +[Feb17 14:52] [Tue Feb 17 14:52:02 2009 <13669.000000>] example[68] +[Feb17 18:46] [Tue Feb 17 18:46:39 2009 <14077.000000>] example[69] +[Feb17 22:48] [Tue Feb 17 22:48:10 2009 <14491.000000>] example[70] +[Feb18 02:56] [Wed Feb 18 02:56:41 2009 <14911.000000>] example[71] +[Feb18 07:12] [Wed Feb 18 07:12:18 2009 <15337.000000>] example[72] +[Feb18 11:35] [Wed Feb 18 11:35:07 2009 <15769.000000>] example[73] +[Feb18 16:05] [Wed Feb 18 16:05:14 2009 <16207.000000>] example[74] +[Feb18 20:42] [Wed Feb 18 20:42:45 2009 <16651.000000>] example[75] +[Feb19 01:27] [Thu Feb 19 01:27:46 2009 <17101.000000>] example[76] +[Feb19 06:20] [Thu Feb 19 06:20:23 2009 <17557.000000>] example[77] +[Feb19 11:20] [Thu Feb 19 11:20:42 2009 <18019.000000>] example[78] +[Feb19 16:28] [Thu Feb 19 16:28:49 2009 <18487.000000>] example[79] +[Feb19 21:44] [Thu Feb 19 21:44:50 2009 <18961.000000>] example[80] +[Feb20 03:08] [Fri Feb 20 03:08:51 2009 <19441.000000>] example[81] +[Feb20 08:40] [Fri Feb 20 08:40:58 2009 <19927.000000>] example[82] +[Feb20 14:21] [Fri Feb 20 14:21:17 2009 <20419.000000>] example[83] +[Feb20 20:09] [Fri Feb 20 20:09:54 2009 <20917.000000>] example[84] +[Feb21 02:06] [Sat Feb 21 02:06:55 2009 <21421.000000>] example[85] +[Feb21 08:12] [Sat Feb 21 08:12:26 2009 <21931.000000>] example[86] +[Feb21 14:26] [Sat Feb 21 14:26:33 2009 <22447.000000>] example[87] +[Feb21 20:49] [Sat Feb 21 20:49:22 2009 <22969.000000>] example[88] +[Feb22 03:20] [Sun Feb 22 03:20:59 2009 <23497.000000>] example[89] +[Feb22 10:01] [Sun Feb 22 10:01:30 2009 <24031.000000>] example[90] +[Feb22 16:51] [Sun Feb 22 16:51:01 2009 <24571.000000>] example[91] +[Feb22 23:49] [Sun Feb 22 23:49:38 2009 <25117.000000>] example[92] +[Feb23 06:57] [Mon Feb 23 06:57:27 2009 <25669.000000>] example[93] +[Feb23 14:14] [Mon Feb 23 14:14:34 2009 <26227.000000>] example[94] +[Feb23 21:41] [Mon Feb 23 21:41:05 2009 <26791.000000>] example[95] +[Feb24 05:17] [Tue Feb 24 05:17:06 2009 <27361.000000>] example[96] +[Feb24 13:02] [Tue Feb 24 13:02:43 2009 <27937.000000>] example[97] +[Feb24 20:58] [Tue Feb 24 20:58:02 2009 <28519.000000>] example[98] +[Feb25 05:03] [Wed Feb 25 05:03:09 2009 <29107.000000>] example[99] +[Feb25 13:18] [Wed Feb 25 13:18:10 2009 <29701.000000>] example[100] +[Feb25 21:43] [Wed Feb 25 21:43:11 2009 <30301.000000>] example[101] +[Feb26 06:18] [Thu Feb 26 06:18:18 2009 <30907.000000>] example[102] +[Feb26 15:03] [Thu Feb 26 15:03:37 2009 <31519.000000>] example[103] +[Feb26 23:59] [Thu Feb 26 23:59:14 2009 <32137.000000>] example[104] +[Apr 7 17:30] [Tue Apr 7 17:30:13 2009 <3432659.000000>] example[105] diff --git a/tests/expected/dmesg/timestamp-format-delta-raw b/tests/expected/dmesg/timestamp-format-delta-raw new file mode 100644 index 0000000..90d3bb7 --- /dev/null +++ b/tests/expected/dmesg/timestamp-format-delta-raw @@ -0,0 +1,106 @@ +[ 0.000000 < 0.000000>] [Fri Feb 13 23:31:30 2009] example[0] +[ 1.000000 < 0.000000>] [Fri Feb 13 23:31:31 2009] example[1] +[ 8.000000 < 7.000000>] [Fri Feb 13 23:31:38 2009] example[2] +[ 27.000000 < 19.000000>] [Fri Feb 13 23:31:57 2009] example[3] +[ 64.000000 < 37.000000>] [Fri Feb 13 23:32:34 2009] example[4] +[ 125.000000 < 61.000000>] [Fri Feb 13 23:33:35 2009] example[5] +[ 216.000000 < 91.000000>] [Fri Feb 13 23:35:06 2009] example[6] +[ 343.000000 < 127.000000>] [Fri Feb 13 23:37:13 2009] example[7] +[ 512.000000 < 169.000000>] [Fri Feb 13 23:40:02 2009] example[8] +[ 729.000000 < 217.000000>] [Fri Feb 13 23:43:39 2009] example[9] +[ 1000.000000 < 271.000000>] [Fri Feb 13 23:48:10 2009] example[10] +[ 1331.000000 < 331.000000>] [Fri Feb 13 23:53:41 2009] example[11] +[ 1728.000000 < 397.000000>] [Sat Feb 14 00:00:18 2009] example[12] +[ 2197.000000 < 469.000000>] [Sat Feb 14 00:08:07 2009] example[13] +[ 2744.000000 < 547.000000>] [Sat Feb 14 00:17:14 2009] example[14] +[ 3375.000000 < 631.000000>] [Sat Feb 14 00:27:45 2009] example[15] +[ 4096.000000 < 721.000000>] [Sat Feb 14 00:39:46 2009] example[16] +[ 4913.000000 < 817.000000>] [Sat Feb 14 00:53:23 2009] example[17] +[ 5832.000000 < 919.000000>] [Sat Feb 14 01:08:42 2009] example[18] +[ 6859.000000 < 1027.000000>] [Sat Feb 14 01:25:49 2009] example[19] +[ 8000.000000 < 1141.000000>] [Sat Feb 14 01:44:50 2009] example[20] +[ 9261.000000 < 1261.000000>] [Sat Feb 14 02:05:51 2009] example[21] +[10648.000000 < 1387.000000>] [Sat Feb 14 02:28:58 2009] example[22] +[12167.000000 < 1519.000000>] [Sat Feb 14 02:54:17 2009] example[23] +[13824.000000 < 1657.000000>] [Sat Feb 14 03:21:54 2009] example[24] +[15625.000000 < 1801.000000>] [Sat Feb 14 03:51:55 2009] example[25] +[17576.000000 < 1951.000000>] [Sat Feb 14 04:24:26 2009] example[26] +[19683.000000 < 2107.000000>] [Sat Feb 14 04:59:33 2009] example[27] +[21952.000000 < 2269.000000>] [Sat Feb 14 05:37:22 2009] example[28] +[24389.000000 < 2437.000000>] [Sat Feb 14 06:17:59 2009] example[29] +[27000.000000 < 2611.000000>] [Sat Feb 14 07:01:30 2009] example[30] +[29791.000000 < 2791.000000>] [Sat Feb 14 07:48:01 2009] example[31] +[32768.000000 < 2977.000000>] [Sat Feb 14 08:37:38 2009] example[32] +[35937.000000 < 3169.000000>] [Sat Feb 14 09:30:27 2009] example[33] +[39304.000000 < 3367.000000>] [Sat Feb 14 10:26:34 2009] example[34] +[42875.000000 < 3571.000000>] [Sat Feb 14 11:26:05 2009] example[35] +[46656.000000 < 3781.000000>] [Sat Feb 14 12:29:06 2009] example[36] +[50653.000000 < 3997.000000>] [Sat Feb 14 13:35:43 2009] example[37] +[54872.000000 < 4219.000000>] [Sat Feb 14 14:46:02 2009] example[38] +[59319.000000 < 4447.000000>] [Sat Feb 14 16:00:09 2009] example[39] +[64000.000000 < 4681.000000>] [Sat Feb 14 17:18:10 2009] example[40] +[68921.000000 < 4921.000000>] [Sat Feb 14 18:40:11 2009] example[41] +[74088.000000 < 5167.000000>] [Sat Feb 14 20:06:18 2009] example[42] +[79507.000000 < 5419.000000>] [Sat Feb 14 21:36:37 2009] example[43] +[85184.000000 < 5677.000000>] [Sat Feb 14 23:11:14 2009] example[44] +[91125.000000 < 5941.000000>] [Sun Feb 15 00:50:15 2009] example[45] +[97336.000000 < 6211.000000>] [Sun Feb 15 02:33:46 2009] example[46] +[103823.000000 < 6487.000000>] [Sun Feb 15 04:21:53 2009] example[47] +[110592.000000 < 6769.000000>] [Sun Feb 15 06:14:42 2009] example[48] +[117649.000000 < 7057.000000>] [Sun Feb 15 08:12:19 2009] example[49] +[125000.000000 < 7351.000000>] [Sun Feb 15 10:14:50 2009] example[50] +[132651.000000 < 7651.000000>] [Sun Feb 15 12:22:21 2009] example[51] +[140608.000000 < 7957.000000>] [Sun Feb 15 14:34:58 2009] example[52] +[148877.000000 < 8269.000000>] [Sun Feb 15 16:52:47 2009] example[53] +[157464.000000 < 8587.000000>] [Sun Feb 15 19:15:54 2009] example[54] +[166375.000000 < 8911.000000>] [Sun Feb 15 21:44:25 2009] example[55] +[175616.000000 < 9241.000000>] [Mon Feb 16 00:18:26 2009] example[56] +[185193.000000 < 9577.000000>] [Mon Feb 16 02:58:03 2009] example[57] +[195112.000000 < 9919.000000>] [Mon Feb 16 05:43:22 2009] example[58] +[205379.000000 <10267.000000>] [Mon Feb 16 08:34:29 2009] example[59] +[216000.000000 <10621.000000>] [Mon Feb 16 11:31:30 2009] example[60] +[226981.000000 <10981.000000>] [Mon Feb 16 14:34:31 2009] example[61] +[238328.000000 <11347.000000>] [Mon Feb 16 17:43:38 2009] example[62] +[250047.000000 <11719.000000>] [Mon Feb 16 20:58:57 2009] example[63] +[262144.000000 <12097.000000>] [Tue Feb 17 00:20:34 2009] example[64] +[274625.000000 <12481.000000>] [Tue Feb 17 03:48:35 2009] example[65] +[287496.000000 <12871.000000>] [Tue Feb 17 07:23:06 2009] example[66] +[300763.000000 <13267.000000>] [Tue Feb 17 11:04:13 2009] example[67] +[314432.000000 <13669.000000>] [Tue Feb 17 14:52:02 2009] example[68] +[328509.000000 <14077.000000>] [Tue Feb 17 18:46:39 2009] example[69] +[343000.000000 <14491.000000>] [Tue Feb 17 22:48:10 2009] example[70] +[357911.000000 <14911.000000>] [Wed Feb 18 02:56:41 2009] example[71] +[373248.000000 <15337.000000>] [Wed Feb 18 07:12:18 2009] example[72] +[389017.000000 <15769.000000>] [Wed Feb 18 11:35:07 2009] example[73] +[405224.000000 <16207.000000>] [Wed Feb 18 16:05:14 2009] example[74] +[421875.000000 <16651.000000>] [Wed Feb 18 20:42:45 2009] example[75] +[438976.000000 <17101.000000>] [Thu Feb 19 01:27:46 2009] example[76] +[456533.000000 <17557.000000>] [Thu Feb 19 06:20:23 2009] example[77] +[474552.000000 <18019.000000>] [Thu Feb 19 11:20:42 2009] example[78] +[493039.000000 <18487.000000>] [Thu Feb 19 16:28:49 2009] example[79] +[512000.000000 <18961.000000>] [Thu Feb 19 21:44:50 2009] example[80] +[531441.000000 <19441.000000>] [Fri Feb 20 03:08:51 2009] example[81] +[551368.000000 <19927.000000>] [Fri Feb 20 08:40:58 2009] example[82] +[571787.000000 <20419.000000>] [Fri Feb 20 14:21:17 2009] example[83] +[592704.000000 <20917.000000>] [Fri Feb 20 20:09:54 2009] example[84] +[614125.000000 <21421.000000>] [Sat Feb 21 02:06:55 2009] example[85] +[636056.000000 <21931.000000>] [Sat Feb 21 08:12:26 2009] example[86] +[658503.000000 <22447.000000>] [Sat Feb 21 14:26:33 2009] example[87] +[681472.000000 <22969.000000>] [Sat Feb 21 20:49:22 2009] example[88] +[704969.000000 <23497.000000>] [Sun Feb 22 03:20:59 2009] example[89] +[729000.000000 <24031.000000>] [Sun Feb 22 10:01:30 2009] example[90] +[753571.000000 <24571.000000>] [Sun Feb 22 16:51:01 2009] example[91] +[778688.000000 <25117.000000>] [Sun Feb 22 23:49:38 2009] example[92] +[804357.000000 <25669.000000>] [Mon Feb 23 06:57:27 2009] example[93] +[830584.000000 <26227.000000>] [Mon Feb 23 14:14:34 2009] example[94] +[857375.000000 <26791.000000>] [Mon Feb 23 21:41:05 2009] example[95] +[884736.000000 <27361.000000>] [Tue Feb 24 05:17:06 2009] example[96] +[912673.000000 <27937.000000>] [Tue Feb 24 13:02:43 2009] example[97] +[941192.000000 <28519.000000>] [Tue Feb 24 20:58:02 2009] example[98] +[970299.000000 <29107.000000>] [Wed Feb 25 05:03:09 2009] example[99] +[1000000.000000 <29701.000000>] [Wed Feb 25 13:18:10 2009] example[100] +[1030301.000000 <30301.000000>] [Wed Feb 25 21:43:11 2009] example[101] +[1061208.000000 <30907.000000>] [Thu Feb 26 06:18:18 2009] example[102] +[1092727.000000 <31519.000000>] [Thu Feb 26 15:03:37 2009] example[103] +[1124864.000000 <32137.000000>] [Thu Feb 26 23:59:14 2009] example[104] +[4557523.000000 <3432659.000000>] [Tue Apr 7 17:30:13 2009] example[105] diff --git a/tests/expected/dmesg/timestamp-format-multiple b/tests/expected/dmesg/timestamp-format-multiple new file mode 100644 index 0000000..c64a036 --- /dev/null +++ b/tests/expected/dmesg/timestamp-format-multiple @@ -0,0 +1,106 @@ +[ 0.000000] [Fri Feb 13 23:31:30 2009] 2009-02-13T23:31:30,123456+00:00 example[0] +[ 1.000000] [Fri Feb 13 23:31:31 2009] 2009-02-13T23:31:31,123456+00:00 example[1] +[ 8.000000] [Fri Feb 13 23:31:38 2009] 2009-02-13T23:31:38,123456+00:00 example[2] +[ 27.000000] [Fri Feb 13 23:31:57 2009] 2009-02-13T23:31:57,123456+00:00 example[3] +[ 64.000000] [Fri Feb 13 23:32:34 2009] 2009-02-13T23:32:34,123456+00:00 example[4] +[ 125.000000] [Fri Feb 13 23:33:35 2009] 2009-02-13T23:33:35,123456+00:00 example[5] +[ 216.000000] [Fri Feb 13 23:35:06 2009] 2009-02-13T23:35:06,123456+00:00 example[6] +[ 343.000000] [Fri Feb 13 23:37:13 2009] 2009-02-13T23:37:13,123456+00:00 example[7] +[ 512.000000] [Fri Feb 13 23:40:02 2009] 2009-02-13T23:40:02,123456+00:00 example[8] +[ 729.000000] [Fri Feb 13 23:43:39 2009] 2009-02-13T23:43:39,123456+00:00 example[9] +[ 1000.000000] [Fri Feb 13 23:48:10 2009] 2009-02-13T23:48:10,123456+00:00 example[10] +[ 1331.000000] [Fri Feb 13 23:53:41 2009] 2009-02-13T23:53:41,123456+00:00 example[11] +[ 1728.000000] [Sat Feb 14 00:00:18 2009] 2009-02-14T00:00:18,123456+00:00 example[12] +[ 2197.000000] [Sat Feb 14 00:08:07 2009] 2009-02-14T00:08:07,123456+00:00 example[13] +[ 2744.000000] [Sat Feb 14 00:17:14 2009] 2009-02-14T00:17:14,123456+00:00 example[14] +[ 3375.000000] [Sat Feb 14 00:27:45 2009] 2009-02-14T00:27:45,123456+00:00 example[15] +[ 4096.000000] [Sat Feb 14 00:39:46 2009] 2009-02-14T00:39:46,123456+00:00 example[16] +[ 4913.000000] [Sat Feb 14 00:53:23 2009] 2009-02-14T00:53:23,123456+00:00 example[17] +[ 5832.000000] [Sat Feb 14 01:08:42 2009] 2009-02-14T01:08:42,123456+00:00 example[18] +[ 6859.000000] [Sat Feb 14 01:25:49 2009] 2009-02-14T01:25:49,123456+00:00 example[19] +[ 8000.000000] [Sat Feb 14 01:44:50 2009] 2009-02-14T01:44:50,123456+00:00 example[20] +[ 9261.000000] [Sat Feb 14 02:05:51 2009] 2009-02-14T02:05:51,123456+00:00 example[21] +[10648.000000] [Sat Feb 14 02:28:58 2009] 2009-02-14T02:28:58,123456+00:00 example[22] +[12167.000000] [Sat Feb 14 02:54:17 2009] 2009-02-14T02:54:17,123456+00:00 example[23] +[13824.000000] [Sat Feb 14 03:21:54 2009] 2009-02-14T03:21:54,123456+00:00 example[24] +[15625.000000] [Sat Feb 14 03:51:55 2009] 2009-02-14T03:51:55,123456+00:00 example[25] +[17576.000000] [Sat Feb 14 04:24:26 2009] 2009-02-14T04:24:26,123456+00:00 example[26] +[19683.000000] [Sat Feb 14 04:59:33 2009] 2009-02-14T04:59:33,123456+00:00 example[27] +[21952.000000] [Sat Feb 14 05:37:22 2009] 2009-02-14T05:37:22,123456+00:00 example[28] +[24389.000000] [Sat Feb 14 06:17:59 2009] 2009-02-14T06:17:59,123456+00:00 example[29] +[27000.000000] [Sat Feb 14 07:01:30 2009] 2009-02-14T07:01:30,123456+00:00 example[30] +[29791.000000] [Sat Feb 14 07:48:01 2009] 2009-02-14T07:48:01,123456+00:00 example[31] +[32768.000000] [Sat Feb 14 08:37:38 2009] 2009-02-14T08:37:38,123456+00:00 example[32] +[35937.000000] [Sat Feb 14 09:30:27 2009] 2009-02-14T09:30:27,123456+00:00 example[33] +[39304.000000] [Sat Feb 14 10:26:34 2009] 2009-02-14T10:26:34,123456+00:00 example[34] +[42875.000000] [Sat Feb 14 11:26:05 2009] 2009-02-14T11:26:05,123456+00:00 example[35] +[46656.000000] [Sat Feb 14 12:29:06 2009] 2009-02-14T12:29:06,123456+00:00 example[36] +[50653.000000] [Sat Feb 14 13:35:43 2009] 2009-02-14T13:35:43,123456+00:00 example[37] +[54872.000000] [Sat Feb 14 14:46:02 2009] 2009-02-14T14:46:02,123456+00:00 example[38] +[59319.000000] [Sat Feb 14 16:00:09 2009] 2009-02-14T16:00:09,123456+00:00 example[39] +[64000.000000] [Sat Feb 14 17:18:10 2009] 2009-02-14T17:18:10,123456+00:00 example[40] +[68921.000000] [Sat Feb 14 18:40:11 2009] 2009-02-14T18:40:11,123456+00:00 example[41] +[74088.000000] [Sat Feb 14 20:06:18 2009] 2009-02-14T20:06:18,123456+00:00 example[42] +[79507.000000] [Sat Feb 14 21:36:37 2009] 2009-02-14T21:36:37,123456+00:00 example[43] +[85184.000000] [Sat Feb 14 23:11:14 2009] 2009-02-14T23:11:14,123456+00:00 example[44] +[91125.000000] [Sun Feb 15 00:50:15 2009] 2009-02-15T00:50:15,123456+00:00 example[45] +[97336.000000] [Sun Feb 15 02:33:46 2009] 2009-02-15T02:33:46,123456+00:00 example[46] +[103823.000000] [Sun Feb 15 04:21:53 2009] 2009-02-15T04:21:53,123456+00:00 example[47] +[110592.000000] [Sun Feb 15 06:14:42 2009] 2009-02-15T06:14:42,123456+00:00 example[48] +[117649.000000] [Sun Feb 15 08:12:19 2009] 2009-02-15T08:12:19,123456+00:00 example[49] +[125000.000000] [Sun Feb 15 10:14:50 2009] 2009-02-15T10:14:50,123456+00:00 example[50] +[132651.000000] [Sun Feb 15 12:22:21 2009] 2009-02-15T12:22:21,123456+00:00 example[51] +[140608.000000] [Sun Feb 15 14:34:58 2009] 2009-02-15T14:34:58,123456+00:00 example[52] +[148877.000000] [Sun Feb 15 16:52:47 2009] 2009-02-15T16:52:47,123456+00:00 example[53] +[157464.000000] [Sun Feb 15 19:15:54 2009] 2009-02-15T19:15:54,123456+00:00 example[54] +[166375.000000] [Sun Feb 15 21:44:25 2009] 2009-02-15T21:44:25,123456+00:00 example[55] +[175616.000000] [Mon Feb 16 00:18:26 2009] 2009-02-16T00:18:26,123456+00:00 example[56] +[185193.000000] [Mon Feb 16 02:58:03 2009] 2009-02-16T02:58:03,123456+00:00 example[57] +[195112.000000] [Mon Feb 16 05:43:22 2009] 2009-02-16T05:43:22,123456+00:00 example[58] +[205379.000000] [Mon Feb 16 08:34:29 2009] 2009-02-16T08:34:29,123456+00:00 example[59] +[216000.000000] [Mon Feb 16 11:31:30 2009] 2009-02-16T11:31:30,123456+00:00 example[60] +[226981.000000] [Mon Feb 16 14:34:31 2009] 2009-02-16T14:34:31,123456+00:00 example[61] +[238328.000000] [Mon Feb 16 17:43:38 2009] 2009-02-16T17:43:38,123456+00:00 example[62] +[250047.000000] [Mon Feb 16 20:58:57 2009] 2009-02-16T20:58:57,123456+00:00 example[63] +[262144.000000] [Tue Feb 17 00:20:34 2009] 2009-02-17T00:20:34,123456+00:00 example[64] +[274625.000000] [Tue Feb 17 03:48:35 2009] 2009-02-17T03:48:35,123456+00:00 example[65] +[287496.000000] [Tue Feb 17 07:23:06 2009] 2009-02-17T07:23:06,123456+00:00 example[66] +[300763.000000] [Tue Feb 17 11:04:13 2009] 2009-02-17T11:04:13,123456+00:00 example[67] +[314432.000000] [Tue Feb 17 14:52:02 2009] 2009-02-17T14:52:02,123456+00:00 example[68] +[328509.000000] [Tue Feb 17 18:46:39 2009] 2009-02-17T18:46:39,123456+00:00 example[69] +[343000.000000] [Tue Feb 17 22:48:10 2009] 2009-02-17T22:48:10,123456+00:00 example[70] +[357911.000000] [Wed Feb 18 02:56:41 2009] 2009-02-18T02:56:41,123456+00:00 example[71] +[373248.000000] [Wed Feb 18 07:12:18 2009] 2009-02-18T07:12:18,123456+00:00 example[72] +[389017.000000] [Wed Feb 18 11:35:07 2009] 2009-02-18T11:35:07,123456+00:00 example[73] +[405224.000000] [Wed Feb 18 16:05:14 2009] 2009-02-18T16:05:14,123456+00:00 example[74] +[421875.000000] [Wed Feb 18 20:42:45 2009] 2009-02-18T20:42:45,123456+00:00 example[75] +[438976.000000] [Thu Feb 19 01:27:46 2009] 2009-02-19T01:27:46,123456+00:00 example[76] +[456533.000000] [Thu Feb 19 06:20:23 2009] 2009-02-19T06:20:23,123456+00:00 example[77] +[474552.000000] [Thu Feb 19 11:20:42 2009] 2009-02-19T11:20:42,123456+00:00 example[78] +[493039.000000] [Thu Feb 19 16:28:49 2009] 2009-02-19T16:28:49,123456+00:00 example[79] +[512000.000000] [Thu Feb 19 21:44:50 2009] 2009-02-19T21:44:50,123456+00:00 example[80] +[531441.000000] [Fri Feb 20 03:08:51 2009] 2009-02-20T03:08:51,123456+00:00 example[81] +[551368.000000] [Fri Feb 20 08:40:58 2009] 2009-02-20T08:40:58,123456+00:00 example[82] +[571787.000000] [Fri Feb 20 14:21:17 2009] 2009-02-20T14:21:17,123456+00:00 example[83] +[592704.000000] [Fri Feb 20 20:09:54 2009] 2009-02-20T20:09:54,123456+00:00 example[84] +[614125.000000] [Sat Feb 21 02:06:55 2009] 2009-02-21T02:06:55,123456+00:00 example[85] +[636056.000000] [Sat Feb 21 08:12:26 2009] 2009-02-21T08:12:26,123456+00:00 example[86] +[658503.000000] [Sat Feb 21 14:26:33 2009] 2009-02-21T14:26:33,123456+00:00 example[87] +[681472.000000] [Sat Feb 21 20:49:22 2009] 2009-02-21T20:49:22,123456+00:00 example[88] +[704969.000000] [Sun Feb 22 03:20:59 2009] 2009-02-22T03:20:59,123456+00:00 example[89] +[729000.000000] [Sun Feb 22 10:01:30 2009] 2009-02-22T10:01:30,123456+00:00 example[90] +[753571.000000] [Sun Feb 22 16:51:01 2009] 2009-02-22T16:51:01,123456+00:00 example[91] +[778688.000000] [Sun Feb 22 23:49:38 2009] 2009-02-22T23:49:38,123456+00:00 example[92] +[804357.000000] [Mon Feb 23 06:57:27 2009] 2009-02-23T06:57:27,123456+00:00 example[93] +[830584.000000] [Mon Feb 23 14:14:34 2009] 2009-02-23T14:14:34,123456+00:00 example[94] +[857375.000000] [Mon Feb 23 21:41:05 2009] 2009-02-23T21:41:05,123456+00:00 example[95] +[884736.000000] [Tue Feb 24 05:17:06 2009] 2009-02-24T05:17:06,123456+00:00 example[96] +[912673.000000] [Tue Feb 24 13:02:43 2009] 2009-02-24T13:02:43,123456+00:00 example[97] +[941192.000000] [Tue Feb 24 20:58:02 2009] 2009-02-24T20:58:02,123456+00:00 example[98] +[970299.000000] [Wed Feb 25 05:03:09 2009] 2009-02-25T05:03:09,123456+00:00 example[99] +[1000000.000000] [Wed Feb 25 13:18:10 2009] 2009-02-25T13:18:10,123456+00:00 example[100] +[1030301.000000] [Wed Feb 25 21:43:11 2009] 2009-02-25T21:43:11,123456+00:00 example[101] +[1061208.000000] [Thu Feb 26 06:18:18 2009] 2009-02-26T06:18:18,123456+00:00 example[102] +[1092727.000000] [Thu Feb 26 15:03:37 2009] 2009-02-26T15:03:37,123456+00:00 example[103] +[1124864.000000] [Thu Feb 26 23:59:14 2009] 2009-02-26T23:59:14,123456+00:00 example[104] +[4557523.000000] [Tue Apr 7 17:30:13 2009] 2009-04-07T17:30:13,123456+00:00 example[105] diff --git a/tests/expected/exch/exch b/tests/expected/exch/exch new file mode 100644 index 0000000..646ff6d --- /dev/null +++ b/tests/expected/exch/exch @@ -0,0 +1,4 @@ +A +B +B +A diff --git a/tests/expected/fadvise/drop b/tests/expected/fadvise/drop index f2360b5..e7bb26b 100644 --- a/tests/expected/fadvise/drop +++ b/tests/expected/fadvise/drop @@ -1,23 +1,23 @@ - RES PAGES SIZE FILE - 32K 8 32K ddtest + RES SIZE FILE + 512K 512K ddtest whole file status: 0 -RES PAGES SIZE FILE - 0B 0 32K ddtest +RES SIZE FILE + 0B 512K ddtest -offset: 8192 +offset: 131072 status: 0 -RES PAGES SIZE FILE - 8K 2 32K ddtest + RES SIZE FILE + 128K 512K ddtest -length: 16384 +length: 262144 status: 0 - RES PAGES SIZE FILE - 16K 4 32K ddtest + RES SIZE FILE + 256K 512K ddtest -offset: 8192, length: 16384 fd: 42 +offset: 131072, length: 262144 fd: 42 status: 0 - RES PAGES SIZE FILE - 16K 4 32K ddtest + RES SIZE FILE + 256K 512K ddtest diff --git a/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end b/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end index 3656a0b..0251f31 100644 --- a/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end +++ b/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end @@ -27,7 +27,6 @@ Select (default p): Partition number (2-4, default 2): First sector (2048-19999, Created a new partition <removed>. Command (m for help): The partition table has been altered. -Syncing disks. ---layout---------- diff --git a/tests/expected/fdisk/resize b/tests/expected/fdisk/resize new file mode 100644 index 0000000..32f9ce2 --- /dev/null +++ b/tests/expected/fdisk/resize @@ -0,0 +1,75 @@ +Create initial partitions + +---layout---------- +Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / <removed> bytes +Disklabel type: gpt +Disk identifier: <removed> + +Device Start End Sectors Size Type +<removed>1 2048 4095 2048 1M Linux filesystem +<removed>2 8192 10239 2048 1M Linux filesystem +------------------- + +Grow first to max + +---layout---------- +Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / <removed> bytes +Disklabel type: gpt +Disk identifier: <removed> + +Device Start End Sectors Size Type +<removed>1 2048 8191 6144 3M Linux filesystem +<removed>2 8192 10239 2048 1M Linux filesystem +------------------- + +Grow second to max + +---layout---------- +Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / <removed> bytes +Disklabel type: gpt +Disk identifier: <removed> + +Device Start End Sectors Size Type +<removed>1 2048 8191 6144 3M Linux filesystem +<removed>2 8192 20446 12255 6M Linux filesystem +------------------- + +Resize first to 4096 bytes + +---layout---------- +Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / <removed> bytes +Disklabel type: gpt +Disk identifier: <removed> + +Device Start End Sectors Size Type +<removed>1 2048 2055 8 4K Linux filesystem +<removed>2 8192 20446 12255 6M Linux filesystem +------------------- + +Resize second to 8 sectors + +---layout---------- +Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / <removed> bytes +Disklabel type: gpt +Disk identifier: <removed> + +Device Start End Sectors Size Type +<removed>1 2048 2055 8 4K Linux filesystem +<removed>2 8192 8199 8 4K Linux filesystem +------------------- + diff --git a/tests/expected/fdisk/sunlabel-create-second-partition b/tests/expected/fdisk/sunlabel-create-second-partition index f6442d3..124f71b 100644 --- a/tests/expected/fdisk/sunlabel-create-second-partition +++ b/tests/expected/fdisk/sunlabel-create-second-partition @@ -8,7 +8,6 @@ Command (m for help): Partition number (2-8, default 2): First cylinder (128-325 Created a new partition <removed>. Command (m for help): The partition table has been altered. -Syncing disks. a87e80830aa13d2d68b766962f052750 sunlabel.img Disk <removed>: 10 MiB, 10485760 bytes, 20480 sectors diff --git a/tests/expected/fincore/count.4096 b/tests/expected/fincore/count.4096 index e90044c..a5d764f 100644 --- a/tests/expected/fincore/count.4096 +++ b/tests/expected/fincore/count.4096 @@ -1,36 +1,36 @@ [ NO EXCITING FILE ] return value: 1 - 0 0 i_EMPTY_FILE +0 0 i_EMPTY_FILE return value: 0 - 1 4095 i_PAGESIZE_-1__incore_ +1 4095 i_PAGESIZE_-1__incore_ return value: 0 - 1 4096 i_JUST_PAGESIZE_incore_ +1 4096 i_JUST_PAGESIZE_incore_ return value: 0 - 0 4096 i_JUST_PAGESIZE_directio_ +0 4096 i_JUST_PAGESIZE_directio_ return value: 0 - 2 8192 i_TWO_PAGES_incore_ +2 8192 i_TWO_PAGES_incore_ return value: 0 - 0 8192 i_TWO_PAGES_directio_ +0 8192 i_TWO_PAGES_directio_ return value: 0 - 1 8192 i_TWO_PAGES_mixed_directio_incore_ +1 8192 i_TWO_PAGES_mixed_directio_incore_ return value: 0 - 1 8192 i_TWO_PAGES_mixed_incore_directio_ +1 8192 i_TWO_PAGES_mixed_incore_directio_ return value: 0 - 2 134213632 i_WINDOW_SIZE_incore-sparse-incore_ +2 134213632 i_WINDOW_SIZE_incore-sparse-incore_ return value: 0 - 0 134213632 i_WINDOW_SIZE_directio-sparse-directio_ +0 134213632 i_WINDOW_SIZE_directio-sparse-directio_ return value: 0 - 1 134213632 i_WINDOW_SIZE_incore-sparse-directio_ +1 134213632 i_WINDOW_SIZE_incore-sparse-directio_ return value: 0 - 1 134213632 i_WINDOW_SIZE_directio-sparse-incore_ +1 134213632 i_WINDOW_SIZE_directio-sparse-incore_ return value: 0 - 2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ +2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ return value: 0 - 0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ +0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ return value: 0 - 1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ +1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ return value: 0 - 1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ +1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ return value: 0 [ MULTIPLE FILES ] PAGES SIZE FILE diff --git a/tests/expected/fincore/count.65536 b/tests/expected/fincore/count.65536 index 22d6a08..07a97d2 100644 --- a/tests/expected/fincore/count.65536 +++ b/tests/expected/fincore/count.65536 @@ -1,36 +1,36 @@ [ NO EXCITING FILE ] return value: 1 - 0 0 i_EMPTY_FILE +0 0 i_EMPTY_FILE return value: 0 - 1 65535 i_PAGESIZE_-1__incore_ +1 65535 i_PAGESIZE_-1__incore_ return value: 0 - 1 65536 i_JUST_PAGESIZE_incore_ +1 65536 i_JUST_PAGESIZE_incore_ return value: 0 - 0 65536 i_JUST_PAGESIZE_directio_ +0 65536 i_JUST_PAGESIZE_directio_ return value: 0 - 2 131072 i_TWO_PAGES_incore_ +2 131072 i_TWO_PAGES_incore_ return value: 0 - 0 131072 i_TWO_PAGES_directio_ +0 131072 i_TWO_PAGES_directio_ return value: 0 - 1 131072 i_TWO_PAGES_mixed_directio_incore_ +1 131072 i_TWO_PAGES_mixed_directio_incore_ return value: 0 - 1 131072 i_TWO_PAGES_mixed_incore_directio_ +1 131072 i_TWO_PAGES_mixed_incore_directio_ return value: 0 - 2 2147418112 i_WINDOW_SIZE_incore-sparse-incore_ +2 2147418112 i_WINDOW_SIZE_incore-sparse-incore_ return value: 0 - 0 2147418112 i_WINDOW_SIZE_directio-sparse-directio_ +0 2147418112 i_WINDOW_SIZE_directio-sparse-directio_ return value: 0 - 1 2147418112 i_WINDOW_SIZE_incore-sparse-directio_ +1 2147418112 i_WINDOW_SIZE_incore-sparse-directio_ return value: 0 - 1 2147418112 i_WINDOW_SIZE_directio-sparse-incore_ +1 2147418112 i_WINDOW_SIZE_directio-sparse-incore_ return value: 0 - 2 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ +2 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ return value: 0 - 0 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ +0 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ return value: 0 - 1 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ +1 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ return value: 0 - 1 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ +1 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ return value: 0 [ MULTIPLE FILES ] PAGES SIZE FILE diff --git a/tests/expected/fincore/count.nosize b/tests/expected/fincore/count.nosize index 6fdcea0..ec26542 100644 --- a/tests/expected/fincore/count.nosize +++ b/tests/expected/fincore/count.nosize @@ -1,36 +1,36 @@ [ NO EXCITING FILE ] return value: 1 - 0 i_EMPTY_FILE +0 i_EMPTY_FILE return value: 0 - 1 i_PAGESIZE_-1__incore_ +1 i_PAGESIZE_-1__incore_ return value: 0 - 1 i_JUST_PAGESIZE_incore_ +1 i_JUST_PAGESIZE_incore_ return value: 0 - 0 i_JUST_PAGESIZE_directio_ +0 i_JUST_PAGESIZE_directio_ return value: 0 - 2 i_TWO_PAGES_incore_ +2 i_TWO_PAGES_incore_ return value: 0 - 0 i_TWO_PAGES_directio_ +0 i_TWO_PAGES_directio_ return value: 0 - 1 i_TWO_PAGES_mixed_directio_incore_ +1 i_TWO_PAGES_mixed_directio_incore_ return value: 0 - 1 i_TWO_PAGES_mixed_incore_directio_ +1 i_TWO_PAGES_mixed_incore_directio_ return value: 0 - 2 i_WINDOW_SIZE_incore-sparse-incore_ +2 i_WINDOW_SIZE_incore-sparse-incore_ return value: 0 - 0 i_WINDOW_SIZE_directio-sparse-directio_ +0 i_WINDOW_SIZE_directio-sparse-directio_ return value: 0 - 1 i_WINDOW_SIZE_incore-sparse-directio_ +1 i_WINDOW_SIZE_incore-sparse-directio_ return value: 0 - 1 i_WINDOW_SIZE_directio-sparse-incore_ +1 i_WINDOW_SIZE_directio-sparse-incore_ return value: 0 - 2 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ +2 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_ return value: 0 - 0 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ +0 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_ return value: 0 - 1 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ +1 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_ return value: 0 - 1 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ +1 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_ return value: 0 [ MULTIPLE FILES ] PAGES FILE diff --git a/tests/expected/hexdump/format-strings-1b_hex b/tests/expected/hexdump/format-strings-1b_hex new file mode 100644 index 0000000..ecd4960 --- /dev/null +++ b/tests/expected/hexdump/format-strings-1b_hex @@ -0,0 +1,41 @@ +0000000 00 20 01 20 02 20 03 20 04 20 05 20 06 20 07 20 +0000010 08 20 09 20 0a 20 0b 20 0c 20 0d 20 0e 20 0f 20 +0000020 10 20 11 20 12 20 13 20 14 20 15 20 16 20 17 20 +0000030 18 20 19 20 1a 20 1b 20 1c 20 1d 20 1e 20 1f 20 +0000040 20 20 21 20 22 20 23 20 24 20 25 20 26 20 27 20 +0000050 28 20 29 20 2a 20 2b 20 2c 20 2d 20 2e 20 2f 20 +0000060 30 20 31 20 32 20 33 20 34 20 35 20 36 20 37 20 +0000070 38 20 39 20 3a 20 3b 20 3c 20 3d 20 3e 20 3f 20 +0000080 40 20 41 20 42 20 43 20 44 20 45 20 46 20 47 20 +0000090 48 20 49 20 4a 20 4b 20 4c 20 4d 20 4e 20 4f 20 +00000a0 50 20 51 20 52 20 53 20 54 20 55 20 56 20 57 20 +00000b0 58 20 59 20 5a 20 5b 20 5c 20 5d 20 5e 20 5f 20 +00000c0 60 20 61 20 62 20 63 20 64 20 65 20 66 20 67 20 +00000d0 68 20 69 20 6a 20 6b 20 6c 20 6d 20 6e 20 6f 20 +00000e0 70 20 71 20 72 20 73 20 74 20 75 20 76 20 77 20 +00000f0 78 20 79 20 7a 20 7b 20 7c 20 7d 20 7e 20 7f 20 +0000100 c2 80 20 c2 81 20 c2 82 20 c2 83 20 c2 84 20 c2 +0000110 85 20 c2 86 20 c2 87 20 c2 88 20 c2 89 20 c2 8a +0000120 20 c2 8b 20 c2 8c 20 c2 8d 20 c2 8e 20 c2 8f 20 +0000130 c2 90 20 c2 91 20 c2 92 20 c2 93 20 c2 94 20 c2 +0000140 95 20 c2 96 20 c2 97 20 c2 98 20 c2 99 20 c2 9a +0000150 20 c2 9b 20 c2 9c 20 c2 9d 20 c2 9e 20 c2 9f 20 +0000160 c2 a0 20 c2 a1 20 c2 a2 20 c2 a3 20 c2 a4 20 c2 +0000170 a5 20 c2 a6 20 c2 a7 20 c2 a8 20 c2 a9 20 c2 aa +0000180 20 c2 ab 20 c2 ac 20 c2 ad 20 c2 ae 20 c2 af 20 +0000190 c2 b0 20 c2 b1 20 c2 b2 20 c2 b3 20 c2 b4 20 c2 +00001a0 b5 20 c2 b6 20 c2 b7 20 c2 b8 20 c2 b9 20 c2 ba +00001b0 20 c2 bb 20 c2 bc 20 c2 bd 20 c2 be 20 c2 bf 20 +00001c0 c3 80 20 c3 81 20 c3 82 20 c3 83 20 c3 84 20 c3 +00001d0 85 20 c3 86 20 c3 87 20 c3 88 20 c3 89 20 c3 8a +00001e0 20 c3 8b 20 c3 8c 20 c3 8d 20 c3 8e 20 c3 8f 20 +00001f0 c3 90 20 c3 91 20 c3 92 20 c3 93 20 c3 94 20 c3 +0000200 95 20 c3 96 20 c3 97 20 c3 98 20 c3 99 20 c3 9a +0000210 20 c3 9b 20 c3 9c 20 c3 9d 20 c3 9e 20 c3 9f 20 +0000220 c3 a0 20 c3 a1 20 c3 a2 20 c3 a3 20 c3 a4 20 c3 +0000230 a5 20 c3 a6 20 c3 a7 20 c3 a8 20 c3 a9 20 c3 aa +0000240 20 c3 ab 20 c3 ac 20 c3 ad 20 c3 ae 20 c3 af 20 +0000250 c3 b0 20 c3 b1 20 c3 b2 20 c3 b3 20 c3 b4 20 c3 +0000260 b5 20 c3 b6 20 c3 b7 20 c3 b8 20 c3 b9 20 c3 ba +0000270 20 c3 bb 20 c3 bc 20 c3 bd 20 c3 be 20 c3 bf 20 +0000280 diff --git a/tests/expected/libfdisk/gpt-all-defaults b/tests/expected/libfdisk/gpt-all-defaults index 218338a..e9df0bd 100644 --- a/tests/expected/libfdisk/gpt-all-defaults +++ b/tests/expected/libfdisk/gpt-all-defaults @@ -21,4 +21,3 @@ Device Start End Sectors Size Type <removed>2 12288 18431 6144 3M Linux filesystem The partition table has been altered. -Syncing disks. diff --git a/tests/expected/libfdisk/gpt-all-defaults-with-typo b/tests/expected/libfdisk/gpt-all-defaults-with-typo index 218338a..e9df0bd 100644 --- a/tests/expected/libfdisk/gpt-all-defaults-with-typo +++ b/tests/expected/libfdisk/gpt-all-defaults-with-typo @@ -21,4 +21,3 @@ Device Start End Sectors Size Type <removed>2 12288 18431 6144 3M Linux filesystem The partition table has been altered. -Syncing disks. diff --git a/tests/expected/libmount/optlist-append b/tests/expected/libmount/optlist-append new file mode 100644 index 0000000..d6951ed --- /dev/null +++ b/tests/expected/libmount/optlist-append @@ -0,0 +1,5 @@ +#01 [ unknown ] name:'aaa', value:'(null)' +#02 [ unknown ] name:'bbb', value:'BBB' +#03 [ unknown ] name:'context', value:'foo,bar,gogo' +#04 [ unknown ] name:'ccc', value:'(null)' +#05 [ unknown ] name:'ddd', value:'(null)' diff --git a/tests/expected/libmount/optlist-append-empty-value b/tests/expected/libmount/optlist-append-empty-value new file mode 100644 index 0000000..1ed1028 --- /dev/null +++ b/tests/expected/libmount/optlist-append-empty-value @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'aaa', value:'(null)' +#02 [ unknown ] name:'bbb', value:'BBB' +#03 [ unknown ] name:'ccc', value:'(null)' +#04 [ unknown ] name:'ddd', value:'(null)' diff --git a/tests/expected/libmount/optlist-append-value b/tests/expected/libmount/optlist-append-value new file mode 100644 index 0000000..24f9115 --- /dev/null +++ b/tests/expected/libmount/optlist-append-value @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'aaa', value:'(null)' +#02 [ unknown ] name:'bbb', value:'BBB' +#03 [ unknown ] name:'ccc', value:'(null)' +#04 [ unknown ] name:'ddd', value:'DDD' diff --git a/tests/expected/libmount/optlist-get b/tests/expected/libmount/optlist-get new file mode 100644 index 0000000..217a6f7 --- /dev/null +++ b/tests/expected/libmount/optlist-get @@ -0,0 +1,4 @@ +Default: rw,aaa,bbb=BBB,ccc +All: rw,aaa,bbb=BBB,ccc +Unknown: aaa,bbb=BBB,ccc +Helpers: rw,aaa,bbb=BBB,ccc diff --git a/tests/expected/libmount/optlist-get-flg-linux b/tests/expected/libmount/optlist-get-flg-linux new file mode 100644 index 0000000..f57108b --- /dev/null +++ b/tests/expected/libmount/optlist-get-flg-linux @@ -0,0 +1 @@ +0x00000008 diff --git a/tests/expected/libmount/optlist-get-flg-user b/tests/expected/libmount/optlist-get-flg-user new file mode 100644 index 0000000..83ab8b2 --- /dev/null +++ b/tests/expected/libmount/optlist-get-flg-user @@ -0,0 +1 @@ +0x0000000c diff --git a/tests/expected/libmount/optlist-get-str b/tests/expected/libmount/optlist-get-str new file mode 100644 index 0000000..f7f3a13 --- /dev/null +++ b/tests/expected/libmount/optlist-get-str @@ -0,0 +1,4 @@ +Default: rw,aaa,bbb=BBB,ccc,defaults +All: rw,aaa,bbb=BBB,ccc,defaults +Unknown: aaa,bbb=BBB,ccc +Helpers: rw,aaa,bbb=BBB,ccc diff --git a/tests/expected/libmount/optlist-get-str-linux b/tests/expected/libmount/optlist-get-str-linux new file mode 100644 index 0000000..abe63b4 --- /dev/null +++ b/tests/expected/libmount/optlist-get-str-linux @@ -0,0 +1,5 @@ +Default: rw,noexec [0x00000008] (in linux map) +Default: rw,noexec,noauto,user,defaults +All: rw,noexec,noauto,user,defaults +Unknown: (null) +Helpers: rw,noexec,user diff --git a/tests/expected/libmount/optlist-get-str-user b/tests/expected/libmount/optlist-get-str-user new file mode 100644 index 0000000..d047003 --- /dev/null +++ b/tests/expected/libmount/optlist-get-str-user @@ -0,0 +1,5 @@ +Default: noauto,user,defaults [0x0000000c] (in user map) +Default: rw,noexec,noauto,user,defaults +All: rw,noexec,noauto,user,defaults +Unknown: (null) +Helpers: rw,noexec,user diff --git a/tests/expected/libmount/optlist-get-value b/tests/expected/libmount/optlist-get-value new file mode 100644 index 0000000..217a6f7 --- /dev/null +++ b/tests/expected/libmount/optlist-get-value @@ -0,0 +1,4 @@ +Default: rw,aaa,bbb=BBB,ccc +All: rw,aaa,bbb=BBB,ccc +Unknown: aaa,bbb=BBB,ccc +Helpers: rw,aaa,bbb=BBB,ccc diff --git a/tests/expected/libmount/optlist-prepend b/tests/expected/libmount/optlist-prepend new file mode 100644 index 0000000..24c64c6 --- /dev/null +++ b/tests/expected/libmount/optlist-prepend @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'ddd', value:'(null)' +#02 [ unknown ] name:'aaa', value:'(null)' +#03 [ unknown ] name:'bbb', value:'BBB' +#04 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-prepend-empty-value b/tests/expected/libmount/optlist-prepend-empty-value new file mode 100644 index 0000000..24c64c6 --- /dev/null +++ b/tests/expected/libmount/optlist-prepend-empty-value @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'ddd', value:'(null)' +#02 [ unknown ] name:'aaa', value:'(null)' +#03 [ unknown ] name:'bbb', value:'BBB' +#04 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-prepend-list b/tests/expected/libmount/optlist-prepend-list new file mode 100644 index 0000000..9e5005f --- /dev/null +++ b/tests/expected/libmount/optlist-prepend-list @@ -0,0 +1,6 @@ +#01 [ unknown ] name:'ddd', value:'(null)' +#02 [ unknown ] name:'eee', value:'EEE' +#03 [ unknown ] name:'fff', value:'(null)' +#04 [ unknown ] name:'aaa', value:'(null)' +#05 [ unknown ] name:'bbb', value:'BBB' +#06 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-prepend-value b/tests/expected/libmount/optlist-prepend-value new file mode 100644 index 0000000..eed5de5 --- /dev/null +++ b/tests/expected/libmount/optlist-prepend-value @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'ddd', value:'DDD' +#02 [ unknown ] name:'aaa', value:'(null)' +#03 [ unknown ] name:'bbb', value:'BBB' +#04 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-remove b/tests/expected/libmount/optlist-remove new file mode 100644 index 0000000..08f3898 --- /dev/null +++ b/tests/expected/libmount/optlist-remove @@ -0,0 +1,12 @@ + +Usage: + test_mount_optlist <test> [testoptions] +Tests: + --append-str <list> <str> [linux|user] append to the list + --prepend-str <list> <str> [linux|user] prepend to the list + --set-str <list> <str> [linux|user] set to the list + --append-flg <list> <flg> linux|user append to the list + --set-flg <list> <flg> linux|user set to the list + --get-str <list> [linux|user] all options in string + --get-flg <list> linux|user all options by flags + diff --git a/tests/expected/libmount/optlist-remove-empty-value b/tests/expected/libmount/optlist-remove-empty-value new file mode 100644 index 0000000..08f3898 --- /dev/null +++ b/tests/expected/libmount/optlist-remove-empty-value @@ -0,0 +1,12 @@ + +Usage: + test_mount_optlist <test> [testoptions] +Tests: + --append-str <list> <str> [linux|user] append to the list + --prepend-str <list> <str> [linux|user] prepend to the list + --set-str <list> <str> [linux|user] set to the list + --append-flg <list> <flg> linux|user append to the list + --set-flg <list> <flg> linux|user set to the list + --get-str <list> [linux|user] all options in string + --get-flg <list> linux|user all options by flags + diff --git a/tests/expected/libmount/optlist-remove-quoted b/tests/expected/libmount/optlist-remove-quoted new file mode 100644 index 0000000..08f3898 --- /dev/null +++ b/tests/expected/libmount/optlist-remove-quoted @@ -0,0 +1,12 @@ + +Usage: + test_mount_optlist <test> [testoptions] +Tests: + --append-str <list> <str> [linux|user] append to the list + --prepend-str <list> <str> [linux|user] prepend to the list + --set-str <list> <str> [linux|user] set to the list + --append-flg <list> <flg> linux|user append to the list + --set-flg <list> <flg> linux|user set to the list + --get-str <list> [linux|user] all options in string + --get-flg <list> linux|user all options by flags + diff --git a/tests/expected/libmount/optlist-remove-value b/tests/expected/libmount/optlist-remove-value new file mode 100644 index 0000000..08f3898 --- /dev/null +++ b/tests/expected/libmount/optlist-remove-value @@ -0,0 +1,12 @@ + +Usage: + test_mount_optlist <test> [testoptions] +Tests: + --append-str <list> <str> [linux|user] append to the list + --prepend-str <list> <str> [linux|user] prepend to the list + --set-str <list> <str> [linux|user] set to the list + --append-flg <list> <flg> linux|user append to the list + --set-flg <list> <flg> linux|user set to the list + --get-str <list> [linux|user] all options in string + --get-flg <list> linux|user all options by flags + diff --git a/tests/expected/libmount/optlist-set b/tests/expected/libmount/optlist-set new file mode 100644 index 0000000..a9f1e66 --- /dev/null +++ b/tests/expected/libmount/optlist-set @@ -0,0 +1,4 @@ +#01 [ unknown ] name:'new', value:'(null)' +#02 [ unknown ] name:'data', value:'(null)' +#03 [ unknown ] name:'for', value:'(null)' +#04 [ unknown ] name:'list', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-empty b/tests/expected/libmount/optlist-set-empty new file mode 100644 index 0000000..02e1b58 --- /dev/null +++ b/tests/expected/libmount/optlist-set-empty @@ -0,0 +1 @@ +#01 [ unknown ] name:'bbb', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-large b/tests/expected/libmount/optlist-set-large new file mode 100644 index 0000000..02e1b58 --- /dev/null +++ b/tests/expected/libmount/optlist-set-large @@ -0,0 +1 @@ +#01 [ unknown ] name:'bbb', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-new b/tests/expected/libmount/optlist-set-new new file mode 100644 index 0000000..c538cbe --- /dev/null +++ b/tests/expected/libmount/optlist-set-new @@ -0,0 +1 @@ +#01 [ unknown ] name:'aaa', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-new-empty b/tests/expected/libmount/optlist-set-new-empty new file mode 100644 index 0000000..c538cbe --- /dev/null +++ b/tests/expected/libmount/optlist-set-new-empty @@ -0,0 +1 @@ +#01 [ unknown ] name:'aaa', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-new-end b/tests/expected/libmount/optlist-set-new-end new file mode 100644 index 0000000..12d6779 --- /dev/null +++ b/tests/expected/libmount/optlist-set-new-end @@ -0,0 +1 @@ +#01 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-new-end-empty b/tests/expected/libmount/optlist-set-new-end-empty new file mode 100644 index 0000000..12d6779 --- /dev/null +++ b/tests/expected/libmount/optlist-set-new-end-empty @@ -0,0 +1 @@ +#01 [ unknown ] name:'ccc', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-remove b/tests/expected/libmount/optlist-set-remove new file mode 100644 index 0000000..02e1b58 --- /dev/null +++ b/tests/expected/libmount/optlist-set-remove @@ -0,0 +1 @@ +#01 [ unknown ] name:'bbb', value:'(null)' diff --git a/tests/expected/libmount/optlist-set-small b/tests/expected/libmount/optlist-set-small new file mode 100644 index 0000000..02e1b58 --- /dev/null +++ b/tests/expected/libmount/optlist-set-small @@ -0,0 +1 @@ +#01 [ unknown ] name:'bbb', value:'(null)' diff --git a/tests/expected/libmount/optstr-prepend-list b/tests/expected/libmount/optstr-prepend-list new file mode 100644 index 0000000..9f289fd --- /dev/null +++ b/tests/expected/libmount/optstr-prepend-list @@ -0,0 +1 @@ +result: >ddd,eee=EEE,fff,aaa,bbb=BBB,ccc< diff --git a/tests/expected/libsmartcols/continuous-json b/tests/expected/libsmartcols/continuous-json new file mode 100644 index 0000000..e8ba584 --- /dev/null +++ b/tests/expected/libsmartcols/continuous-json @@ -0,0 +1,40 @@ +{ + "count": "0", + "text": "text0" +} +{ + "count": "1", + "text": "text1" +} +{ + "count": "2", + "text": "text2" +} +{ + "count": "3", + "text": "text3" +} +{ + "count": "4", + "text": "text4" +} +{ + "count": "5", + "text": "text5" +} +{ + "count": "6", + "text": "text6" +} +{ + "count": "7", + "text": "text7" +} +{ + "count": "8", + "text": "text8" +} +{ + "count": "9", + "text": "text9" +} diff --git a/tests/expected/libsmartcols/filter b/tests/expected/libsmartcols/filter new file mode 100644 index 0000000..4155aa3 --- /dev/null +++ b/tests/expected/libsmartcols/filter @@ -0,0 +1 @@ +...done. diff --git a/tests/expected/libsmartcols/filter-bool-and b/tests/expected/libsmartcols/filter-bool-and new file mode 100644 index 0000000..136149c --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-and @@ -0,0 +1,7 @@ +expr: BOOL && NAME + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-as-string b/tests/expected/libsmartcols/filter-bool-as-string new file mode 100644 index 0000000..213ce58 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-as-string @@ -0,0 +1,2 @@ +expr: BOOL == "0" + diff --git a/tests/expected/libsmartcols/filter-bool-as-string2 b/tests/expected/libsmartcols/filter-bool-as-string2 new file mode 100644 index 0000000..c4ddd20 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-as-string2 @@ -0,0 +1,2 @@ +expr: BOOL == "1" + diff --git a/tests/expected/libsmartcols/filter-bool-eq-false b/tests/expected/libsmartcols/filter-bool-eq-false new file mode 100644 index 0000000..8454205 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-false @@ -0,0 +1,8 @@ +expr: BOOL == FALSE + +NAME BOOL +aaaa 0 +dddddd 0 +ffff false +gggggg FALSE +iiiiii 0 diff --git a/tests/expected/libsmartcols/filter-bool-eq-false2 b/tests/expected/libsmartcols/filter-bool-eq-false2 new file mode 100644 index 0000000..d0d19ff --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-false2 @@ -0,0 +1,8 @@ +expr: BOOL == false + +NAME BOOL +aaaa 0 +dddddd 0 +ffff false +gggggg FALSE +iiiiii 0 diff --git a/tests/expected/libsmartcols/filter-bool-eq-false3 b/tests/expected/libsmartcols/filter-bool-eq-false3 new file mode 100644 index 0000000..605bc93 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-false3 @@ -0,0 +1,9 @@ +expr: BOOL == 0 + +NAME BOOL +aaaa 0 +ccccc +dddddd 0 +ffff false +gggggg FALSE +iiiiii 0 diff --git a/tests/expected/libsmartcols/filter-bool-eq-true b/tests/expected/libsmartcols/filter-bool-eq-true new file mode 100644 index 0000000..d2d9199 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-true @@ -0,0 +1,7 @@ +expr: BOOL == TRUE + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-eq-true2 b/tests/expected/libsmartcols/filter-bool-eq-true2 new file mode 100644 index 0000000..12dedc2 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-true2 @@ -0,0 +1,7 @@ +expr: BOOL == true + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-eq-true3 b/tests/expected/libsmartcols/filter-bool-eq-true3 new file mode 100644 index 0000000..801ee24 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-eq-true3 @@ -0,0 +1,7 @@ +expr: BOOL == 1 + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-is b/tests/expected/libsmartcols/filter-bool-is new file mode 100644 index 0000000..1e8b359 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-is @@ -0,0 +1,7 @@ +expr: BOOL + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-ne b/tests/expected/libsmartcols/filter-bool-ne new file mode 100644 index 0000000..6491fad --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-ne @@ -0,0 +1,7 @@ +expr: BOOL != false + +NAME BOOL +bbb 1 +ee true +hhh TRUE +jj 1 diff --git a/tests/expected/libsmartcols/filter-bool-ne2 b/tests/expected/libsmartcols/filter-bool-ne2 new file mode 100644 index 0000000..9fc6844 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-ne2 @@ -0,0 +1,8 @@ +expr: BOOL != true + +NAME BOOL +aaaa 0 +dddddd 0 +ffff false +gggggg FALSE +iiiiii 0 diff --git a/tests/expected/libsmartcols/filter-bool-neg b/tests/expected/libsmartcols/filter-bool-neg new file mode 100644 index 0000000..9311918 --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-neg @@ -0,0 +1,9 @@ +expr: !BOOL + +NAME BOOL +aaaa 0 +ccccc +dddddd 0 +ffff false +gggggg FALSE +iiiiii 0 diff --git a/tests/expected/libsmartcols/filter-bool-or b/tests/expected/libsmartcols/filter-bool-or new file mode 100644 index 0000000..506242c --- /dev/null +++ b/tests/expected/libsmartcols/filter-bool-or @@ -0,0 +1,13 @@ +expr: BOOL || NAME + +NAME BOOL +aaaa 0 +bbb 1 +ccccc +dddddd 0 +ee true +ffff false +gggggg FALSE +hhh TRUE +iiiiii 0 +jj 1 diff --git a/tests/expected/libsmartcols/filter-broken-bad-column b/tests/expected/libsmartcols/filter-broken-bad-column new file mode 100644 index 0000000..484d84a --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-bad-column @@ -0,0 +1,4 @@ +expr: XXX == 100 + +sample-scols-fromfile: unknown column 'XXX' in filter +sample-scols-fromfile: failed to initialize filter diff --git a/tests/expected/libsmartcols/filter-broken-bad-float b/tests/expected/libsmartcols/filter-broken-bad-float new file mode 100644 index 0000000..bc11bbc --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-bad-float @@ -0,0 +1,3 @@ +expr: NUM == 100 . 5 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-bad-number b/tests/expected/libsmartcols/filter-broken-bad-number new file mode 100644 index 0000000..d7d5e70 --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-bad-number @@ -0,0 +1,3 @@ +expr: NUM == 1y0 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-bad-oper b/tests/expected/libsmartcols/filter-broken-bad-oper new file mode 100644 index 0000000..f0600ca --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-bad-oper @@ -0,0 +1,3 @@ +expr: NUM ** 100 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-bad-oper2 b/tests/expected/libsmartcols/filter-broken-bad-oper2 new file mode 100644 index 0000000..69e62a2 --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-bad-oper2 @@ -0,0 +1,3 @@ +expr: NUM = 100 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-no-close b/tests/expected/libsmartcols/filter-broken-no-close new file mode 100644 index 0000000..9298977 --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-no-close @@ -0,0 +1,3 @@ +expr: (NUM == 100 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-no-column b/tests/expected/libsmartcols/filter-broken-no-column new file mode 100644 index 0000000..db17bca --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-no-column @@ -0,0 +1,3 @@ +expr: == 100 + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-no-param b/tests/expected/libsmartcols/filter-broken-no-param new file mode 100644 index 0000000..50f18ea --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-no-param @@ -0,0 +1,3 @@ +expr: NUM == + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-broken-no-start b/tests/expected/libsmartcols/filter-broken-no-start new file mode 100644 index 0000000..227c027 --- /dev/null +++ b/tests/expected/libsmartcols/filter-broken-no-start @@ -0,0 +1,3 @@ +expr: NUM == 100) + +sample-scols-fromfile: failed to parse filter: <bison syntax error message removed> diff --git a/tests/expected/libsmartcols/filter-float-and b/tests/expected/libsmartcols/filter-float-and new file mode 100644 index 0000000..dd733fb --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-and @@ -0,0 +1,12 @@ +expr: NUM && NAME + +NAME NUM +bbb 100 +ccccc 100.5 +dddddd 99.9 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-as-string b/tests/expected/libsmartcols/filter-float-as-string new file mode 100644 index 0000000..5e2d9eb --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-as-string @@ -0,0 +1,4 @@ +expr: NUM == "100" + +NAME NUM +bbb 100 diff --git a/tests/expected/libsmartcols/filter-float-as-string2 b/tests/expected/libsmartcols/filter-float-as-string2 new file mode 100644 index 0000000..a829b9c --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-as-string2 @@ -0,0 +1,4 @@ +expr: NUM == "100.5" + +NAME NUM +ccccc 100.5 diff --git a/tests/expected/libsmartcols/filter-float-eq b/tests/expected/libsmartcols/filter-float-eq new file mode 100644 index 0000000..e6e1451 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-eq @@ -0,0 +1,4 @@ +expr: NUM == 100 + +NAME NUM +bbb 100 diff --git a/tests/expected/libsmartcols/filter-float-eq2 b/tests/expected/libsmartcols/filter-float-eq2 new file mode 100644 index 0000000..71e27e2 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-eq2 @@ -0,0 +1,4 @@ +expr: NUM == 100.5 + +NAME NUM +ccccc 100.5 diff --git a/tests/expected/libsmartcols/filter-float-ge b/tests/expected/libsmartcols/filter-float-ge new file mode 100644 index 0000000..ca892d2 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-ge @@ -0,0 +1,11 @@ +expr: NUM >= 100 + +NAME NUM +bbb 100 +ccccc 100.5 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-ge2 b/tests/expected/libsmartcols/filter-float-ge2 new file mode 100644 index 0000000..c089fed --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-ge2 @@ -0,0 +1,10 @@ +expr: NUM >= 100.5 + +NAME NUM +ccccc 100.5 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-gt b/tests/expected/libsmartcols/filter-float-gt new file mode 100644 index 0000000..283f13d --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-gt @@ -0,0 +1,6 @@ +expr: NUM > 8000 + +NAME NUM +gggggg 678993321 +hhh 7666666 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-gt2 b/tests/expected/libsmartcols/filter-float-gt2 new file mode 100644 index 0000000..bd54c05 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-gt2 @@ -0,0 +1,5 @@ +expr: NUM > 8000.5 + +NAME NUM +gggggg 678993321 +hhh 7666666 diff --git a/tests/expected/libsmartcols/filter-float-is b/tests/expected/libsmartcols/filter-float-is new file mode 100644 index 0000000..79e30ba --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-is @@ -0,0 +1,12 @@ +expr: NUM + +NAME NUM +bbb 100 +ccccc 100.5 +dddddd 99.9 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-le b/tests/expected/libsmartcols/filter-float-le new file mode 100644 index 0000000..6954d68 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-le @@ -0,0 +1,6 @@ +expr: NUM <= 100 + +NAME NUM +aaaa 0 +bbb 100 +dddddd 99.9 diff --git a/tests/expected/libsmartcols/filter-float-le2 b/tests/expected/libsmartcols/filter-float-le2 new file mode 100644 index 0000000..c8693cc --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-le2 @@ -0,0 +1,7 @@ +expr: NUM <= 100.5 + +NAME NUM +aaaa 0 +bbb 100 +ccccc 100.5 +dddddd 99.9 diff --git a/tests/expected/libsmartcols/filter-float-lt b/tests/expected/libsmartcols/filter-float-lt new file mode 100644 index 0000000..ac67cd7 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-lt @@ -0,0 +1,5 @@ +expr: NUM < 100 + +NAME NUM +aaaa 0 +dddddd 99.9 diff --git a/tests/expected/libsmartcols/filter-float-lt2 b/tests/expected/libsmartcols/filter-float-lt2 new file mode 100644 index 0000000..0c26b03 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-lt2 @@ -0,0 +1,6 @@ +expr: NUM < 100.5 + +NAME NUM +aaaa 0 +bbb 100 +dddddd 99.9 diff --git a/tests/expected/libsmartcols/filter-float-ne b/tests/expected/libsmartcols/filter-float-ne new file mode 100644 index 0000000..b16c48e --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-ne @@ -0,0 +1,12 @@ +expr: NUM != 100 + +NAME NUM +aaaa 0 +ccccc 100.5 +dddddd 99.9 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-ne2 b/tests/expected/libsmartcols/filter-float-ne2 new file mode 100644 index 0000000..3d55387 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-ne2 @@ -0,0 +1,12 @@ +expr: NUM != 100.5 + +NAME NUM +aaaa 0 +bbb 100 +dddddd 99.9 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-float-neg b/tests/expected/libsmartcols/filter-float-neg new file mode 100644 index 0000000..647af52 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-neg @@ -0,0 +1,4 @@ +expr: !NUM + +NAME NUM +aaaa 0 diff --git a/tests/expected/libsmartcols/filter-float-or b/tests/expected/libsmartcols/filter-float-or new file mode 100644 index 0000000..40f2291 --- /dev/null +++ b/tests/expected/libsmartcols/filter-float-or @@ -0,0 +1,13 @@ +expr: NUM || NAME + +NAME NUM +aaaa 0 +bbb 100 +ccccc 100.5 +dddddd 99.9 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8000 +jj 8000.5 diff --git a/tests/expected/libsmartcols/filter-number-and b/tests/expected/libsmartcols/filter-number-and new file mode 100644 index 0000000..be82bf5 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-and @@ -0,0 +1,12 @@ +expr: NUM && NAME + +NAME NUM +bbb 100 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-number-and-or b/tests/expected/libsmartcols/filter-number-and-or new file mode 100644 index 0000000..79ee4cb --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-and-or @@ -0,0 +1,7 @@ +expr: (NUM >= 3 && NUM <= 100) || NUM == 0 + +NAME NUM +aaaa 0 +bbb 100 +ccccc 21 +dddddd 3 diff --git a/tests/expected/libsmartcols/filter-number-as-string b/tests/expected/libsmartcols/filter-number-as-string new file mode 100644 index 0000000..5e2d9eb --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-as-string @@ -0,0 +1,4 @@ +expr: NUM == "100" + +NAME NUM +bbb 100 diff --git a/tests/expected/libsmartcols/filter-number-eq b/tests/expected/libsmartcols/filter-number-eq new file mode 100644 index 0000000..e6e1451 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-eq @@ -0,0 +1,4 @@ +expr: NUM == 100 + +NAME NUM +bbb 100 diff --git a/tests/expected/libsmartcols/filter-number-expr-and-expr b/tests/expected/libsmartcols/filter-number-expr-and-expr new file mode 100644 index 0000000..5bc6b37 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-expr-and-expr @@ -0,0 +1,7 @@ +expr: NUM > 10 && NUM < 8000 + +NAME NUM +bbb 100 +ccccc 21 +ee 411 +ffff 5111 diff --git a/tests/expected/libsmartcols/filter-number-expr-or-expr b/tests/expected/libsmartcols/filter-number-expr-or-expr new file mode 100644 index 0000000..2e3f83b --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-expr-or-expr @@ -0,0 +1,5 @@ +expr: NUM == 3 || NUM == 100 + +NAME NUM +bbb 100 +dddddd 3 diff --git a/tests/expected/libsmartcols/filter-number-ge b/tests/expected/libsmartcols/filter-number-ge new file mode 100644 index 0000000..23899e5 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-ge @@ -0,0 +1,10 @@ +expr: NUM >= 100 + +NAME NUM +bbb 100 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-number-gt b/tests/expected/libsmartcols/filter-number-gt new file mode 100644 index 0000000..6668cd4 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-gt @@ -0,0 +1,7 @@ +expr: NUM > 8000 + +NAME NUM +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-number-is b/tests/expected/libsmartcols/filter-number-is new file mode 100644 index 0000000..85dd344 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-is @@ -0,0 +1,12 @@ +expr: NUM + +NAME NUM +bbb 100 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-number-le b/tests/expected/libsmartcols/filter-number-le new file mode 100644 index 0000000..f2d7521 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-le @@ -0,0 +1,7 @@ +expr: NUM <= 100 + +NAME NUM +aaaa 0 +bbb 100 +ccccc 21 +dddddd 3 diff --git a/tests/expected/libsmartcols/filter-number-lt b/tests/expected/libsmartcols/filter-number-lt new file mode 100644 index 0000000..b0784db --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-lt @@ -0,0 +1,6 @@ +expr: NUM < 100 + +NAME NUM +aaaa 0 +ccccc 21 +dddddd 3 diff --git a/tests/expected/libsmartcols/filter-number-ne b/tests/expected/libsmartcols/filter-number-ne new file mode 100644 index 0000000..c2ee709 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-ne @@ -0,0 +1,12 @@ +expr: NUM != 100 + +NAME NUM +aaaa 0 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-number-neg b/tests/expected/libsmartcols/filter-number-neg new file mode 100644 index 0000000..647af52 --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-neg @@ -0,0 +1,4 @@ +expr: !NUM + +NAME NUM +aaaa 0 diff --git a/tests/expected/libsmartcols/filter-number-or b/tests/expected/libsmartcols/filter-number-or new file mode 100644 index 0000000..8a32fac --- /dev/null +++ b/tests/expected/libsmartcols/filter-number-or @@ -0,0 +1,13 @@ +expr: NUM || NAME + +NAME NUM +aaaa 0 +bbb 100 +ccccc 21 +dddddd 3 +ee 411 +ffff 5111 +gggggg 678993321 +hhh 7666666 +iiiiii 8765 +jj 987456 diff --git a/tests/expected/libsmartcols/filter-string-eq b/tests/expected/libsmartcols/filter-string-eq new file mode 100644 index 0000000..ac96885 --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-eq @@ -0,0 +1,4 @@ +expr: NAME == "bbb" + +NAME +bbb diff --git a/tests/expected/libsmartcols/filter-string-ge b/tests/expected/libsmartcols/filter-string-ge new file mode 100644 index 0000000..4e2d7de --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-ge @@ -0,0 +1,12 @@ +expr: NAME >= "bbb" + +NAME +bbb +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/expected/libsmartcols/filter-string-gt b/tests/expected/libsmartcols/filter-string-gt new file mode 100644 index 0000000..b33b8ac --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-gt @@ -0,0 +1,11 @@ +expr: NAME > "bbb" + +NAME +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/expected/libsmartcols/filter-string-is b/tests/expected/libsmartcols/filter-string-is new file mode 100644 index 0000000..c4d8245 --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-is @@ -0,0 +1,13 @@ +expr: NAME + +NAME +aaaa +bbb +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/expected/libsmartcols/filter-string-le b/tests/expected/libsmartcols/filter-string-le new file mode 100644 index 0000000..3fea9f1 --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-le @@ -0,0 +1,5 @@ +expr: NAME <= "bbb" + +NAME +aaaa +bbb diff --git a/tests/expected/libsmartcols/filter-string-lt b/tests/expected/libsmartcols/filter-string-lt new file mode 100644 index 0000000..f60cb56 --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-lt @@ -0,0 +1,4 @@ +expr: NAME < "bbb" + +NAME +aaaa diff --git a/tests/expected/libsmartcols/filter-string-ne b/tests/expected/libsmartcols/filter-string-ne new file mode 100644 index 0000000..d69f05b --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-ne @@ -0,0 +1,12 @@ +expr: NAME != "bbb" + +NAME +aaaa +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/expected/libsmartcols/filter-string-neg b/tests/expected/libsmartcols/filter-string-neg new file mode 100644 index 0000000..bd5a0dd --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-neg @@ -0,0 +1,2 @@ +expr: !NAME + diff --git a/tests/expected/libsmartcols/filter-string-nreg b/tests/expected/libsmartcols/filter-string-nreg new file mode 100644 index 0000000..e85030e --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-nreg @@ -0,0 +1,12 @@ +expr: NAME !~ "aaa.*" + +NAME +bbb +ccccc +dddddd +ee +ffff +gggggg +hhh +iiiiii +jj diff --git a/tests/expected/libsmartcols/filter-string-reg b/tests/expected/libsmartcols/filter-string-reg new file mode 100644 index 0000000..3c32c01 --- /dev/null +++ b/tests/expected/libsmartcols/filter-string-reg @@ -0,0 +1,4 @@ +expr: NAME =~ "aaa.*" + +NAME +aaaa diff --git a/tests/expected/libsmartcols/fromfile-tree-json b/tests/expected/libsmartcols/fromfile-tree-json index 3d65183..aada9f0 100644 --- a/tests/expected/libsmartcols/fromfile-tree-json +++ b/tests/expected/libsmartcols/fromfile-tree-json @@ -2,56 +2,56 @@ "testtable": [ { "tree": "aaaa", - "id": "1", + "id": 1, "parent": "0", "strings": "qqqqqqqqqqqqqqqqqX", "children": [ { "tree": "bbb", - "id": "2", + "id": 2, "parent": "1", "strings": "dddddddddddddX", "children": [ { "tree": "ee", - "id": "5", + "id": 5, "parent": "2", "strings": "ddddddddddddddddddddddddddX" },{ "tree": "ffff", - "id": "6", + "id": 6, "parent": "2", "strings": "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjX" } ] },{ "tree": "ccccc", - "id": "3", + "id": 3, "parent": "1", "strings": "ffffffffffffffffffffffffffffffffffffffffX", "children": [ { "tree": "gggggg", - "id": "7", + "id": 7, "parent": "3", "strings": "mmmmmmmmmmmmmmmmmmmX", "children": [ { "tree": "hhh", - "id": "8", + "id": 8, "parent": "7", "strings": "lllllllllllllllllllllllllllllllllllllX", "children": [ { "tree": "iiiiii", - "id": "9", + "id": 9, "parent": "8", "strings": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyX" } ] },{ "tree": "jj", - "id": "10", + "id": 10, "parent": "7", "strings": "pppppppppX" } @@ -60,7 +60,7 @@ ] },{ "tree": "dddddd", - "id": "4", + "id": 4, "parent": "1", "strings": "ssssssssssX" } diff --git a/tests/expected/libsmartcols/fromfile-wrapzero b/tests/expected/libsmartcols/fromfile-wrapzero new file mode 100644 index 0000000..11370ff --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrapzero @@ -0,0 +1,19 @@ +NAME NUM WRAPZERO +aaaa 0 aaa +bbb 100 bbbbb +ccccc 21 cccc + CCCC +dddddd 3 dddddddd + DDDD + DD +ee 411 hello + baby +ffff 5111 aaa + bbb + ccc + ddd +gggggg 678993321 eee +hhh 7666666 fffff +iiiiii 8765 g + hhhhh +jj 987456 ppppppppp diff --git a/tests/expected/libsmartcols/fromfile-wrapzero-tree b/tests/expected/libsmartcols/fromfile-wrapzero-tree new file mode 100644 index 0000000..552470d --- /dev/null +++ b/tests/expected/libsmartcols/fromfile-wrapzero-tree @@ -0,0 +1,19 @@ +TREE ID PARENT WRAPZERO +aaaa 1 0 aaa +|-bbb 2 1 bbbbb +| |-ee 5 2 hello +| | baby +| `-ffff 6 2 aaa +| bbb +| ccc +| ddd +|-ccccc 3 1 cccc +| | CCCC +| `-gggggg 7 3 eee +| |-hhh 8 7 fffff +| | `-iiiiii 9 8 g +| | hhhhh +| `-jj 10 7 ppppppppp +`-dddddd 4 1 dddddddd + DDDD + DD diff --git a/tests/expected/lscpu/lscpu-rv64-linux b/tests/expected/lscpu/lscpu-rv64-linux index 22767db..d741cae 100644 --- a/tests/expected/lscpu/lscpu-rv64-linux +++ b/tests/expected/lscpu/lscpu-rv64-linux @@ -1,16 +1,23 @@ CPU(s): 2 On-line CPU(s) list: 0,1 +Model name: sifive,u74-mc +Thread(s) per core: 2 +Core(s) per socket: 1 +Socket(s): 1 +L1d cache: 64 KiB (2 instances) +L1i cache: 64 KiB (2 instances) +L2 cache: 2 MiB (1 instance) # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID # starting usually from zero. -# CPU,Core,Socket,Node -,,, -,,, +# CPU,Core,Socket,Node,,L1d,L1i,L2 +0,0,0,,,0,0,0 +1,0,0,,,1,1,0 # The following is the parsable format, which can be fed to other # programs. Each different item in every column has an unique ID # starting usually from zero. -# CPU,Core,Socket,Node -,,, -,,, +# CPU,Core,Socket,Node,,L1d,L1i,L2 +0,-,-,,,0,0,0 +1,-,-,,,1,1,0 diff --git a/tests/expected/lscpu/lscpu-rv64-visionfive2 b/tests/expected/lscpu/lscpu-rv64-visionfive2 new file mode 100644 index 0000000..0b2390d --- /dev/null +++ b/tests/expected/lscpu/lscpu-rv64-visionfive2 @@ -0,0 +1,33 @@ +Byte Order: Little Endian +CPU(s): 4 +On-line CPU(s) list: 0-3 +Vendor ID: 0x489 +Model name: sifive,u74-mc +CPU family: 0x8000000000000007 +Model: 0x4210427 +Thread(s) per core: 1 +Core(s) per socket: 4 +Socket(s): 1 +L1d cache: 128 KiB (4 instances) +L1i cache: 128 KiB (4 instances) +L2 cache: 2 MiB (1 instance) +NUMA node(s): 1 +NUMA node0 CPU(s): 0-3 + +# The following is the parsable format, which can be fed to other +# programs. Each different item in every column has an unique ID +# starting usually from zero. +# CPU,Core,Socket,Node,,L1d,L1i,L2 +0,0,0,0,,0,0,0 +1,1,0,0,,1,1,0 +2,2,0,0,,2,2,0 +3,3,0,0,,3,3,0 + +# The following is the parsable format, which can be fed to other +# programs. Each different item in every column has an unique ID +# starting usually from zero. +# CPU,Core,Socket,Node,,L1d,L1i,L2 +0,3,0,0,,0,0,0 +1,1,0,0,,1,1,0 +2,2,0,0,,2,2,0 +3,4,0,0,,3,3,0 diff --git a/tests/expected/lsfd/column-ainodeclass-inotify b/tests/expected/lsfd/column-ainodeclass-inotify index f93e19e..b1561dd 100644 --- a/tests/expected/lsfd/column-ainodeclass-inotify +++ b/tests/expected/lsfd/column-ainodeclass-inotify @@ -1,2 +1,2 @@ - 3 UNKN inotify +3 UNKN inotify inotify:ASSOC,STTYPE,AINODECLASS: 0 diff --git a/tests/expected/lsfd/column-ainodeclass-pidfd b/tests/expected/lsfd/column-ainodeclass-pidfd index 269cea5..5fe751c 100644 --- a/tests/expected/lsfd/column-ainodeclass-pidfd +++ b/tests/expected/lsfd/column-ainodeclass-pidfd @@ -1,2 +1,2 @@ - 3 UNKN pidfd +3 UNKN pidfd pidfd:ASSOC,STTYPE,AINODECLASS: 0 diff --git a/tests/expected/lsfd/column-deleted-make-regular-file b/tests/expected/lsfd/column-deleted-make-regular-file new file mode 100644 index 0000000..86e46bc --- /dev/null +++ b/tests/expected/lsfd/column-deleted-make-regular-file @@ -0,0 +1,2 @@ +1 +make-regular-file: DELETED: 0 diff --git a/tests/expected/lsfd/column-deleted-ro-regular-file b/tests/expected/lsfd/column-deleted-ro-regular-file new file mode 100644 index 0000000..ccaf14e --- /dev/null +++ b/tests/expected/lsfd/column-deleted-ro-regular-file @@ -0,0 +1,2 @@ +0 +ro-regular-file: DELETED: 0 diff --git a/tests/expected/lsfd/column-name-deleted-file b/tests/expected/lsfd/column-name-deleted-file new file mode 100644 index 0000000..de33c8b --- /dev/null +++ b/tests/expected/lsfd/column-name-deleted-file @@ -0,0 +1,2 @@ +tmp-column-name +make-regular-file: DELETED,NAME: 0 diff --git a/tests/expected/lsfd/column-name-pidfd b/tests/expected/lsfd/column-name-pidfd index 49abe81..10e3c5e 100644 --- a/tests/expected/lsfd/column-name-pidfd +++ b/tests/expected/lsfd/column-name-pidfd @@ -1,2 +1,2 @@ - 3 anon_inode:[pidfd] pid=1 comm= nspid=1 +3 anon_inode:[pidfd] pid=1 comm= nspid=1 pidfd:ASSOC,KNAME,NAME: 0 diff --git a/tests/expected/lsfd/column-name-ro-regular-file b/tests/expected/lsfd/column-name-ro-regular-file index 446a916..e7fc7c6 100644 --- a/tests/expected/lsfd/column-name-ro-regular-file +++ b/tests/expected/lsfd/column-name-ro-regular-file @@ -1,2 +1,2 @@ - 3 /etc/passwd /etc/passwd +3 /etc/passwd /etc/passwd ro-regular-file:ASSOC,KNAME,NAME: 0 diff --git a/tests/expected/lsfd/column-name-socketpair b/tests/expected/lsfd/column-name-socketpair index bd94e56..b4aaf7b 100644 --- a/tests/expected/lsfd/column-name-socketpair +++ b/tests/expected/lsfd/column-name-socketpair @@ -1,2 +1,2 @@ - 3 socket:[INODENUM] state=connected type=dgram +3 socket:[INODENUM] state=connected type=dgram socketpair:ASSOC,KNAME,NAME: 0 diff --git a/tests/expected/lsfd/column-source-namespace-ASSOC b/tests/expected/lsfd/column-source-namespace-ASSOC new file mode 100644 index 0000000..e6ed958 --- /dev/null +++ b/tests/expected/lsfd/column-source-namespace-ASSOC @@ -0,0 +1,7 @@ + ipc nsfs + mnt nsfs + net nsfs + pid nsfs +pid4c nsfs + user nsfs + uts nsfs diff --git a/tests/expected/lsfd/column-source-with-root-SysVIPC-shmem b/tests/expected/lsfd/column-source-with-root-SysVIPC-shmem new file mode 100644 index 0000000..db40d92 --- /dev/null +++ b/tests/expected/lsfd/column-source-with-root-SysVIPC-shmem @@ -0,0 +1,2 @@ +shm tmpfs +ASSOC,SOURCE: 0 diff --git a/tests/expected/lsfd/column-type-inotify b/tests/expected/lsfd/column-type-inotify index 69588d9..15363f5 100644 --- a/tests/expected/lsfd/column-type-inotify +++ b/tests/expected/lsfd/column-type-inotify @@ -1,2 +1,2 @@ - 3 UNKN inotify +3 UNKN inotify inotify:ASSOC,STTYPE,TYPE: 0 diff --git a/tests/expected/lsfd/column-type-pidfd b/tests/expected/lsfd/column-type-pidfd index a3278d2..6c9a963 100644 --- a/tests/expected/lsfd/column-type-pidfd +++ b/tests/expected/lsfd/column-type-pidfd @@ -1,2 +1,2 @@ - 3 UNKN pidfd +3 UNKN pidfd pidfd:ASSOC,STTYPE,TYPE: 0 diff --git a/tests/expected/lsfd/column-type-ro-regular-file b/tests/expected/lsfd/column-type-ro-regular-file index 63b4356..7028264 100644 --- a/tests/expected/lsfd/column-type-ro-regular-file +++ b/tests/expected/lsfd/column-type-ro-regular-file @@ -1,2 +1,2 @@ - 3 REG REG +3 REG REG ro-regular-file:ASSOC,STTYPE,TYPE: 0 diff --git a/tests/expected/lsfd/column-type-socketpair b/tests/expected/lsfd/column-type-socketpair index 22a61b7..ec00f65 100644 --- a/tests/expected/lsfd/column-type-socketpair +++ b/tests/expected/lsfd/column-type-socketpair @@ -1,2 +1,2 @@ - 3 SOCK UNIX +3 SOCK UNIX socketpair:ASSOC,STTYPE,TYPE: 0 diff --git a/tests/expected/lsfd/column-xmode-MODE-r-bit b/tests/expected/lsfd/column-xmode-MODE-r-bit new file mode 100644 index 0000000..05b2dd1 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-MODE-r-bit @@ -0,0 +1,2 @@ +r-- +MODE(r-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-MODE-w-bit b/tests/expected/lsfd/column-xmode-MODE-w-bit new file mode 100644 index 0000000..bd0cca6 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-MODE-w-bit @@ -0,0 +1,2 @@ +-w- +MODE(w-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-MODE-x-bit b/tests/expected/lsfd/column-xmode-MODE-x-bit new file mode 100644 index 0000000..8ab32fd --- /dev/null +++ b/tests/expected/lsfd/column-xmode-MODE-x-bit @@ -0,0 +1,2 @@ +r-x +MODE(x-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-D-bit b/tests/expected/lsfd/column-xmode-XMODE-D-bit new file mode 100644 index 0000000..5ede600 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-D-bit @@ -0,0 +1,2 @@ +-w-D-- +XMODE(D-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-flock-ex b/tests/expected/lsfd/column-xmode-XMODE-L-bit-flock-ex new file mode 100644 index 0000000..3799161 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-flock-ex @@ -0,0 +1,2 @@ +-w--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-lease-w b/tests/expected/lsfd/column-xmode-XMODE-L-bit-lease-w new file mode 100644 index 0000000..3799161 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-lease-w @@ -0,0 +1,2 @@ +-w--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd--w b/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd--w new file mode 100644 index 0000000..3799161 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd--w @@ -0,0 +1,2 @@ +-w--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd-rw b/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd-rw new file mode 100644 index 0000000..1b763f7 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-ofd-rw @@ -0,0 +1,2 @@ +rw--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix--w b/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix--w new file mode 100644 index 0000000..3799161 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix--w @@ -0,0 +1,2 @@ +-w--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix-rw b/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix-rw new file mode 100644 index 0000000..1b763f7 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-L-bit-posix-rw @@ -0,0 +1,2 @@ +rw--L- +XMODE(L-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-l-bit-flock-sh b/tests/expected/lsfd/column-xmode-XMODE-l-bit-flock-sh new file mode 100644 index 0000000..3299e66 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-l-bit-flock-sh @@ -0,0 +1,2 @@ +-w--l- +XMODE(l-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-l-bit-lease-r b/tests/expected/lsfd/column-xmode-XMODE-l-bit-lease-r new file mode 100644 index 0000000..585ea21 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-l-bit-lease-r @@ -0,0 +1,2 @@ +r---l- +XMODE(l-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-l-bit-ofd-r- b/tests/expected/lsfd/column-xmode-XMODE-l-bit-ofd-r- new file mode 100644 index 0000000..0288697 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-l-bit-ofd-r- @@ -0,0 +1,2 @@ +rw--l- +XMODE(l-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-l-bit-posix-r- b/tests/expected/lsfd/column-xmode-XMODE-l-bit-posix-r- new file mode 100644 index 0000000..0288697 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-l-bit-posix-r- @@ -0,0 +1,2 @@ +rw--l- +XMODE(l-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-m-bit b/tests/expected/lsfd/column-xmode-XMODE-m-bit new file mode 100644 index 0000000..238f28d --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-m-bit @@ -0,0 +1,3 @@ +r----m +-w---m +XMODE(m-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-r-bit b/tests/expected/lsfd/column-xmode-XMODE-r-bit new file mode 100644 index 0000000..655aa7b --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-r-bit @@ -0,0 +1,2 @@ +r----- +XMODE(r-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-w-bit b/tests/expected/lsfd/column-xmode-XMODE-w-bit new file mode 100644 index 0000000..b4b4b1f --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-w-bit @@ -0,0 +1,2 @@ +-w---- +XMODE(w-bit): 0 diff --git a/tests/expected/lsfd/column-xmode-XMODE-x-bit b/tests/expected/lsfd/column-xmode-XMODE-x-bit new file mode 100644 index 0000000..2baf1e7 --- /dev/null +++ b/tests/expected/lsfd/column-xmode-XMODE-x-bit @@ -0,0 +1,2 @@ +r-x--- +XMODE(x-bit): 0 diff --git a/tests/expected/lsfd/filter-broken-exp b/tests/expected/lsfd/filter-broken-exp new file mode 100644 index 0000000..61512e0 --- /dev/null +++ b/tests/expected/lsfd/filter-broken-exp @@ -0,0 +1,4 @@ +lsfd: failed to parse "(": <bison syntax error message removed> +lsfd: failed to parse ")": <bison syntax error message removed> +lsfd: failed to parse "(FD == 1)garbage": <bison syntax error message removed> +lsfd: unknown column: NOSUCHCOLUMN diff --git a/tests/expected/lsfd/filter-floating-point-nums b/tests/expected/lsfd/filter-floating-point-nums new file mode 100644 index 0000000..60d87a9 --- /dev/null +++ b/tests/expected/lsfd/filter-floating-point-nums @@ -0,0 +1,15 @@ +pid in a range: 0 +coparing pids: 0 +3 10.000050000 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL < 10.000051) and (TIMERFD.INTERVAL > 10): 0 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL <= 10) and (TIMERFD.INTERVAL > 9.99): 0 +3 10.000050000 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL >= 10): 0 +3 10.000050000 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL >= 10.0): 0 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL < 10) and (0 < TIMERFD.INTERVAL): 0 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL < 10) and (0.0 < TIMERFD.INTERVAL): 0 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL > 11): 0 +3 10.000050000 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL == 10.00005): 0 +FD,TIMERFD.INTERVAL: (TIMERFD.INTERVAL == 10.000051): 0 diff --git a/tests/expected/lsfd/mkfds-bpf-map b/tests/expected/lsfd/mkfds-bpf-map new file mode 100644 index 0000000..b4f7964 --- /dev/null +++ b/tests/expected/lsfd/mkfds-bpf-map @@ -0,0 +1,2 @@ +array 2 mkfds_map +BPF-MAP.TYPE,BPF-MAP.TYPE.RAW,BPF.NAME: 0 diff --git a/tests/expected/lsfd/mkfds-bpf-prog b/tests/expected/lsfd/mkfds-bpf-prog new file mode 100644 index 0000000..b67afc5 --- /dev/null +++ b/tests/expected/lsfd/mkfds-bpf-prog @@ -0,0 +1,2 @@ +kprobe 2 mkdfs_prog +BPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME: 0 diff --git a/tests/expected/lsfd/mkfds-cdev-tun b/tests/expected/lsfd/mkfds-cdev-tun new file mode 100644 index 0000000..5217d79 --- /dev/null +++ b/tests/expected/lsfd/mkfds-cdev-tun @@ -0,0 +1,4 @@ +3 rw- CHR misc:tun +ASSOC,MODE,TYPE,SOURCE: 0 +NAME: 0 +TUN.IFACE: 0 diff --git a/tests/expected/lsfd/mkfds-directory b/tests/expected/lsfd/mkfds-directory index fd7f293..62c9d5c 100644 --- a/tests/expected/lsfd/mkfds-directory +++ b/tests/expected/lsfd/mkfds-directory @@ -1,4 +1,4 @@ - 3 r-- DIR directory / +3 r-- DIR directory / ASSOC,MODE,TYPE,FLAGS,NAME: 0 PID[RUN]: 0 PID[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-eventfd b/tests/expected/lsfd/mkfds-eventfd new file mode 100644 index 0000000..d99157e --- /dev/null +++ b/tests/expected/lsfd/mkfds-eventfd @@ -0,0 +1,12 @@ +3 rw- eventfd anon_inodefs +parent: ASSOC,MODE,TYPE,SOURCE: 0 +parent: NAME: 0 +parent: ID: 0 +4 rw- eventfd anon_inodefs +child: ASSOC,MODE,TYPE,SOURCE: 0 +child: NAME: 0 +child: ID: 0 +NAME[STR]: 0 +ID[STR]: 0 +NAMExID[STR]: 0 +ENDPOINTS[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-eventpoll b/tests/expected/lsfd/mkfds-eventpoll new file mode 100644 index 0000000..d494fb4 --- /dev/null +++ b/tests/expected/lsfd/mkfds-eventpoll @@ -0,0 +1,16 @@ +3 eventpoll tfds=5,7 5 + 7 +ASSOC,TYPE,NAME,EVENTPOLL.TFDS: 0 +{ + "lsfd": [ + { + "assoc": "3", + "type": "eventpoll", + "name": "tfds=5,7", + "eventpoll.tfds": [ + 5, 7 + ] + } + ] +} +ASSOC,TYPE,NAME,EVENTPOLL.TFDS (JSON): 0 diff --git a/tests/expected/lsfd/mkfds-inotify b/tests/expected/lsfd/mkfds-inotify new file mode 100644 index 0000000..6fc0d12 --- /dev/null +++ b/tests/expected/lsfd/mkfds-inotify @@ -0,0 +1,4 @@ +INOTIFY.INODES.RAW: 0 +INOTIFY.INODES.RAW == CMDLINE\x0aPROC +INOTIFY.INODES.RAW (JSON): 0 +INOTIFY.INODES.RAW == EXPECTED_JSON diff --git a/tests/expected/lsfd/mkfds-inotify-btrfs b/tests/expected/lsfd/mkfds-inotify-btrfs new file mode 100644 index 0000000..cb55f96 --- /dev/null +++ b/tests/expected/lsfd/mkfds-inotify-btrfs @@ -0,0 +1,4 @@ +INOTIFY.INODES.RAW: 0 +INOTIFY.INODES.RAW == FSTAB\x0aROOT +INOTIFY.INODES.RAW (JSON): 0 +INOTIFY.INODES.RAW == EXPECTED_JSON diff --git a/tests/expected/lsfd/mkfds-mapped-packet-socket b/tests/expected/lsfd/mkfds-mapped-packet-socket index 7c1b503..ec8795b 100644 --- a/tests/expected/lsfd/mkfds-mapped-packet-socket +++ b/tests/expected/lsfd/mkfds-mapped-packet-socket @@ -1,8 +1,8 @@ - PACKET +PACKET SOCK.PROTONAME: 0 -type=raw protocol=all iface=lo raw PACKET lo all +type=raw protocol=all iface=lo raw PACKET lo all NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL: 0 - PACKET +PACKET SOCK.PROTONAME: 0 -type=dgram protocol=all iface=lo dgram PACKET lo all +type=dgram protocol=all iface=lo dgram PACKET lo all NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL: 0 diff --git a/tests/expected/lsfd/mkfds-mqueue b/tests/expected/lsfd/mkfds-mqueue new file mode 100644 index 0000000..b08de13 --- /dev/null +++ b/tests/expected/lsfd/mkfds-mqueue @@ -0,0 +1,8 @@ +3 r-- mqueue mqueue /mkfds-mqueue +parent: ASSOC,MODE,TYPE,SOURCE,NAME: 0 +parent: INODE: 0 +4 -w- mqueue mqueue +child: ASSOC,MODE,TYPE,SOURCE: 0 +child: INODE: 0 +INODE[STR]: 0 +ENDPOINTS[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-multiplexing-poll b/tests/expected/lsfd/mkfds-multiplexing-poll new file mode 100644 index 0000000..c23fa0f --- /dev/null +++ b/tests/expected/lsfd/mkfds-multiplexing-poll @@ -0,0 +1,13 @@ +10 r----m +11 -w---- +12 -w---m +13 r----- +14 r----m +15 -w---- +16 r----m +17 -w---- +18 -w---m +19 r----- +20 r----m +21 -w---- +[poll] ASSOC,XMODE: 0 diff --git a/tests/expected/lsfd/mkfds-multiplexing-ppoll b/tests/expected/lsfd/mkfds-multiplexing-ppoll new file mode 100644 index 0000000..46f860b --- /dev/null +++ b/tests/expected/lsfd/mkfds-multiplexing-ppoll @@ -0,0 +1,13 @@ +10 r----m +11 -w---- +12 -w---m +13 r----- +14 r----m +15 -w---- +16 r----m +17 -w---- +18 -w---m +19 r----- +20 r----m +21 -w---- +[ppoll] ASSOC,XMODE: 0 diff --git a/tests/expected/lsfd/mkfds-multiplexing-pselect6 b/tests/expected/lsfd/mkfds-multiplexing-pselect6 new file mode 100644 index 0000000..fbdb773 --- /dev/null +++ b/tests/expected/lsfd/mkfds-multiplexing-pselect6 @@ -0,0 +1,13 @@ +10 r----m +11 -w---- +12 -w---m +13 r----- +14 r----m +15 -w---- +16 r----m +17 -w---- +18 -w---m +19 r----- +20 r----m +21 -w---- +[pselect6] ASSOC,XMODE: 0 diff --git a/tests/expected/lsfd/mkfds-multiplexing-select b/tests/expected/lsfd/mkfds-multiplexing-select new file mode 100644 index 0000000..a44b0da --- /dev/null +++ b/tests/expected/lsfd/mkfds-multiplexing-select @@ -0,0 +1,13 @@ +10 r----m +11 -w---- +12 -w---m +13 r----- +14 r----m +15 -w---- +16 r----m +17 -w---- +18 -w---m +19 r----- +20 r----m +21 -w---- +[select] ASSOC,XMODE: 0 diff --git a/tests/expected/lsfd/mkfds-netlink-groups b/tests/expected/lsfd/mkfds-netlink-groups index ad50da1..e78c8eb 100644 --- a/tests/expected/lsfd/mkfds-netlink-groups +++ b/tests/expected/lsfd/mkfds-netlink-groups @@ -1,3 +1,3 @@ - 3 NETLINK protocol=sock_diag lport= groups=5 raw sock_diag 5 +3 NETLINK protocol=sock_diag lport= groups=5 raw sock_diag 5 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,NETLINK.PROTOCOL,NETLINK.GROUPS: 0 LPORT: OK diff --git a/tests/expected/lsfd/mkfds-netlink-protocol b/tests/expected/lsfd/mkfds-netlink-protocol index df3dce7..77c4e1f 100644 --- a/tests/expected/lsfd/mkfds-netlink-protocol +++ b/tests/expected/lsfd/mkfds-netlink-protocol @@ -1,3 +1,3 @@ - 3 NETLINK protocol=sock_diag lport= raw sock_diag 0 +3 NETLINK protocol=sock_diag lport= raw sock_diag 0 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,NETLINK.PROTOCOL: 0 LPORT: OK diff --git a/tests/expected/lsfd/mkfds-netns b/tests/expected/lsfd/mkfds-netns index 4b4c0ac..89d5bef 100644 --- a/tests/expected/lsfd/mkfds-netns +++ b/tests/expected/lsfd/mkfds-netns @@ -1,4 +1,4 @@ - net +net NAME_FD == NAME_NS: 0 NAME_FD == net:[INO_FD]: 0 NAME_FD == net:[INO_NS]: 0 diff --git a/tests/expected/lsfd/mkfds-pidfd b/tests/expected/lsfd/mkfds-pidfd index 3f7edbb..9484699 100644 --- a/tests/expected/lsfd/mkfds-pidfd +++ b/tests/expected/lsfd/mkfds-pidfd @@ -1,2 +1,2 @@ - 3 UNKN anon_inodefs pid=1 comm=systemd nspid=1 systemd 1 +3 UNKN anon_inodefs pid=1 comm=systemd nspid=1 systemd 1 ASSOC,STTYPE,SOURCE,NAME,PIDFD.COMM,PIDFD.PID: 0 diff --git a/tests/expected/lsfd/mkfds-ping-ping b/tests/expected/lsfd/mkfds-ping-ping index cad42b1..06fe2bd 100644 --- a/tests/expected/lsfd/mkfds-ping-ping +++ b/tests/expected/lsfd/mkfds-ping-ping @@ -1,4 +1,4 @@ - 3 PING state=established id=9999 laddr=127.0.0.1 raddr=127.0.0.1 established dgram 127.0.0.1 127.0.0.1 9999 +3 PING state=established id=9999 laddr=127.0.0.1 raddr=127.0.0.1 established dgram 127.0.0.1 127.0.0.1 9999 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET.LADDR,INET.RADDR,PING.ID: 0 - 3 PING state=close id=9999 laddr=127.0.0.1 close dgram 127.0.0.1 0.0.0.0 9999 +3 PING state=close id=9999 laddr=127.0.0.1 close dgram 127.0.0.1 0.0.0.0 9999 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET.LADDR,INET.RADDR,PING.ID: 0 diff --git a/tests/expected/lsfd/mkfds-ping-ping6 b/tests/expected/lsfd/mkfds-ping-ping6 index 3ef9730..6919ba1 100644 --- a/tests/expected/lsfd/mkfds-ping-ping6 +++ b/tests/expected/lsfd/mkfds-ping-ping6 @@ -1,4 +1,4 @@ - 3 PINGv6 state=established id=9999 laddr=::1 raddr=::1 established dgram ::1 ::1 9999 +3 PINGv6 state=established id=9999 laddr=::1 raddr=::1 established dgram ::1 ::1 9999 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET6.LADDR,INET6.RADDR,PING.ID: 0 - 3 PINGv6 state=close id=9999 laddr=::1 close dgram ::1 :: 9999 +3 PINGv6 state=close id=9999 laddr=::1 close dgram ::1 :: 9999 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET6.LADDR,INET6.RADDR,PING.ID: 0 diff --git a/tests/expected/lsfd/mkfds-pipe-no-fork b/tests/expected/lsfd/mkfds-pipe-no-fork index 390b8a3..4cd2a55 100644 --- a/tests/expected/lsfd/mkfds-pipe-no-fork +++ b/tests/expected/lsfd/mkfds-pipe-no-fork @@ -1,5 +1,5 @@ - 3 r-- FIFO pipefs - 4 -w- FIFO pipefs wronly,nonblock +3 r-- FIFO pipefs +4 -w- FIFO pipefs wronly,nonblock ASSOC,MODE,TYPE,SOURCE,FLAGS: 0 PID[RUN]: 0 PID[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-pty b/tests/expected/lsfd/mkfds-pty new file mode 100644 index 0000000..ac38fc9 --- /dev/null +++ b/tests/expected/lsfd/mkfds-pty @@ -0,0 +1,10 @@ +5 rw- CHR ptmx +ASSOC,MODE,TYPE,SOURCE: 0 +NAME: 0 +ENDPOINTS: 0 +PTMX.TTY-INDEX: 0 +6 r-- CHR +ASSOC,MODE,TYPE: 0 +SOURCE: 0 +NAME: 0 +ENDPOINTS: 0 diff --git a/tests/expected/lsfd/mkfds-raw b/tests/expected/lsfd/mkfds-raw index e8bc41a..37baddc 100644 --- a/tests/expected/lsfd/mkfds-raw +++ b/tests/expected/lsfd/mkfds-raw @@ -1,2 +1,2 @@ - 3 RAW state=established protocol=5 laddr=127.0.0.1 raddr=127.0.0.2 established raw 127.0.0.1 127.0.0.2 5 +3 RAW state=established protocol=5 laddr=127.0.0.1 raddr=127.0.0.2 established raw 127.0.0.1 127.0.0.2 5 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET.LADDR,INET.RADDR,RAW.PROTOCOL: 0 diff --git a/tests/expected/lsfd/mkfds-raw6 b/tests/expected/lsfd/mkfds-raw6 index a813a37..2d77e8f 100644 --- a/tests/expected/lsfd/mkfds-raw6 +++ b/tests/expected/lsfd/mkfds-raw6 @@ -1,2 +1,2 @@ - 3 RAWv6 state=established protocol=5 laddr=::1 raddr=::ffff:127.0.0.1 established raw ::1 ::ffff:127.0.0.1 5 +3 RAWv6 state=established protocol=5 laddr=::1 raddr=::ffff:127.0.0.1 established raw ::1 ::ffff:127.0.0.1 5 ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET6.LADDR,INET6.RADDR,RAW.PROTOCOL: 0 diff --git a/tests/expected/lsfd/mkfds-ro-block-device b/tests/expected/lsfd/mkfds-ro-block-device index 3b2fe07..4c38d05 100644 --- a/tests/expected/lsfd/mkfds-ro-block-device +++ b/tests/expected/lsfd/mkfds-ro-block-device @@ -1,4 +1,4 @@ - 3 r-- BLK 0 loop blk +3 r-- BLK 0 loop blk ASSOC,MODE,TYPE,,POS,,BLKDRV,DEVTYPE: 0 NAME[RUN]: 0 NAME[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-ro-regular-file b/tests/expected/lsfd/mkfds-ro-regular-file index 092f40b..662daa8 100644 --- a/tests/expected/lsfd/mkfds-ro-regular-file +++ b/tests/expected/lsfd/mkfds-ro-regular-file @@ -1,4 +1,4 @@ -ABC 3 r-- REG /etc/passwd 1 +ABC 3 r-- REG /etc/passwd 1 COMMAND,ASSOC,MODE,TYPE,NAME,POS: 0 PID[RUN]: 0 PID[STR]: 0 diff --git a/tests/expected/lsfd/mkfds-rw-character-device b/tests/expected/lsfd/mkfds-rw-character-device index 00423f4..fed92ec 100644 --- a/tests/expected/lsfd/mkfds-rw-character-device +++ b/tests/expected/lsfd/mkfds-rw-character-device @@ -1,4 +1,4 @@ - 3 rw- CHR /dev/zero mem:5 0 1:5 mem char 1:5 +3 rw- CHR /dev/zero mem:5 0 1:5 mem char 1:5 ASSOC,MODE,TYPE,NAME,SOURCE,POS,MAJ:MIN,CHRDRV,DEVTYPE,RDEV: 0 DEV[RUN]: 0 STAT[RUN]: 0 diff --git a/tests/expected/lsfd/mkfds-signalfd b/tests/expected/lsfd/mkfds-signalfd new file mode 100644 index 0000000..16bf732 --- /dev/null +++ b/tests/expected/lsfd/mkfds-signalfd @@ -0,0 +1,2 @@ +3 signalfd mask=FPE,USR1,42 FPE,USR1,42 +ASSOC,TYPE,NAME,SIGNALFD.MASK: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair b/tests/expected/lsfd/mkfds-socketpair deleted file mode 100644 index a015353..0000000 --- a/tests/expected/lsfd/mkfds-socketpair +++ /dev/null @@ -1,3 +0,0 @@ - 3 rw- SOCK sockfs UNIX - 4 rw- SOCK sockfs UNIX -ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair-DGRAM b/tests/expected/lsfd/mkfds-socketpair-DGRAM new file mode 100644 index 0000000..d8ba4d0 --- /dev/null +++ b/tests/expected/lsfd/mkfds-socketpair-DGRAM @@ -0,0 +1,3 @@ +3 rw- SOCK sockfs UNIX +4 rw- SOCK sockfs UNIX +ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair-STREAM b/tests/expected/lsfd/mkfds-socketpair-STREAM new file mode 100644 index 0000000..d8ba4d0 --- /dev/null +++ b/tests/expected/lsfd/mkfds-socketpair-STREAM @@ -0,0 +1,3 @@ +3 rw- SOCK sockfs UNIX +4 rw- SOCK sockfs UNIX +ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT b/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT new file mode 100644 index 0000000..02f6498 --- /dev/null +++ b/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT @@ -0,0 +1,3 @@ +3 rw- SOCK sockfs 1,test_mkfds,4rw +4 rw- SOCK sockfs 1,test_mkfds,3rw +ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT-halfclose b/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT-halfclose new file mode 100644 index 0000000..72fa052 --- /dev/null +++ b/tests/expected/lsfd/mkfds-socketpair-STREAM-ENDPOINT-halfclose @@ -0,0 +1,3 @@ +3 rw- SOCK sockfs 1,test_mkfds,4r- +4 rw- SOCK sockfs 1,test_mkfds,3-w +ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS: 0 diff --git a/tests/expected/lsfd/mkfds-socketpair-STREAM-SHUTDOWN-STATE b/tests/expected/lsfd/mkfds-socketpair-STREAM-SHUTDOWN-STATE new file mode 100644 index 0000000..a7a285c --- /dev/null +++ b/tests/expected/lsfd/mkfds-socketpair-STREAM-SHUTDOWN-STATE @@ -0,0 +1,3 @@ +3 rw- SOCK sockfs -w +4 rw- SOCK sockfs r- +ASSOC,MODE,STTYPE,SOURCE,SOCK.SHUTDOWN: 0 diff --git a/tests/expected/lsfd/mkfds-symlink b/tests/expected/lsfd/mkfds-symlink index ab10159..6084e83 100644 --- a/tests/expected/lsfd/mkfds-symlink +++ b/tests/expected/lsfd/mkfds-symlink @@ -1,2 +1,2 @@ - 3 --- LINK /dev/stdin nofollow,path +3 --- LINK /dev/stdin nofollow,path ASSOC,MODE,TYPE,NAME,FLAGS: 0 diff --git a/tests/expected/lsfd/mkfds-tcp b/tests/expected/lsfd/mkfds-tcp index dfec0ae..08b5735 100644 --- a/tests/expected/lsfd/mkfds-tcp +++ b/tests/expected/lsfd/mkfds-tcp @@ -1,4 +1,4 @@ - 3 TCP SOCK state=listen laddr=127.0.0.1:34567 listen stream 1 127.0.0.1 0.0.0.0 127.0.0.1:34567 34567 0.0.0.0:0 0 - 4 TCP SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established stream 0 127.0.0.1 127.0.0.1 127.0.0.1:23456 23456 127.0.0.1:34567 34567 - 5 TCP SOCK state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 established stream 0 127.0.0.1 127.0.0.1 127.0.0.1:34567 34567 127.0.0.1:23456 23456 +3 TCP SOCK state=listen laddr=127.0.0.1:56789 listen stream 1 127.0.0.1 0.0.0.0 127.0.0.1:56789 56789 0.0.0.0:0 0 +4 TCP SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established stream 0 127.0.0.1 127.0.0.1 127.0.0.1:45678 45678 127.0.0.1:56789 56789 +5 TCP SOCK state=established laddr=127.0.0.1:56789 raddr=127.0.0.1:45678 established stream 0 127.0.0.1 127.0.0.1 127.0.0.1:56789 56789 127.0.0.1:45678 45678 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT: 0 diff --git a/tests/expected/lsfd/mkfds-tcp6 b/tests/expected/lsfd/mkfds-tcp6 index 26b6039..c6e5ee2 100644 --- a/tests/expected/lsfd/mkfds-tcp6 +++ b/tests/expected/lsfd/mkfds-tcp6 @@ -1,4 +1,4 @@ - 3 TCPv6 SOCK state=listen laddr=[::1]:34567 listen stream 1 ::1 :: [::1]:34567 34567 [::]:0 0 - 4 TCPv6 SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established stream 0 ::1 ::1 [::1]:23456 23456 [::1]:34567 34567 - 5 TCPv6 SOCK state=established laddr=[::1]:34567 raddr=[::1]:23456 established stream 0 ::1 ::1 [::1]:34567 34567 [::1]:23456 23456 +3 TCPv6 SOCK state=listen laddr=[::1]:56789 listen stream 1 ::1 :: [::1]:56789 56789 [::]:0 0 +4 TCPv6 SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established stream 0 ::1 ::1 [::1]:45678 45678 [::1]:56789 56789 +5 TCPv6 SOCK state=established laddr=[::1]:56789 raddr=[::1]:45678 established stream 0 ::1 ::1 [::1]:56789 56789 [::1]:45678 45678 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT: 0 diff --git a/tests/expected/lsfd/mkfds-timerfd b/tests/expected/lsfd/mkfds-timerfd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/expected/lsfd/mkfds-timerfd diff --git a/tests/expected/lsfd/mkfds-timerfd-alarm b/tests/expected/lsfd/mkfds-timerfd-alarm new file mode 100644 index 0000000..10dc4c3 --- /dev/null +++ b/tests/expected/lsfd/mkfds-timerfd-alarm @@ -0,0 +1,16 @@ +3 timerfd clockid=realtime-alarm +ASSOC,TYPE,NAME: 0 +realtime-alarm +CLOCKID: 0 +0.000000000 +TIMERFD.REMAINING: 0 +0.000000000 +TIMERFD.INTERVAL: 0 +3 timerfd clockid=boottime-alarm +ASSOC,TYPE,NAME: 0 +boottime-alarm +CLOCKID: 0 +0.000000000 +TIMERFD.REMAINING: 0 +0.000000000 +TIMERFD.INTERVAL: 0 diff --git a/tests/expected/lsfd/mkfds-timerfd-boottime-interval-only b/tests/expected/lsfd/mkfds-timerfd-boottime-interval-only new file mode 100644 index 0000000..b708c29 --- /dev/null +++ b/tests/expected/lsfd/mkfds-timerfd-boottime-interval-only @@ -0,0 +1,8 @@ +3 timerfd clockid=boottime interval=10.123456789 +ASSOC,TYPE,NAME: 0 +boottime +CLOCKID: 0 +0.000000000 +TIMERFD.REMAINING: 0 +10.123456789 +TIMERFD.INTERVAL: 0 diff --git a/tests/expected/lsfd/mkfds-timerfd-monotonic-remaining-only b/tests/expected/lsfd/mkfds-timerfd-monotonic-remaining-only new file mode 100644 index 0000000..7aedda6 --- /dev/null +++ b/tests/expected/lsfd/mkfds-timerfd-monotonic-remaining-only @@ -0,0 +1,8 @@ +3 timerfd clockid=monotonic remaining=100.987654321 +ASSOC,TYPE,NAME: 0 +monotonic +CLOCKID: 0 +100.987654321 +TIMERFD.REMAINING: 0 +0.000000000 +TIMERFD.INTERVAL: 0 diff --git a/tests/expected/lsfd/mkfds-timerfd-realtime-remaining-and-interval b/tests/expected/lsfd/mkfds-timerfd-realtime-remaining-and-interval new file mode 100644 index 0000000..4ba3d8e --- /dev/null +++ b/tests/expected/lsfd/mkfds-timerfd-realtime-remaining-and-interval @@ -0,0 +1,8 @@ +3 timerfd clockid=realtime remaining=100.987654321 interval=5.123456789 +ASSOC,TYPE,NAME: 0 +realtime +CLOCKID: 0 +100.987654321 +TIMERFD.REMAINING: 0 +5.123456789 +TIMERFD.INTERVAL: 0 diff --git a/tests/expected/lsfd/mkfds-udp b/tests/expected/lsfd/mkfds-udp index 58ce260..0595e3b 100644 --- a/tests/expected/lsfd/mkfds-udp +++ b/tests/expected/lsfd/mkfds-udp @@ -1,24 +1,24 @@ - 3 UDP SOCK state=close laddr=127.0.0.1:34567 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:34567 34567 0.0.0.0:0 0 - 4 UDP SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:23456 23456 127.0.0.1:34567 34567 +3 UDP SOCK state=close laddr=127.0.0.1:56789 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:56789 56789 0.0.0.0:0 0 +4 UDP SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:45678 45678 127.0.0.1:56789 56789 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 - 3 UDP SOCK 0 +3 UDP SOCK 0 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 NAME pattern match: OK - 4 UDP SOCK established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:34567 34567 +4 UDP SOCK established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:56789 56789 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.RADDR,UDP.RPORT: 0 LADDR/LPORT pattern match: OK - 3 UDP SOCK state=close laddr=127.0.0.1:34567 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:34567 34567 0.0.0.0:0 0 - 4 UDP SOCK state=close laddr=127.0.0.1:23456 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:23456 23456 0.0.0.0:0 0 +3 UDP SOCK state=close laddr=127.0.0.1:56789 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:56789 56789 0.0.0.0:0 0 +4 UDP SOCK state=close laddr=127.0.0.1:45678 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:45678 45678 0.0.0.0:0 0 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 - 3 UDP-Lite SOCK state=close laddr=127.0.0.1:34567 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:34567 34567 0.0.0.0:0 0 - 4 UDP-Lite SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:23456 23456 127.0.0.1:34567 34567 +3 UDP-Lite SOCK state=close laddr=127.0.0.1:56789 close dgram 0 127.0.0.1 0.0.0.0 127.0.0.1:56789 56789 0.0.0.0:0 0 +4 UDP-Lite SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:45678 45678 127.0.0.1:56789 56789 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0 - 3 UDP-Lite SOCK 0 +3 UDP-Lite SOCK 0 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0 NAME pattern match: OK - 4 UDP-Lite SOCK established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:34567 34567 +4 UDP-Lite SOCK established dgram 0 127.0.0.1 127.0.0.1 127.0.0.1:56789 56789 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.RADDR,UDPLite.RPORT: 0 LADDR/LPORT pattern match: OK - 3 UDP-Lite SOCK state=close laddr=127.0.0.1:34567 close dgram 0 127.0.0.1 0.0.0.0 - 4 UDP-Lite SOCK state=close laddr=127.0.0.1:23456 close dgram 0 127.0.0.1 0.0.0.0 +3 UDP-Lite SOCK state=close laddr=127.0.0.1:56789 close dgram 0 127.0.0.1 0.0.0.0 +4 UDP-Lite SOCK state=close laddr=127.0.0.1:45678 close dgram 0 127.0.0.1 0.0.0.0 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 diff --git a/tests/expected/lsfd/mkfds-udp6 b/tests/expected/lsfd/mkfds-udp6 index e29797b..cbf44d0 100644 --- a/tests/expected/lsfd/mkfds-udp6 +++ b/tests/expected/lsfd/mkfds-udp6 @@ -1,24 +1,24 @@ - 3 UDPv6 SOCK state=close laddr=[::1]:34567 close dgram 0 ::1 :: [::1]:34567 34567 [::]:0 0 - 4 UDPv6 SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established dgram 0 ::1 ::1 [::1]:23456 23456 [::1]:34567 34567 +3 UDPv6 SOCK state=close laddr=[::1]:56789 close dgram 0 ::1 :: [::1]:56789 56789 [::]:0 0 +4 UDPv6 SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established dgram 0 ::1 ::1 [::1]:45678 45678 [::1]:56789 56789 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 - 3 UDPv6 SOCK 0 +3 UDPv6 SOCK 0 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 NAME pattern match: OK - 4 UDPv6 SOCK established dgram 0 ::1 ::1 [::1]:34567 34567 +4 UDPv6 SOCK established dgram 0 ::1 ::1 [::1]:56789 56789 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.RADDR,UDP.RPORT: 0 LADDR/LPORT pattern match: OK - 3 UDPv6 SOCK state=close laddr=[::1]:34567 close dgram 0 ::1 :: [::1]:34567 34567 [::]:0 0 - 4 UDPv6 SOCK state=close laddr=[::1]:23456 close dgram 0 ::1 :: [::1]:23456 23456 [::]:0 0 +3 UDPv6 SOCK state=close laddr=[::1]:56789 close dgram 0 ::1 :: [::1]:56789 56789 [::]:0 0 +4 UDPv6 SOCK state=close laddr=[::1]:45678 close dgram 0 ::1 :: [::1]:45678 45678 [::]:0 0 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0 - 3 UDPLITEv6 SOCK state=close laddr=[::1]:34567 close dgram 0 ::1 :: [::1]:34567 34567 [::]:0 0 - 4 UDPLITEv6 SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established dgram 0 ::1 ::1 [::1]:23456 23456 [::1]:34567 34567 +3 UDPLITEv6 SOCK state=close laddr=[::1]:56789 close dgram 0 ::1 :: [::1]:56789 56789 [::]:0 0 +4 UDPLITEv6 SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established dgram 0 ::1 ::1 [::1]:45678 45678 [::1]:56789 56789 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0 - 3 UDPLITEv6 SOCK 0 +3 UDPLITEv6 SOCK 0 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0 NAME pattern match: OK - 4 UDPLITEv6 SOCK established dgram 0 ::1 ::1 [::1]:34567 34567 +4 UDPLITEv6 SOCK established dgram 0 ::1 ::1 [::1]:56789 56789 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.RADDR,UDPLite.RPORT: 0 LADDR/LPORT pattern match: OK - 3 UDPLITEv6 SOCK state=close laddr=[::1]:34567 close dgram 0 ::1 :: [::1]:34567 34567 [::]:0 0 - 4 UDPLITEv6 SOCK state=close laddr=[::1]:23456 close dgram 0 ::1 :: [::1]:23456 23456 [::]:0 0 +3 UDPLITEv6 SOCK state=close laddr=[::1]:56789 close dgram 0 ::1 :: [::1]:56789 56789 [::]:0 0 +4 UDPLITEv6 SOCK state=close laddr=[::1]:45678 close dgram 0 ::1 :: [::1]:45678 45678 [::]:0 0 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0 diff --git a/tests/expected/lsfd/mkfds-unix-dgram b/tests/expected/lsfd/mkfds-unix-dgram index b8fd9d4..dfd91e6 100644 --- a/tests/expected/lsfd/mkfds-unix-dgram +++ b/tests/expected/lsfd/mkfds-unix-dgram @@ -1,6 +1,6 @@ - 3 SOCK state=connected path=test_mkfds-unix-dgram type=dgram connected dgram 0 test_mkfds-unix-dgram - 4 SOCK state=connected type=dgram connected dgram 0 +3 SOCK state=connected\x20path=test_mkfds-unix-dgram\x20type=dgram connected dgram 0 test_mkfds-unix-dgram +4 SOCK state=connected\x20type=dgram connected dgram 0 ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=connected path=@test_mkfds-unix-dgram type=dgram connected dgram 0 @test_mkfds-unix-dgram - 4 SOCK state=connected type=dgram connected dgram 0 +3 SOCK state=connected\x20path=@test_mkfds-unix-dgram\x20type=dgram connected dgram 0 @test_mkfds-unix-dgram +4 SOCK state=connected\x20type=dgram connected dgram 0 ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 diff --git a/tests/expected/lsfd/mkfds-unix-in-netns-dgram b/tests/expected/lsfd/mkfds-unix-in-netns-dgram index c33dd9a..48ac72f 100644 --- a/tests/expected/lsfd/mkfds-unix-in-netns-dgram +++ b/tests/expected/lsfd/mkfds-unix-in-netns-dgram @@ -1,6 +1,6 @@ - 5 SOCK state=unconnected path=test_mkfds-unix-dgram-ns type=dgram unconnected dgram 0 test_mkfds-unix-dgram-ns +5 SOCK state=unconnected path=test_mkfds-unix-dgram-ns type=dgram unconnected dgram 0 test_mkfds-unix-dgram-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the dgram socket is extracted as expectedly - 5 SOCK state=unconnected path=@test_mkfds-unix-dgram-ns type=dgram unconnected dgram 0 @test_mkfds-unix-dgram-ns +5 SOCK state=unconnected path=@test_mkfds-unix-dgram-ns type=dgram unconnected dgram 0 @test_mkfds-unix-dgram-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the abstract dgram socket is extracted as expectedly diff --git a/tests/expected/lsfd/mkfds-unix-in-netns-seqpacket b/tests/expected/lsfd/mkfds-unix-in-netns-seqpacket index 1f70061..b997e55 100644 --- a/tests/expected/lsfd/mkfds-unix-in-netns-seqpacket +++ b/tests/expected/lsfd/mkfds-unix-in-netns-seqpacket @@ -1,6 +1,6 @@ - 5 SOCK state=listen path=test_mkfds-unix-seqpacket-ns type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket-ns +5 SOCK state=listen path=test_mkfds-unix-seqpacket-ns type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the seqpacket socket is extracted as expectedly - 5 SOCK state=listen path=@test_mkfds-unix-seqpacket-ns type=seqpacket listen seqpacket 1 @test_mkfds-unix-seqpacket-ns +5 SOCK state=listen path=@test_mkfds-unix-seqpacket-ns type=seqpacket listen seqpacket 1 @test_mkfds-unix-seqpacket-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the abstract seqpacket socket is extracted as expectedly diff --git a/tests/expected/lsfd/mkfds-unix-in-netns-stream b/tests/expected/lsfd/mkfds-unix-in-netns-stream index fd09105..c4ec9d4 100644 --- a/tests/expected/lsfd/mkfds-unix-in-netns-stream +++ b/tests/expected/lsfd/mkfds-unix-in-netns-stream @@ -1,6 +1,6 @@ - 5 SOCK state=listen path=test_mkfds-unix-stream-ns listen stream 1 test_mkfds-unix-stream-ns +5 SOCK state=listen path=test_mkfds-unix-stream-ns listen stream 1 test_mkfds-unix-stream-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the stream socket is extracted as expectedly - 5 SOCK state=listen path=@test_mkfds-unix-stream-ns listen stream 1 @test_mkfds-unix-stream-ns +5 SOCK state=listen path=@test_mkfds-unix-stream-ns listen stream 1 @test_mkfds-unix-stream-ns ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 the netns for the abstract stream socket is extracted as expectedly diff --git a/tests/expected/lsfd/mkfds-unix-stream b/tests/expected/lsfd/mkfds-unix-stream index c2e64a7..645be81 100644 --- a/tests/expected/lsfd/mkfds-unix-stream +++ b/tests/expected/lsfd/mkfds-unix-stream @@ -1,32 +1,32 @@ - 3 SOCK state=listen path=test_mkfds-unix-stream listen stream 1 test_mkfds-unix-stream - 4 SOCK state=connected connected stream 0 - 5 SOCK state=connected path=test_mkfds-unix-stream connected stream 0 test_mkfds-unix-stream +3 SOCK state=listen path=test_mkfds-unix-stream listen stream 1 test_mkfds-unix-stream +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=test_mkfds-unix-stream connected stream 0 test_mkfds-unix-stream ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=@test_mkfds-unix-stream-abs listen stream 1 @test_mkfds-unix-stream-abs - 4 SOCK state=connected connected stream 0 - 5 SOCK state=connected path=@test_mkfds-unix-stream-abs connected stream 0 @test_mkfds-unix-stream-abs +3 SOCK state=listen path=@test_mkfds-unix-stream-abs listen stream 1 @test_mkfds-unix-stream-abs +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=@test_mkfds-unix-stream-abs connected stream 0 @test_mkfds-unix-stream-abs (abs) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=test_mkfds-unix-stream-shutdown listen stream 1 test_mkfds-unix-stream-shutdown - 4 SOCK state=connected connected stream 0 - 5 SOCK state=connected path=test_mkfds-unix-stream-shutdown connected stream 0 test_mkfds-unix-stream-shutdown +3 SOCK state=listen path=test_mkfds-unix-stream-shutdown listen stream 1 test_mkfds-unix-stream-shutdown +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=test_mkfds-unix-stream-shutdown connected stream 0 test_mkfds-unix-stream-shutdown (shutdown) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=test_mkfds-unix with spaces stream listen stream 1 test_mkfds-unix with spaces stream - 4 SOCK state=connected connected stream 0 - 5 SOCK state=connected path=test_mkfds-unix with spaces stream connected stream 0 test_mkfds-unix with spaces stream +3 SOCK state=listen path=test_mkfds-unix with spaces stream listen stream 1 test_mkfds-unix with spaces stream +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=test_mkfds-unix with spaces stream connected stream 0 test_mkfds-unix with spaces stream ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=test_mkfds-unix-seqpacket type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket - 4 SOCK state=connected type=seqpacket connected seqpacket 0 - 5 SOCK state=connected path=test_mkfds-unix-seqpacket type=seqpacket connected seqpacket 0 test_mkfds-unix-seqpacket +3 SOCK state=listen path=test_mkfds-unix-seqpacket type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket +4 SOCK state=connected type=seqpacket connected seqpacket 0 +5 SOCK state=connected path=test_mkfds-unix-seqpacket type=seqpacket connected seqpacket 0 test_mkfds-unix-seqpacket ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=@test_mkfds-unix-seqpacket-abs listen stream 1 @test_mkfds-unix-seqpacket-abs - 4 SOCK state=connected connected stream 0 - 5 SOCK state=connected path=@test_mkfds-unix-seqpacket-abs connected stream 0 @test_mkfds-unix-seqpacket-abs +3 SOCK state=listen path=@test_mkfds-unix-seqpacket-abs listen stream 1 @test_mkfds-unix-seqpacket-abs +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=@test_mkfds-unix-seqpacket-abs connected stream 0 @test_mkfds-unix-seqpacket-abs (abs) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=test_mkfds-unix-seqpacket-shutdown type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket-shutdown - 4 SOCK state=connected type=seqpacket connected seqpacket 0 - 5 SOCK state=connected path=test_mkfds-unix-seqpacket-shutdown type=seqpacket connected seqpacket 0 test_mkfds-unix-seqpacket-shutdown +3 SOCK state=listen path=test_mkfds-unix-seqpacket-shutdown type=seqpacket listen seqpacket 1 test_mkfds-unix-seqpacket-shutdown +4 SOCK state=connected type=seqpacket connected seqpacket 0 +5 SOCK state=connected path=test_mkfds-unix-seqpacket-shutdown type=seqpacket connected seqpacket 0 test_mkfds-unix-seqpacket-shutdown (shutdown) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 - 3 SOCK state=listen path=test_mkfds-unix with spaces seqpacket type=seqpacket listen seqpacket 1 test_mkfds-unix with spaces seqpacket - 4 SOCK state=connected type=seqpacket connected seqpacket 0 - 5 SOCK state=connected path=test_mkfds-unix with spaces seqpacket type=seqpacket connected seqpacket 0 test_mkfds-unix with spaces seqpacket +3 SOCK state=listen path=test_mkfds-unix with spaces seqpacket type=seqpacket listen seqpacket 1 test_mkfds-unix with spaces seqpacket +4 SOCK state=connected type=seqpacket connected seqpacket 0 +5 SOCK state=connected path=test_mkfds-unix with spaces seqpacket type=seqpacket connected seqpacket 0 test_mkfds-unix with spaces seqpacket ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 diff --git a/tests/expected/lsfd/mkfds-unix-stream-requiring-sockdiag b/tests/expected/lsfd/mkfds-unix-stream-requiring-sockdiag new file mode 100644 index 0000000..946c95f --- /dev/null +++ b/tests/expected/lsfd/mkfds-unix-stream-requiring-sockdiag @@ -0,0 +1,8 @@ +3 SOCK state=listen path=test_mkfds-unix with newline stream a\x0ab\x0ac listen stream 1 test_mkfds-unix with newline stream a\x0ab\x0ac +4 SOCK state=connected connected stream 0 +5 SOCK state=connected path=test_mkfds-unix with newline stream a\x0ab\x0ac connected stream 0 test_mkfds-unix with newline stream a\x0ab\x0ac +ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 +3 SOCK state=listen path=test_mkfds-unix with newline seqpacket a\x0ab\x0ac type=seqpacket listen seqpacket 1 test_mkfds-unix with newline seqpacket a\x0ab\x0ac +4 SOCK state=connected type=seqpacket connected seqpacket 0 +5 SOCK state=connected path=test_mkfds-unix with newline seqpacket a\x0ab\x0ac type=seqpacket connected seqpacket 0 test_mkfds-unix with newline seqpacket a\x0ab\x0ac +ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH: 0 diff --git a/tests/expected/lsfd/option-filter-broken-exp b/tests/expected/lsfd/option-filter-broken-exp deleted file mode 100644 index 8c14f22..0000000 --- a/tests/expected/lsfd/option-filter-broken-exp +++ /dev/null @@ -1,7 +0,0 @@ -lsfd: error: empty filter expression -lsfd: error: empty filter expression -lsfd: error: unbalanced parenthesis: ) -lsfd: error: unexpected token: garbage after OP2 -lsfd: error: bool expression is expected: FD -lsfd: unknown column: NOSUCHCOLUMN -lsfd: error: no such column: NOSUCHCOLUMN diff --git a/tests/expected/lsfd/option-inet b/tests/expected/lsfd/option-inet index cebfded..66edac9 100644 --- a/tests/expected/lsfd/option-inet +++ b/tests/expected/lsfd/option-inet @@ -1,46 +1,46 @@ # --inet - 3 TCP state=listen laddr=127.0.0.1:34567 - 4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 - 3 TCPv6 state=listen laddr=[::1]:34567 - 4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 - 5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 - 3 UDP state=close laddr=127.0.0.1:34567 - 4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 3 UDPLITEv6 state=close laddr=[::1]:34567 - 4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +3 TCP state=listen laddr=127.0.0.1:34567 +4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 +3 TCPv6 state=listen laddr=[::1]:34567 +4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 +3 UDP state=close laddr=127.0.0.1:34567 +4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +3 UDPLITEv6 state=close laddr=[::1]:34567 +4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 # --inet=4 - 3 TCP state=listen laddr=127.0.0.1:34567 - 4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 - 3 UDP state=close laddr=127.0.0.1:34567 - 4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +3 TCP state=listen laddr=127.0.0.1:34567 +4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 +3 UDP state=close laddr=127.0.0.1:34567 +4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 # --inet=6 - 3 TCPv6 state=listen laddr=[::1]:34567 - 4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 - 5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 - 3 UDPLITEv6 state=close laddr=[::1]:34567 - 4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +3 TCPv6 state=listen laddr=[::1]:34567 +4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 +3 UDPLITEv6 state=close laddr=[::1]:34567 +4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 # -i - 3 TCP state=listen laddr=127.0.0.1:34567 - 4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 - 3 TCPv6 state=listen laddr=[::1]:34567 - 4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 - 5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 - 3 UDP state=close laddr=127.0.0.1:34567 - 4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 3 UDPLITEv6 state=close laddr=[::1]:34567 - 4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +3 TCP state=listen laddr=127.0.0.1:34567 +4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 +3 TCPv6 state=listen laddr=[::1]:34567 +4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 +3 UDP state=close laddr=127.0.0.1:34567 +4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +3 UDPLITEv6 state=close laddr=[::1]:34567 +4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 # -i4 - 3 TCP state=listen laddr=127.0.0.1:34567 - 4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 - 5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 - 3 UDP state=close laddr=127.0.0.1:34567 - 4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +3 TCP state=listen laddr=127.0.0.1:34567 +4 TCP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 +5 TCP state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 +3 UDP state=close laddr=127.0.0.1:34567 +4 UDP state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 # -i6 - 3 TCPv6 state=listen laddr=[::1]:34567 - 4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 - 5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 - 3 UDPLITEv6 state=close laddr=[::1]:34567 - 4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +3 TCPv6 state=listen laddr=[::1]:34567 +4 TCPv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 +5 TCPv6 state=established laddr=[::1]:34567 raddr=[::1]:23456 +3 UDPLITEv6 state=close laddr=[::1]:34567 +4 UDPLITEv6 state=established laddr=[::1]:23456 raddr=[::1]:34567 diff --git a/tests/expected/lsfd/option-summary b/tests/expected/lsfd/option-summary index 4e96f55..058de37 100644 --- a/tests/expected/lsfd/option-summary +++ b/tests/expected/lsfd/option-summary @@ -1,3 +1,3 @@ - 10 GROUP - 3 PASSWD - 13 PROC +10 GROUP + 3 PASSWD +13 PROC diff --git a/tests/expected/lslocks/lslocks-flock-ex b/tests/expected/lslocks/lslocks-flock-ex new file mode 100644 index 0000000..b7e6ee2 --- /dev/null +++ b/tests/expected/lslocks/lslocks-flock-ex @@ -0,0 +1,4 @@ +test_mkfds FLOCK WRITE 0 0 +# flock-ex + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# flock-ex + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-flock-ex+HOLDERS b/tests/expected/lslocks/lslocks-flock-ex+HOLDERS new file mode 100644 index 0000000..3a817e2 --- /dev/null +++ b/tests/expected/lslocks/lslocks-flock-ex+HOLDERS @@ -0,0 +1,2 @@ +test_mkfds FLOCK WRITE 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +# flock-ex + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-flock-sh b/tests/expected/lslocks/lslocks-flock-sh new file mode 100644 index 0000000..6188cc1 --- /dev/null +++ b/tests/expected/lslocks/lslocks-flock-sh @@ -0,0 +1,4 @@ +test_mkfds FLOCK READ 0 0 +# flock-sh + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# flock-sh + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-flock-sh+HOLDERS b/tests/expected/lslocks/lslocks-flock-sh+HOLDERS new file mode 100644 index 0000000..37996b1 --- /dev/null +++ b/tests/expected/lslocks/lslocks-flock-sh+HOLDERS @@ -0,0 +1,2 @@ +test_mkfds FLOCK READ 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +# flock-sh + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-lease-w b/tests/expected/lslocks/lslocks-lease-w new file mode 100644 index 0000000..78a0a21 --- /dev/null +++ b/tests/expected/lslocks/lslocks-lease-w @@ -0,0 +1,4 @@ +test_mkfds LEASE WRITE 0 0 +# lease-w + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# lease-w + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-lease-w+HOLDERS b/tests/expected/lslocks/lslocks-lease-w+HOLDERS new file mode 100644 index 0000000..8c6ab5d --- /dev/null +++ b/tests/expected/lslocks/lslocks-lease-w+HOLDERS @@ -0,0 +1,2 @@ +test_mkfds LEASE WRITE 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +# lease-w + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd--w b/tests/expected/lslocks/lslocks-ofd--w new file mode 100644 index 0000000..20b8bc9 --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd--w @@ -0,0 +1,4 @@ +test_mkfds OFDLCK 1B WRITE 0 0 +# ofd--w + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# ofd--w + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd--w+HOLDERS b/tests/expected/lslocks/lslocks-ofd--w+HOLDERS new file mode 100644 index 0000000..4ff9158 --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd--w+HOLDERS @@ -0,0 +1,2 @@ +test_mkfds OFDLCK 1B WRITE 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +# ofd--w + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd-r- b/tests/expected/lslocks/lslocks-ofd-r- new file mode 100644 index 0000000..bf9e809 --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd-r- @@ -0,0 +1,4 @@ +test_mkfds OFDLCK 1B READ 0 0 +# ofd-r- + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# ofd-r- + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd-r-+HOLDERS b/tests/expected/lslocks/lslocks-ofd-r-+HOLDERS new file mode 100644 index 0000000..1abbf44 --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd-r-+HOLDERS @@ -0,0 +1,2 @@ +test_mkfds OFDLCK 1B READ 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +# ofd-r- + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd-rw b/tests/expected/lslocks/lslocks-ofd-rw new file mode 100644 index 0000000..dd3d71c --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd-rw @@ -0,0 +1,6 @@ +test_mkfds OFDLCK 3B READ 0 0 +test_mkfds OFDLCK 3B WRITE 2 2 +# ofd-rw + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +util-linux-lslocks-target-file +# ofd-rw + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-ofd-rw+HOLDERS b/tests/expected/lslocks/lslocks-ofd-rw+HOLDERS new file mode 100644 index 0000000..a105d32 --- /dev/null +++ b/tests/expected/lslocks/lslocks-ofd-rw+HOLDERS @@ -0,0 +1,3 @@ +test_mkfds OFDLCK 3B READ 0 0 1,test_mkfds,17\x0a1,test_mkfds,18 +test_mkfds OFDLCK 3B WRITE 2 2 1,test_mkfds,17\x0a1,test_mkfds,18 +# ofd-rw + COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-posix--w b/tests/expected/lslocks/lslocks-posix--w new file mode 100644 index 0000000..2668fcd --- /dev/null +++ b/tests/expected/lslocks/lslocks-posix--w @@ -0,0 +1,4 @@ +test_mkfds POSIX 1B WRITE 0 0 +# posix--w + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# posix--w + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-posix-r- b/tests/expected/lslocks/lslocks-posix-r- new file mode 100644 index 0000000..5e1113d --- /dev/null +++ b/tests/expected/lslocks/lslocks-posix-r- @@ -0,0 +1,4 @@ +test_mkfds POSIX 1B READ 0 0 +# posix-r- + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +# posix-r- + PATH + --raw --noheadings: 0 diff --git a/tests/expected/lslocks/lslocks-posix-rw b/tests/expected/lslocks/lslocks-posix-rw new file mode 100644 index 0000000..890d96a --- /dev/null +++ b/tests/expected/lslocks/lslocks-posix-rw @@ -0,0 +1,6 @@ +test_mkfds POSIX 3B READ 0 0 +test_mkfds POSIX 3B WRITE 2 2 +# posix-rw + COMMAND,TYPE,SIZE,MODE,START,END + --raw --noheadings: 0 +util-linux-lslocks-target-file +util-linux-lslocks-target-file +# posix-rw + PATH + --raw --noheadings: 0 diff --git a/tests/expected/misc/boilerplate-exec b/tests/expected/misc/boilerplate-exec new file mode 100644 index 0000000..324da67 --- /dev/null +++ b/tests/expected/misc/boilerplate-exec @@ -0,0 +1 @@ +ret=0 diff --git a/tests/expected/misc/boilerplate-help b/tests/expected/misc/boilerplate-help new file mode 100644 index 0000000..549400d --- /dev/null +++ b/tests/expected/misc/boilerplate-help @@ -0,0 +1,24 @@ + +Usage: + test_boilerplate [options] file... + +Short program description. + +Options: + -n, --no-argument option does not use argument + --optional[=<arg>] option argument is optional + -r, --required <arg> option requires an argument + -z no long option + --xyzzy a long option only + -e, --extremely-long-long-option + use next line for description when needed + -l, --long-explanation an example of very verbose, and chatty option + description on two, or multiple lines, where the + consecutive lines are intended by two spaces + -f, --foobar next option description resets indent + + -h, --help display this help + -V, --version display version + +For more details see fixme-command-name(1). +ret=0 diff --git a/tests/expected/misc/enosys-basic b/tests/expected/misc/enosys-basic new file mode 100644 index 0000000..6552946 --- /dev/null +++ b/tests/expected/misc/enosys-basic @@ -0,0 +1,4 @@ +test_enosys: fallocate r=-1 errno=Bad file descriptor +test_enosys: fallocate r=-1 errno=Function not implemented +test_enosys: fallocate r=-1 errno=Function not implemented +test_enosys: fallocate r=-1 errno=Function not implemented diff --git a/tests/expected/misc/enosys-exec b/tests/expected/misc/enosys-exec new file mode 100644 index 0000000..be9e72f --- /dev/null +++ b/tests/expected/misc/enosys-exec @@ -0,0 +1 @@ +test_enosys: exec failed: Function not implemented diff --git a/tests/expected/misc/enosys-ioctl b/tests/expected/misc/enosys-ioctl new file mode 100644 index 0000000..7ab1efd --- /dev/null +++ b/tests/expected/misc/enosys-ioctl @@ -0,0 +1,5 @@ +test_enosys: ioctl r=0 errno=Success +test_enosys: ioctl r=-1 errno=Function not implemented +test_enosys: ioctl r=-1 errno=Inappropriate ioctl for device +test_enosys: ioctl r=-1 errno=Inappropriate ioctl for device +test_enosys: ioctl r=-1 errno=Function not implemented diff --git a/tests/expected/misc/lsclocks-basic b/tests/expected/misc/lsclocks-basic new file mode 100644 index 0000000..1b375b8 --- /dev/null +++ b/tests/expected/misc/lsclocks-basic @@ -0,0 +1,10 @@ +TYPE ID CLOCK NAME +sys 0 CLOCK_REALTIME realtime +sys 1 CLOCK_MONOTONIC monotonic +sys 4 CLOCK_MONOTONIC_RAW monotonic-raw +sys 5 CLOCK_REALTIME_COARSE realtime-coarse +sys 6 CLOCK_MONOTONIC_COARSE monotonic-coarse +sys 7 CLOCK_BOOTTIME boottime +sys 8 CLOCK_REALTIME_ALARM realtime-alarm +sys 9 CLOCK_BOOTTIME_ALARM boottime-alarm +sys 11 CLOCK_TAI tai diff --git a/tests/expected/misc/lsclocks-cpu b/tests/expected/misc/lsclocks-cpu new file mode 100644 index 0000000..8da71a5 --- /dev/null +++ b/tests/expected/misc/lsclocks-cpu @@ -0,0 +1 @@ +cpu 1 diff --git a/tests/expected/misc/lsclocks-dynamic b/tests/expected/misc/lsclocks-dynamic new file mode 100644 index 0000000..156ee3f --- /dev/null +++ b/tests/expected/misc/lsclocks-dynamic @@ -0,0 +1 @@ +ptp /dev/ptp0 /dev/ptp0 diff --git a/tests/expected/misc/lsclocks-rtc b/tests/expected/misc/lsclocks-rtc new file mode 100644 index 0000000..85615b1 --- /dev/null +++ b/tests/expected/misc/lsclocks-rtc @@ -0,0 +1 @@ +rtc /dev/rtc0 /dev/rtc0 diff --git a/tests/expected/misc/lsclocks-time b/tests/expected/misc/lsclocks-time new file mode 100644 index 0000000..adc6524 --- /dev/null +++ b/tests/expected/misc/lsclocks-time @@ -0,0 +1 @@ +X.X diff --git a/tests/expected/misc/setpgid b/tests/expected/misc/setpgid new file mode 100644 index 0000000..3e4e055 --- /dev/null +++ b/tests/expected/misc/setpgid @@ -0,0 +1,2 @@ +success +not equal diff --git a/tests/expected/misc/time_t b/tests/expected/misc/time_t new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/tests/expected/misc/time_t @@ -0,0 +1 @@ +8 diff --git a/tests/expected/mount/special-missing-options b/tests/expected/mount/special-missing-options new file mode 100644 index 0000000..9ead324 --- /dev/null +++ b/tests/expected/mount/special-missing-options @@ -0,0 +1 @@ +SRC=/foo TARGET=/mountpoint ROOT=/ OPTS=x-foo=123,x-bar=BAR diff --git a/tests/expected/rename/basic b/tests/expected/rename/basic index 2712ba1..7f1af7c 100644 --- a/tests/expected/rename/basic +++ b/tests/expected/rename/basic @@ -17,3 +17,4 @@ what is rename_all* *.? doing here? `rename_zz_last_zzz.z' -> `rename_zz_last_zAAzzBB.z' what is rename*last* doing here? `rename_all_empty' -> `_r_e_n_a_m_e___a_l_l___e_m_p_t_y_' +`rename_dir' -> `rename_new_dir' diff --git a/tests/expected/schedutils/chrt-deadline b/tests/expected/schedutils/chrt-deadline index 33d5527..35066c5 100644 --- a/tests/expected/schedutils/chrt-deadline +++ b/tests/expected/schedutils/chrt-deadline @@ -1,9 +1,9 @@ SCHED_DEADLINE 0 -<removed>'s current runtime/deadline/period parameters: 13000/13000/13000 +<removed>'s current runtime/deadline/period parameters: 130000/130000/130000 SCHED_DEADLINE 0 -<removed>'s current runtime/deadline/period parameters: 12000/12000/13000 +<removed>'s current runtime/deadline/period parameters: 120000/120000/130000 SCHED_DEADLINE 0 -<removed>'s current runtime/deadline/period parameters: 10000/12000/13000 +<removed>'s current runtime/deadline/period parameters: 100000/120000/130000 diff --git a/tests/expected/setpriv/landlock-nothing-allowed b/tests/expected/setpriv/landlock-nothing-allowed new file mode 100644 index 0000000..6a63dbc --- /dev/null +++ b/tests/expected/setpriv/landlock-nothing-allowed @@ -0,0 +1 @@ +setpriv: failed to execute true: Permission denied diff --git a/tests/expected/setpriv/landlock-partial-access-fail b/tests/expected/setpriv/landlock-partial-access-fail new file mode 100644 index 0000000..0a9a503 --- /dev/null +++ b/tests/expected/setpriv/landlock-partial-access-fail @@ -0,0 +1 @@ +cp: cannot create regular file '/dev/zero': Permission denied diff --git a/tests/expected/utmp/utmpdump-subsecond b/tests/expected/utmp/utmpdump-subsecond index 67d2cf8..02990c7 100644 --- a/tests/expected/utmp/utmpdump-subsecond +++ b/tests/expected/utmp/utmpdump-subsecond @@ -1,4 +1,4 @@ last 9 is expected to disappear in conversion [7] [00010] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:30:40,123456+00:00] [8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:40:50,999999+00:00] -[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [2013-08-28T12:00:00,12345678+00:00] +[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [2013-08-28T12:00:00,000000+00:00] diff --git a/tests/expected/wipefs/signatures-bcachefs b/tests/expected/wipefs/signatures-bcachefs new file mode 100644 index 0000000..0c7e0a3 --- /dev/null +++ b/tests/expected/wipefs/signatures-bcachefs @@ -0,0 +1,3 @@ +0x1018,e1cf0710-c3cb-498b-9453-d5f3e7dbf9cc,,bcachefs +0x200018,e1cf0710-c3cb-498b-9453-d5f3e7dbf9cc,,bcachefs +0x1300018,e1cf0710-c3cb-498b-9453-d5f3e7dbf9cc,,bcachefs diff --git a/tests/functions.sh b/tests/functions.sh index 5a562a3..5fe5ba0 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -163,6 +163,18 @@ function ts_skip_nonroot { fi } +# Specify the capability needed in your test case like: +# +# ts_skip_capability cap_wake_alarm +# +function ts_skip_capability { + ts_check_prog "$TS_HELPER_CAP" + + if ! "$TS_HELPER_CAP" "$1"; then + ts_skip "no capability: $1" + fi +} + function ts_skip_qemu_user { if [ "$QEMU_USER" == "1" ]; then ts_skip "running under qemu-user emulation" @@ -283,10 +295,10 @@ function ts_init_core_subtest_env { TS_EXPECTED_ERR="$TS_TOPDIR/expected/$TS_NS.err" TS_MOUNTPOINT="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-mnt" - rm -f $TS_OUTPUT $TS_ERRLOG $TS_VGDUMP $TS_EXIT_CODE + rm -f "$TS_OUTPUT" "$TS_ERRLOG" "$TS_VGDUMP" "$TS_EXIT_CODE" [ -d "$TS_OUTDIR" ] || mkdir -p "$TS_OUTDIR" - touch $TS_OUTPUT $TS_ERRLOG $TS_EXIT_CODE + touch "$TS_OUTPUT" "$TS_ERRLOG" "$TS_EXIT_CODE" [ -n "$TS_VALGRIND_CMD" ] && touch $TS_VGDUMP } @@ -386,6 +398,7 @@ function ts_init_env { TS_ENABLE_UBSAN="yes" fi + TS_FSTAB="$TS_OUTDIR/${TS_TESTNAME}.fstab" BLKID_FILE="$TS_OUTDIR/${TS_TESTNAME}.blkidtab" declare -a TS_SUID_PROGS @@ -529,19 +542,19 @@ function ts_gen_diff_from { local output="$2" local difffile="$3" - diff -u $expected $output > $difffile + diff -u "$expected" "$output" > "$difffile" - if [ $? -ne 0 ] || [ -s $difffile ]; then + if [ $? -ne 0 ] || [ -s "$difffile" ]; then res=1 if [ "$TS_SHOWDIFF" == "yes" -a "$TS_KNOWN_FAIL" != "yes" ]; then echo echo "diff-{{{" - cat $difffile + cat "$difffile" echo "}}}-diff" echo fi else - rm -f $difffile; + rm -f "$difffile"; fi return $res @@ -556,8 +569,8 @@ function ts_gen_diff { [ -f "$TS_EXPECTED" ] || TS_EXPECTED=/dev/null # remove libtool lt- prefixes - sed --in-place 's/^lt\-\(.*\: \)/\1/g' $TS_OUTPUT - sed --in-place 's/^lt\-\(.*\: \)/\1/g' $TS_ERRLOG + sed --in-place 's/^lt\-\(.*\: \)/\1/g' "$TS_OUTPUT" + sed --in-place 's/^lt\-\(.*\: \)/\1/g' "$TS_ERRLOG" [ -d "$TS_DIFFDIR" ] || mkdir -p "$TS_DIFFDIR" @@ -566,10 +579,10 @@ function ts_gen_diff { [ -f "$TS_ERRLOG" ] || TS_ERRLOG=/dev/null if [ "$TS_COMPONENT" != "fuzzers" ]; then - ts_gen_diff_from $TS_EXPECTED $TS_OUTPUT $TS_DIFF + ts_gen_diff_from "$TS_EXPECTED" "$TS_OUTPUT" "$TS_DIFF" status_out=$? - ts_gen_diff_from $TS_EXPECTED_ERR $TS_ERRLOG $TS_DIFF.err + ts_gen_diff_from "$TS_EXPECTED_ERR" "$TS_ERRLOG" "$TS_DIFF.err" status_err=$? else # TS_EXIT_CODE is empty when tests aren't run with ts_run: https://github.com/util-linux/util-linux/issues/1072 @@ -580,8 +593,8 @@ function ts_gen_diff { fi if [ $exit_code -ne 0 ]; then - ts_gen_diff_from $TS_EXPECTED $TS_OUTPUT $TS_DIFF - ts_gen_diff_from $TS_EXPECTED_ERR $TS_ERRLOG $TS_DIFF.err + ts_gen_diff_from "$TS_EXPECTED" "$TS_OUTPUT" "$TS_DIFF" + ts_gen_diff_from "$TS_EXPECTED_ERR" "$TS_ERRLOG" "$TS_DIFF.err" fi fi @@ -824,12 +837,12 @@ function ts_is_mounted { } function ts_fstab_open { - echo "# <!-- util-linux test entry" >> /etc/fstab + echo "# <!-- util-linux test entry" >> "$TS_FSTAB" } function ts_fstab_close { - echo "# -->" >> /etc/fstab - sync /etc/fstab 2>/dev/null + echo "# -->" >> "$TS_FSTAB" + sync "$TS_FSTAB" 2>/dev/null } function ts_fstab_addline { @@ -838,7 +851,7 @@ function ts_fstab_addline { local FS=${3:-"auto"} local OPT=${4:-"defaults"} - echo "$SPEC $MNT $FS $OPT 0 0" >> /etc/fstab + echo "$SPEC $MNT $FS $OPT 0 0" >> "$TS_FSTAB" } function ts_fstab_lock { @@ -862,9 +875,9 @@ function ts_fstab_clean { ba } s/# <!-- util-linux.*-->//; -/^$/d" /etc/fstab +/^$/d" "$TS_FSTAB" - sync /etc/fstab 2>/dev/null + sync "$TS_FSTAB" 2>/dev/null ts_unlock "fstab" } @@ -1159,8 +1172,8 @@ function ts_is_virt { } function ts_check_enosys_syscalls { - ts_check_test_command "$TS_HELPER_ENOSYS" - "$TS_HELPER_ENOSYS" ${@/#/-s } true 2> /dev/null + ts_check_test_command "$TS_CMD_ENOSYS" + "$TS_CMD_ENOSYS" ${@/#/-s } true 2> /dev/null [ $? -ne 0 ] && ts_skip "test_enosys does not work: $*" } diff --git a/tests/helpers/Makemodule.am b/tests/helpers/Makemodule.am index 2b1df3c..67a1d3d 100644 --- a/tests/helpers/Makemodule.am +++ b/tests/helpers/Makemodule.am @@ -33,8 +33,16 @@ test_uuid_namespace_SOURCES = tests/helpers/test_uuid_namespace.c \ if LINUX check_PROGRAMS += test_mkfds -test_mkfds_SOURCES = tests/helpers/test_mkfds.c +test_mkfds_SOURCES = tests/helpers/test_mkfds.c tests/helpers/test_mkfds.h \ + tests/helpers/test_mkfds_ppoll.c +test_mkfds_LDADD = $(LDADD) $(MQ_LIBS) check_PROGRAMS += test_enosys test_enosys_SOURCES = tests/helpers/test_enosys.c endif + +if HAVE_CAP_NG +check_PROGRAMS += test_cap +test_cap_SOURCES = tests/helpers/test_cap.c +test_cap_LDADD = -lcap-ng +endif diff --git a/tests/helpers/test_cap.c b/tests/helpers/test_cap.c new file mode 100644 index 0000000..658e86a --- /dev/null +++ b/tests/helpers/test_cap.c @@ -0,0 +1,33 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de> + */ + +#include <stdlib.h> +#include <stdio.h> + +#include <cap-ng.h> + +int main(int argc, char **argv) +{ + int cap, r; + + if (argc != 2) + return EXIT_FAILURE; + + cap = capng_name_to_capability(argv[1]); + if (cap < 0) { + fprintf(stderr, "capng_name_to_capability(%s) failed\n", argv[1]); + return EXIT_FAILURE; + } + + r = capng_get_caps_process(); + if (r) { + fprintf(stderr, "capng_get_caps_process() failed\n"); + return EXIT_FAILURE; + } + + r = capng_have_capability(CAPNG_EFFECTIVE, cap); + return r ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/tests/helpers/test_enosys.c b/tests/helpers/test_enosys.c index 9e93cc2..98f8d15 100644 --- a/tests/helpers/test_enosys.c +++ b/tests/helpers/test_enosys.c @@ -16,111 +16,39 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include <stddef.h> -#include <stdbool.h> -#include <getopt.h> - -#include <linux/unistd.h> -#include <linux/filter.h> -#include <linux/seccomp.h> -#include <linux/audit.h> -#include <sys/prctl.h> - -#include "c.h" -#include "audit-arch.h" -#include "exitcodes.h" - -#define syscall_nr (offsetof(struct seccomp_data, nr)) - -struct syscall { - const char *const name; - int number; -}; - -const struct syscall syscalls[] = { -#ifdef __NR_move_mount - { "move_mount", __NR_move_mount }, -#endif -#ifdef __NR_open_tree - { "open_tree", __NR_open_tree }, -#endif -#ifdef __NR_fsopen - { "fsopen", __NR_fsopen }, -#endif -#ifdef __NR_mount_setattr - { "mount_setattr", __NR_mount_setattr }, -#endif - -}; +#include <err.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/ioctl.h> int main(int argc, char **argv) { - int c; - size_t i; - bool found; - static const struct option longopts[] = { - { "syscall", required_argument, NULL, 's' }, - { 0 } - }; + int r; - bool blocked_syscalls[ARRAY_SIZE(syscalls)] = {}; - - while ((c = getopt_long (argc, argv, "s:", longopts, NULL)) != -1) { - switch (c) { - case 's': - found = 0; - for (i = 0; i < ARRAY_SIZE(syscalls); i++) { - if (strcmp(optarg, syscalls[i].name) == 0) { - blocked_syscalls[i] = true; - found = 1; - break; - } - } - if (!found) - errx(EXIT_FAILURE, "Unknown syscall '%s'", optarg); - break; - default: - errx(EXIT_FAILURE, "Unknown option"); - } + if (argc != 2) { + fprintf(stderr, "invalid options\n"); + return EXIT_FAILURE; } - if (optind >= argc) - errx(EXIT_FAILURE, "No executable specified"); - -#define N_FILTERS (ARRAY_SIZE(syscalls) + 3) - - struct sock_filter filter[N_FILTERS] = { - [0] = BPF_STMT(BPF_LD | BPF_W | BPF_ABS, syscall_nr), - - [N_FILTERS - 2] = BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW), - [N_FILTERS - 1] = BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ERRNO | ENOSYS), - }; - - const struct sock_filter nop = BPF_JUMP(BPF_JMP | BPF_JA, 0, 0, 0); - - for (i = 0; i < ARRAY_SIZE(syscalls); i++) { - if (blocked_syscalls[i]) { - const struct sock_filter block = BPF_JUMP( - BPF_JMP | BPF_JEQ | BPF_K, - syscalls[i].number, - N_FILTERS - 3 - i, 0); - filter[i + 1] = block; - } else { - filter[i + 1] = nop; - } + if (strcmp(argv[1], "fallocate") == 0) { + errno = 0; + r = fallocate(-1, 0, 0, 0); + errx(EXIT_SUCCESS, "fallocate r=%d errno=%s", r, strerror(errno)); + } else if (strcmp(argv[1], "exec") == 0) { + char *const cmd[] = { + "/bin/false", + NULL + }; + execve(cmd[0], cmd, NULL); + err(EXIT_FAILURE, "exec failed"); + } else if (strcmp(argv[1], "ioctl") == 0) { + r = ioctl(0, FIOCLEX); + errx(EXIT_SUCCESS, "ioctl r=%d errno=%s", r, strerror(errno)); } - struct sock_fprog prog = { - .len = ARRAY_SIZE(filter), - .filter = filter, - }; - - if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) - err(EXIT_NOTSUPP, "prctl(PR_SET_NO_NEW_PRIVS)"); - - if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) - err(EXIT_NOTSUPP, "prctl(PR_SET_SECCOMP)"); - - if (execvp(argv[optind], argv + optind)) - err(EXIT_NOTSUPP, "Could not exec"); + errx(EXIT_FAILURE, "invalid mode %s", argv[1]); } diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index 194c175..39427ba 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -17,49 +17,66 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "c.h" +#include "xalloc.h" +#include "test_mkfds.h" +#include "exitcodes.h" + #include <arpa/inet.h> #include <ctype.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <sys/file.h> #include <getopt.h> +#include <linux/bpf.h> #include <linux/if_ether.h> #include <linux/if_packet.h> +#include <linux/if_tun.h> #include <linux/netlink.h> +#include <linux/sock_diag.h> +# include <linux/unix_diag.h> /* for UNIX domain sockets */ #include <linux/sockios.h> /* SIOCGSKNS */ +#include <mqueue.h> #include <net/if.h> #include <netinet/in.h> #include <netinet/tcp.h> +#include <poll.h> #include <sched.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/epoll.h> +#include <sys/eventfd.h> #include <sys/inotify.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/prctl.h> #include <sys/select.h> +#include <sys/signalfd.h> #include <sys/socket.h> +#include <sys/shm.h> #include <sys/syscall.h> +#include <sys/timerfd.h> #include <sys/types.h> #include <sys/un.h> #include <sys/user.h> +#include <sys/wait.h> +#include <time.h> #include <unistd.h> -#include "c.h" -#include "xalloc.h" - -#define EXIT_ENOSYS 17 #define EXIT_EPERM 18 #define EXIT_ENOPROTOOPT 19 #define EXIT_EPROTONOSUPPORT 20 -#define EXIT_EACCESS 21 +#define EXIT_EACCES 21 +#define EXIT_ENOENT 22 #define _U_ __attribute__((__unused__)) static int pidfd_open(pid_t pid, unsigned int flags); +static void do_nothing(int signum _U_); static void __attribute__((__noreturn__)) usage(FILE *out, int status) { @@ -67,11 +84,15 @@ static void __attribute__((__noreturn__)) usage(FILE *out, int status) fprintf(out, " %s [options] FACTORY FD... [PARAM=VAL...]\n", program_invocation_short_name); fputs("\nOptions:\n", out); + fputs(" -a, --is-available <factory> exit 0 if the factory is available\n", out); fputs(" -l, --list list available file descriptor factories and exit\n", out); fputs(" -I, --parameters <factory> list parameters the factory takes\n", out); fputs(" -r, --comm <name> rename self\n", out); fputs(" -q, --quiet don't print pid(s)\n", out); + fputs(" -X, --dont-monitor-stdin don't monitor stdin when pausing\n", out); fputs(" -c, --dont-pause don't pause after making fd(s)\n", out); + fputs(" -w, --wait-with <multiplexer> use MULTIPLEXER for waiting events\n", out); + fputs(" -W, --multiplexers list multiplexers\n", out); fputs("\n", out); fputs("Examples:\n", out); @@ -289,7 +310,7 @@ static struct arg decode_arg(const char *pname, v = NULL; } } - arg.v = ptype_classes [p->type].read (v, &p->defv); + arg.v = ptype_classes [p->type].read(v, &p->defv); arg.free = ptype_classes [p->type].free; return arg; } @@ -299,22 +320,17 @@ static void free_arg(struct arg *arg) arg->free(arg->v); } -struct fdesc { - int fd; - void (*close)(int, void *); - void *data; -}; - struct factory { const char *name; /* [-a-zA-Z0-9_]+ */ const char *desc; bool priv; /* the root privilege is needed to make fd(s) */ -#define MAX_N 5 +#define MAX_N 13 int N; /* the number of fds this factory makes */ int EX_N; /* fds made optionally */ + int EX_R; /* the number of extra words printed to stdout. */ void *(*make)(const struct factory *, struct fdesc[], int, char **); void (*free)(const struct factory *, void *); - void (*report)(const struct factory *, void *, FILE *); + void (*report)(const struct factory *, int, void *, FILE *); const struct parameter * params; }; @@ -323,11 +339,20 @@ static void close_fdesc(int fd, void *data _U_) close(fd); } +volatile ssize_t unused_result_ok; +static void abort_with_child_death_message(int signum _U_) +{ + const char msg[] = "the child process exits unexpectedly"; + unused_result_ok = write(2, msg, sizeof(msg)); + _exit(EXIT_FAILURE); +} + static void *open_ro_regular_file(const struct factory *factory, struct fdesc fdescs[], int argc, char ** argv) { struct arg file = decode_arg("file", factory->params, argc, argv); struct arg offset = decode_arg("offset", factory->params, argc, argv); + struct arg lease_r = decode_arg("read-lease", factory->params, argc, argv); int fd = open(ARG_STRING(file), O_RDONLY); if (fd < 0) @@ -344,6 +369,16 @@ static void *open_ro_regular_file(const struct factory *factory, struct fdesc fd } free_arg(&offset); + if (ARG_BOOLEAN(lease_r)) { + if (fcntl(fd, F_SETLEASE, F_RDLCK) < 0) { + int e = errno; + close(fd); + errno = e; + err(EXIT_FAILURE, "failed to take out a read lease"); + } + } + free_arg(&lease_r); + if (fd != fdescs[0].fd) { if (dup2(fd, fdescs[0].fd) < 0) { int e = errno; @@ -363,6 +398,365 @@ static void *open_ro_regular_file(const struct factory *factory, struct fdesc fd return NULL; } +static void unlink_and_close_fdesc(int fd, void *data) +{ + char *fname = data; + + unlink(fname); + close(fd); +} + +typedef void (*lockFn)(int fd, const char *fname, int dupfd); + +static void lock_fn_none(int fd _U_, const char *fname _U_, int dupfd _U_) +{ + /* Do nothing */ +} + +static void lock_fn_flock_sh(int fd, const char *fname, int dupfd) +{ + if (flock(fd, LOCK_SH) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_flock_ex(int fd, const char *fname, int dupfd) +{ + if (flock(fd, LOCK_EX) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_posix_r_(int fd, const char *fname, int dupfd) +{ + struct flock r = { + .l_type = F_RDLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + }; + if (fcntl(fd, F_SETLK, &r) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_posix__w(int fd, const char *fname, int dupfd) +{ + struct flock w = { + .l_type = F_WRLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + }; + if (fcntl(fd, F_SETLK, &w) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_posix_rw(int fd, const char *fname, int dupfd) +{ + struct flock r = { + .l_type = F_RDLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + }; + struct flock w = { + .l_type = F_WRLCK, + .l_whence = SEEK_SET, + .l_start = 2, + .l_len = 1, + }; + if (fcntl(fd, F_SETLK, &r) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock(read)"); + } + if (fcntl(fd, F_SETLK, &w) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock(write)"); + } +} + +#ifdef F_OFD_SETLK +static void lock_fn_ofd_r_(int fd, const char *fname, int dupfd) +{ + struct flock r = { + .l_type = F_RDLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + .l_pid = 0, + }; + if (fcntl(fd, F_OFD_SETLK, &r) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_ofd__w(int fd, const char *fname, int dupfd) +{ + struct flock w = { + .l_type = F_WRLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + .l_pid = 0, + }; + if (fcntl(fd, F_OFD_SETLK, &w) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock"); + } +} + +static void lock_fn_ofd_rw(int fd, const char *fname, int dupfd) +{ + struct flock r = { + .l_type = F_RDLCK, + .l_whence = SEEK_SET, + .l_start = 0, + .l_len = 1, + .l_pid = 0, + }; + struct flock w = { + .l_type = F_WRLCK, + .l_whence = SEEK_SET, + .l_start = 2, + .l_len = 1, + .l_pid = 0, + }; + if (fcntl(fd, F_OFD_SETLK, &r) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock(read)"); + } + if (fcntl(fd, F_OFD_SETLK, &w) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to lock(write)"); + } +} +#endif /* F_OFD_SETLK */ + +static void lock_fn_lease_w(int fd, const char *fname, int dupfd) +{ + if (fcntl(fd, F_SETLEASE, F_WRLCK) < 0) { + int e = errno; + close(fd); + close(dupfd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to take out a write lease"); + } +} + + +static void *make_w_regular_file(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + int fd; + + struct arg file = decode_arg("file", factory->params, argc, argv); + char *fname = xstrdup(ARG_STRING(file)); + + struct arg delete = decode_arg("delete", factory->params, argc, argv); + bool bDelete = ARG_BOOLEAN(delete); + + struct arg write_bytes = decode_arg("write-bytes", factory->params, argc, argv); + int iWrite_bytes = ARG_INTEGER(write_bytes); + + struct arg readable = decode_arg("readable", factory->params, argc, argv); + bool bReadable = ARG_BOOLEAN(readable); + + struct arg lock = decode_arg("lock", factory->params, argc, argv); + const char *sLock = ARG_STRING(lock); + lockFn lock_fn; + + struct arg dupfd = decode_arg("dupfd", factory->params, argc, argv); + int iDupfd = ARG_INTEGER(dupfd); + + void *data = NULL; + + if (iWrite_bytes < 0) + errx(EXIT_FAILURE, "write-bytes must be a positive number or zero."); + + if (strcmp(sLock, "none") == 0) + lock_fn = lock_fn_none; + else if (strcmp(sLock, "flock-sh") == 0) + lock_fn = lock_fn_flock_sh; + else if (strcmp(sLock, "flock-ex") == 0) + lock_fn = lock_fn_flock_ex; + else if (strcmp(sLock, "posix-r-") == 0) { + bReadable = true; + if (iWrite_bytes < 1) + iWrite_bytes = 1; + lock_fn = lock_fn_posix_r_; + } else if (strcmp(sLock, "posix--w") == 0) { + if (iWrite_bytes < 1) + iWrite_bytes = 1; + lock_fn = lock_fn_posix__w; + } else if (strcmp(sLock, "posix-rw") == 0) { + bReadable = true; + if (iWrite_bytes < 3) + iWrite_bytes = 3; + lock_fn = lock_fn_posix_rw; +#ifdef F_OFD_SETLK + } else if (strcmp(sLock, "ofd-r-") == 0) { + bReadable = true; + if (iWrite_bytes < 1) + iWrite_bytes = 1; + lock_fn = lock_fn_ofd_r_; + } else if (strcmp(sLock, "ofd--w") == 0) { + if (iWrite_bytes < 1) + iWrite_bytes = 1; + lock_fn = lock_fn_ofd__w; + } else if (strcmp(sLock, "ofd-rw") == 0) { + bReadable = true; + if (iWrite_bytes < 3) + iWrite_bytes = 3; + lock_fn = lock_fn_ofd_rw; +#else + } else if (strcmp(sLock, "ofd-r-") == 0 + || strcmp(sLock, "ofd--w") == 0 + || strcmp(sLock, "ofd-rw") == 0) { + errx(EXIT_ENOSYS, "no availability for ofd lock"); +#endif /* F_OFD_SETLK */ + } else if (strcmp(sLock, "lease-w") == 0) + lock_fn = lock_fn_lease_w; + else + errx(EXIT_FAILURE, "unexpected value for lock parameter: %s", sLock); + + free_arg(&dupfd); + free_arg(&lock); + free_arg(&readable); + free_arg(&write_bytes); + free_arg(&delete); + free_arg(&file); + + fd = open(fname, O_CREAT|O_EXCL|(bReadable? O_RDWR: O_WRONLY), S_IWUSR); + if (fd < 0) + err(EXIT_FAILURE, "failed to make: %s", fname); + + if (fd != fdescs[0].fd) { + if (dup2(fd, fdescs[0].fd) < 0) { + int e = errno; + close(fd); + unlink(fname); + free(fname); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", fd, fdescs[0].fd); + } + close(fd); + fd = fdescs[0].fd; + } + + if (bDelete) { + if (unlink(fname) < 0) { + int e = errno; + close(fd); + errno = e; + err(EXIT_FAILURE, "failed to unlink %s", fname); + } + free(fname); + fname = NULL; + } + + for (int i = 0; i < iWrite_bytes; i++) { + if (write(fd, "z", 1) != 1) { + int e = errno; + close(fd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed to write"); + } + } + + if (iDupfd >= 0) { + if (dup2(fd, iDupfd) < 0) { + int e = errno; + close(fd); + if (fname) + unlink(fname); + errno = e; + err(EXIT_FAILURE, "failed in dup2"); + } + data = xmalloc(sizeof(iDupfd)); + *((int *)data) = iDupfd; + } + + lock_fn(fd, fname, iDupfd); + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = bDelete? close_fdesc: unlink_and_close_fdesc, + .data = fname, + }; + + return data; +} + +static void free_after_closing_duplicated_fd(const struct factory * factory _U_, void *data) +{ + if (data) { + int *fdp = data; + close(*fdp); + free(data); + } +} + static void *make_pipe(const struct factory *factory, struct fdesc fdescs[], int argc, char ** argv) { @@ -552,6 +946,12 @@ static void *make_socketpair(const struct factory *factory, struct fdesc fdescs[ int sd[2]; struct arg socktype = decode_arg("socktype", factory->params, argc, argv); int isocktype; + struct arg halfclose = decode_arg("halfclose", factory->params, argc, argv); + bool bhalfclose; + + bhalfclose = ARG_BOOLEAN(halfclose); + free_arg(&halfclose); + if (strcmp(ARG_STRING(socktype), "STREAM") == 0) isocktype = SOCK_STREAM; else if (strcmp(ARG_STRING(socktype), "DGRAM") == 0) @@ -567,6 +967,15 @@ static void *make_socketpair(const struct factory *factory, struct fdesc fdescs[ if (socketpair(AF_UNIX, isocktype, 0, sd) < 0) err(EXIT_FAILURE, "failed to make socket pair"); + if (bhalfclose) { + if (shutdown(sd[0], SHUT_RD) < 0) + err(EXIT_FAILURE, + "failed to shutdown the read end of the 1st socket"); + if (shutdown(sd[1], SHUT_WR) < 0) + err(EXIT_FAILURE, + "failed to shutdown the write end of the 2nd socket"); + } + for (int i = 0; i < 2; i++) { if (sd[i] != fdescs[i].fd) { if (dup2(sd[i], fdescs[i].fd) < 0) { @@ -735,7 +1144,7 @@ static void *make_mmapped_packet_socket(const struct factory *factory, struct fd "failed to specify a buffer spec to a packet socket"); } - munmap_data = xmalloc(sizeof (*munmap_data)); + munmap_data = xmalloc(sizeof(*munmap_data)); munmap_data->len = (size_t) req.tp_block_size * req.tp_block_nr; munmap_data->ptr = mmap(NULL, munmap_data->len, PROT_WRITE, MAP_SHARED, sd, 0); if (munmap_data->ptr == MAP_FAILED) { @@ -775,8 +1184,7 @@ static void *make_pidfd(const struct factory *factory, struct fdesc fdescs[], int fd = pidfd_open(pid, 0); if (fd < 0) - err((errno == ENOSYS? EXIT_ENOSYS: EXIT_FAILURE), - "failed in pidfd_open(%d)", (int)pid); + err_nosys(EXIT_FAILURE, "failed in pidfd_open(%d)", (int)pid); free_arg(&target_pid); if (fd != fdescs[0].fd) { @@ -801,10 +1209,31 @@ static void *make_pidfd(const struct factory *factory, struct fdesc fdescs[], static void *make_inotify_fd(const struct factory *factory _U_, struct fdesc fdescs[], int argc _U_, char ** argv _U_) { + struct arg dir = decode_arg("dir", factory->params, argc, argv); + const char *sdir = ARG_STRING(dir); + struct arg file = decode_arg("file", factory->params, argc, argv); + const char *sfile = ARG_STRING(file); + int fd = inotify_init(); if (fd < 0) err(EXIT_FAILURE, "failed in inotify_init()"); + if (inotify_add_watch(fd, sdir, IN_DELETE) < 0) { + int e = errno; + close(fd); + errno = e; + err(EXIT_FAILURE, "failed in inotify_add_watch(\"%s\")", sdir); + } + free_arg(&dir); + + if (inotify_add_watch(fd, sfile, IN_DELETE) < 0) { + int e = errno; + close(fd); + errno = e; + err(EXIT_FAILURE, "failed in inotify_add_watch(\"%s\")", sfile); + } + free_arg(&file); + if (fd != fdescs[0].fd) { if (dup2(fd, fdescs[0].fd) < 0) { int e = errno; @@ -1670,7 +2099,7 @@ static void *make_ping_common(const struct factory *factory, struct fdesc fdescs sd = socket(family, SOCK_DGRAM, protocol); if (sd < 0) - err((errno == EACCES? EXIT_EACCESS: EXIT_FAILURE), + err((errno == EACCES? EXIT_EACCES: EXIT_FAILURE), "failed to make an icmp socket"); if (sd != fdescs[0].fd) { @@ -1690,7 +2119,7 @@ static void *make_ping_common(const struct factory *factory, struct fdesc fdescs int e = errno; close(sd); errno = e; - err((errno == EACCES? EXIT_EACCESS: EXIT_FAILURE), + err((errno == EACCES? EXIT_EACCES: EXIT_FAILURE), "failed in bind(2)"); } } @@ -1809,6 +2238,7 @@ static void *make_ping6(const struct factory *factory, struct fdesc fdescs[], (struct sockaddr *)&in6); } +#ifdef SIOCGSKNS static void *make_netns(const struct factory *factory _U_, struct fdesc fdescs[], int argc _U_, char ** argv _U_) { @@ -1818,8 +2248,7 @@ static void *make_netns(const struct factory *factory _U_, struct fdesc fdescs[] int ns = ioctl(sd, SIOCGSKNS); if (ns < 0) - err((errno == ENOSYS? EXIT_ENOSYS: EXIT_FAILURE), - "failed in ioctl(SIOCGSKNS)"); + err_nosys(EXIT_FAILURE, "failed in ioctl(SIOCGSKNS)"); close(sd); if (ns != fdescs[0].fd) { @@ -1840,6 +2269,7 @@ static void *make_netns(const struct factory *factory _U_, struct fdesc fdescs[] return NULL; } +#endif /* SIOCGSKNS */ static void *make_netlink(const struct factory *factory, struct fdesc fdescs[], int argc, char ** argv) @@ -1887,6 +2317,952 @@ static void *make_netlink(const struct factory *factory, struct fdesc fdescs[], return NULL; } +static void *make_eventfd(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + int fd; + pid_t *pid = xcalloc(1, sizeof(*pid)); + + if (fdescs[0].fd == fdescs[1].fd) + errx(EXIT_FAILURE, "specify three different numbers as file descriptors"); + + fd = eventfd(0, 0); + if (fd < 0) + err(EXIT_FAILURE, "failed in eventfd(2)"); + + if (fd != fdescs[0].fd) { + if (dup2(fd, fdescs[0].fd) < 0) { + int e = errno; + close(fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", fd, fdescs[0].fd); + } + close(fd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + if (dup2(fdescs[0].fd, fdescs[1].fd) < 0) { + int e = errno; + close(fdescs[0].fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", fdescs[0].fd, fdescs[1].fd); + } + + signal(SIGCHLD, abort_with_child_death_message); + *pid = fork(); + if (*pid < -1) { + int e = errno; + close(fdescs[0].fd); + close(fdescs[1].fd); + errno = e; + err(EXIT_FAILURE, "failed in fork()"); + } else if (*pid == 0) { + uint64_t v = 1; + + free(pid); + close(fdescs[0].fd); + + signal(SIGCONT, do_nothing); + /* Notify the parent that I'm ready. */ + if (write(fdescs[1].fd, &v, sizeof(v)) != sizeof(v)) { + close(fdescs[1].fd); + err(EXIT_FAILURE, + "failed in write() to notify the readiness to the prent"); + } + /* Wait till the parent lets me go. */ + pause(); + + close(fdescs[1].fd); + exit(0); + } else { + uint64_t v; + + /* The child owns fdescs[1]. */ + close(fdescs[1].fd); + fdescs[1].fd = -1; + + /* Wait till the child is ready. */ + if (read(fdescs[0].fd, &v, sizeof(uint64_t)) != sizeof(v)) { + free(pid); + close(fdescs[0].fd); + err(EXIT_FAILURE, + "failed in read() the readiness notification from the child"); + } + signal(SIGCHLD, SIG_DFL); + } + + return pid; +} + +static void report_eventfd(const struct factory *factory _U_, + int nth, void *data, FILE *fp) +{ + if (nth == 0) { + pid_t *child = data; + fprintf(fp, "%d", *child); + } +} + +static void free_eventfd(const struct factory * factory _U_, void *data) +{ + pid_t child = *(pid_t *)data; + int wstatus; + + free(data); + + kill(child, SIGCONT); + if (waitpid(child, &wstatus, 0) < 0) + err(EXIT_FAILURE, "failed in waitpid()"); + + if (WIFEXITED(wstatus)) { + int s = WEXITSTATUS(wstatus); + if (s != 0) + err(EXIT_FAILURE, "the child process got an error: %d", s); + } else if (WIFSIGNALED(wstatus)) { + int s = WTERMSIG(wstatus); + if (WTERMSIG(wstatus) != 0) + err(EXIT_FAILURE, "the child process got a signal: %d", s); + } +} + +struct mqueue_data { + pid_t pid; + const char *path; + bool created; +}; + +static void mqueue_data_free(struct mqueue_data *data) +{ + if (data->created) + mq_unlink(data->path); + free((void *)data->path); + free(data); +} + +static void report_mqueue(const struct factory *factory _U_, + int nth, void *data, FILE *fp) +{ + if (nth == 0) { + fprintf(fp, "%d", ((struct mqueue_data *)data)->pid); + } +} + +static void close_mqueue(int fd, void *data _U_) +{ + mq_close(fd); +} + +static void free_mqueue(const struct factory * factory _U_, void *data) +{ + struct mqueue_data *mqueue_data = data; + pid_t child = mqueue_data->pid; + int wstatus; + + mqueue_data_free(mqueue_data); + + kill(child, SIGCONT); + if (waitpid(child, &wstatus, 0) < 0) + err(EXIT_FAILURE, "failed in waitpid()"); + + if (WIFEXITED(wstatus)) { + int s = WEXITSTATUS(wstatus); + if (s != 0) + err(EXIT_FAILURE, "the child process got an error: %d", s); + } else if (WIFSIGNALED(wstatus)) { + int s = WTERMSIG(wstatus); + if (WTERMSIG(wstatus) != 0) + err(EXIT_FAILURE, "the child process got a signal: %d", s); + } +} + +static void *make_mqueue(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + struct mqueue_data *mqueue_data; + struct arg path = decode_arg("path", factory->params, argc, argv); + const char *spath = ARG_STRING(path); + + struct mq_attr attr = { + .mq_maxmsg = 1, + .mq_msgsize = 1, + }; + + int fd; + + if (spath[0] != '/') + errx(EXIT_FAILURE, "the path for mqueue must start with '/': %s", spath); + + if (spath[0] == '\0') + err(EXIT_FAILURE, "the path should not be empty"); + + if (fdescs[0].fd == fdescs[1].fd) + errx(EXIT_FAILURE, "specify three different numbers as file descriptors"); + + mqueue_data = xmalloc(sizeof(*mqueue_data)); + mqueue_data->pid = 0; + mqueue_data->path = xstrdup(spath); + mqueue_data->created = false; + + free_arg(&path); + + fd = mq_open(mqueue_data->path, O_CREAT|O_EXCL | O_RDONLY, S_IRUSR | S_IWUSR, &attr); + if (fd < 0) { + mqueue_data_free(mqueue_data); + err(EXIT_FAILURE, "failed in mq_open(3) for reading"); + } + + mqueue_data->created = true; + if (fd != fdescs[0].fd) { + if (dup2(fd, fdescs[0].fd) < 0) { + int e = errno; + mq_close(fd); + mqueue_data_free(mqueue_data); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", fd, fdescs[0].fd); + } + mq_close(fd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_mqueue, + .data = NULL + }; + + fd = mq_open(mqueue_data->path, O_WRONLY, S_IRUSR | S_IWUSR, NULL); + if (fd < 0) { + int e = errno; + mq_close(fdescs[0].fd); + mqueue_data_free(mqueue_data); + errno = e; + err(EXIT_FAILURE, "failed in mq_open(3) for writing"); + } + + if (fd != fdescs[1].fd) { + if (dup2(fd, fdescs[1].fd) < 0) { + int e = errno; + mq_close(fd); + mq_close(fdescs[0].fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", fd, fdescs[1].fd); + } + mq_close(fd); + } + fdescs[1] = (struct fdesc){ + .fd = fdescs[1].fd, + .close = close_mqueue, + .data = NULL + }; + + signal(SIGCHLD, abort_with_child_death_message); + mqueue_data->pid = fork(); + if (mqueue_data->pid < -1) { + int e = errno; + mq_close(fdescs[0].fd); + mq_close(fdescs[1].fd); + mqueue_data_free(mqueue_data); + errno = e; + err(EXIT_FAILURE, "failed in fork()"); + } else if (mqueue_data->pid == 0) { + mqueue_data->created = false; + mqueue_data_free(mqueue_data); + mq_close(fdescs[0].fd); + + signal(SIGCONT, do_nothing); + /* Notify the parent that I'm ready. */ + if (mq_send(fdescs[1].fd, "", 0, 0) < 0) + err(EXIT_FAILURE, + "failed in mq_send() to notify the readiness to the prent"); + /* Wait till the parent lets me go. */ + pause(); + + mq_close(fdescs[1].fd); + exit(0); + } else { + char c; + + /* The child owns fdescs[1]. */ + mq_close(fdescs[1].fd); + fdescs[1].fd = -1; + + /* Wait till the child is ready. */ + if (mq_receive(fdescs[0].fd, &c, 1, NULL) < 0) { + mq_close(fdescs[0].fd); + mqueue_data_free(mqueue_data); + err(EXIT_FAILURE, + "failed in mq_receive() the readiness notification from the child"); + } + signal(SIGCHLD, SIG_DFL); + } + + return mqueue_data; +} +struct sysvshm_data { + void *addr; + int id; +}; + +static void *make_sysvshm(const struct factory *factory _U_, struct fdesc fdescs[] _U_, + int argc _U_, char ** argv _U_) +{ + size_t pagesize = getpagesize(); + struct sysvshm_data *sysvshm_data; + int id = shmget(IPC_PRIVATE, pagesize, IPC_CREAT | 0600); + void *start; + + if (id == -1) + err(EXIT_FAILURE, "failed to do shmget(.., %zu, ...)", + pagesize); + + start = shmat(id, NULL, SHM_RDONLY); + if (start == (void *) -1) { + int e = errno; + shmctl(id, IPC_RMID, NULL); + errno = e; + err(EXIT_FAILURE, "failed to do shmat(%d,...)", id); + } + + sysvshm_data = xmalloc(sizeof(*sysvshm_data)); + sysvshm_data->addr = start; + sysvshm_data->id = id; + return sysvshm_data; +} + +static void free_sysvshm(const struct factory *factory _U_, void *data) +{ + struct sysvshm_data *sysvshm_data = data; + + shmdt(sysvshm_data->addr); + shmctl(sysvshm_data->id, IPC_RMID, NULL); +} + +static void *make_eventpoll(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + int efd; + struct spec { + const char *file; + int flag; + uint32_t events; + } specs [] = { + { + .file = "DUMMY, DONT'USE THIS" + }, { + .file = "/dev/random", + .flag = O_RDONLY, + .events = EPOLLIN, + }, { + .file = "/dev/random", + .flag = O_WRONLY, + .events = EPOLLOUT, + }, + }; + + efd = epoll_create(1); + if (efd < 0) + err(EXIT_FAILURE, "failed in epoll_create(2)"); + if (efd != fdescs[0].fd) { + if (dup2(efd, fdescs[0].fd) < 0) { + int e = errno; + close(efd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", efd, fdescs[0].fd); + } + close(efd); + efd = fdescs[0].fd; + } + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + for (size_t i = 1; i < ARRAY_SIZE(specs); i++) { + int fd = open(specs[i].file, specs[i].flag); + if (fd < 0) { + int e = errno; + close(efd); + for (size_t j = i - 1; j > 0; j--) + close(fdescs[j].fd); + errno = e; + err(EXIT_FAILURE, "failed in open(\"%s\",...)", + specs[i].file); + } + if (fd != fdescs[i].fd) { + if (dup2(fd, fdescs[i].fd) < 0) { + int e = errno; + close(efd); + for (size_t j = i - 1; j > 0; j--) + close(fdescs[j].fd); + close(fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", + fd, fdescs[i].fd); + } + close(fd); + } + fdescs[i] = (struct fdesc) { + .fd = fdescs[i].fd, + .close = close_fdesc, + .data = NULL + }; + if (epoll_ctl(efd, EPOLL_CTL_ADD, fdescs[i].fd, + &(struct epoll_event) { + .events = specs[i].events, + .data = {.ptr = NULL,} + }) < 0) { + int e = errno; + close(efd); + for (size_t j = i; j > 0; j--) + close(fdescs[j].fd); + errno = e; + err(EXIT_FAILURE, + "failed to add fd %d to the eventpoll fd with epoll_ctl", + fdescs[i].fd); + } + } + + return NULL; +} + +static bool decode_clockid(const char *sclockid, clockid_t *clockid) +{ + if (sclockid == NULL) + return false; + if (sclockid[0] == '\0') + return false; + + if (strcmp(sclockid, "realtime") == 0) + *clockid = CLOCK_REALTIME; + else if (strcmp(sclockid, "monotonic") == 0) + *clockid = CLOCK_MONOTONIC; + else if (strcmp(sclockid, "boottime") == 0) + *clockid = CLOCK_BOOTTIME; + else if (strcmp(sclockid, "realtime-alarm") == 0) + *clockid = CLOCK_REALTIME_ALARM; + else if (strcmp(sclockid, "boottime-alarm") == 0) + *clockid = CLOCK_BOOTTIME_ALARM; + else + return false; + return true; +} + +static void *make_timerfd(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + int tfd; + struct timespec now; + struct itimerspec tspec; + + struct arg abstime = decode_arg("abstime", factory->params, argc, argv); + bool babstime = ARG_BOOLEAN(abstime); + + struct arg remaining = decode_arg("remaining", factory->params, argc, argv); + unsigned int uremaining = ARG_UINTEGER(remaining); + + struct arg interval = decode_arg("interval", factory->params, argc, argv); + unsigned int uinterval = ARG_UINTEGER(interval); + + struct arg interval_frac = decode_arg("interval-nanofrac", factory->params, argc, argv); + unsigned int uinterval_frac = ARG_UINTEGER(interval_frac); + + struct arg clockid_ = decode_arg("clockid", factory->params, argc, argv); + const char *sclockid = ARG_STRING(clockid_); + clockid_t clockid; + + if (decode_clockid (sclockid, &clockid) == false) + err(EXIT_FAILURE, "unknown clockid: %s", sclockid); + + free_arg(&clockid_); + free_arg(&interval_frac); + free_arg(&interval); + free_arg(&remaining); + free_arg(&abstime); + + if (babstime) { + int r = clock_gettime(clockid, &now); + if (r == -1) + err(EXIT_FAILURE, "failed in clock_gettime(2)"); + } + + tfd = timerfd_create(clockid, 0); + if (tfd < 0) + err(EXIT_FAILURE, "failed in timerfd_create(2)"); + + tspec.it_value.tv_sec = (babstime? now.tv_sec: 0) + uremaining; + tspec.it_value.tv_nsec = (babstime? now.tv_nsec: 0); + + tspec.it_interval.tv_sec = uinterval; + tspec.it_interval.tv_nsec = uinterval_frac; + + if (timerfd_settime(tfd, babstime? TFD_TIMER_ABSTIME: 0, &tspec, NULL) < 0) { + int e = errno; + close(tfd); + errno = e; + err(EXIT_FAILURE, "failed in timerfd_settime(2)"); + } + + if (tfd != fdescs[0].fd) { + if (dup2(tfd, fdescs[0].fd) < 0) { + int e = errno; + close(tfd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", tfd, fdescs[0].fd); + } + close(tfd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return NULL; +} + +static void *make_signalfd(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + sigset_t mask; + int numsig = 42; + + if (sigemptyset(&mask) < 0) + err(EXIT_FAILURE, "failed in sigemptyset()"); + if (sigaddset(&mask, SIGFPE) < 0) + err(EXIT_FAILURE, "failed in sigaddset(FPE)"); + if (sigaddset(&mask, SIGUSR1) < 0) + err(EXIT_FAILURE, "failed in sigaddset(USR1)"); + if (sigaddset(&mask, numsig) < 0) + err(EXIT_FAILURE, "failed in sigaddset(%d)", numsig); + + int sfd= signalfd(-1, &mask, 0); + if (sfd < 0) + err(EXIT_FAILURE, "failed in signalfd(2)"); + + if (sfd != fdescs[0].fd) { + if (dup2(sfd, fdescs[0].fd) < 0) { + int e = errno; + close(sfd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", sfd, fdescs[0].fd); + } + close(sfd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return NULL; +} + + +/* ref. linux/Documentation/networking/tuntap.rst */ +static void *make_cdev_tun(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + int tfd = open("/dev/net/tun", O_RDWR); + struct ifreq ifr; + + if (tfd < 0) + err(EXIT_FAILURE, "failed in opening /dev/net/tun"); + + memset(&ifr, 0, sizeof(ifr)); + + ifr.ifr_flags = IFF_TUN; + strcpy(ifr.ifr_name, "mkfds%d"); + + if (ioctl(tfd, TUNSETIFF, (void *) &ifr) < 0) { + int e = errno; + close(tfd); + errno = e; + err(EXIT_FAILURE, "failed in setting \"lo\" to the tun device"); + } + + if (tfd != fdescs[0].fd) { + if (dup2(tfd, fdescs[0].fd) < 0) { + int e = errno; + close(tfd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", tfd, fdescs[0].fd); + } + close(tfd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return xstrdup(ifr.ifr_name); +} + +static void report_cdev_tun(const struct factory *factory _U_, + int nth, void *data, FILE *fp) +{ + if (nth == 0) { + char *devname = data; + fprintf(fp, "%s", devname); + } +} + +static void free_cdev_tun(const struct factory * factory _U_, void *data) +{ + free(data); +} + +static void *make_bpf_prog(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + struct arg prog_type_id = decode_arg("prog-type-id", factory->params, argc, argv); + int iprog_type_id = ARG_INTEGER(prog_type_id); + + struct arg name = decode_arg("name", factory->params, argc, argv); + const char *sname = ARG_STRING(name); + + int bfd; + union bpf_attr attr; + /* Just doing exit with 0. */ + struct bpf_insn insns[] = { + [0] = { + .code = BPF_ALU64 | BPF_MOV | BPF_K, + .dst_reg = BPF_REG_0, .src_reg = 0, .off = 0, .imm = 0 + }, + [1] = { + .code = BPF_JMP | BPF_EXIT, + .dst_reg = 0, .src_reg = 0, .off = 0, .imm = 0 + }, + }; + + memset(&attr, 0, sizeof(attr)); + attr.prog_type = iprog_type_id; + attr.insns = (uint64_t)(unsigned long)insns; + attr.insn_cnt = ARRAY_SIZE(insns); + attr.license = (int64_t)(unsigned long)"GPL"; + strncpy(attr.prog_name, sname, sizeof(attr.prog_name) - 1); + + free_arg(&name); + free_arg(&prog_type_id); + + bfd = syscall(SYS_bpf, BPF_PROG_LOAD, &attr, sizeof(attr)); + if (bfd < 0) + err_nosys(EXIT_FAILURE, "failed in bpf(BPF_PROG_LOAD)"); + + if (bfd != fdescs[0].fd) { + if (dup2(bfd, fdescs[0].fd) < 0) { + int e = errno; + close(bfd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", bfd, fdescs[0].fd); + } + close(bfd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return NULL; +} + +static void *make_some_pipes(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + /* Reserver fds before making pipes */ + for (int i = 0; i < factory->N; i++) { + close(fdescs[i].fd); + if (dup2(0, fdescs[0].fd) < 0) + err(EXIT_FAILURE, "failed to reserve fd %d with dup2", fdescs[0].fd); + } + + for (int i = 0; i < (factory->N) / 2; i++) { + int pd[2]; + unsigned int mode; + int r = 0, w = 1; + + mode = 1 << (i % 3); + if (mode == MX_WRITE) { + r = 1; + w = 0; + } + + if (pipe(pd) < 0) + err(EXIT_FAILURE, "failed to make pipe"); + + if (dup2(pd[0], fdescs[2 * i + r].fd) < 0) + err(EXIT_FAILURE, "failed to dup %d -> %d", pd[0], fdescs[2 * i + r].fd); + close(pd[0]); + fdescs[2 * 1 + r].close = close_fdesc; + + if (dup2(pd[1], fdescs[2 * i + w].fd) < 0) + err(EXIT_FAILURE, "failed to dup %d -> %d", pd[1], fdescs[2 * i + 2].fd); + close(pd[1]); + fdescs[2 * 1 + w].close = close_fdesc; + + fdescs[2 * i].mx_modes |= mode; + + /* Make the pipe for writing full. */ + if (fdescs[2 * i].mx_modes & MX_WRITE) { + int n = fcntl(fdescs[2 * i].fd, F_GETPIPE_SZ); + char *buf; + + if (n < 0) + err(EXIT_FAILURE, "failed to get PIPE BUFFER SIZE from %d", fdescs[2 * i].fd); + + buf = xmalloc(n); + if (write(fdescs[2 * i].fd, buf, n) != n) + err(EXIT_FAILURE, "failed to fill the pipe buffer specified with %d", + fdescs[2 * i].fd); + free(buf); + } + + } + + return NULL; +} + +static void *make_bpf_map(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + struct arg map_type_id = decode_arg("map-type-id", factory->params, argc, argv); + int imap_type_id = ARG_INTEGER(map_type_id); + + struct arg name = decode_arg("name", factory->params, argc, argv); + const char *sname = ARG_STRING(name); + + int bfd; + union bpf_attr attr = { + .map_type = imap_type_id, + .key_size = 4, + .value_size = 4, + .max_entries = 10, + }; + + strncpy(attr.map_name, sname, sizeof(attr.map_name) - 1); + + free_arg(&name); + free_arg(&map_type_id); + + bfd = syscall(SYS_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); + if (bfd < 0) + err_nosys(EXIT_FAILURE, "failed in bpf(BPF_MAP_CREATE)"); + + if (bfd != fdescs[0].fd) { + if (dup2(bfd, fdescs[0].fd) < 0) { + int e = errno; + close(bfd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", bfd, fdescs[0].fd); + } + close(bfd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return NULL; +} + +static void *make_pty(const struct factory *factory _U_, struct fdesc fdescs[], + int argc _U_, char ** argv _U_) +{ + int index, *indexp; + char *pts; + int pts_fd; + int ptmx_fd = posix_openpt(O_RDWR); + if (ptmx_fd < 0) + err(EXIT_FAILURE, "failed in opening /dev/ptmx"); + + if (unlockpt(ptmx_fd) < 0) { + int e = errno; + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed in unlockpt()"); + } + + if (ioctl(ptmx_fd, TIOCGPTN, &index) < 0) { + int e = errno; + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed in ioctl(TIOCGPTN)"); + } + + pts = ptsname(ptmx_fd); + if (pts == NULL) { + int e = errno; + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed in ptsname()"); + } + + if (ptmx_fd != fdescs[0].fd) { + if (dup2(ptmx_fd, fdescs[0].fd) < 0) { + int e = errno; + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", ptmx_fd, fdescs[0].fd); + } + close(ptmx_fd); + ptmx_fd = fdescs[0].fd; + } + + pts_fd = open(pts, O_RDONLY); + if (pts_fd < 0) { + int e = errno; + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed in opening %s", pts); + } + + if (pts_fd != fdescs[1].fd) { + if (dup2(pts_fd, fdescs[1].fd) < 0) { + int e = errno; + close(pts_fd); + close(ptmx_fd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", pts_fd, fdescs[1].fd); + } + close(pts_fd); + pts_fd = fdescs[1].fd; + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + fdescs[1] = (struct fdesc){ + .fd = fdescs[1].fd, + .close = close_fdesc, + .data = NULL + }; + + indexp = xmalloc(sizeof(index)); + *indexp = index; + return indexp; +} + +static void report_pty(const struct factory *factory _U_, + int nth, void *data, FILE *fp) +{ + if (nth == 0) { + int *index = data; + fprintf(fp, "%d", *index); + } +} + +static void free_pty(const struct factory * factory _U_, void *data) +{ + free(data); +} + +static int send_diag_request(int diagsd, void *req, size_t req_size) +{ + struct sockaddr_nl nladdr = { + .nl_family = AF_NETLINK, + }; + + struct nlmsghdr nlh = { + .nlmsg_len = sizeof(nlh) + req_size, + .nlmsg_type = SOCK_DIAG_BY_FAMILY, + .nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP, + }; + + struct iovec iovecs[] = { + { &nlh, sizeof(nlh) }, + { req, req_size }, + }; + + const struct msghdr mhd = { + .msg_namelen = sizeof(nladdr), + .msg_name = &nladdr, + .msg_iovlen = ARRAY_SIZE(iovecs), + .msg_iov = iovecs, + }; + + if (sendmsg(diagsd, &mhd, 0) < 0) + return errno; + + return 0; +} + +static void *make_sockdiag(const struct factory *factory, struct fdesc fdescs[], + int argc, char ** argv) +{ + struct arg family = decode_arg("family", factory->params, argc, argv); + const char *sfamily = ARG_STRING(family); + int ifamily; + + if (strcmp(sfamily, "unix") == 0) + ifamily = AF_UNIX; + else + errx(EXIT_FAILURE, "unknown/unsupported family: %s", sfamily); + free_arg(&family); + + int diagsd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_SOCK_DIAG); + if (diagsd < 0) + err(errno == EPROTONOSUPPORT? EXIT_EPROTONOSUPPORT: EXIT_FAILURE, + "failed in sendmsg()"); + + void *req = NULL; + size_t reqlen = 0; + + struct unix_diag_req udr; + if (ifamily == AF_UNIX) { + udr = (struct unix_diag_req) { + .sdiag_family = AF_UNIX, + .udiag_states = -1, /* set the all bits. */ + .udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_PEER | UNIX_DIAG_SHUTDOWN, + }; + req = &udr; + reqlen = sizeof(udr); + } + + int e = send_diag_request(diagsd, req, reqlen); + if (e) { + close (diagsd); + errno = e; + if (errno == EACCES) + err(EXIT_EACCES, "failed in sendmsg()"); + if (errno == ENOENT) + err(EXIT_ENOENT, "failed in sendmsg()"); + err(EXIT_FAILURE, "failed in sendmsg()"); + } + + + if (diagsd != fdescs[0].fd) { + if (dup2(diagsd, fdescs[0].fd) < 0) { + int e = errno; + close(diagsd); + errno = e; + err(EXIT_FAILURE, "failed to dup %d -> %d", diagsd, fdescs[0].fd); + } + close(diagsd); + } + + fdescs[0] = (struct fdesc){ + .fd = fdescs[0].fd, + .close = close_fdesc, + .data = NULL + }; + + return NULL; +} + #define PARAM_END { .name = NULL, } static const struct factory factories[] = { { @@ -1909,6 +3285,60 @@ static const struct factory factories[] = { .desc = "seek bytes after open with SEEK_CUR", .defv.integer = 0, }, + { + .name = "read-lease", + .type = PTYPE_BOOLEAN, + .desc = "taking out read lease for the file", + .defv.boolean = false, + }, + PARAM_END + }, + }, + { + .name = "make-regular-file", + .desc = "regular file for writing", + .priv = false, + .N = 1, + .EX_N = 0, + .make = make_w_regular_file, + .free = free_after_closing_duplicated_fd, + .params = (struct parameter []) { + { + .name = "file", + .type = PTYPE_STRING, + .desc = "file to be made", + .defv.string = "./test_mkfds_make_regular_file", + }, + { + .name = "delete", + .type = PTYPE_BOOLEAN, + .desc = "delete the file just after making it", + .defv.boolean = false, + }, + { + .name = "write-bytes", + .type = PTYPE_INTEGER, + .desc = "write something (> 0)", + .defv.integer = 0, + }, + { + .name = "readable", + .type = PTYPE_BOOLEAN, + .desc = "open the new file readable way", + .defv.string = false, + }, + { + .name = "lock", + .type = PTYPE_STRING, + .desc = "the way for file locking: [none]|flock-sh|flock-ex|posix-r-|posix--w|posix-rw|ofd-r-|ofd--w|ofd-rw|lease-w", + .defv.string = "none", + }, + { + .name = "dupfd", + .type = PTYPE_INTEGER, + .desc = "the number for the fd duplicated from the original fd", + .defv.integer = -1, + }, PARAM_END }, }, @@ -1995,6 +3425,12 @@ static const struct factory factories[] = { .desc = "STREAM, DGRAM, or SEQPACKET", .defv.string = "STREAM", }, + { + .name = "halfclose", + .type = PTYPE_BOOLEAN, + .desc = "Shutdown the read end of the 1st socket, the write end of the 2nd socket", + .defv.boolean = false, + }, PARAM_END }, }, @@ -2080,6 +3516,18 @@ static const struct factory factories[] = { .EX_N = 0, .make = make_inotify_fd, .params = (struct parameter []) { + { + .name = "dir", + .type = PTYPE_STRING, + .desc = "the directory that the inotify monitors", + .defv.string = "/", + }, + { + .name = "file", + .type = PTYPE_STRING, + .desc = "the file that the inotify monitors", + .defv.string = "/etc/fstab", + }, PARAM_END }, }, @@ -2416,6 +3864,7 @@ static const struct factory factories[] = { PARAM_END } }, +#ifdef SIOCGSKNS { .name = "netns", .desc = "open a file specifying a netns", @@ -2427,6 +3876,7 @@ static const struct factory factories[] = { PARAM_END } }, +#endif { .name = "netlink", .desc = "AF_NETLINK sockets", @@ -2450,6 +3900,219 @@ static const struct factory factories[] = { PARAM_END } }, + { + .name = "eventfd", + .desc = "make an eventfd connecting two processes", + .priv = false, + .N = 2, + .EX_N = 0, + .EX_R = 1, + .make = make_eventfd, + .report = report_eventfd, + .free = free_eventfd, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "mqueue", + .desc = "make a mqueue connecting two processes", + .priv = false, + .N = 2, + .EX_N = 0, + .EX_R = 1, + .make = make_mqueue, + .report = report_mqueue, + .free = free_mqueue, + .params = (struct parameter []) { + { + .name = "path", + .type = PTYPE_STRING, + .desc = "path for mqueue", + .defv.string = "/test_mkfds-mqueue", + }, + PARAM_END + } + }, + { + .name = "sysvshm", + .desc = "shared memory mapped with SYSVIPC shmem syscalls", + .priv = false, + .N = 0, + .EX_N = 0, + .make = make_sysvshm, + .free = free_sysvshm, + .params = (struct parameter []) { + PARAM_END + }, + }, + { + .name = "eventpoll", + .desc = "make eventpoll (epoll) file", + .priv = false, + .N = 3, + .EX_N = 0, + .make = make_eventpoll, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "timerfd", + .desc = "make timerfd", + .priv = false, + .N = 1, + .EX_N = 0, + .make = make_timerfd, + .params = (struct parameter []) { + { + .name = "clockid", + .type = PTYPE_STRING, + .desc = "ID: realtime, monotonic, boottime, realtime-alarm, or boottime-alarm", + .defv.string = "realtime", + }, + { + .name = "abstime", + .type = PTYPE_BOOLEAN, + .desc = "use TFD_TIMER_ABSTIME flag", + .defv.boolean = false, + }, + { + .name = "remaining", + .type = PTYPE_UINTEGER, + .desc = "remaining seconds for expiration", + .defv.uinteger = 99, + }, + { + .name = "interval", + .type = PTYPE_UINTEGER, + .desc = "inteval in seconds", + .defv.uinteger = 10, + }, + { + .name = "interval-nanofrac", + .type = PTYPE_UINTEGER, + .desc = "nsec part of inteval", + .defv.uinteger = 0, + }, + + PARAM_END + } + }, + { + .name = "signalfd", + .desc = "make signalfd", + .priv = false, + .N = 1, + .EX_N = 0, + .make = make_signalfd, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "cdev-tun", + .desc = "open /dev/net/tun", + .priv = true, + .N = 1, + .EX_N = 0, + .EX_R = 1, + .make = make_cdev_tun, + .report = report_cdev_tun, + .free = free_cdev_tun, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "bpf-prog", + .desc = "make bpf-prog", + .priv = true, + .N = 1, + .EX_N = 0, + .make = make_bpf_prog, + .params = (struct parameter []) { + { + .name = "prog-type-id", + .type = PTYPE_INTEGER, + .desc = "program type by id", + .defv.integer = 1, + }, + { + .name = "name", + .type = PTYPE_STRING, + .desc = "name assigned to bpf prog object", + .defv.string = "mkfds_bpf_prog", + }, + PARAM_END + } + }, + { + .name = "multiplexing", + .desc = "making pipes monitored by multiplexers", + .priv = false, + .N = 12, + .EX_N = 0, + .make = make_some_pipes, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "bpf-map", + .desc = "make bpf-map", + .priv = true, + .N = 1, + .EX_N = 0, + .make = make_bpf_map, + .params = (struct parameter []) { + { + .name = "map-type-id", + .type = PTYPE_INTEGER, + .desc = "map type by id", + .defv.integer = 1, + }, + { + .name = "name", + .type = PTYPE_STRING, + .desc = "name assigned to the bpf map object", + .defv.string = "mkfds_bpf_map", + }, + PARAM_END + } + }, + { + .name = "pty", + .desc = "make a pair of ptmx and pts", + .priv = false, + .N = 2, + .EX_N = 0, + .EX_R = 1, + .make = make_pty, + .report = report_pty, + .free = free_pty, + .params = (struct parameter []) { + PARAM_END + } + }, + { + .name = "sockdiag", + .desc = "make a sockdiag netlink socket", + .priv = false, + .N = 1, + .EX_N = 0, + .make = make_sockdiag, + .params = (struct parameter []) { + { + .name = "family", + .type = PTYPE_STRING, + /* TODO: inet, inet6 */ + .desc = "name of a protocol family ([unix])", + .defv.string = "unix", + }, + PARAM_END + } + }, }; static int count_parameters(const struct factory *factory) @@ -2465,17 +4128,18 @@ static int count_parameters(const struct factory *factory) static void print_factory(const struct factory *factory) { - printf("%-20s %4s %5d %6d %s\n", + printf("%-20s %4s %5d %7d %6d %s\n", factory->name, factory->priv? "yes": "no", factory->N, + factory->EX_R + 1, count_parameters(factory), factory->desc); } static void list_factories(void) { - printf("%-20s PRIV COUNT NPARAM DESCRIPTION\n", "FACTORY"); + printf("%-20s PRIV COUNT NRETURN NPARAM DESCRIPTION\n", "FACTORY"); for (size_t i = 0; i < ARRAY_SIZE(factories); i++) print_factory(factories + i); } @@ -2533,25 +4197,146 @@ pidfd_open(pid_t pid _U_, unsigned int flags _U_) } #endif -static void wait_event(void) +/* + * Multiplexers + */ +struct multiplexer { + const char *name; + void (*fn)(bool, struct fdesc *fdescs, size_t n_fdescs); +}; + +#if defined(__NR_select) || defined(__NR_poll) +static void sighandler_nop(int si _U_) { - fd_set readfds; - sigset_t sigset; - int n = 0; + /* Do nothing */ +} +#endif - FD_ZERO(&readfds); - /* Monitor the standard input only when the process - * is in foreground. */ - if (tcgetpgrp(STDIN_FILENO) == getpgrp()) { - n = 1; - FD_SET(0, &readfds); +#define DEFUN_WAIT_EVENT_SELECT(NAME,SYSCALL,XDECLS,SETUP_SIG_HANDLER,SYSCALL_INVOCATION) \ + static void wait_event_##NAME(bool add_stdin, struct fdesc *fdescs, size_t n_fdescs) \ + { \ + fd_set readfds; \ + fd_set writefds; \ + fd_set exceptfds; \ + XDECLS \ + int n = 0; \ + \ + FD_ZERO(&readfds); \ + FD_ZERO(&writefds); \ + FD_ZERO(&exceptfds); \ + /* Monitor the standard input only when the process \ + * is in foreground. */ \ + if (add_stdin) { \ + n = 1; \ + FD_SET(0, &readfds); \ + } \ + \ + for (size_t i = 0; i < n_fdescs; i++) { \ + if (fdescs[i].mx_modes & MX_READ) { \ + n = max(n, fdescs[i].fd + 1); \ + FD_SET(fdescs[i].fd, &readfds); \ + } \ + if (fdescs[i].mx_modes & MX_WRITE) { \ + n = max(n, fdescs[i].fd + 1); \ + FD_SET(fdescs[i].fd, &writefds); \ + } \ + if (fdescs[i].mx_modes & MX_EXCEPT) { \ + n = max(n, fdescs[i].fd + 1); \ + FD_SET(fdescs[i].fd, &exceptfds); \ + } \ + } \ + \ + SETUP_SIG_HANDLER \ + \ + if (SYSCALL_INVOCATION < 0 \ + && errno != EINTR) \ + err(EXIT_FAILURE, "failed in " SYSCALL); \ } - sigemptyset(&sigset); +DEFUN_WAIT_EVENT_SELECT(default, + "pselect", + sigset_t sigset;, + sigemptyset(&sigset);, + pselect(n, &readfds, &writefds, &exceptfds, NULL, &sigset)) + +#ifdef __NR_pselect6 +DEFUN_WAIT_EVENT_SELECT(pselect6, + "pselect6", + sigset_t sigset;, + sigemptyset(&sigset);, + syscall(__NR_pselect6, n, &readfds, &writefds, &exceptfds, NULL, &sigset)) +#endif - if (pselect(n, &readfds, NULL, NULL, NULL, &sigset) < 0 - && errno != EINTR) - errx(EXIT_FAILURE, "failed in pselect"); +#ifdef __NR_select +DEFUN_WAIT_EVENT_SELECT(select, + "select", + , + signal(SIGCONT,sighandler_nop);, + syscall(__NR_select, n, &readfds, &writefds, &exceptfds, NULL)) +#endif + +#ifdef __NR_poll +static DEFUN_WAIT_EVENT_POLL(poll, + "poll", + , + signal(SIGCONT,sighandler_nop);, + syscall(__NR_poll, pfds, n, -1)) +#endif + +#define DEFAULT_MULTIPLEXER 0 +static struct multiplexer multiplexers [] = { + { + .name = "default", + .fn = wait_event_default, + }, +#ifdef __NR_pselect6 + { + .name = "pselect6", + .fn = wait_event_pselect6, + }, +#endif +#ifdef __NR_select + { + .name = "select", + .fn = wait_event_select, + }, +#endif +#ifdef __NR_poll + { + .name = "poll", + .fn = wait_event_poll, + }, +#endif +#ifdef __NR_ppoll + { + .name = "ppoll", + .fn = wait_event_ppoll, + }, +#endif +}; + +static struct multiplexer *lookup_multiplexer(const char *name) +{ + for (size_t i = 0; i < ARRAY_SIZE(multiplexers); i++) + if (strcmp(name, multiplexers[i].name) == 0) + return multiplexers + i; + return NULL; +} + +static void list_multiplexers(void) +{ + puts("NAME"); + for (size_t i = 0; i < ARRAY_SIZE(multiplexers); i++) + puts(multiplexers[i].name); +} + +static bool is_available(const char *factory) +{ + for (size_t i = 0; i < ARRAY_SIZE(factories); i++) + if (strcmp(factories[i].name, factory) == 0) + return true; + + return false; } int main(int argc, char **argv) @@ -2562,21 +4347,30 @@ int main(int argc, char **argv) bool quiet = false; bool cont = false; void *data; + bool monitor_stdin = true; + + struct multiplexer *wait_event = NULL; static const struct option longopts[] = { + { "is-available",required_argument,NULL, 'a' }, { "list", no_argument, NULL, 'l' }, { "parameters", required_argument, NULL, 'I' }, { "comm", required_argument, NULL, 'r' }, { "quiet", no_argument, NULL, 'q' }, + { "dont-monitor-stdin", no_argument, NULL, 'X' }, { "dont-puase", no_argument, NULL, 'c' }, + { "wait-with", required_argument, NULL, 'w' }, + { "multiplexers",no_argument,NULL, 'W' }, { "help", no_argument, NULL, 'h' }, { NULL, 0, NULL, 0 }, }; - while ((c = getopt_long(argc, argv, "lhqcI:r:", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "a:lhqcI:r:w:WX", longopts, NULL)) != -1) { switch (c) { case 'h': usage(stdout, EXIT_SUCCESS); + case 'a': + exit(is_available(optarg)? 0: 1); case 'l': list_factories(); exit(EXIT_SUCCESS); @@ -2589,9 +4383,20 @@ int main(int argc, char **argv) case 'c': cont = true; break; + case 'w': + wait_event = lookup_multiplexer(optarg); + if (wait_event == NULL) + errx(EXIT_FAILURE, "unknown multiplexer: %s", optarg); + break; + case 'W': + list_multiplexers(); + exit(EXIT_SUCCESS); case 'r': rename_self(optarg); break; + case 'X': + monitor_stdin = false; + break; default: usage(stderr, EXIT_FAILURE); } @@ -2600,6 +4405,11 @@ int main(int argc, char **argv) if (optind == argc) errx(EXIT_FAILURE, "no file descriptor specification given"); + if (cont && wait_event) + errx(EXIT_FAILURE, "don't specify both -c/--dont-puase and -w/--wait-with options"); + if (wait_event == NULL) + wait_event = multiplexers + DEFAULT_MULTIPLEXER; + factory = find_factory(argv[optind]); if (!factory) errx(EXIT_FAILURE, "no such factory: %s", argv[optind]); @@ -2615,6 +4425,7 @@ int main(int argc, char **argv) for (int i = 0; i < MAX_N; i++) { fdescs[i].fd = -1; + fdescs[i].mx_modes = 0; fdescs[i].close = NULL; } @@ -2645,21 +4456,26 @@ int main(int argc, char **argv) if (!quiet) { printf("%d", getpid()); + if (factory->report) { + for (int i = 0; i < factory->EX_R; i++) { + putchar(' '); + factory->report(factory, i, data, stdout); + } + } putchar('\n'); - if (factory->report) - factory->report(factory, data, stdout); fflush(stdout); } if (!cont) - wait_event(); + wait_event->fn(monitor_stdin, + fdescs, factory->N + factory->EX_N); for (int i = 0; i < factory->N + factory->EX_N; i++) if (fdescs[i].fd >= 0 && fdescs[i].close) fdescs[i].close(fdescs[i].fd, fdescs[i].data); if (factory->free) - factory->free (factory, data); + factory->free(factory, data); exit(EXIT_SUCCESS); } diff --git a/tests/helpers/test_mkfds.h b/tests/helpers/test_mkfds.h new file mode 100644 index 0000000..7d679b4 --- /dev/null +++ b/tests/helpers/test_mkfds.h @@ -0,0 +1,85 @@ +/* + * test_mkfds - make various file descriptors + * + * Written by Masatake YAMATO <yamato@redhat.com> + * + * This program 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. + * + * This program is distributed in the hope that it would 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef TEST_MKFDS_H +#define TEST_MKFDS_H + +#include <asm/unistd.h> +#include <stdbool.h> +#include <stddef.h> + +enum multiplexing_mode { + MX_READ = 1 << 0, + MX_WRITE = 1 << 1, + MX_EXCEPT = 1 << 2, +}; + +struct fdesc { + int fd; + void (*close)(int, void *); + unsigned int mx_modes; + void *data; +}; + +#define DEFUN_WAIT_EVENT_POLL(NAME,SYSCALL,XDECLS,SETUP_SIG_HANDLER,SYSCALL_INVOCATION) \ + void wait_event_##NAME(bool add_stdin, struct fdesc *fdescs, size_t n_fdescs) \ + { \ + int n = add_stdin? 1: 0; \ + int n0 = 0; \ + struct pollfd *pfds = NULL; \ + \ + XDECLS \ + \ + for (size_t i = 0; i < n_fdescs; i++) \ + if (fdescs[i].mx_modes) \ + n++; \ + \ + pfds = xcalloc(n, sizeof(pfds[0])); \ + \ + for (size_t i = 0; i < n_fdescs; i++) { \ + if (!fdescs[i].mx_modes) \ + continue; \ + pfds[n0].fd = fdescs[i].fd; \ + if (fdescs[i].mx_modes & MX_READ) \ + pfds[n0].events |= POLLIN; \ + if (fdescs[i].mx_modes & MX_WRITE) \ + pfds[n0].events |= POLLOUT; \ + if (fdescs[i].mx_modes & MX_EXCEPT) \ + pfds[n0].events |= POLLHUP; \ + n0++; \ + } \ + \ + if (add_stdin) { \ + pfds[n0].fd = 0; \ + pfds[n0].events |= POLLIN; \ + } \ + \ + SETUP_SIG_HANDLER \ + \ + if (SYSCALL_INVOCATION < 0 \ + && errno != EINTR) \ + err(EXIT_FAILURE, "failed in " SYSCALL); \ + free(pfds); \ + } + +#ifdef __NR_ppoll +void wait_event_ppoll(bool add_stdin, struct fdesc *fdescs, size_t n_fdescs); +#endif + +#endif /* TEST_MKFDS_H */ diff --git a/tests/helpers/test_mkfds_ppoll.c b/tests/helpers/test_mkfds_ppoll.c new file mode 100644 index 0000000..33d5aa8 --- /dev/null +++ b/tests/helpers/test_mkfds_ppoll.c @@ -0,0 +1,79 @@ +/* + * test_mkfds_ppoll.c - call ppoll(2) DIRECTLY + * + * Written by Masatake YAMATO <yamato@redhat.com> + * + * This program 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. + * + * This program is distributed in the hope that it would 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +/* Why this ppoll multiplexer must be defined here? + * + * Glibc defines sigset_t its own way. However, it is not what kernel + * expects. + * + * If an applicaiton uses the glibc's sigset_t via ppoll(2) wrapper, + * there is no problem; the wrapper function may translate the glibc's + * sigset_t to what kernel expects. + * + * Here, we want to ppoll(2) directly. In this case, the glibc's sigset_t + * becomes an issue. To use ppoll(2) directly, we have to include <asm/poll.h>. + * Including both <poll.h> provided by glibc and <asm/poll.h> provided by kernel + * causes "redefined ***" errors. + * + * This file is for defining the poll multiplexer only with <asm/poll.h>. + * + */ +#include "test_mkfds.h" + +#include <string.h> /* memset */ +#include <err.h> /* err */ +#include <errno.h> /* EINTR */ +#include <linux/poll.h> /* struct pollfd */ +#include <asm/signal.h> /* sigset_t */ + +extern long syscall(long number, ...); +extern void *calloc(size_t nmemb, size_t size); +extern void free(void *ptr); + +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif +#ifndef XALLOC_EXIT_CODE +# define XALLOC_EXIT_CODE EXIT_FAILURE +#endif + +/* Copied from include/xalloc.h */ +static void *xcalloc(const size_t nelems, const size_t size) +{ + void *ret = calloc(nelems, size); + + if (!ret && size && nelems) + err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); + return ret; +} + +/* sigemptyset may not be defiend and/or declared in asm/signal.h */ +static void clear_sigset(sigset_t *sigset) +{ + memset(sigset, 0, sizeof(*sigset)); +} + +#ifdef __NR_ppoll +DEFUN_WAIT_EVENT_POLL(ppoll, + "ppoll", + sigset_t sigset;, + clear_sigset(&sigset);, + syscall(__NR_ppoll, pfds, n, NULL, &sigset, sizeof(sigset))) +#endif diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c index 81fbdd7..c36aca2 100644 --- a/tests/helpers/test_sysinfo.c +++ b/tests/helpers/test_sysinfo.c @@ -25,6 +25,7 @@ #include <inttypes.h> #include <wchar.h> #include <errno.h> +#include <time.h> #include <sys/ioctl.h> #include <sys/mount.h> @@ -125,7 +126,13 @@ static int hlp_fsopen_ok(void) return 0; } -static mntHlpfnc hlps[] = +static int hlp_sz_time(void) +{ + printf("%zu\n", sizeof(time_t)); + return 0; +} + +static const mntHlpfnc hlps[] = { { "WORDSIZE", hlp_wordsize }, { "pagesize", hlp_pagesize }, @@ -139,13 +146,14 @@ static mntHlpfnc hlps[] = { "wcsspn-ok", hlp_wcsspn_ok }, { "enotty-ok", hlp_enotty_ok }, { "fsopen-ok", hlp_fsopen_ok }, + { "sz(time_t)", hlp_sz_time }, { NULL, NULL } }; int main(int argc, char **argv) { int re = 0; - mntHlpfnc *fn; + const mntHlpfnc *fn; if (argc == 1) { for (fn = hlps; fn->name; fn++) { diff --git a/tests/ts/blkid/images-fs/swap-luks.img.xz b/tests/ts/blkid/images-fs/swap-luks.img.xz Binary files differnew file mode 100644 index 0000000..9b5cb65 --- /dev/null +++ b/tests/ts/blkid/images-fs/swap-luks.img.xz diff --git a/tests/ts/blkid/images-fs/vxfs-be.img.xz b/tests/ts/blkid/images-fs/vxfs-be.img.xz Binary files differnew file mode 100644 index 0000000..61ff461 --- /dev/null +++ b/tests/ts/blkid/images-fs/vxfs-be.img.xz diff --git a/tests/ts/blkid/images-fs/vxfs-le.img.xz b/tests/ts/blkid/images-fs/vxfs-le.img.xz Binary files differnew file mode 100644 index 0000000..f4643a5 --- /dev/null +++ b/tests/ts/blkid/images-fs/vxfs-le.img.xz diff --git a/tests/ts/column/table b/tests/ts/column/table index 8b22d83..5d5e131 100755 --- a/tests/ts/column/table +++ b/tests/ts/column/table @@ -65,6 +65,13 @@ $TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \ >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest +ts_init_subtest "noheaders" +$TS_CMD_COLUMN --table $TS_SELF/files/table \ + --table-noheadings \ + --table-columns VERYLONG,COLUMN,NAMES \ + >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + ts_init_subtest "truncate" $TS_CMD_COLUMN --table $TS_SELF/files/mountinfo \ --table-columns ID,PARENT,MAJMIN,ROOT,TARGET,VFS-OPTS,PROP,SEP,TYPE,SOURCE,FS-OPTS \ diff --git a/tests/ts/dmesg/cid-input b/tests/ts/dmesg/cid-input new file mode 100644 index 0000000..7dbd89d --- /dev/null +++ b/tests/ts/dmesg/cid-input @@ -0,0 +1,106 @@ +<0>[ 0.000000] [ T0] example[0] +<1>[ 1.000000] [ T1] example[1] +<2>[ 8.000000] [ T2] example[2] +<3>[ 27.000000] [ T3] example[3] +<4>[ 64.000000] [ T4] example[4] +<5>[ 125.000000] [ T5] example[5] +<6>[ 216.000000] [ T6] example[6] +<7>[ 343.000000] [ T7] example[7] +<8>[ 512.000000] [ T8] example[8] +<9>[ 729.000000] [ T9] example[9] +<10>[ 1000.000000] [ T10] example[10] +<11>[ 1331.000000] [ T11] example[11] +<12>[ 1728.000000] [ T12] example[12] +<13>[ 2197.000000] [ T13] example[13] +<14>[ 2744.000000] [ T14] example[14] +<15>[ 3375.000000] [ T15] example[15] +<16>[ 4096.000000] [ T16] example[16] +<17>[ 4913.000000] [ T17] example[17] +<18>[ 5832.000000] [ T18] example[18] +<19>[ 6859.000000] [ T19] example[19] +<20>[ 8000.000000] [ T20] example[20] +<21>[ 9261.000000] [ T21] example[21] +<22>[10648.000000] [ T22] example[22] +<23>[12167.000000] [ T23] example[23] +<24>[13824.000000] [ T24] example[24] +<25>[15625.000000] [ T25] example[25] +<26>[17576.000000] [ T26] example[26] +<27>[19683.000000] [ T27] example[27] +<28>[21952.000000] [ T28] example[28] +<29>[24389.000000] [ T29] example[29] +<30>[27000.000000] [ T10] example[30] +<31>[29791.000000] [ T31] example[31] +<32>[32768.000000] [ T32] example[32] +<33>[35937.000000] [ T33] example[33] +<34>[39304.000000] [ T34] example[34] +<35>[42875.000000] [ T35] example[35] +<36>[46656.000000] [ T36] example[36] +<37>[50653.000000] [ T37] example[37] +<38>[54872.000000] [ T38] example[38] +<39>[59319.000000] [ T39] example[39] +<40>[64000.000000] [ T40] example[40] +<41>[68921.000000] [ T41] example[41] +<42>[74088.000000] [ T42] example[42] +<43>[79507.000000] [ T43] example[43] +<44>[85184.000000] [ T44] example[44] +<45>[91125.000000] [ T45] example[45] +<46>[97336.000000] [ T46] example[46] +<47>[103823.000000] [ T47] example[47] +<48>[110592.000000] [ T48] example[48] +<49>[117649.000000] [ T49] example[49] +<50>[125000.000000] [ T50] example[50] +<51>[132651.000000] [ T51] example[51] +<52>[140608.000000] [ T52] example[52] +<53>[148877.000000] [ T53] example[53] +<54>[157464.000000] [ T54] example[54] +<55>[166375.000000] [ T55] example[55] +<56>[175616.000000] [ T56] example[56] +<57>[185193.000000] [ T57] example[57] +<58>[195112.000000] [ T58] example[58] +<59>[205379.000000] [ T59] example[59] +<60>[216000.000000] [ T60] example[60] +<61>[226981.000000] [ T61] example[61] +<62>[238328.000000] [ T62] example[62] +<63>[250047.000000] [ T63] example[63] +<64>[262144.000000] [ T64] example[64] +<65>[274625.000000] [ T65] example[65] +<66>[287496.000000] [ T66] example[66] +<67>[300763.000000] [ T67] example[67] +<68>[314432.000000] [ T68] example[68] +<69>[328509.000000] [ T69] example[69] +<70>[343000.000000] [ T70] example[70] +<71>[357911.000000] [ T71] example[71] +<72>[373248.000000] [ T72] example[72] +<73>[389017.000000] [ T73] example[73] +<74>[405224.000000] [ T74] example[74] +<75>[421875.000000] [ T75] example[75] +<76>[438976.000000] [ T76] example[76] +<77>[456533.000000] [ T77] example[77] +<78>[474552.000000] [ T78] example[78] +<79>[493039.000000] [ T79] example[79] +<80>[512000.000000] [ T80] example[80] +<81>[531441.000000] [ T81] example[81] +<82>[551368.000000] [ T82] example[82] +<83>[571787.000000] [ T83] example[83] +<84>[592704.000000] [ T84] example[84] +<85>[614125.000000] [ T85] example[85] +<86>[636056.000000] [ T86] example[86] +<87>[658503.000000] [ T87] example[87] +<88>[681472.000000] [ T88] example[88] +<89>[704969.000000] [ T89] example[89] +<90>[729000.000000] [ T90] example[90] +<91>[753571.000000] [ T91] example[91] +<92>[778688.000000] [ T92] example[92] +<93>[804357.000000] [ T93] example[93] +<94>[830584.000000] [ T94] example[94] +<95>[857375.000000] [ T95] example[95] +<96>[884736.000000] [ T96] example[96] +<97>[912673.000000] [ T97] example[97] +<98>[941192.000000] [ T98] example[98] +<99>[970299.000000] [ T99] example[99] +<100>[1000000.000000] [ T100] example[100] +<101>[1030301.000000] [ T101] example[101] +<102>[1061208.000000] [ T102] example[102] +<103>[1092727.000000] [ T103] example[103] +<104>[1124864.000000] [ T104] example[104] +<150>[4557523.000000] [ T105] example[105] diff --git a/tests/ts/dmesg/cid-json b/tests/ts/dmesg/cid-json new file mode 100755 index 0000000..7836379 --- /dev/null +++ b/tests/ts/dmesg/cid-json @@ -0,0 +1,28 @@ +#!/bin/bash + +# 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="cid-json" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -J -F $TS_SELF/cid-input >> $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-colors b/tests/ts/dmesg/cid-kmsg-colors new file mode 100755 index 0000000..b94e8a9 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-colors @@ -0,0 +1,34 @@ +#!/bin/bash + +# 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="cid-kmsg-colors" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" +ts_inhibit_custom_colorscheme + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG --color=always -K $TS_SELF/cid-kmsg-input -x >> $TS_OUTPUT 2>/dev/null + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-console-levels b/tests/ts/dmesg/cid-kmsg-console-levels new file mode 100755 index 0000000..19d8004 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-console-levels @@ -0,0 +1,49 @@ +#!/bin/bash + +# 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="cid-kmsg-levels" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +for I in {-1..8}; do + echo "Display console level: $I" >> $TS_OUTPUT + $TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l $I >> $TS_OUTPUT 2>/dev/null +done + +echo "Display console level: err+" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l err+ >> $TS_OUTPUT 2>/dev/null +echo "Display console level: emerg+" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l emerg+ >> $TS_OUTPUT 2>/dev/null +echo "Display console level: +err" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l +err >> $TS_OUTPUT 2>/dev/null +echo "Display console level: +debug" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l +debug >> $TS_OUTPUT 2>/dev/null +echo "Display console level: debug" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l debug >> $TS_OUTPUT 2>/dev/null +echo "Display console level: + (invalid)" >> $TS_OUTPUT +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -l + 2>> $TS_OUTPUT >/dev/null + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-decode b/tests/ts/dmesg/cid-kmsg-decode new file mode 100755 index 0000000..b920997 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-decode @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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="cid-kmsg-decode" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -x -K $TS_SELF/cid-kmsg-input >> $TS_OUTPUT 2>/dev/null + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-delta b/tests/ts/dmesg/cid-kmsg-delta new file mode 100755 index 0000000..1b5f572 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-delta @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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="cid-kmsg-delta" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -d -K $TS_SELF/cid-kmsg-input >> $TS_OUTPUT 2>/dev/null + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-facilities b/tests/ts/dmesg/cid-kmsg-facilities new file mode 100755 index 0000000..38ca9c5 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-facilities @@ -0,0 +1,36 @@ +#!/bin/bash + +# 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="cid-kmsg-facilities" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +for I in {-1..12}; do + echo "Display facility list: $I" >> $TS_OUTPUT + $TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-input -f $I -x >> $TS_OUTPUT 2>/dev/null +done + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-indentation b/tests/ts/dmesg/cid-kmsg-indentation new file mode 100755 index 0000000..c3f8e06 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-indentation @@ -0,0 +1,45 @@ +#!/bin/bash + +# 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="cid-kmsg-indentation" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG -K $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG --time-format=delta --kmsg-file $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG --time-format=notime --kmsg-file $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG --time-format=reltime --kmsg-file $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG --time-format=ctime --kmsg-file $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +$TS_HELPER_DMESG --time-format=iso --kmsg-file $TS_SELF/cid-kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-input b/tests/ts/dmesg/cid-kmsg-input Binary files differnew file mode 100644 index 0000000..2575be8 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-input diff --git a/tests/ts/dmesg/cid-kmsg-json b/tests/ts/dmesg/cid-kmsg-json new file mode 100755 index 0000000..ad1e3e7 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-json @@ -0,0 +1,28 @@ +#!/bin/bash + +# 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="cid-kmsg-json" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -J -K $TS_SELF/cid-kmsg-input >> $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-limit b/tests/ts/dmesg/cid-kmsg-limit new file mode 100755 index 0000000..06f1c8b --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-limit @@ -0,0 +1,34 @@ +#!/bin/bash + +# 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="cid-kmsg-limit" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG --since @1234567890.124 --until @1234567991 -K $TS_SELF/cid-kmsg-input \ + >> $TS_OUTPUT 2> $TS_ERRLOG + +# dmesg kmsg output can have varying number of caller_id padding spaces +# normalize caller_id padding by removing leading spaces +sed -i 's/\[ *T/\[T/g' $TS_OUTPUT +sed -i 's/\[ *C/\[C/g' $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/dmesg/cid-kmsg-newlines b/tests/ts/dmesg/cid-kmsg-newlines Binary files differnew file mode 100644 index 0000000..574d217 --- /dev/null +++ b/tests/ts/dmesg/cid-kmsg-newlines diff --git a/tests/ts/dmesg/input b/tests/ts/dmesg/input index 98307df..bcec23e 100644 --- a/tests/ts/dmesg/input +++ b/tests/ts/dmesg/input @@ -103,3 +103,4 @@ <102>[1061208.000000] example[102] <103>[1092727.000000] example[103] <104>[1124864.000000] example[104] +<150>[4557523.000000] example[105] diff --git a/tests/ts/dmesg/json b/tests/ts/dmesg/json new file mode 100755 index 0000000..09ed2b0 --- /dev/null +++ b/tests/ts/dmesg/json @@ -0,0 +1,28 @@ +#!/bin/bash + +# 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="json" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -J -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/dmesg/kmsg-file b/tests/ts/dmesg/kmsg-file new file mode 100755 index 0000000..a90a91e --- /dev/null +++ b/tests/ts/dmesg/kmsg-file @@ -0,0 +1,28 @@ +#!/bin/bash + +# 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="kmsg-file" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +$TS_HELPER_DMESG -J -K $TS_SELF/kmsg-input >> $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/dmesg/kmsg-input b/tests/ts/dmesg/kmsg-input Binary files differnew file mode 100644 index 0000000..c08331d --- /dev/null +++ b/tests/ts/dmesg/kmsg-input diff --git a/tests/ts/dmesg/timestamp-format b/tests/ts/dmesg/timestamp-format new file mode 100755 index 0000000..feb1ad8 --- /dev/null +++ b/tests/ts/dmesg/timestamp-format @@ -0,0 +1,42 @@ +#!/bin/bash + +# 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="timestamp-format" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_DMESG" + +export TZ="GMT" +export DMESG_TEST_BOOTIME="1234567890.123456" + +ts_init_subtest "multiple" +$TS_HELPER_DMESG --time-format raw --time-format ctime --time-format iso -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +ts_init_subtest "delta" +$TS_HELPER_DMESG --time-format iso --time-format delta -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +ts_init_subtest "delta-ctime" +$TS_HELPER_DMESG --time-format reltime --time-format delta --time-format ctime -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +ts_init_subtest "delta-raw" +$TS_HELPER_DMESG --time-format raw --time-format ctime --time-format delta -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount index 838ee9c..af5808f 100755 --- a/tests/ts/eject/umount +++ b/tests/ts/eject/umount @@ -83,7 +83,7 @@ init_device mkfs.ext2 -q -F $TS_DEVICE udevadm settle mkdir -p $TS_MOUNTPOINT -$TS_CMD_MOUNT $TS_DEVICE $TS_MOUNTPOINT +$TS_CMD_MOUNT $TS_DEVICE $TS_MOUNTPOINT &> /dev/null udevadm settle $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" deinit_device @@ -95,8 +95,8 @@ init_device init_partitions $TS_DEVICE mkdir -p ${TS_MOUNTPOINT}1 mkdir -p ${TS_MOUNTPOINT}2 -$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 -$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 +$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 &> /dev/null +$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 &> /dev/null udevadm settle $TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success" deinit_device @@ -116,8 +116,8 @@ init_device init_partitions $TS_DEVICE mkdir -p ${TS_MOUNTPOINT}1 mkdir -p ${TS_MOUNTPOINT}2 -$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 -$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 +$TS_CMD_MOUNT ${TS_DEVICE}1 ${TS_MOUNTPOINT}1 &> /dev/null +$TS_CMD_MOUNT ${TS_DEVICE}2 ${TS_MOUNTPOINT}2 &> /dev/null udevadm settle $TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success" deinit_device diff --git a/tests/ts/exch/exch b/tests/ts/exch/exch new file mode 100755 index 0000000..1c6a28e --- /dev/null +++ b/tests/ts/exch/exch @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="exch" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_EXCH" + +ts_cd "$TS_OUTDIR" + +{ + echo A > a + echo B > b + + cat a + cat b + + "$TS_CMD_EXCH" a b + + cat a + cat b +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/fadvise/drop b/tests/ts/fadvise/drop index 7c7eee5..45dcb91 100755 --- a/tests/ts/fadvise/drop +++ b/tests/ts/fadvise/drop @@ -16,7 +16,7 @@ ts_check_prog "sleep" ts_cd "$TS_OUTDIR" FILE="ddtest" -BS=4k +BS=65536 COUNT=8 FILE_FS="$("$TS_CMD_FINDMNT" -nr -o FSTYPE -T "$PWD")" @@ -28,37 +28,41 @@ create_file() { dd if=/dev/zero of="$FILE" bs=$BS count=$COUNT conv=fsync >& /dev/null } +do_fincore() { + "$TS_CMD_FINCORE" -o RES,SIZE,FILE "$FILE" +} + { create_file - "$TS_CMD_FINCORE" "$FILE" + do_fincore echo create_file echo "whole file" "$TS_CMD_FADVISE" "$FILE" echo status: $? - "$TS_CMD_FINCORE" "$FILE" + do_fincore echo create_file - echo "offset: 8192" - "$TS_CMD_FADVISE" -o 8192 "$FILE" + echo "offset: $(( 2 * $BS ))" + "$TS_CMD_FADVISE" -o $(( 2 * $BS )) "$FILE" echo status: $? - "$TS_CMD_FINCORE" "$FILE" + do_fincore echo create_file - echo "length: 16384" - "$TS_CMD_FADVISE" -l 16384 "$FILE" + echo "length: $(( 4 * $BS ))" + "$TS_CMD_FADVISE" -l $(( 4 * $BS )) "$FILE" echo status: $? - "$TS_CMD_FINCORE" "$FILE" + do_fincore echo create_file - echo "offset: 8192, length: 16384 fd: 42" - "$TS_CMD_FADVISE" -o 8192 -l 16384 --fd 42 42<"$FILE" + echo "offset: $(( 2 * $BS )), length: $(( 4 * $BS )) fd: 42" + "$TS_CMD_FADVISE" -o $(( 2 * $BS )) -l $(( 4 * $BS )) --fd 42 42<"$FILE" echo status: $? - "$TS_CMD_FINCORE" "$FILE" + do_fincore echo rm "$FILE" diff --git a/tests/ts/fdisk/resize b/tests/ts/fdisk/resize new file mode 100755 index 0000000..9536cd7 --- /dev/null +++ b/tests/ts/fdisk/resize @@ -0,0 +1,66 @@ +#!/bin/bash +# +# This file is part of util-linux. +# +# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de> +# +# 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="resize" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_FDISK" + +TEST_IMAGE_NAME=$(ts_image_init 10) + +function print_layout { + echo -ne "\n---layout----------\n" >> "$TS_OUTPUT" + "$TS_CMD_FDISK" -l "${TEST_IMAGE_NAME}" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" + echo -ne "-------------------\n\n" >> "$TS_OUTPUT" + + ts_fdisk_clean "${TEST_IMAGE_NAME}" +} + +function test_fdisk() { + "$TS_CMD_FDISK" --noauto-pt "${TEST_IMAGE_NAME}" &> /dev/null +} + +ts_log "Create initial partitions" +echo -e "g\nn\n\n\n+1M\nn\n\n8192\n+1M\nw\n" | test_fdisk + +print_layout + +ts_log "Grow first to max" +echo -e "e\n1\n\nw\n" | test_fdisk + +print_layout + +ts_log "Grow second to max" +echo -e "e\n2\n\nw\n" | test_fdisk + +print_layout + +ts_log "Resize first to 4096 bytes" +echo -e "e\n1\n4K\nw\n" | test_fdisk + +print_layout + +ts_log "Resize second to 8 sectors" +echo -e "e\n2\n8S\nw\n" | test_fdisk + +print_layout + +ts_finalize diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count index ba5f6cd..caf9c3a 100755 --- a/tests/ts/fincore/count +++ b/tests/ts/fincore/count @@ -107,6 +107,7 @@ if test -f "$TS_EXPECTED.$PAGE_SIZE"; then OUT_COLUMNS="PAGES,SIZE,FILE" else TS_EXPECTED+=".nosize" + TS_EXPECTED_ERR+=".nosize" OUT_COLUMNS="PAGES,FILE" fi @@ -119,11 +120,11 @@ check_dd_fs_feat INPUT= input= +ts_log_both "[ NO EXCITING FILE ]" { input=no_such_file INPUT="${INPUT} ${input}" - ts_log_both "[ NO EXCITING FILE ]" $TS_CMD_FINCORE --output $OUT_COLUMNS --bytes --noheadings $input footer "$?" } >> $TS_OUTPUT 2>> $TS_ERRLOG @@ -220,8 +221,8 @@ input= "oflag=append seek=$hole_count" } >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_log_both "[ MULTIPLE FILES ]" { - ts_log_both "[ MULTIPLE FILES ]" $TS_CMD_FINCORE --output $OUT_COLUMNS --bytes $INPUT footer "$?" } >> $TS_OUTPUT 2>> $TS_ERRLOG diff --git a/tests/ts/hexdump/format-strings b/tests/ts/hexdump/format-strings index 9f055ba..b971538 100755 --- a/tests/ts/hexdump/format-strings +++ b/tests/ts/hexdump/format-strings @@ -43,6 +43,10 @@ ts_init_subtest "1b_octal" $TS_CMD_HEXDUMP -b $FILES/ascii.in &> $TS_OUTPUT ts_finalize_subtest +ts_init_subtest "1b_hex" +$TS_CMD_HEXDUMP -X $FILES/ascii.in &> $TS_OUTPUT +ts_finalize_subtest + ts_init_subtest "1b_char" $TS_CMD_HEXDUMP -c $FILES/ascii.in &> $TS_OUTPUT ts_finalize_subtest diff --git a/tests/ts/lib/timeutils b/tests/ts/lib/timeutils index 13ec68b..043b0c0 100755 --- a/tests/ts/lib/timeutils +++ b/tests/ts/lib/timeutils @@ -16,9 +16,15 @@ ts_init "$*" ts_check_test_command "$TS_HELPER_TIMEUTILS" ts_init_subtest "timestamp" +"$TS_HELPER_TIMEUTILS" --unittest-timestamp 2> "$TS_ERRLOG" || ts_die "test failed" +ts_finalize_subtest -"$TS_HELPER_TIMEUTILS" --unittest-timestamp 2> "$TS_ERRLOG" +ts_init_subtest "format" +"$TS_HELPER_TIMEUTILS" --unittest-format 2> "$TS_ERRLOG" || ts_die "test failed" +ts_finalize_subtest +ts_init_subtest "format-relative" +"$TS_HELPER_TIMEUTILS" --unittest-format-relative 2> "$TS_ERRLOG" || ts_die "test failed" ts_finalize_subtest ts_finalize diff --git a/tests/ts/liblastlog2/dlopen b/tests/ts/liblastlog2/dlopen new file mode 100755 index 0000000..8ce4e17 --- /dev/null +++ b/tests/ts/liblastlog2/dlopen @@ -0,0 +1,23 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="dlopen" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +# incorrect warning: top_builddir is referenced but not assigned. +# shellcheck disable=SC2154 +if [ -e "$top_builddir/meson.conf" ]; then + #meson build + libpath=${top_builddir}/liblastlog2 +else + #automake/autoconf build + libpath=${top_builddir}/.libs +fi + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_DLOPEN + +$TS_HELPER_LIBLASTLOG2_DLOPEN ${libpath}/liblastlog2.so >/dev/null || ts_failed "returned an error" + +ts_finalize diff --git a/tests/ts/liblastlog2/pam_lastlog2_output b/tests/ts/liblastlog2/pam_lastlog2_output new file mode 100755 index 0000000..c9961f1 --- /dev/null +++ b/tests/ts/liblastlog2/pam_lastlog2_output @@ -0,0 +1,17 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="pam_lastlog2_output" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_PAM_LASTLOG2_OUTPUT + +export TZ=UTC + +$TS_HELPER_LIBLASTLOG2_PAM_LASTLOG2_OUTPUT || ts_failed "returned an error" + +rm pam_lastlog2-output.db + +ts_finalize diff --git a/tests/ts/liblastlog2/remove_entry b/tests/ts/liblastlog2/remove_entry new file mode 100755 index 0000000..63503d9 --- /dev/null +++ b/tests/ts/liblastlog2/remove_entry @@ -0,0 +1,15 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="remove_entry" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_REMOVE_ENTRY + +$TS_HELPER_LIBLASTLOG2_REMOVE_ENTRY || ts_failed "returned an error" + +rm tst-delete-user.db + +ts_finalize diff --git a/tests/ts/liblastlog2/rename_user b/tests/ts/liblastlog2/rename_user new file mode 100755 index 0000000..38f0763 --- /dev/null +++ b/tests/ts/liblastlog2/rename_user @@ -0,0 +1,15 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="rename_user" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_RENAME_USER + +$TS_HELPER_LIBLASTLOG2_RENAME_USER || ts_failed "returned an error" + +rm tst-rename-user.db + +ts_finalize diff --git a/tests/ts/liblastlog2/sqlite3_time b/tests/ts/liblastlog2/sqlite3_time new file mode 100755 index 0000000..9ff27fe --- /dev/null +++ b/tests/ts/liblastlog2/sqlite3_time @@ -0,0 +1,15 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="sqlite3_time" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_Y2038_SQLITE2_TIME + +$TS_HELPER_LIBLASTLOG2_Y2038_SQLITE2_TIME >/dev/null || ts_failed "returned an error" + +rm y2038-sqlite3-time.db + +ts_finalize diff --git a/tests/ts/liblastlog2/write_read_user b/tests/ts/liblastlog2/write_read_user new file mode 100755 index 0000000..8a6028a --- /dev/null +++ b/tests/ts/liblastlog2/write_read_user @@ -0,0 +1,15 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="write_read_user" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_WRITE_READ_USER + +$TS_HELPER_LIBLASTLOG2_WRITE_READ_USER || ts_failed "returned an error" + +rm tst-write-read-user.db + +ts_finalize diff --git a/tests/ts/liblastlog2/y2038_ll2_read_all b/tests/ts/liblastlog2/y2038_ll2_read_all new file mode 100755 index 0000000..da779c2 --- /dev/null +++ b/tests/ts/liblastlog2/y2038_ll2_read_all @@ -0,0 +1,15 @@ +#!/bin/bash + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="y2038_ll2_read_all" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBLASTLOG2_Y2038_LL2_READ_ALL + +$TS_HELPER_LIBLASTLOG2_Y2038_LL2_READ_ALL >/dev/null || ts_failed "returned an error" + +rm y2038-ll2_read_all.db + +ts_finalize diff --git a/tests/ts/libmount/optlist b/tests/ts/libmount/optlist new file mode 100755 index 0000000..8499496 --- /dev/null +++ b/tests/ts/libmount/optlist @@ -0,0 +1,67 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="options string" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command $TS_HELPER_LIBMOUNT_OPTLIST + +TESTPROG="$TS_HELPER_LIBMOUNT_OPTLIST" + +ts_init_subtest "append" +ts_run $TESTPROG --append-str "aaa,bbb=BBB,context=\"foo,bar,gogo\",ccc" "ddd" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "append-value" +ts_run $TESTPROG --append-str "aaa,bbb=BBB,ccc" "ddd=DDD" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "append-empty-value" +ts_run $TESTPROG --append-str "aaa,bbb=BBB,ccc" "ddd=" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "prepend" +ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "prepend-list" +ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd,eee=EEE,fff" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "prepend-value" +ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd=DDD" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "prepend-empty-value" +ts_run $TESTPROG --prepend-str "aaa,bbb=BBB,ccc" "ddd=" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "set" +ts_run $TESTPROG --set-str "aaa,bbb=BBB,ccc" "new,data,for,list" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "get-str" +ts_run $TESTPROG --get-str "aaa,bbb=BBB,ccc,defaults" &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "get-str-linux" +ts_run $TESTPROG --get-str "noexec,noauto,user,defaults" linux &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "get-str-user" +ts_run $TESTPROG --get-str "noexec,noauto,user,defaults" user &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "get-flg-linux" +ts_run $TESTPROG --get-flg "noexec,noauto,user,defaults" linux &> $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "get-flg-user" +ts_run $TESTPROG --get-flg "noexec,noauto,user,defaults" user &> $TS_OUTPUT +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/libmount/optstr b/tests/ts/libmount/optstr index 26d9b73..979517e 100755 --- a/tests/ts/libmount/optstr +++ b/tests/ts/libmount/optstr @@ -8,9 +8,9 @@ TS_DESC="options string" . "$TS_TOPDIR"/functions.sh ts_init "$*" -TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR" +ts_check_test_command $TS_HELPER_LIBMOUNT_OPTSTR -[ -x $TESTPROG ] || ts_skip "test not compiled" +TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR" ts_init_subtest "append" ts_run $TESTPROG --append "aaa,bbb=BBB,context=\"foo,bar,gogo\",ccc" "ddd" &> $TS_OUTPUT @@ -28,6 +28,10 @@ ts_init_subtest "prepend" ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT ts_finalize_subtest +ts_init_subtest "prepend-list" +ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd,eee=EEE,fff" &> $TS_OUTPUT +ts_finalize_subtest + ts_init_subtest "prepend-value" ts_run $TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT ts_finalize_subtest diff --git a/tests/ts/libmount/update b/tests/ts/libmount/update index ba93e0b..b8f7488 100755 --- a/tests/ts/libmount/update +++ b/tests/ts/libmount/update @@ -7,7 +7,6 @@ TS_DESC="tab update" . "$TS_TOPDIR"/functions.sh ts_init "$*" -ts_skip_nonroot TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE" diff --git a/tests/ts/libmount/update-py b/tests/ts/libmount/update-py index bfb8441..b4450c4 100755 --- a/tests/ts/libmount/update-py +++ b/tests/ts/libmount/update-py @@ -8,7 +8,6 @@ TS_DESC="tab update-py" . "$TS_TOPDIR"/functions.sh ts_init "$*" ts_init_py libmount -ts_skip_nonroot if [ "$TS_ENABLE_ASAN" == "yes" -o "$TS_ENABLE_UBSAN" == "yes" ]; then TS_KNOWN_FAIL="yes" diff --git a/tests/ts/libsmartcols/continuous-json b/tests/ts/libsmartcols/continuous-json new file mode 100755 index 0000000..8456d6b --- /dev/null +++ b/tests/ts/libsmartcols/continuous-json @@ -0,0 +1,28 @@ +#!/bin/bash +# +# 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="title" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_LIBSMARTCOLS_CONTINUOUS_JSON" +ts_check_test_command "$TESTPROG" + +ts_run $TESTPROG --width 80 >> $TS_OUTPUT 2>> $TS_ERRLOG + +ts_finalize diff --git a/tests/ts/libsmartcols/files/col-bool b/tests/ts/libsmartcols/files/col-bool new file mode 100644 index 0000000..c3324e8 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-bool @@ -0,0 +1 @@ +name=BOOL,right,type=boolean,json=boolean diff --git a/tests/ts/libsmartcols/files/col-float b/tests/ts/libsmartcols/files/col-float new file mode 100644 index 0000000..7069dc7 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-float @@ -0,0 +1 @@ +name=NUM,right,type=float,json=float diff --git a/tests/ts/libsmartcols/files/col-hidden b/tests/ts/libsmartcols/files/col-hidden index 83182a8..9bbb15f 100644 --- a/tests/ts/libsmartcols/files/col-hidden +++ b/tests/ts/libsmartcols/files/col-hidden @@ -1,3 +1 @@ -FOO -0 -hidden +name=FOO,hidden diff --git a/tests/ts/libsmartcols/files/col-id b/tests/ts/libsmartcols/files/col-id index 0188f42..8a800fc 100644 --- a/tests/ts/libsmartcols/files/col-id +++ b/tests/ts/libsmartcols/files/col-id @@ -1,3 +1 @@ -ID -0 -right +name=ID,right,type=number,json=number diff --git a/tests/ts/libsmartcols/files/col-name b/tests/ts/libsmartcols/files/col-name index 0a98f29..4fed26f 100644 --- a/tests/ts/libsmartcols/files/col-name +++ b/tests/ts/libsmartcols/files/col-name @@ -1,3 +1 @@ -NAME -0 -none +name=NAME diff --git a/tests/ts/libsmartcols/files/col-noextremes b/tests/ts/libsmartcols/files/col-noextremes index 715edce..7df2e2f 100644 --- a/tests/ts/libsmartcols/files/col-noextremes +++ b/tests/ts/libsmartcols/files/col-noextremes @@ -1,3 +1 @@ -NOEXTREME -0 -noextremes +name=NOEXTREME,noextremes diff --git a/tests/ts/libsmartcols/files/col-number b/tests/ts/libsmartcols/files/col-number index 34a70e4..0f880ff 100644 --- a/tests/ts/libsmartcols/files/col-number +++ b/tests/ts/libsmartcols/files/col-number @@ -1,3 +1 @@ -NUM -0 -right +name=NUM,right,type=number,json=number diff --git a/tests/ts/libsmartcols/files/col-parent b/tests/ts/libsmartcols/files/col-parent index 86fe08c..be25a82 100644 --- a/tests/ts/libsmartcols/files/col-parent +++ b/tests/ts/libsmartcols/files/col-parent @@ -1,3 +1 @@ -PARENT -0 -right +name=PARENT,right,type=number diff --git a/tests/ts/libsmartcols/files/col-strict b/tests/ts/libsmartcols/files/col-strict index 62bb96b..8381f92 100644 --- a/tests/ts/libsmartcols/files/col-strict +++ b/tests/ts/libsmartcols/files/col-strict @@ -1,3 +1 @@ -STRICT -20 -strictwidth,right +name=STRICT,strictwidth,right,width=20 diff --git a/tests/ts/libsmartcols/files/col-string b/tests/ts/libsmartcols/files/col-string index 7e2904b..e96c37f 100644 --- a/tests/ts/libsmartcols/files/col-string +++ b/tests/ts/libsmartcols/files/col-string @@ -1,3 +1 @@ -STRINGS -0 -none +name=STRINGS diff --git a/tests/ts/libsmartcols/files/col-tree b/tests/ts/libsmartcols/files/col-tree index 5076880..6c69ca0 100644 --- a/tests/ts/libsmartcols/files/col-tree +++ b/tests/ts/libsmartcols/files/col-tree @@ -1,3 +1 @@ -TREE -0 -tree +name=TREE,tree diff --git a/tests/ts/libsmartcols/files/col-trunc b/tests/ts/libsmartcols/files/col-trunc index 2887b43..55c9a70 100644 --- a/tests/ts/libsmartcols/files/col-trunc +++ b/tests/ts/libsmartcols/files/col-trunc @@ -1,3 +1 @@ -TRUNC -0 -trunc +name=TRUNC,trunc diff --git a/tests/ts/libsmartcols/files/col-wrap b/tests/ts/libsmartcols/files/col-wrap index dc4ca34..c8e622d 100644 --- a/tests/ts/libsmartcols/files/col-wrap +++ b/tests/ts/libsmartcols/files/col-wrap @@ -1,3 +1 @@ -WRAP -0 -wrap +name=WRAP,wrap diff --git a/tests/ts/libsmartcols/files/col-wrapnl b/tests/ts/libsmartcols/files/col-wrapnl index 0a18fd1..fcbc217 100644 --- a/tests/ts/libsmartcols/files/col-wrapnl +++ b/tests/ts/libsmartcols/files/col-wrapnl @@ -1,3 +1 @@ -WRAPNL -0 -wrapnl +name=WRAPNL,wrapnl diff --git a/tests/ts/libsmartcols/files/col-wrapzero b/tests/ts/libsmartcols/files/col-wrapzero new file mode 100644 index 0000000..b197014 --- /dev/null +++ b/tests/ts/libsmartcols/files/col-wrapzero @@ -0,0 +1 @@ +name=WRAPZERO,wrapzero diff --git a/tests/ts/libsmartcols/files/data-bool b/tests/ts/libsmartcols/files/data-bool new file mode 100644 index 0000000..d6bda92 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-bool @@ -0,0 +1,10 @@ +0 +1 + +0 +true +false +FALSE +TRUE +0 +1 diff --git a/tests/ts/libsmartcols/files/data-float b/tests/ts/libsmartcols/files/data-float new file mode 100644 index 0000000..ead3d90 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-float @@ -0,0 +1,10 @@ +0 +100 +100.5 +99.9 +411 +5111 +678993321 +7666666 +8000 +8000.5 diff --git a/tests/ts/libsmartcols/files/data-string-nl b/tests/ts/libsmartcols/files/data-string-nl index 7822e57..ef16a72 100644 --- a/tests/ts/libsmartcols/files/data-string-nl +++ b/tests/ts/libsmartcols/files/data-string-nl @@ -1,10 +1,10 @@ aaa bbbbb -cccc\nCCCC -dddddddd\nDDDD\nDD -hello\nbaby -aaa\nbbb\nccc\nddd +cccc\x0ACCCC +dddddddd\x0ADDDD\x0ADD +hello\x0Ababy +aaa\x0Abbb\x0Accc\x0Addd eee fffff -g\nhhhhh +g\x0Ahhhhh ppppppppp diff --git a/tests/ts/libsmartcols/files/data-string-zero b/tests/ts/libsmartcols/files/data-string-zero new file mode 100644 index 0000000..5f936f1 --- /dev/null +++ b/tests/ts/libsmartcols/files/data-string-zero @@ -0,0 +1,10 @@ +aaa +bbbbb +cccc\x00CCCC +dddddddd\x00DDDD\x00DD +hello\x00baby +aaa\x00bbb\x00ccc\x00ddd +eee +fffff +g\x00hhhhh +ppppppppp diff --git a/tests/ts/libsmartcols/filter b/tests/ts/libsmartcols/filter new file mode 100755 index 0000000..2025ef5 --- /dev/null +++ b/tests/ts/libsmartcols/filter @@ -0,0 +1,217 @@ +#!/bin/bash +# +# 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="fromfile" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_LIBSMARTCOLS_FROMFILE" +ts_check_test_command "$TESTPROG" + +### Number +# +prefix="number" +declare -A FILTERS + +FILTERS["is"]='NUM' +FILTERS["neg"]='!NUM' +FILTERS["and"]='NUM && NAME' +FILTERS["or"]='NUM || NAME' + +FILTERS["eq"]='NUM == 100' +FILTERS["ne"]='NUM != 100' + +FILTERS["gt"]='NUM > 8000' +FILTERS["ge"]='NUM >= 100' +FILTERS["lt"]='NUM < 100' +FILTERS["le"]='NUM <= 100' + +FILTERS["expr-and-expr"]='NUM > 10 && NUM < 8000' +FILTERS["expr-or-expr"]='NUM == 3 || NUM == 100' +FILTERS["and-or"]='(NUM >= 3 && NUM <= 100) || NUM == 0' + +FILTERS["as-string"]='NUM == "100"' + +printf '%s\n' "${!FILTERS[@]}" | sort | while read name; do + ts_init_subtest "$prefix-$name" + echo "expr: ${FILTERS[$name]}" >> $TS_OUTPUT + echo >> $TS_OUTPUT + ts_run $TESTPROG --nlines 10 --width 80 \ + --filter "${FILTERS[$name]}" \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + >> $TS_OUTPUT 2> /dev/null + ts_finalize_subtest +done +FILTERS=() + + +### Float +# +prefix="float" +declare -A FILTERS + +FILTERS["is"]='NUM' +FILTERS["neg"]='!NUM' +FILTERS["and"]='NUM && NAME' +FILTERS["or"]='NUM || NAME' + +FILTERS["eq"]='NUM == 100' +FILTERS["eq2"]='NUM == 100.5' + +FILTERS["ne"]='NUM != 100' +FILTERS["ne2"]='NUM != 100.5' + +FILTERS["gt"]='NUM > 8000' +FILTERS["gt2"]='NUM > 8000.5' + +FILTERS["ge"]='NUM >= 100' +FILTERS["ge2"]='NUM >= 100.5' + +FILTERS["lt"]='NUM < 100' +FILTERS["lt2"]='NUM < 100.5' + +FILTERS["le"]='NUM <= 100' +FILTERS["le2"]='NUM <= 100.5' + +FILTERS["as-string"]='NUM == "100"' +FILTERS["as-string2"]='NUM == "100.5"' + +printf '%s\n' "${!FILTERS[@]}" | sort | while read name; do + ts_init_subtest "$prefix-$name" + echo "expr: ${FILTERS[$name]}" >> $TS_OUTPUT + echo >> $TS_OUTPUT + ts_run $TESTPROG --nlines 10 --width 80 \ + --filter "${FILTERS[$name]}" \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-float \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-float \ + >> $TS_OUTPUT 2> /dev/null + ts_finalize_subtest +done +FILTERS=() + +### Boolean +# +prefix="bool" +declare -A FILTERS + +FILTERS["is"]='BOOL' +FILTERS["neg"]='!BOOL' +FILTERS["and"]='BOOL && NAME' +FILTERS["or"]='BOOL || NAME' + +FILTERS["eq-true"]='BOOL == TRUE' +FILTERS["eq-true2"]='BOOL == true' +FILTERS["eq-true3"]='BOOL == 1' + +FILTERS["eq-false"]='BOOL == FALSE' +FILTERS["eq-false2"]='BOOL == false' +FILTERS["eq-false3"]='BOOL == 0' + +FILTERS["ne"]='BOOL != false' +FILTERS["ne2"]='BOOL != true' + +FILTERS["as-string"]='BOOL == "0"' +FILTERS["as-string2"]='BOOL == "1"' + +printf '%s\n' "${!FILTERS[@]}" | sort | while read name; do + ts_init_subtest "$prefix-$name" + echo "expr: ${FILTERS[$name]}" >> $TS_OUTPUT + echo >> $TS_OUTPUT + ts_run $TESTPROG --nlines 10 --width 80 \ + --filter "${FILTERS[$name]}" \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-bool \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-bool \ + >> $TS_OUTPUT 2> /dev/null + ts_finalize_subtest +done +FILTERS=() + + +### Strings +# +prefix="string" +declare -A FILTERS + +FILTERS["is"]='NAME' +FILTERS["neg"]='!NAME' + +FILTERS["eq"]='NAME == "bbb"' +FILTERS["ne"]='NAME != "bbb"' + +FILTERS["gt"]='NAME > "bbb"' +FILTERS["ge"]='NAME >= "bbb"' +FILTERS["lt"]='NAME < "bbb"' +FILTERS["le"]='NAME <= "bbb"' + +FILTERS["reg"]='NAME =~ "aaa.*"' +FILTERS["nreg"]='NAME !~ "aaa.*"' + +printf '%s\n' "${!FILTERS[@]}" | sort | while read name; do + ts_init_subtest "$prefix-$name" + echo "expr: ${FILTERS[$name]}" >> $TS_OUTPUT + echo >> $TS_OUTPUT + ts_run $TESTPROG --nlines 10 --width 80 \ + --filter "${FILTERS[$name]}" \ + --column $TS_SELF/files/col-name \ + $TS_SELF/files/data-string \ + >> $TS_OUTPUT 2> /dev/null + ts_finalize_subtest +done +FILTERS=() + + +### Broken +# +prefix="broken" +declare -A FILTERS + +FILTERS["no-start"]='NUM == 100)' +FILTERS["no-close"]='(NUM == 100' +FILTERS["no-column"]=' == 100' +FILTERS["no-param"]='NUM == ' +FILTERS["bad-oper"]='NUM ** 100' +FILTERS["bad-oper2"]='NUM = 100' +FILTERS["bad-column"]='XXX == 100' +FILTERS["bad-number"]='NUM == 1y0' +FILTERS["bad-float"]='NUM == 100 . 5' + +printf '%s\n' "${!FILTERS[@]}" | sort | while read name; do + ts_init_subtest "$prefix-$name" + echo "expr: ${FILTERS[$name]}" >> $TS_OUTPUT + echo >> $TS_OUTPUT + ts_run $TESTPROG --nlines 10 --width 80 \ + --filter "${FILTERS[$name]}" \ + --column $TS_SELF/files/col-number \ + $TS_SELF/files/data-number \ + 2>> $TS_OUTPUT 1> /dev/null + + sed -i -e 's/syntax error.*/<bison syntax error message removed>/g' $TS_OUTPUT + ts_finalize_subtest +done +FILTERS=() + + +ts_log "...done." +ts_finalize diff --git a/tests/ts/libsmartcols/fromfile b/tests/ts/libsmartcols/fromfile index 45b8471..c11140c 100755 --- a/tests/ts/libsmartcols/fromfile +++ b/tests/ts/libsmartcols/fromfile @@ -249,6 +249,32 @@ ts_run $TESTPROG --nlines 10 \ >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest +ts_init_subtest "wrapzero" +ts_run $TESTPROG --nlines 10 \ + --column $TS_SELF/files/col-name \ + --column $TS_SELF/files/col-number \ + --column $TS_SELF/files/col-wrapzero \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-number \ + $TS_SELF/files/data-string-zero \ + >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + +ts_init_subtest "wrapzero-tree" +ts_run $TESTPROG --nlines 10 \ + --tree-id-column 1 \ + --tree-parent-column 2 \ + --column $TS_SELF/files/col-tree \ + --column $TS_SELF/files/col-id \ + --column $TS_SELF/files/col-parent \ + --column $TS_SELF/files/col-wrapzero \ + $TS_SELF/files/data-string \ + $TS_SELF/files/data-id \ + $TS_SELF/files/data-parent \ + $TS_SELF/files/data-string-zero \ + >> $TS_OUTPUT 2>> $TS_ERRLOG +ts_finalize_subtest + ts_init_subtest "raw" ts_run $TESTPROG --nlines 10 --raw \ --column $TS_SELF/files/col-name \ diff --git a/tests/ts/lscpu/dumps/rv64-visionfive2.tar.gz b/tests/ts/lscpu/dumps/rv64-visionfive2.tar.gz Binary files differnew file mode 100644 index 0000000..23666f1 --- /dev/null +++ b/tests/ts/lscpu/dumps/rv64-visionfive2.tar.gz diff --git a/tests/ts/lsfd/column-ainodeclass b/tests/ts/lsfd/column-ainodeclass index 6391c48..6829494 100755 --- a/tests/ts/lsfd/column-ainodeclass +++ b/tests/ts/lsfd/column-ainodeclass @@ -38,11 +38,11 @@ for C in pidfd inotify; do ${TS_CMD_LSFD} -n -o ASSOC,STTYPE,AINODECLASS -p "${PID}" -Q "${EXPR}" echo "$C"':ASSOC,STTYPE,AINODECLASS': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 - if [ "$C-$?" == "pidfd-$ENOSYS" ]; then + if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then ts_skip_subtest "pidfd_open(2) is not available" continue fi diff --git a/tests/ts/lsfd/column-deleted b/tests/ts/lsfd/column-deleted new file mode 100755 index 0000000..128cd0e --- /dev/null +++ b/tests/ts/lsfd/column-deleted @@ -0,0 +1,61 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="DELETED column" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +EXPR= + +C=make-regular-file +ts_init_subtest $C +{ + target=util-linux-lsfd-test-make-regular-file + coproc MKFDS { "$TS_HELPER_MKFDS" "$C" "$FD" file="$target" delete=1; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD"')' + ${TS_CMD_LSFD} -p "$PID" -n -o DELETED -Q "${EXPR}" + echo "$C: DELETED: " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +C=ro-regular-file +ts_init_subtest $C +{ + coproc MKFDS { "$TS_HELPER_MKFDS" "$C" "$FD"; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD"')' + ${TS_CMD_LSFD} -p "$PID" -n -o DELETED -Q "${EXPR}" + echo "$C: DELETED: " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lsfd/column-kthread b/tests/ts/lsfd/column-kthread index 0b093e9..2238ade 100755 --- a/tests/ts/lsfd/column-kthread +++ b/tests/ts/lsfd/column-kthread @@ -31,7 +31,7 @@ ts_check_prog "ps" ts_cd "$TS_OUTDIR" { - "$TS_CMD_LSFD" -o COMMAND,PID,USER,MODE,TYPE,NAME,KTHREAD \ + "$TS_CMD_LSFD" --threads -o COMMAND,PID,USER,MODE,TYPE,NAME,KTHREAD \ -Q '(PID < 3) and ((ASSOC == "cwd") or (ASSOC == "rtd"))' echo $? } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/column-name b/tests/ts/lsfd/column-name index 5dc491a..8bf8f42 100755 --- a/tests/ts/lsfd/column-name +++ b/tests/ts/lsfd/column-name @@ -60,15 +60,31 @@ for C in ro-regular-file pidfd socketpair; do } echo "$C"':ASSOC,KNAME,NAME': ${PIPESTATUS[0]} - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi } > "$TS_OUTPUT" 2>&1 wait "${MKFDS_PID}" - if [ "$C-$?" == "pidfd-$ENOSYS" ]; then + if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then ts_skip_subtest "pidfd_open(2) is not available" continue fi ts_finalize_subtest done +C=make-regular-file +ts_init_subtest deleted-file +{ + target=tmp-column-name + coproc MKFDS { "$TS_HELPER_MKFDS" $C $FD file=tmp-column-name delete=1; } + if read -r -u "${MKFDS[0]}" PID; then + ${TS_CMD_LSFD} -n -o DELETED,NAME -p "${PID}" -Q "${EXPR}" | + sed -e 's#.*/\([^/]\+\)#\1#' + echo "$C: DELETED,NAME: " ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + ts_finalize diff --git a/tests/ts/lsfd/column-source b/tests/ts/lsfd/column-source new file mode 100755 index 0000000..a74f9de --- /dev/null +++ b/tests/ts/lsfd/column-source @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="SOURCE column" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +. "$TS_SELF/lsfd-functions.bash" +ts_check_test_command "$TS_CMD_LSFD" + +ts_cd "$TS_OUTDIR" + +declare -a NAMESPACES=( + cgorup + ipc + mnt + net + pid + pid4c + # older kernel doesn't support time namespace. + # time + # time4c + user + uts +) +ts_init_subtest namespace-ASSOC +{ + EXPR="false" + for ns in "${NAMESPACES[@]}"; do + EXPR=${EXPR}' || (ASSOC == "'"$ns"'")' + done + ${TS_CMD_LSFD} -p $$ -n -o ASSOC,SOURCE -Q "$EXPR" +} > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lsfd/column-source-with-root b/tests/ts/lsfd/column-source-with-root new file mode 100755 index 0000000..c00ee15 --- /dev/null +++ b/tests/ts/lsfd/column-source-with-root @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="SOURCE column (requiring the root privilege)" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_nonroot +ts_skip_docker + +. "$TS_SELF/lsfd-functions.bash" +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +EXPR='(NAME =~ "/SYSV.*")' +ts_init_subtest SysVIPC-shmem +{ + coproc MKFDS { "$TS_HELPER_MKFDS" sysvshm; } + if read -u ${MKFDS[0]} PID; then + ${TS_CMD_LSFD} -p "$PID" -n -o ASSOC,SOURCE -Q "${EXPR}" + echo 'ASSOC,SOURCE': $? + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lsfd/column-type b/tests/ts/lsfd/column-type index cf6175e..77bc5c9 100755 --- a/tests/ts/lsfd/column-type +++ b/tests/ts/lsfd/column-type @@ -46,11 +46,11 @@ for C in ro-regular-file pidfd inotify socketpair; do ${TS_CMD_LSFD} -n -o ASSOC,STTYPE,TYPE -p "${PID}" -Q "${EXPR}" echo "$C"':ASSOC,STTYPE,TYPE': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 - if [ "$C-$?" == "pidfd-$ENOSYS" ]; then + if [ "$C-$?" == "pidfd-$TS_EXIT_NOTSUPP" ]; then ts_skip_subtest "pidfd_open(2) is not available" continue fi diff --git a/tests/ts/lsfd/column-xmode b/tests/ts/lsfd/column-xmode new file mode 100755 index 0000000..1e719a4 --- /dev/null +++ b/tests/ts/lsfd/column-xmode @@ -0,0 +1,202 @@ +#!/bin/bash +# +# Copyright (C) 2022 Masatake YAMATO <yamato@redhat.com> +# +# 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="MODE and XMODE columns" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +. "$TS_SELF/lsfd-functions.bash" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_check_prog "stat" + +ts_cd "$TS_OUTDIR" + +INO=$(stat -c '%i' "$TS_HELPER_MKFDS") +PID= +FD=3 + + +EXPR="(FD == 3)" +ts_init_subtest "MODE-r-bit" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" ro-regular-file $FD; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o MODE -p "${PID}" -Q "${EXPR}" + echo "MODE(r-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +ts_init_subtest "XMODE-r-bit" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" ro-regular-file $FD; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(r-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +EXPR="(FD == $((FD + 1)))" +ts_init_subtest "MODE-w-bit" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" pipe-no-fork $FD $((FD + 1)); } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o MODE -p "${PID}" -Q "${EXPR}" + echo "MODE(w-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +ts_init_subtest "XMODE-w-bit" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" pipe-no-fork $FD $((FD + 1)); } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(w-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +EXPR='(ASSOC == "mem") and (INODE == '"$INO"') and (MODE != "r--") and (MODE != "rw-") and (MODE != "rwx")' +ts_init_subtest "MODE-x-bit" +if [ "$QEMU_USER" == "1" ]; then + ts_skip_subtest "running under qemu-user emulation" +else + { + coproc MKFDS { "$TS_HELPER_MKFDS" ro-regular-file $FD; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o MODE -p "${PID}" -Q "${EXPR}" + echo "MODE(x-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + wait "${MKFDS_PID}" + ts_finalize_subtest +fi + +ts_init_subtest "XMODE-x-bit" +if [ "$QEMU_USER" == "1" ]; then + ts_skip_subtest "running under qemu-user emulation" +else + { + coproc MKFDS { "$TS_HELPER_MKFDS" ro-regular-file $FD; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(x-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + wait "${MKFDS_PID}" + ts_finalize_subtest +fi + +FILE=./test_mkfds_make_regular_file +EXPR='(FD == '"$FD"')' +ts_init_subtest "XMODE-D-bit" +{ + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" delete=1; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(D-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +for m in flock-sh posix-r- ofd-r-; do + ts_init_subtest "XMODE-l-bit-$m" + { + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(l-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + wait "${MKFDS_PID}" + if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip_subtest "$m lock is not available" + continue + fi + ts_finalize_subtest +done + +ts_init_subtest "XMODE-l-bit-lease-r" +f=ro-regular-file-read-lease +touch "$f" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" ro-regular-file $FD file=$f read-lease=1; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(l-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +rm -f "$f" +ts_finalize_subtest + +for m in flock-ex posix--w posix-rw ofd--w ofd-rw lease-w; do + ts_init_subtest "XMODE-L-bit-$m" + { + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(L-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + wait "${MKFDS_PID}" + if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip_subtest "$m lock is not available" + continue + fi + ts_finalize_subtest +done + +M0=6 +M1=9 +EXPR="(FD == $M0) or (FD == $M1)" +ts_init_subtest "XMODE-m-bit" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" eventpoll $FD $M0 $M1; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q "${EXPR}" + echo "XMODE(m-bit): " $? + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 +wait "${MKFDS_PID}" +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lsfd/option-filter-broken-exp b/tests/ts/lsfd/filter-broken-exp index bedf439..1854e50 100755 --- a/tests/ts/lsfd/option-filter-broken-exp +++ b/tests/ts/lsfd/filter-broken-exp @@ -25,12 +25,13 @@ ts_check_test_command "$TS_CMD_LSFD" ts_cd "$TS_OUTDIR" { - $TS_CMD_LSFD -Q '' $TS_CMD_LSFD -Q '(' $TS_CMD_LSFD -Q ')' $TS_CMD_LSFD -Q '(FD == 1)garbage' - $TS_CMD_LSFD -Q 'FD' $TS_CMD_LSFD -Q 'NOSUCHCOLUMN' } > $TS_OUTPUT 2>&1 +sed -i -e 's/syntax error.*/<bison syntax error message removed>/g' \ + $TS_OUTPUT $TS_ERRLOG + ts_finalize diff --git a/tests/ts/lsfd/filter-floating-point-nums b/tests/ts/lsfd/filter-floating-point-nums new file mode 100755 index 0000000..7f66dd5 --- /dev/null +++ b/tests/ts/lsfd/filter-floating-point-nums @@ -0,0 +1,90 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="timerfd" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +EXPR= + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" timerfd $FD clockid=realtime remaining=0 interval=10 interval-nanofrac=000050000; } + if read -u ${MKFDS[0]} PID; then + + PID_1=$((PID -1)) + EXPR="(PID > ${PID_1}.9) and (PID < ${PID}.1) and (ASSOC == 'exe')" + PID_0=$(${TS_CMD_LSFD} -n -r -o PID -Q "$EXPR") + echo "pid in a range:" $? + + if [[ "${PID_0}" == "${PID}" ]]; then + echo "coparing pids": $? + else + echo "coparing pids": $? "PID_0:${PID_0} == PID:${PID}" + fi + + EXPR='(TIMERFD.INTERVAL < 10.000051) and (TIMERFD.INTERVAL > 10)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL <= 10) and (TIMERFD.INTERVAL > 9.99)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL >= 10)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL >= 10.0)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + + EXPR='(TIMERFD.INTERVAL < 10) and (0 < TIMERFD.INTERVAL)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL < 10) and (0.0 < TIMERFD.INTERVAL)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL > 11)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL == 10.00005)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + EXPR='(TIMERFD.INTERVAL == 10.000051)' + ${TS_CMD_LSFD} -n -r -o FD,TIMERFD.INTERVAL -p "$PID" -Q "$EXPR" + echo "FD,TIMERFD.INTERVAL: $EXPR": $? + + echo DONE >&"${MKFDS[1]}" + fi + + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/lsfd-functions.bash b/tests/ts/lsfd/lsfd-functions.bash index d9a3595..3a3f58f 100644 --- a/tests/ts/lsfd/lsfd-functions.bash +++ b/tests/ts/lsfd/lsfd-functions.bash @@ -16,11 +16,11 @@ # # The exit-status used in a test target. -readonly ENOSYS=17 readonly EPERM=18 readonly ENOPROTOOPT=19 readonly EPROTONOSUPPORT=20 -readonly EACCESS=21 +readonly EACCES=21 +readonly ENOENT=22 function lsfd_wait_for_pausing { ts_check_prog "sleep" @@ -59,7 +59,7 @@ function lsfd_compare_dev { fi } -lsfd_strip_type_stream() +function lsfd_strip_type_stream { # lsfd changes the output of NAME column for a unix stream socket # whether the kernel reports it is a "UNIX-STREAM" socket or a @@ -68,7 +68,7 @@ lsfd_strip_type_stream() sed -e 's/ type=stream//' } -lsfd_make_state_connected() +function lsfd_make_state_connected { # Newer kernels report the states of unix dgram sockets created by # sockerpair(2) are "connected" via /proc/net/unix though Older @@ -83,3 +83,39 @@ lsfd_make_state_connected() # to that on newer kernels. sed -e 's/state=unconnected/state=connected/' } + +function lsfd_check_mkfds_factory +{ + local FACTORY=$1 + + ts_check_test_command "$TS_HELPER_MKFDS" + if ! "$TS_HELPER_MKFDS" --is-available "$FACTORY"; then + ts_skip "test_mkfds has no factory for $FACTORY" + fi +} + +function lsfd_check_sockdiag +{ + local family=$1 + + ts_check_test_command "$TS_HELPER_MKFDS" + + local msg + local err + + msg=$("$TS_HELPER_MKFDS" -c sockdiag 9 family=$family 2>&1) + err=$? + + case $err in + 0) + return;; + $EPROTONOSUPPORT) + ts_skip "NETLINK_SOCK_DIAG protocol is not supported in socket(2)";; + $EACCES) + ts_skip "sending a msg via a sockdiag netlink socket is not permitted";; + $ENOENT) + ts_skip "sockdiag netlink socket is not available";; + *) + ts_failed "failed to create a sockdiag netlink socket $family ($err): $msg";; + esac +} diff --git a/tests/ts/lsfd/mkfds-bpf-map b/tests/ts/lsfd/mkfds-bpf-map new file mode 100755 index 0000000..7821fe5 --- /dev/null +++ b/tests/ts/lsfd/mkfds-bpf-map @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="bpf-map files" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_nonroot +ts_skip_docker + +. "$TS_SELF/lsfd-functions.bash" +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +NAME=mkfds_map +{ + coproc MKFDS { "$TS_HELPER_MKFDS" bpf-map "$FD" map-type-id=2 name="$NAME"; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -r -n -oBPF-MAP.TYPE,BPF-MAP.TYPE.RAW,BPF.NAME -p "${PID}" -Q "(FD == $FD)" + echo "BPF-MAP.TYPE,BPF-MAP.TYPE.RAW,BPF.NAME": $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip "bpf(2) is not available" +fi + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-bpf-prog b/tests/ts/lsfd/mkfds-bpf-prog new file mode 100755 index 0000000..b2a7275 --- /dev/null +++ b/tests/ts/lsfd/mkfds-bpf-prog @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="bpf-prog files" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_nonroot +ts_skip_docker + +. "$TS_SELF/lsfd-functions.bash" +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +NAME=mkdfs_prog +{ + coproc MKFDS { "$TS_HELPER_MKFDS" bpf-prog "$FD" prog-type-id=2 name="$NAME"; } + if read -r -u "${MKFDS[0]}" PID; then + "${TS_CMD_LSFD}" -r -n -oBPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME -p "${PID}" -Q "(FD == $FD)" + echo "BPF-PROG.TYPE,BPF-PROG.TYPE.RAW,BPF.NAME": $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then + ts_skip "bpf(2) is not available" +fi + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-cdev-tun b/tests/ts/lsfd/mkfds-cdev-tun new file mode 100755 index 0000000..7354509 --- /dev/null +++ b/tests/ts/lsfd/mkfds-cdev-tun @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="tun device and interface behind the device" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_nonroot + +[[ -e /dev/net/tun ]] || ts_skip "/dev/net/tun doest not exist" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +IFNAME= + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" cdev-tun $FD ; } + if read -u ${MKFDS[0]} PID IFNAME; then + EXPR='(FD == '"$FD"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,MODE,TYPE,SOURCE -Q "${EXPR}" + echo 'ASSOC,MODE,TYPE,SOURCE': $? + + output=$(${TS_CMD_LSFD} -p "${PID}" -n --raw -o NAME -Q "${EXPR}") + if [[ "$output" == "iface=$IFNAME" ]]; then + echo 'NAME': $? + else + echo 'NAME': $? + echo "expected NAME: iface=$IFNAME" + echo "output NAME: $output" + fi + + output=$(${TS_CMD_LSFD} -p "${PID}" -n --raw -o TUN.IFACE -Q "${EXPR}") + if [[ "$output" == "$IFNAME" ]]; then + echo 'TUN.IFACE': $? + else + echo 'TUN.IFAEC': $? + echo "expected TUN.IFACE: $IFNAME" + echo "output TUN.IFACE: $output" + fi + + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-directory b/tests/ts/lsfd/mkfds-directory index ef769c9..738cb86 100755 --- a/tests/ts/lsfd/mkfds-directory +++ b/tests/ts/lsfd/mkfds-directory @@ -101,7 +101,7 @@ esac echo 'stat reports:' "$(stat -c %h /)" fi - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-eventfd b/tests/ts/lsfd/mkfds-eventfd new file mode 100755 index 0000000..02c86a6 --- /dev/null +++ b/tests/ts/lsfd/mkfds-eventfd @@ -0,0 +1,104 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="eventfd with fork" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID0= +PID1= +FD0=3 +FD1=4 +EXPR= +ID0= +ID1= +NAME0= +NAME1= +ENDPOINTS= + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" eventfd $FD0 $FD1 ; } + if read -u ${MKFDS[0]} PID0 PID1; then + EXPR='(FD == '"$FD0"') or (FD =='"$FD1"')' + ${TS_CMD_LSFD} -p "${PID0}" -n -o ASSOC,MODE,TYPE,SOURCE -Q "${EXPR}" + echo 'parent: ASSOC,MODE,TYPE,SOURCE': $? + + NAME0=$(${TS_CMD_LSFD} -p "${PID0}" --raw -n -o NAME -Q "${EXPR}") + echo 'parent: NAME': $? + + ID0=$(${TS_CMD_LSFD} -p "${PID0}" --raw -n -o EVENTFD.ID -Q "${EXPR}") + echo 'parent: ID': $? + + EXPR='(FD == '"$FD0"') or (FD =='"$FD1"')' + ${TS_CMD_LSFD} -p "${PID1}" -n -o ASSOC,MODE,TYPE,SOURCE -Q "${EXPR}" + echo 'child: ASSOC,MODE,TYPE,SOURCE': $? + + NAME1=$(${TS_CMD_LSFD} -p "${PID1}" --raw -n -o NAME -Q "${EXPR}") + echo 'child: NAME': $? + + ID1=$(${TS_CMD_LSFD} -p "${PID1}" --raw -n -o EVENTFD.ID -Q "${EXPR}") + echo 'child: ID': $? + + if [ "${NAME0}" == "${NAME1}" ]; then + echo 'NAME[STR]:' $? + else + echo 'NAME[STR]:' $? + echo NAME0: "${NAME0}" + echo NAME1: "${NAME1}" + fi + + if [ "${ID0}" == "${ID1}" ]; then + echo 'ID[STR]:' $? + else + echo 'ID[STR]:' $? + echo ID0: "${ID0}" + echo ID0: "${ID1}" + fi + + if [ "${NAME0}" == "id=${ID1}" ]; then + echo 'NAMExID[STR]:' $? + else + echo 'NAMExID[STR]:' $? + echo NAME0: "${NAME0}" + echo ID0: "${ID0}" + fi + + EXPR='(EVENTFD.ID == '"${ID0}"')' + ENDPOINTS=$(${TS_CMD_LSFD} --raw -n -o PID,ASSOC,ENDPOINTS -Q "${EXPR}") + tmp=$(printf "%d %d %d,test_mkfds,%d\n%d %d %d,test_mkfds,%d" \ + "$PID0" "$FD0" "$PID1" "$FD1" \ + "$PID1" "$FD1" "$PID0" "$FD0") + if [ "$ENDPOINTS" == "$tmp" ]; then + echo 'ENDPOINTS[STR]:' $? + else + echo 'ENDPOINTS[STR]:' $? + echo 'ENDPOINTS:' "$ENDPOINTS" + echo 'lsfd:' "$tmp" + fi + + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-eventpoll b/tests/ts/lsfd/mkfds-eventpoll new file mode 100755 index 0000000..230d6c4 --- /dev/null +++ b/tests/ts/lsfd/mkfds-eventpoll @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="eventpoll targets" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD0=3 +FD1=5 +FD2=7 + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" eventpoll $FD0 $FD1 $FD2 ; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD0"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,TYPE,NAME,EVENTPOLL.TFDS -Q "${EXPR}" + echo 'ASSOC,TYPE,NAME,EVENTPOLL.TFDS': $? + ${TS_CMD_LSFD} -J -p "${PID}" -n -o ASSOC,TYPE,NAME,EVENTPOLL.TFDS -Q "${EXPR}" + echo 'ASSOC,TYPE,NAME,EVENTPOLL.TFDS (JSON)': $? + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-inotify b/tests/ts/lsfd/mkfds-inotify new file mode 100755 index 0000000..a44fd77 --- /dev/null +++ b/tests/ts/lsfd/mkfds-inotify @@ -0,0 +1,74 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="inotify" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_CMD_FINDMNT" +ts_check_prog "stat" +ts_check_prog "sed" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +dir=/proc +file=/proc/cmdline +PROC="$(stat -c %i $dir)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $dir)" +CMDLINE="$(stat -c %i $file)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $file)" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" inotify $FD dir=$dir file=$file ; } + if read -u ${MKFDS[0]} PID; then + EXPR='(PID == '"${PID}"') and (FD == '"$FD"')' + INODES_RAW=$(${TS_CMD_LSFD} --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") + echo "INOTIFY.INODES.RAW": $? + if [[ "$INODES_RAW" == "${CMDLINE}"'\x0a'"${PROC}" ]]; then + echo "INOTIFY.INODES.RAW" == CMDLINE'\x0a'PROC + else + echo "INOTIFY.INODES.RAW": "$INODES_RAW" + echo "CMDLINE": "$CMDLINE" + echo "PROC": "$PROC" + fi + INODES_RAW_JSON=$(${TS_CMD_LSFD} -J --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") + echo "INOTIFY.INODES.RAW (JSON)": $? + EXPECTED_JSON=$(cat<<EOF +{ + "lsfd": [ + { + "inotify.inodes.raw": [ + "$CMDLINE", "$PROC" + ] + } + ] +} +EOF + ) + if [[ "$INODES_RAW_JSON" == "${EXPECTED_JSON}" ]]; then + echo "INOTIFY.INODES.RAW" == EXPECTED_JSON + else + echo "INOTIFY.INODES.RAW": "$INODES_RAW_JSON" + fi + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-inotify-btrfs b/tests/ts/lsfd/mkfds-inotify-btrfs new file mode 100755 index 0000000..5dc8e97 --- /dev/null +++ b/tests/ts/lsfd/mkfds-inotify-btrfs @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Copyright (C) 2024 Masatake YAMATO <yamato@redhat.com> +# +# 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="inotify on btrfs" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_nonroot + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_CMD_FINDMNT" +ts_check_prog "stat" +ts_check_prog "sed" +ts_check_prog "mkfs.btrfs" +ts_check_prog "dd" + +ts_cd "$TS_OUTDIR" + +IMG=img.btrfs +MNTPNT=mntpnt +mkdir -p $MNTPNT +dd if=/dev/zero of=$IMG bs=114294784 count=1 status=none +if ! mkfs.btrfs -q $IMG; then + ts_skip "failed to make a btrfs image: $IMG" +fi +if ! mount $IMG $MNTPNT; then + ts_skip "failed to mount a btrfs image, $IMG to $MNTPNT" +fi +trap "umount $MNTPNT; rm -f $IMG" EXIT + +if ! touch $MNTPNT/fstab; then + ts_skip "failed to touch a file on a btrfs filesystem: $MNTPNT/fstab" +fi + +PID= +FD=3 +ROOT="$(stat -c %i $MNTPNT)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $MNTPNT)" +FSTAB="$(stat -c %i $MNTPNT/fstab)"@"$($TS_CMD_FINDMNT --raw --noheadings -oMAJ:MIN --target $MNTPNT/fstab)" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" inotify $FD dir=$MNTPNT file=$MNTPNT/fstab; } + if read -u ${MKFDS[0]} PID; then + EXPR='(PID == '"${PID}"') and (FD == '"$FD"')' + INODES_RAW=$(${TS_CMD_LSFD} --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") + echo "INOTIFY.INODES.RAW": $? + if [[ "$INODES_RAW" == "${FSTAB}"'\x0a'"${ROOT}" ]]; then + echo "INOTIFY.INODES.RAW" == FSTAB'\x0a'ROOT + else + echo "INOTIFY.INODES.RAW": "$INODES_RAW" + echo "FSTAB": "$FSTAB" + echo "ROOT": "$ROOT" + fi + INODES_RAW_JSON=$(${TS_CMD_LSFD} -J --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}") + echo "INOTIFY.INODES.RAW (JSON)": $? + EXPECTED_JSON=$(cat<<EOF +{ + "lsfd": [ + { + "inotify.inodes.raw": [ + "$FSTAB", "$ROOT" + ] + } + ] +} +EOF + ) + if [[ "$INODES_RAW_JSON" == "${EXPECTED_JSON}" ]]; then + echo "INOTIFY.INODES.RAW" == EXPECTED_JSON + else + echo "INOTIFY.INODES.RAW": "$INODES_RAW_JSON" + fi + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-mapped-packet-socket b/tests/ts/lsfd/mkfds-mapped-packet-socket index a1fb68f..12c5ef6 100755 --- a/tests/ts/lsfd/mkfds-mapped-packet-socket +++ b/tests/ts/lsfd/mkfds-mapped-packet-socket @@ -49,7 +49,7 @@ for SOCKTYPE in RAW DGRAM; do ${TS_CMD_LSFD} -p "$PID" -n -o NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL -Q "${EXPR}" echo 'NAME,SOCK.TYPE,SOCK.PROTONAME,PACKET.IFACE,PACKET.PROTOCOL': $? - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} ERR=$? diff --git a/tests/ts/lsfd/mkfds-mqueue b/tests/ts/lsfd/mkfds-mqueue new file mode 100755 index 0000000..bd22132 --- /dev/null +++ b/tests/ts/lsfd/mkfds-mqueue @@ -0,0 +1,83 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="mqueue with fork" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" +ts_check_native_byteorder + +ts_cd "$TS_OUTDIR" + +MQUEUE=/mkfds-mqueue +PID0= +PID1= +FD0=3 +FD1=4 +EXPR= +INODE0= +INODE1= +ENDPOINTS= + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" mqueue $FD0 $FD1 path=${MQUEUE}; } + if read -u ${MKFDS[0]} PID0 PID1; then + EXPR='(FD == '"$FD0"') or (FD =='"$FD1"')' + ${TS_CMD_LSFD} -p "${PID0}" -n -o ASSOC,MODE,TYPE,SOURCE,NAME -Q "${EXPR}" + echo 'parent: ASSOC,MODE,TYPE,SOURCE,NAME': $? + + INODE0=$(${TS_CMD_LSFD} -p "${PID0}" --raw -n -o INODE -Q "${EXPR}") + echo 'parent: INODE': $? + + EXPR='(FD == '"$FD0"') or (FD =='"$FD1"')' + ${TS_CMD_LSFD} -p "${PID1}" -n -o ASSOC,MODE,TYPE,SOURCE -Q "${EXPR}" + echo 'child: ASSOC,MODE,TYPE,SOURCE': $? + + INODE1=$(${TS_CMD_LSFD} -p "${PID1}" --raw -n -o INODE -Q "${EXPR}") + echo 'child: INODE': $? + + if [ "${INODE0}" == "${INODE1}" ]; then + echo 'INODE[STR]:' $? + else + echo 'INODE[STR]:' $? + echo INODE0: "${INODE0}" + echo INODE1: "${INODE1}" + fi + + EXPR='(INODE == '"${INODE0}"') and (TYPE == "mqueue")' + ENDPOINTS=$(${TS_CMD_LSFD} --raw -n -o PID,ASSOC,ENDPOINTS -Q "${EXPR}") + tmp=$(printf "%d %d %d,test_mkfds,%d-w\n%d %d %d,test_mkfds,%dr-" \ + "$PID0" "$FD0" "$PID1" "$FD1" \ + "$PID1" "$FD1" "$PID0" "$FD0") + if [ "$ENDPOINTS" == "$tmp" ]; then + echo 'ENDPOINTS[STR]:' $? + else + echo 'ENDPOINTS[STR]:' $? + echo 'ENDPOINTS:' "$ENDPOINTS" + echo 'lsfd:' "$tmp" + grep mqueue /proc/self/mountinfo + fi + + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-multiplexing b/tests/ts/lsfd/mkfds-multiplexing new file mode 100755 index 0000000..8cc7f31 --- /dev/null +++ b/tests/ts/lsfd/mkfds-multiplexing @@ -0,0 +1,70 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="XMODE.m for classical system calls for multiplexing" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +# /proc/${PID}/syscall is rendered in the host side byteorder. +ts_skip_qemu_user + +ts_check_prog "grep" + +ts_cd "$TS_OUTDIR" + +PID= + +for multiplexer in pselect6 select poll ppoll; do + ts_init_subtest "${multiplexer}" + if ! "$TS_HELPER_MKFDS" -W | grep -q "^$multiplexer\$"; then + ts_skip_subtest "the multiplexer ${multiplexer} is not available" + continue + fi + + { + coproc MKFDS { "$TS_HELPER_MKFDS" -w "$multiplexer" multiplexing {10..22}; } + } > "$TS_OUTPUT" 2>&1 + + if read -r -u "${MKFDS[0]}" PID; then + if ! cat /proc/"${PID}"/syscall > /dev/null 2>&1; then + kill -CONT "${PID}" + wait "${MKFDS_PID}" + ts_skip_subtest "cannot open /proc/${PID}/syscall" + continue + fi + { + "${TS_CMD_LSFD}" -n -o ASSOC,XMODE -p "${PID}" -Q '(FD >= 10) && (FD <= 22)' + echo "[$multiplexer] ASSOC,XMODE: $?" + + # For debugging + if [[ $("${TS_CMD_LSFD}" -n -o XMODE -p "${PID}" -Q '(FD == 10)') != "r----m" ]]; then + cat /proc/"${PID}"/syscall + fi + + echo DONE >&"${MKFDS[1]}" + } >> "$TS_OUTPUT" 2>&1 + fi + + wait "${MKFDS_PID}" + ts_finalize_subtest +done + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-netlink-groups b/tests/ts/lsfd/mkfds-netlink-groups index 896b50c..b7646c2 100755 --- a/tests/ts/lsfd/mkfds-netlink-groups +++ b/tests/ts/lsfd/mkfds-netlink-groups @@ -47,7 +47,7 @@ NETLINK_GROUPS=5 else printf "LPORT: FAILED (PID: %d != NETLINK.LPORT: %d)\n" "${PID}" "${NETLINK_LPORT}" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-netlink-protocol b/tests/ts/lsfd/mkfds-netlink-protocol index c1a5ffc..abf2eb2 100755 --- a/tests/ts/lsfd/mkfds-netlink-protocol +++ b/tests/ts/lsfd/mkfds-netlink-protocol @@ -46,7 +46,7 @@ NETLINK_GROUPS=5 else printf "LPORT: FAILED (PID: %d != NETLINK.LPORT: %d)\n" "${PID}" "${NETLINK_LPORT}" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-netns b/tests/ts/lsfd/mkfds-netns index cd110f6..0fbaec8 100755 --- a/tests/ts/lsfd/mkfds-netns +++ b/tests/ts/lsfd/mkfds-netns @@ -25,6 +25,7 @@ ts_skip_docker . "$TS_SELF/lsfd-functions.bash" ts_check_test_command "$TS_CMD_LSFD" ts_check_test_command "$TS_HELPER_MKFDS" +lsfd_check_mkfds_factory netns ts_cd "$TS_OUTDIR" @@ -61,11 +62,11 @@ INO_NS= echo "NAME_FD: $NAME_FD" == "net:[INO_NS: $INO_NS]": $? fi - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 -if [ "$?" == "$ENOSYS" ]; then +if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then ts_skip "ioctl(fd, SIOCGSKNS) is not available" fi diff --git a/tests/ts/lsfd/mkfds-pidfd b/tests/ts/lsfd/mkfds-pidfd index aad693f..c0fae4f 100755 --- a/tests/ts/lsfd/mkfds-pidfd +++ b/tests/ts/lsfd/mkfds-pidfd @@ -40,11 +40,11 @@ EXPR="(PID != ${TARGET}) and (FD == 3) and (PIDFD.PID == ${TARGET})" ${TS_CMD_LSFD} -n -o ASSOC,STTYPE,SOURCE,NAME,PIDFD.COMM,PIDFD.PID -p "${PID}" -p ${TARGET} -Q "${EXPR}" echo 'ASSOC,STTYPE,SOURCE,NAME,PIDFD.COMM,PIDFD.PID': $? - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 -if [ "$?" == "$ENOSYS" ]; then +if [ "$?" == "$TS_EXIT_NOTSUPP" ]; then ts_skip "pidfd_open(2) is not available" fi diff --git a/tests/ts/lsfd/mkfds-ping b/tests/ts/lsfd/mkfds-ping index c2ca049..2baafde 100755 --- a/tests/ts/lsfd/mkfds-ping +++ b/tests/ts/lsfd/mkfds-ping @@ -90,7 +90,7 @@ ERRMSG= for i in 0 1; do ERRMSG=$("$TS_HELPER_MKFDS" -c -q "${FACTORY[$i]}" 3 id=$ID 2>&1) ERR="$?" - if [[ "$ERR" == "$EACCESS" ]]; then + if [[ "$ERR" == "$EACCES" ]]; then case "$ERRMSG" in *bind*) MSG="making ${TYPE[$i]} socket with specifying id is not allowed (blocked by SELinux?)" @@ -122,7 +122,7 @@ for i in 0 1; do -o ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,${COLNS[$i]}.LADDR,${COLNS[$i]}.RADDR,PING.ID \ -p "${PID}" -Q "${EXPR[$i]}" echo "ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,${COLNS[$i]}.LADDR,${COLNS[$i]}.RADDR,PING.ID": $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -132,7 +132,7 @@ for i in 0 1; do -o ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,${COLNS[$i]}.LADDR,${COLNS[$i]}.RADDR,PING.ID \ -p "${PID}" -Q "${EXPR[$i]}" echo "ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,${COLNS[$i]}.LADDR,${COLNS[$i]}.RADDR,PING.ID": $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi } > "$TS_OUTPUT" 2>&1 wait "${MKFDS_PID}" diff --git a/tests/ts/lsfd/mkfds-pipe-no-fork b/tests/ts/lsfd/mkfds-pipe-no-fork index e28aa9d..f2f950a 100755 --- a/tests/ts/lsfd/mkfds-pipe-no-fork +++ b/tests/ts/lsfd/mkfds-pipe-no-fork @@ -116,7 +116,7 @@ EOF echo EXPECTED_LSFD_ENDPOINTS_JSON: "${EXPECTED_LSFD_ENDPOINTS_JSON}" fi - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-pty b/tests/ts/lsfd/mkfds-pty new file mode 100755 index 0000000..cc781eb --- /dev/null +++ b/tests/ts/lsfd/mkfds-pty @@ -0,0 +1,73 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="ptmx and associated pts" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD0=5 +FD1=6 +INDEX= + +col_test() +{ + local col=$1 + local expected=$2 + local output + + output=$(${TS_CMD_LSFD} -p "${PID}" -n --raw -o "$col" -Q "${EXPR}") + echo "$col": $? + if [[ "$output" != "$expected" ]]; then + echo "expected ${col} -Q ${EXPR}: ${expected}" + echo "output ${col} -Q ${EXPR}: ${output}" + fi +} + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" pty $FD0 $FD1 ; } + if read -u ${MKFDS[0]} PID INDEX; then + EXPR='(FD == '$FD0')' + columns=ASSOC,MODE,TYPE,SOURCE + ${TS_CMD_LSFD} -p "${PID}" -n -r -o "$columns" -Q "${EXPR}" + echo "$columns": $? + + col_test NAME "tty-index=${INDEX}" + col_test ENDPOINTS "${PID},test_mkfds,${FD1}r-" + col_test PTMX.TTY-INDEX "$INDEX" + + EXPR='(FD == '$FD1')' + columns=ASSOC,MODE,TYPE + ${TS_CMD_LSFD} -p "${PID}" -n -r -o "$columns" -Q "${EXPR}" + echo "$columns": $? + + col_test SOURCE "pts:${INDEX}" + col_test NAME "/dev/pts/${INDEX}" + col_test ENDPOINTS "${PID},test_mkfds,${FD0}rw" + + echo DONE >&"${MKFDS[1]}" + fi + wait ${MKFDS_PID} +} > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-raw b/tests/ts/lsfd/mkfds-raw index 0260ba1..5770340 100755 --- a/tests/ts/lsfd/mkfds-raw +++ b/tests/ts/lsfd/mkfds-raw @@ -40,7 +40,7 @@ PROTOCOL=5 -o ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET.LADDR,INET.RADDR,RAW.PROTOCOL \ -p "${PID}" -Q "${EXPR}" echo 'ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET.LADDR,INET.RADDR,RAW.PROTOCOL': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" diff --git a/tests/ts/lsfd/mkfds-raw6 b/tests/ts/lsfd/mkfds-raw6 index 0b82fff..1eddea2 100755 --- a/tests/ts/lsfd/mkfds-raw6 +++ b/tests/ts/lsfd/mkfds-raw6 @@ -41,7 +41,7 @@ PROTOCOL=5 -o ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET6.LADDR,INET6.RADDR,RAW.PROTOCOL \ -p "${PID}" -Q "${EXPR}" echo 'ASSOC,TYPE,NAME,SOCK.STATE,SOCK.TYPE,INET6.LADDR,INET6.RADDR,RAW.PROTOCOL': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" diff --git a/tests/ts/lsfd/mkfds-ro-block-device b/tests/ts/lsfd/mkfds-ro-block-device index ad5a492..7b14630 100755 --- a/tests/ts/lsfd/mkfds-ro-block-device +++ b/tests/ts/lsfd/mkfds-ro-block-device @@ -72,7 +72,7 @@ EXPR= lsfd_compare_dev "${TS_CMD_LSFD}" "${LSFD_LOOP_BDEV}" "${EXPR}" - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-ro-regular-file b/tests/ts/lsfd/mkfds-ro-regular-file index a2c4c26..367a07d 100755 --- a/tests/ts/lsfd/mkfds-ro-regular-file +++ b/tests/ts/lsfd/mkfds-ro-regular-file @@ -70,7 +70,7 @@ EXPR= lsfd_compare_dev "${TS_CMD_LSFD}" $target "${EXPR}" - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-rw-character-device b/tests/ts/lsfd/mkfds-rw-character-device index 85dd29c..3df2944 100755 --- a/tests/ts/lsfd/mkfds-rw-character-device +++ b/tests/ts/lsfd/mkfds-rw-character-device @@ -42,7 +42,7 @@ EXPR= lsfd_compare_dev "${TS_CMD_LSFD}" $target "${EXPR}" - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-signalfd b/tests/ts/lsfd/mkfds-signalfd new file mode 100755 index 0000000..ecc7379 --- /dev/null +++ b/tests/ts/lsfd/mkfds-signalfd @@ -0,0 +1,64 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="signalfd" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +# s390x and riscv64 reported the same error: +# +# lsfd: signalfd ... +# diff-{{{ +# --- /home/runner/work/util-linux/util-linux/tests/expected/lsfd/mkfds-signalfd 2023-06-08 10:20:13.520555037 +0000 +# +++ /home/runner/work/util-linux/util-linux/tests/output/lsfd/mkfds-signalfd 2023-06-08 11:12:21.150054369 +0000 +# @@ -1,2 +1,2 @@ +# - 3 signalfd mask=FPE,USR1,42 FPE,USR1,42 +# + 3 signalfd mask=FPE,USR1,44 FPE,USR1,44 +# ASSOC,TYPE,NAME,SIGNALFD.MASK: 0 +# }}}-diff +# +# FAILED (lsfd/mkfds-signalfd) +# +# The error is nothing to do with endianness; the endian s390x is +# big-endian. riscv64 is little-endian. +# +# So Qemu's user emulation is suspicious. +ts_skip_qemu_user + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 + +COL=ASSOC,TYPE,NAME,SIGNALFD.MASK +EXPR='(FD == '"$FD"')' + +{ + coproc MKFDS { "$TS_HELPER_MKFDS" signalfd $FD; } + if read -u ${MKFDS[0]} PID; then + ${TS_CMD_LSFD} -p "${PID}" -n -o "${COL}" -Q "${EXPR}" + echo "${COL}": $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-socketpair b/tests/ts/lsfd/mkfds-socketpair index 3ffd088..3ef60c7 100755 --- a/tests/ts/lsfd/mkfds-socketpair +++ b/tests/ts/lsfd/mkfds-socketpair @@ -20,6 +20,7 @@ TS_DESC="AF_UNIX socket pair created with socketpair(2)" . "$TS_TOPDIR"/functions.sh ts_init "$*" +. "$TS_SELF/lsfd-functions.bash" ts_check_test_command "$TS_CMD_LSFD" ts_check_test_command "$TS_HELPER_MKFDS" @@ -28,11 +29,14 @@ ts_check_prog "sed" ts_cd "$TS_OUTDIR" +lsfd_check_sockdiag "unix" + PID= FD0=3 FD1=4 EXPR= +ts_init_subtest "DGRAM" { coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=DGRAM; } if read -u ${MKFDS[0]} PID; then @@ -40,9 +44,96 @@ EXPR= ${TS_CMD_LSFD} -n -o ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME -Q "${EXPR}" | sed -e 's/UNIX-DGRAM/UNIX/' echo 'ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME': ${PIPESTATUS[0]} - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 + +wait ${MKFDS_PID} +ts_finalize_subtest + +ts_init_subtest "STREAM" +{ + coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=STREAM; } + if read -u ${MKFDS[0]} PID; then + EXPR='(PID == '"${PID}"') and ((FD == '"$FD0"') or (FD == '"$FD1"'))' + ${TS_CMD_LSFD} -n -o ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME -Q "${EXPR}" | sed -e 's/UNIX-STREAM/UNIX/' + echo 'ASSOC,MODE,STTYPE,SOURCE,SOCK.PROTONAME': ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi +} > "$TS_OUTPUT" 2>&1 + +wait ${MKFDS_PID} +ts_finalize_subtest + +mkfds_socketpair_stream_endpoint() +{ + ts_init_subtest "STREAM-ENDPOINT" + if [ "$QEMU_USER" == "1" ]; then + ts_skip_subtest "running under qemu-user emulation" + return + fi + { + coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=STREAM; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD0"') or (FD == '"$FD1"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS -Q "${EXPR}" | sed -e "s/${PID}/1/g" + echo 'ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS': ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + + wait ${MKFDS_PID} + ts_finalize_subtest +} + +mkfds_socketpair_stream_shutdown_state() +{ + ts_init_subtest "STREAM-SHUTDOWN-STATE" + if [ "$QEMU_USER" == "1" ]; then + ts_skip_subtest "running under qemu-user emulation" + return + fi + { + coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=STREAM halfclose=1; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD0"') or (FD == '"$FD1"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,MODE,STTYPE,SOURCE,SOCK.SHUTDOWN -Q "${EXPR}" + echo 'ASSOC,MODE,STTYPE,SOURCE,SOCK.SHUTDOWN': ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + + wait ${MKFDS_PID} + ts_finalize_subtest +} + +mkfds_socketpair_stream_endpoint_halfclose() +{ + ts_init_subtest "STREAM-ENDPOINT-halfclose" + if [ "$QEMU_USER" == "1" ]; then + ts_skip_subtest "running under qemu-user emulation" + return fi + { + coproc MKFDS { "$TS_HELPER_MKFDS" socketpair $FD0 $FD1 socktype=STREAM halfclose=1; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD0"') or (FD == '"$FD1"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS -Q "${EXPR}" | sed -e "s/${PID}/1/g" + echo 'ASSOC,MODE,STTYPE,SOURCE,ENDPOINTS': ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + wait ${MKFDS_PID} -} > $TS_OUTPUT 2>&1 + ts_finalize_subtest +} + +mkfds_socketpair_stream_endpoint +mkfds_socketpair_stream_shutdown_state +mkfds_socketpair_stream_endpoint_halfclose ts_finalize diff --git a/tests/ts/lsfd/mkfds-symlink b/tests/ts/lsfd/mkfds-symlink index 4825645..56eccca 100755 --- a/tests/ts/lsfd/mkfds-symlink +++ b/tests/ts/lsfd/mkfds-symlink @@ -37,7 +37,7 @@ EXPR= ${TS_CMD_LSFD} -n -o ASSOC,MODE,TYPE,NAME,FLAGS -Q "${EXPR}" echo 'ASSOC,MODE,TYPE,NAME,FLAGS': $? - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/mkfds-tcp b/tests/ts/lsfd/mkfds-tcp index e531a7b..666cf6a 100755 --- a/tests/ts/lsfd/mkfds-tcp +++ b/tests/ts/lsfd/mkfds-tcp @@ -34,15 +34,15 @@ EXPR='(TYPE == "TCP") and (FD >= 3) and (FD <= 5)' { coproc MKFDS { "$TS_HELPER_MKFDS" tcp $FDS $FDC $FDA \ - server-port=34567 \ - client-port=23456 ; } + server-port=56789 \ + client-port=45678 ; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ -o ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT \ -p "${PID}" -Q "${EXPR}" echo 'ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-tcp6 b/tests/ts/lsfd/mkfds-tcp6 index 7368bfa..bffa630 100755 --- a/tests/ts/lsfd/mkfds-tcp6 +++ b/tests/ts/lsfd/mkfds-tcp6 @@ -35,15 +35,15 @@ EXPR='(TYPE == "TCPv6") and (FD >= 3) and (FD <= 5)' { coproc MKFDS { "$TS_HELPER_MKFDS" tcp6 $FDS $FDC $FDA \ - server-port=34567 \ - client-port=23456 ; } + server-port=56789 \ + client-port=45678 ; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ -o ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT \ -p "${PID}" -Q "${EXPR}" echo 'ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-timerfd b/tests/ts/lsfd/mkfds-timerfd new file mode 100755 index 0000000..d2e0b8a --- /dev/null +++ b/tests/ts/lsfd/mkfds-timerfd @@ -0,0 +1,109 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="timerfd" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_check_prog "sed" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +EXPR='(FD == '"$FD"')' + +ts_init_subtest "realtime-remaining-and-interval" +{ + clock=realtime + coproc MKFDS { "$TS_HELPER_MKFDS" timerfd $FD clockid=$clock remaining=99 interval=5 interval-nanofrac=123456789; } + if read -u ${MKFDS[0]} PID; then + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,TYPE,NAME -Q "${EXPR}" | \ + sed -e 's/remaining=[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/remaining=100.987654321/' + echo 'ASSOC,TYPE,NAME': ${PIPESTATUS[0]} + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.CLOCKID -Q "${EXPR}" + echo 'CLOCKID': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.REMAINING -Q "${EXPR}" | \ + sed -e 's/^ *[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/100.987654321/' + echo 'TIMERFD.REMAINING': ${PIPESTATUS[0]} + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.INTERVAL -Q "${EXPR}" + echo 'TIMERFD.INTERVAL': $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_init_subtest "monotonic-remaining-only" +{ + clock=monotonic + coproc MKFDS { "$TS_HELPER_MKFDS" timerfd $FD clockid=$clock remaining=99 interval=0 interval-nanofrac=0; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,TYPE,NAME -Q "${EXPR}" | \ + sed -e 's/remaining=[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/remaining=100.987654321/' + echo 'ASSOC,TYPE,NAME': ${PIPESTATUS[0]} + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.CLOCKID -Q "${EXPR}" + echo 'CLOCKID': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.REMAINING -Q "${EXPR}" | \ + sed -e 's/^ *[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/100.987654321/' + echo 'TIMERFD.REMAINING': ${PIPESTATUS[0]} + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.INTERVAL -Q "${EXPR}" + echo 'TIMERFD.INTERVAL': $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_init_subtest "boottime-interval-only" +{ + clock=boottime + coproc MKFDS { "$TS_HELPER_MKFDS" timerfd $FD clockid=$clock remaining=0 interval=10 interval-nanofrac=123456789; } + if read -u ${MKFDS[0]} PID; then + EXPR='(FD == '"$FD"')' + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,TYPE,NAME -Q "${EXPR}" + echo 'ASSOC,TYPE,NAME': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.CLOCKID -Q "${EXPR}" + echo 'CLOCKID': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.REMAINING -Q "${EXPR}" + echo 'TIMERFD.REMAINING': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.INTERVAL -Q "${EXPR}" + echo 'TIMERFD.INTERVAL': $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" +} > "$TS_OUTPUT" 2>&1 +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-timerfd-alarm b/tests/ts/lsfd/mkfds-timerfd-alarm new file mode 100755 index 0000000..c7e6650 --- /dev/null +++ b/tests/ts/lsfd/mkfds-timerfd-alarm @@ -0,0 +1,56 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="timerfd associating alarm" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_skip_capability WAKE_ALARM + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +PID= +FD=3 +EXPR='(FD == '"$FD"')' + +{ + for clock in realtime-alarm boottime-alarm; do + coproc MKFDS { "$TS_HELPER_MKFDS" timerfd $FD clockid=$clock remaining=0 interval=0 interval-nanofrac=0; } + if read -u ${MKFDS[0]} PID; then + ${TS_CMD_LSFD} -p "${PID}" -n -o ASSOC,TYPE,NAME -Q "${EXPR}" + echo 'ASSOC,TYPE,NAME': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.CLOCKID -Q "${EXPR}" + echo 'CLOCKID': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.REMAINING -Q "${EXPR}" + echo 'TIMERFD.REMAINING': $? + + ${TS_CMD_LSFD} -p "${PID}" -n -o TIMERFD.INTERVAL -Q "${EXPR}" + echo 'TIMERFD.INTERVAL': $? + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" + done +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/mkfds-udp b/tests/ts/lsfd/mkfds-udp index e6e1f1c..3d1b272 100755 --- a/tests/ts/lsfd/mkfds-udp +++ b/tests/ts/lsfd/mkfds-udp @@ -51,8 +51,8 @@ LPORT= for lite in 0 1; do coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ @@ -60,13 +60,13 @@ for lite in 0 1; do -p "${PID}" -Q "${EXPR[$lite]}" echo "ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,${COLNS[$lite]}.LADDR,${COLNS[$lite]}.LPORT,${COLNS[$lite]}.RADDR,${COLNS[$lite]}.RPORT": $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ server-do-bind=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -85,13 +85,13 @@ for lite in 0 1; do echo "NAME pattern match: FAILED (NAME=$NAME)" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ client-do-bind=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -115,13 +115,13 @@ for lite in 0 1; do echo "LADDR/LPORT pattern match: FAILED (LADDR=$LADDR, LPORT=$LPORT)" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ client-do-connect=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -130,7 +130,7 @@ for lite in 0 1; do -p "${PID}" -Q "${EXPR[$lite]}" echo 'ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" done > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-udp6 b/tests/ts/lsfd/mkfds-udp6 index 75381ba..26bdacd 100755 --- a/tests/ts/lsfd/mkfds-udp6 +++ b/tests/ts/lsfd/mkfds-udp6 @@ -52,8 +52,8 @@ LPORT= for lite in 0 1; do coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ @@ -61,13 +61,13 @@ for lite in 0 1; do -p "${PID}" -Q "${EXPR[$lite]}" echo "ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,${COLNS[$lite]}.LADDR,${COLNS[$lite]}.LPORT,${COLNS[$lite]}.RADDR,${COLNS[$lite]}.RPORT": $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ server-do-bind=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -86,13 +86,13 @@ for lite in 0 1; do echo "NAME pattern match: FAILED (NAME=$NAME)" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ client-do-bind=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -116,13 +116,13 @@ for lite in 0 1; do echo "LADDR/LPORT pattern match: FAILED (LADDR=$LADDR, LPORT=$LPORT)" fi - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \ - server-port=34567 \ - client-port=23456 \ + server-port=56789 \ + client-port=45678 \ client-do-connect=no \ lite=$lite; } if read -r -u "${MKFDS[0]}" PID; then @@ -131,7 +131,7 @@ for lite in 0 1; do -p "${PID}" -Q "${EXPR[$lite]}" echo "ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,${COLNS[$lite]}.LADDR,${COLNS[$lite]}.LPORT,${COLNS[$lite]}.RADDR,${COLNS[$lite]}.RPORT": $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" done > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-unix-dgram b/tests/ts/lsfd/mkfds-unix-dgram index c8b40eb..45a0b2d 100755 --- a/tests/ts/lsfd/mkfds-unix-dgram +++ b/tests/ts/lsfd/mkfds-unix-dgram @@ -35,7 +35,7 @@ make_state_connected() { # The first one is for rewriting NAME column. # The second one is for rewriting STATE column. - lsfd_make_state_connected | sed -e 's/unconnected/ connected/' + lsfd_make_state_connected | sed -e 's/unconnected/connected/' } { @@ -43,11 +43,12 @@ make_state_connected() path=test_mkfds-unix-dgram ; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ + -r \ -o ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH \ -p "${PID}" -Q "${EXPR}" | make_state_connected echo 'ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -56,11 +57,12 @@ make_state_connected() abstract=true ; } if read -r -u "${MKFDS[0]}" PID; then ${TS_CMD_LSFD} -n \ + -r \ -o ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH \ -p "${PID}" -Q "${EXPR}" | make_state_connected echo 'ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': $? - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-unix-in-netns b/tests/ts/lsfd/mkfds-unix-in-netns index cfca087..9ed4567 100755 --- a/tests/ts/lsfd/mkfds-unix-in-netns +++ b/tests/ts/lsfd/mkfds-unix-in-netns @@ -78,7 +78,7 @@ for t in stream dgram seqpacket; do compare_net_namespaces "$t" "${PID}" - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -94,7 +94,7 @@ for t in stream dgram seqpacket; do compare_net_namespaces "abstract $t" "${PID}" - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" } > "$TS_OUTPUT" 2>&1 diff --git a/tests/ts/lsfd/mkfds-unix-stream b/tests/ts/lsfd/mkfds-unix-stream index fe08e72..3c31443 100755 --- a/tests/ts/lsfd/mkfds-unix-stream +++ b/tests/ts/lsfd/mkfds-unix-stream @@ -46,7 +46,7 @@ EXPR='(((TYPE == "UNIX-STREAM") or (TYPE == "UNIX")) and (FD >= 3) and (FD <= 5) -p "${PID}" -Q "${EXPR}" | lsfd_strip_type_stream echo 'ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -59,7 +59,7 @@ EXPR='(((TYPE == "UNIX-STREAM") or (TYPE == "UNIX")) and (FD >= 3) and (FD <= 5) -p "${PID}" -Q "${EXPR}" | lsfd_strip_type_stream echo '(abs) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -75,7 +75,7 @@ EXPR='(((TYPE == "UNIX-STREAM") or (TYPE == "UNIX")) and (FD >= 3) and (FD <= 5) echo '(shutdown) ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} # Surprisingly, the socket status doesn't change at all. - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" @@ -88,7 +88,7 @@ EXPR='(((TYPE == "UNIX-STREAM") or (TYPE == "UNIX")) and (FD >= 3) and (FD <= 5) -p "${PID}" -Q "${EXPR}" | lsfd_strip_type_stream echo 'ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} - kill -CONT "${PID}" + echo DONE >&"${MKFDS[1]}" fi wait "${MKFDS_PID}" diff --git a/tests/ts/lsfd/mkfds-unix-stream-requiring-sockdiag b/tests/ts/lsfd/mkfds-unix-stream-requiring-sockdiag new file mode 100755 index 0000000..6189d0d --- /dev/null +++ b/tests/ts/lsfd/mkfds-unix-stream-requiring-sockdiag @@ -0,0 +1,58 @@ +#!/bin/bash +# +# Copyright (C) 2022 Masatake YAMATO <yamato@redhat.com> +# +# 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="UNIX stream sockets" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" +ts_skip_qemu_user + +. "$TS_SELF/lsfd-functions.bash" + +ts_check_test_command "$TS_CMD_LSFD" +ts_check_test_command "$TS_HELPER_MKFDS" + +ts_cd "$TS_OUTDIR" + +lsfd_check_sockdiag "unix" + +PID= +FDS=3 +FDC=4 +FDA=5 +EXPR='(((TYPE == "UNIX-STREAM") or (TYPE == "UNIX")) and (FD >= 3) and (FD <= 5))' + +{ + for t in stream seqpacket; do + + coproc MKFDS { "$TS_HELPER_MKFDS" unix-stream $FDS $FDC $FDA \ + path="test_mkfds-unix with newline ${t} $(printf 'a\nb\nc')" \ + type=$t ; } + if read -r -u "${MKFDS[0]}" PID; then + ${TS_CMD_LSFD} -n \ + -o ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH \ + -p "${PID}" -Q "${EXPR}" | lsfd_strip_type_stream + echo 'ASSOC,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,UNIX.PATH': ${PIPESTATUS[0]} + + echo DONE >&"${MKFDS[1]}" + fi + wait "${MKFDS_PID}" + + done +} > "$TS_OUTPUT" 2>&1 + +ts_finalize diff --git a/tests/ts/lsfd/option-inet b/tests/ts/lsfd/option-inet index 011a9b3..7ca8837 100755 --- a/tests/ts/lsfd/option-inet +++ b/tests/ts/lsfd/option-inet @@ -25,23 +25,54 @@ ts_skip_docker ts_check_test_command "$TS_CMD_LSFD" ts_check_test_command "$TS_HELPER_MKFDS" +ts_check_prog "mkfifo" + ts_cd "$TS_OUTDIR" +FIFO=./test_mkfds-option-inet.fifo { - "$TS_HELPER_MKFDS" -q tcp 3 4 5 server-port=34567 client-port=23456 & - PID0=$! - - "$TS_HELPER_MKFDS" -q tcp6 3 4 5 server-port=34567 client-port=23456 & - PID1=$! - - "$TS_HELPER_MKFDS" -q ro-regular-file 3 file=/etc/passwd & - PID2=$! - - "$TS_HELPER_MKFDS" -q udp 3 4 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1& - PID3=$! - - "$TS_HELPER_MKFDS" -q udp6 3 4 lite=1 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1& - PID4=$! + rm -f "${FIFO}" + if ! mkfifo "${FIFO}"; then + ts_finalize "failed in creating a fifo" + fi + + "$TS_HELPER_MKFDS" -X tcp 3 4 5 server-port=34567 client-port=23456 > "${FIFO}" & + if ! read PID0 < "${FIFO}"; then + rm "${FIFO}" + ts_finalize "$TS_HELPER_MKFDS tcp...doesn't report its pid" + fi + + "$TS_HELPER_MKFDS" -X tcp6 3 4 5 server-port=34567 client-port=23456 > "${FIFO}" & + if ! read PID1 < "${FIFO}"; then + kill -CONT "${PID0}" + wait "${PID0}" + rm "${FIFO}" + ts_finalize "$TS_HELPER_MKFDS tcp6...doesn't report its pid" + fi + + "$TS_HELPER_MKFDS" -X ro-regular-file 3 file=/etc/passwd > "${FIFO}" & + if ! read PID2 < "${FIFO}"; then + kill -CONT "${PID0}" "${PID1}" + wait "${PID0}" "${PID1}" + rm "${FIFO}" + ts_finalize "$TS_HELPER_MKFDS ro-regular-file...doesn't report its pid" + fi + + "$TS_HELPER_MKFDS" -X udp 3 4 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1 > "${FIFO}" & + if ! read PID3 < "${FIFO}"; then + kill -CONT "${PID0}" "${PID1}" "${PID2}" + wait "${PID0}" "${PID1}" "${PID2}" + rm "${FIFO}" + ts_finalize "$TS_HELPER_MKFDS udp...doesn't report its pid" + fi + + "$TS_HELPER_MKFDS" -X udp6 3 4 lite=1 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1 > "${FIFO}" & + if ! read PID4 < "${FIFO}"; then + kill -CONT "${PID0}" "${PID1}" "${PID2}" "${PID3}" + wait "${PID0}" "${PID1}" "${PID2}" "${PID3}" + rm "${FIFO}" + ts_finalize "$TS_HELPER_MKFDS udp6 lite=1...doesn't report its pid" + fi OPT='--inet' echo "# $OPT" @@ -85,14 +116,9 @@ ts_cd "$TS_OUTDIR" -o ASSOC,TYPE,NAME \ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)" - kill -CONT "${PID0}" - wait "${PID0}" - - kill -CONT "${PID1}" - wait "${PID1}" - - kill -CONT "${PID2}" - wait "${PID2}" + kill -CONT "${PID0}" "${PID1}" "${PID2}" "${PID3}" "${PID4}" + wait "${PID0}" "${PID1}" "${PID2}" "${PID3}" "${PID4}" + rm "${FIFO}" } > "$TS_OUTPUT" 2>&1 ts_finalize diff --git a/tests/ts/lsfd/option-pid b/tests/ts/lsfd/option-pid index 0ea4353..003b624 100755 --- a/tests/ts/lsfd/option-pid +++ b/tests/ts/lsfd/option-pid @@ -72,7 +72,7 @@ POUT= [ "${QOUT}" = "${POUT}" ] echo "EQ[-p PID --pid=1]:" $? - kill -CONT ${PID} + echo DONE >&"${MKFDS[1]}" fi wait ${MKFDS_PID} } > $TS_OUTPUT 2>&1 diff --git a/tests/ts/lsfd/option-summary b/tests/ts/lsfd/option-summary index 64bf54b..9813901 100755 --- a/tests/ts/lsfd/option-summary +++ b/tests/ts/lsfd/option-summary @@ -35,14 +35,14 @@ PIDS= PID= for i in {1..10}; do - "$TS_HELPER_MKFDS" -q ro-regular-file $FD file=$F_GROUP & + "$TS_HELPER_MKFDS" -X -q ro-regular-file $FD file=$F_GROUP & PID=$! PIDS="${PIDS} ${PID} " lsfd_wait_for_pausing "${PID}" done for i in {1..3}; do - "$TS_HELPER_MKFDS" -q ro-regular-file $FD file=$F_PASSWD & + "$TS_HELPER_MKFDS" -X -q ro-regular-file $FD file=$F_PASSWD & PID=$! PIDS="${PIDS} ${PID} " lsfd_wait_for_pausing "${PID}" diff --git a/tests/ts/lslocks/lslocks b/tests/ts/lslocks/lslocks new file mode 100755 index 0000000..912fac8 --- /dev/null +++ b/tests/ts/lslocks/lslocks @@ -0,0 +1,117 @@ +#!/bin/bash +# +# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com> +# +# 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="flock" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSLOCKS" +ts_check_test_command "$TS_HELPER_MKFDS" +ts_check_prog "sed" + +ts_cd "$TS_OUTDIR" + +FILE0=util-linux-lslocks-target-file +FILE=${FILE0}--$$ +FD=17 +DFD=18 +COLS=COMMAND,TYPE,SIZE,MODE,START,END +OPTS="--raw --noheadings" +METHODS=( + flock-sh + flock-ex + posix-r- + posix--w + posix-rw + ofd-r- + ofd--w + ofd-rw + lease-w +) + +OFD_METHODS=( + flock-sh + flock-ex + ofd-r- + ofd--w + ofd-rw + lease-w +) + +SLEEP() +{ + # It appears that there is a time lag between locking and its + # visibility in /proc/locks. See the unstbale results of errors I + # observed in https://github.com/util-linux/util-linux/pull/2629. + sleep 1 +} + +DFD=18 +COLS_WITH_HOLDERS=COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS +run_lslocks() +{ + local m=$1 + + { + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m; } + if read -r -u "${MKFDS[0]}" PID; then + SLEEP + + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS}" + echo "# $m + ${COLS} + ${OPTS}": $? + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o PATH | sed -e 's#.*\('"$FILE0"'\)--[0-9]\+ *$#\1#' + echo "# $m + PATH + ${OPTS}": ${PIPESTATUS[0]} + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + + wait "${MKFDS_PID}" +} + +run_lslocks_with_co_holders() +{ + local m=$1 + + { + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m dupfd=$DFD; } + SLEEP + if read -r -u "${MKFDS[0]}" PID; then + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS_WITH_HOLDERS}" | sed -e "s/${PID},/1,/g" + echo "# $m + ${COLS_WITH_HOLDERS} + ${OPTS}": ${PIPESTATUS[0]} + echo DONE >&"${MKFDS[1]}" + fi + } > "$TS_OUTPUT" 2>&1 + + wait "${MKFDS_PID}" +} + +for m in "${METHODS[@]}"; do + ts_init_subtest "$m" + run_lslocks "$m" + ts_finalize_subtest +done + +for m in "${OFD_METHODS[@]}"; do + ts_init_subtest "$m+HOLDERS" + run_lslocks_with_co_holders "$m" + ts_finalize_subtest +done + +ts_finalize diff --git a/tests/ts/misc/boilerplate b/tests/ts/misc/boilerplate new file mode 100755 index 0000000..d795ec2 --- /dev/null +++ b/tests/ts/misc/boilerplate @@ -0,0 +1,39 @@ +#!/bin/bash + +# Copyright (C) 2023 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="Documentation/boilerplate" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_BOILERPLATE" + +ts_init_subtest exec + +"$TS_HELPER_BOILERPLATE" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" +echo "ret=$?" >> "$TS_OUTPUT" + +ts_finalize_subtest + +ts_init_subtest help + +"$TS_HELPER_BOILERPLATE" --help >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" +echo "ret=$?" >> "$TS_OUTPUT" + +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/misc/enosys b/tests/ts/misc/enosys new file mode 100755 index 0000000..ae93c63 --- /dev/null +++ b/tests/ts/misc/enosys @@ -0,0 +1,58 @@ +#!/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="enosys" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_ENOSYS" +ts_check_enosys_syscalls fallocate fsopen execve + +ts_init_subtest basic + +FALLOCATE_TEST="$TS_HELPER_ENOSYS fallocate" + +$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s fallocate $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s fsopen -s fallocate $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s fallocate -s fsopen $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" + +ts_finalize_subtest + +ts_init_subtest exec + +FALLOCATE_TEST="$TS_HELPER_ENOSYS exec" + +$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s execve $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" + +ts_finalize_subtest + +ts_init_subtest ioctl + +FALLOCATE_TEST="$TS_HELPER_ENOSYS ioctl" + +$FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s ioctl $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -i FIOCLEX $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -i "$("$TS_CMD_ENOSYS" -m | grep FIOCLEX | awk '{ print $1 }')" $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" +"$TS_CMD_ENOSYS" -s ioctl -i FIOCLEX $FALLOCATE_TEST > /dev/null 2>> "$TS_OUTPUT" + +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/misc/lsclocks b/tests/ts/misc/lsclocks new file mode 100755 index 0000000..71fefaa --- /dev/null +++ b/tests/ts/misc/lsclocks @@ -0,0 +1,70 @@ +#!/bin/bash + +# Copyright (C) 2023 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="lsclocks" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LSCLOCKS" +ts_check_prog sed + +mask_timestamps() { + sed 's/[0-9]\+\.[0-9]\+/X.X/g' +} + +NO_DISCOVER="--no-discover-dynamic --no-discover-rtc" + +ts_init_subtest basic + +"$TS_CMD_LSCLOCKS" $NO_DISCOVER -o TYPE,ID,CLOCK,NAME > "$TS_OUTPUT" 2>> "$TS_ERRLOG" + +ts_finalize_subtest + +ts_init_subtest time + +"$TS_CMD_LSCLOCKS" --time monotonic | mask_timestamps > "$TS_OUTPUT" 2>> "$TS_ERRLOG" + +ts_finalize_subtest + +ts_init_subtest dynamic + +if [ -c /dev/ptp0 ] && [ -r /dev/ptp0 ]; then + "$TS_CMD_LSCLOCKS" $NO_DISCOVER --dynamic-clock /dev/ptp0 --output TYPE,ID,CLOCK,NAME \ + | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG" + ts_finalize_subtest +else + ts_skip_subtest "/dev/ptp0 not usable" +fi + +ts_init_subtest rtc + +if [ -c /dev/rtc0 ] && [ -r /dev/rtc0 ]; then + "$TS_CMD_LSCLOCKS" $NO_DISCOVER --rtc /dev/rtc0 --output TYPE,ID,CLOCK,NAME \ + | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG" + ts_finalize_subtest +else + ts_skip_subtest "/dev/rtc0 not usable" +fi + +ts_init_subtest cpu + +"$TS_CMD_LSCLOCKS" --cpu 1 --output TYPE,ID,NAME | tail -1 > "$TS_OUTPUT" 2>> "$TS_ERRLOG" + +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/misc/setpgid b/tests/ts/misc/setpgid new file mode 100755 index 0000000..40c4754 --- /dev/null +++ b/tests/ts/misc/setpgid @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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="setpgid" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_SETPGID" + +$TS_CMD_SETPGID echo "success" >> $TS_OUTPUT 2>> $TS_ERRLOG + +# qemu-user always reports '0' for the pgid field which prevents the test from +# working so we skip it. +ts_skip_qemu_user + +PGID1="$(awk '{print $5}' /proc/self/stat)" +PGID2="$($TS_CMD_SETPGID awk '{print $5}' /proc/self/stat)" +test ! "$PGID1" = "$PGID2" && echo "not equal" >> $TS_OUTPUT + +ts_finalize diff --git a/tests/ts/misc/time_t b/tests/ts/misc/time_t new file mode 100755 index 0000000..b0ced51 --- /dev/null +++ b/tests/ts/misc/time_t @@ -0,0 +1,28 @@ +#!/bin/bash + +# Copyright (C) 2023 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="time_t size" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_HELPER_SYSINFO" +[ -n "$UL_ALLOW_32BIT_TIME" ] && ts_skip "32bit time allowed" + +"$TS_HELPER_SYSINFO" 'sz(time_t)' >> "$TS_OUTPUT" + +ts_finalize diff --git a/tests/ts/misc/waitpid b/tests/ts/misc/waitpid index ae5ab6f..904222c 100755 --- a/tests/ts/misc/waitpid +++ b/tests/ts/misc/waitpid @@ -24,7 +24,7 @@ ts_check_test_command "$TS_CMD_WAITPID" ts_init_subtest normal -(sleep 0.2; echo 1 >> "$TS_OUTPUT") & +(sleep 0.5; echo 1 >> "$TS_OUTPUT") & BG1="$!" (sleep 0.1; echo 2 >> "$TS_OUTPUT") & @@ -44,7 +44,7 @@ echo $? >> "$TS_OUTPUT" ts_finalize_subtest ts_init_subtest exited -"$TS_CMD_WAITPID" -e 2147483647 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" +"$TS_CMD_WAITPID" -v -e 2147483647 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" echo $? >> "$TS_ERRLOG" ts_finalize_subtest diff --git a/tests/ts/mkswap/mkswap b/tests/ts/mkswap/mkswap index fa4856b..39b8723 100755 --- a/tests/ts/mkswap/mkswap +++ b/tests/ts/mkswap/mkswap @@ -27,6 +27,7 @@ ts_check_test_command "$TS_CMD_MKSWAP" ts_check_test_command "$TS_HELPER_SYSINFO" ts_check_prog "xz" ts_check_prog "cmp" +ts_check_prog "truncate" UUID=4c08e1cd-3c82-46bf-a55b-0c3270d6dfeb @@ -49,17 +50,54 @@ for PAGESIZE in 4096 8192; do ts_init_subtest $name rm -f "$outimg" - truncate -s $(( PAGESIZE * 10 )) "$outimg" > $TS_ERRLOG 2>&1 + truncate -s $(( PAGESIZE * 10 )) "$outimg" >> $TS_ERRLOG 2>&1 "$TS_CMD_MKSWAP" -q -L label -U "$UUID" -e "$ENDIANNESS" -p "$PAGESIZE" "$outimg" \ - > "$TS_OUTPUT" 2>/dev/null \ + >> "$TS_OUTPUT" 2>/dev/null \ || ts_log "mkswap failed" xz -dc "$TS_SELF/${BYTE_ORDER}-${PAGESIZE}.img.xz" > "$origimg" - cmp "$origimg" "$outimg" > "$TS_ERRLOG" 2>&1 + cmp "$origimg" "$outimg" >> "$TS_ERRLOG" 2>&1 + + ts_finalize_subtest + + ts_init_subtest "$name-file" + + rm -f "$outimg" + + "$TS_CMD_MKSWAP" -q -L label -U "$UUID" -e "$ENDIANNESS" -p "$PAGESIZE" -F -s $(( PAGESIZE * 10 )) "$outimg" \ + >> "$TS_OUTPUT" 2>/dev/null \ + || ts_log "mkswap failed" + xz -dc "$TS_SELF/${BYTE_ORDER}-${PAGESIZE}.img.xz" > "$origimg" + + cmp "$origimg" "$outimg" >> "$TS_ERRLOG" 2>&1 ts_finalize_subtest done done +ts_init_subtest offset + +offset=10000 +outimg="$TS_OUTDIR/offset.img" + +rm -f "$outimg" +truncate -s $(( 4096 * 10 )) "$outimg" > $TS_ERRLOG 2>&1 + +rm -f "$outimg.offset" +truncate -s $(( 4096 * 10 + $offset )) "$outimg.offset" > $TS_ERRLOG 2>&1 + +"$TS_CMD_MKSWAP" -q -U "$UUID" -p 4096 "$outimg" \ + >> "$TS_OUTPUT" 2>/dev/null \ + || ts_log "mkswap failed" + +"$TS_CMD_MKSWAP" -q -U "$UUID" -p 4096 -o "$offset" "$outimg.offset" \ + >> "$TS_OUTPUT" 2>/dev/null \ + || ts_log "mkswap -o failed" + +cmp -n "$offset" "$outimg.offset" /dev/zero >> "$TS_ERRLOG" 2>&1 +cmp "$outimg" "$outimg.offset" 0 "$offset" >> "$TS_ERRLOG" 2>&1 + +ts_finalize_subtest + ts_finalize diff --git a/tests/ts/mount/fallback b/tests/ts/mount/fallback index e2a1de7..cbdf449 100755 --- a/tests/ts/mount/fallback +++ b/tests/ts/mount/fallback @@ -22,7 +22,7 @@ test_mount_fallback() { mkdir -p "$MY_SOURCE" mkdir -p "$TS_MOUNTPOINT" - "$TS_HELPER_ENOSYS" $2 -- "$TS_CMD_MOUNT" --bind "$MY_SOURCE" "$TS_MOUNTPOINT" \ + "$TS_CMD_ENOSYS" $2 -- "$TS_CMD_MOUNT" --bind "$MY_SOURCE" "$TS_MOUNTPOINT" \ >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" [ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT" @@ -49,7 +49,7 @@ mkdir -p "$MOUNTPOINT" ts_init_subtest "later-fsopen" -$TS_HELPER_ENOSYS -s fsopen -- "$TS_CMD_MOUNT" -t foo,bar,ext2 "$DEVICE" "$MOUNTPOINT" \ +$TS_CMD_ENOSYS -s fsopen -- "$TS_CMD_MOUNT" -t foo,bar,ext2 "$DEVICE" "$MOUNTPOINT" \ >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" mkdir -p ${MOUNTPOINT}/subdir @@ -58,7 +58,7 @@ ts_finalize_subtest ts_init_subtest "subdir" -$TS_HELPER_ENOSYS -s fsopen -s open_tree -- \ +$TS_CMD_ENOSYS -s fsopen -s open_tree -- \ "$TS_CMD_MOUNT" -o X-mount.subdir=subdir "$DEVICE" "$MOUNTPOINT" \ >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" @@ -69,12 +69,12 @@ ts_finalize_subtest ts_init_subtest "mount_setattr" "$TS_CMD_MOUNT" "$DEVICE" "$MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" -$TS_HELPER_ENOSYS -s mount_setattr -- \ +$TS_CMD_ENOSYS -s mount_setattr -- \ "$TS_CMD_MOUNT" -o remount,ro "$MOUNTPOINT" \ >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_FINDMNT --kernel --mountpoint "$MOUNTPOINT" --options "ro" &> /dev/null [ "$?" == "0" ] || ts_die "Cannot find read-only in $MOUNTPOINT in /proc/self/mountinfo" -$TS_HELPER_ENOSYS -s mount_setattr -- \ +$TS_CMD_ENOSYS -s mount_setattr -- \ "$TS_CMD_MOUNT" --make-slave "$MOUNTPOINT" \ >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_FINDMNT -n --kernel --mountpoint "$MOUNTPOINT" -o PROPAGATION >> $TS_OUTPUT diff --git a/tests/ts/mount/fslists b/tests/ts/mount/fslists index 230186a..6ac72c3 100755 --- a/tests/ts/mount/fslists +++ b/tests/ts/mount/fslists @@ -61,7 +61,7 @@ ts_finalize_subtest ts_init_subtest "more-types-fstab" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_fstab_add $DEVICE $TS_MOUNTPOINT "foo,bar,ext2" -$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ts_fstab_clean ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $TS_MOUNTPOINT diff --git a/tests/ts/mount/fstab-all b/tests/ts/mount/fstab-all index 83e1b63..ad9a7d0 100755 --- a/tests/ts/mount/fstab-all +++ b/tests/ts/mount/fstab-all @@ -68,16 +68,15 @@ MOUNTPOINT=$TS_MOUNTPOINT [ -d "${MOUNTPOINT}D" ] || mkdir -p ${MOUNTPOINT}D # generic fstab -MY_FSTAB="$TS_OUTDIR/${TS_TESTNAME}.fstab" -rm -rf $MY_FSTAB -echo "${TS_DEVICE}1 ${MOUNTPOINT}A ext2 rw,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}2 ${MOUNTPOINT}B ext2 rw,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}3 ${MOUNTPOINT}C ext2 ro,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}4 ${MOUNTPOINT}D ext4 rw,defaults 0 0" >> $MY_FSTAB +rm -rf "${TS_FSTAB}" +echo "${TS_DEVICE}1 ${MOUNTPOINT}A ext2 rw,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}2 ${MOUNTPOINT}B ext2 rw,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}3 ${MOUNTPOINT}C ext2 ro,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}4 ${MOUNTPOINT}D ext4 rw,defaults 0 0" >> "${TS_FSTAB}" ts_init_subtest "basic" -$TS_CMD_MOUNT --all --fstab $MY_FSTAB >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} @@ -86,7 +85,7 @@ ts_finalize_subtest ts_init_subtest "filter-type" -$TS_CMD_MOUNT --all --fstab $MY_FSTAB -t ext4 >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" -t ext4 >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}D @@ -95,7 +94,7 @@ ts_finalize_subtest ts_init_subtest "filter-notype" -$TS_CMD_MOUNT --all --fstab $MY_FSTAB -t noext4 >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" -t noext4 >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C} @@ -104,7 +103,7 @@ ts_finalize_subtest ts_init_subtest "filter-option" -$TS_CMD_MOUNT --all --fstab $MY_FSTAB -O ro >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" -O ro >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}C @@ -113,7 +112,7 @@ ts_finalize_subtest ts_init_subtest "override-option" -$TS_CMD_MOUNT --all --fstab $MY_FSTAB -o ro >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab "${TS_FSTAB}" -o ro >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} @@ -123,7 +122,7 @@ ts_finalize_subtest ts_init_subtest "relative-path" cd "$TS_OUTDIR" > /dev/null -$TS_CMD_MOUNT --all --fstab $(basename "$MY_FSTAB") >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT --all --fstab $(basename "${TS_FSTAB}") >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" udevadm settle $TS_CMD_UMOUNT ${MOUNTPOINT}{A,B,C,D} @@ -135,16 +134,14 @@ ts_finalize_subtest ts_init_subtest "prefix" MY_ROOT="$TS_OUTDIR/${TS_TESTNAME}-rootdir" [ -d "${MY_ROOT}" ] || mkdir -p ${MY_ROOT} -# sub-test specific fstab -MY_FSTAB="$TS_OUTDIR/${TS_TESTNAME}.fstab" -rm -rf $MY_FSTAB -echo "${TS_DEVICE}1 /foo/A ext2 rw,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}2 /foo/B ext2 rw,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}3 /foo/C ext2 rw,defaults 0 0" >> $MY_FSTAB -echo "${TS_DEVICE}4 /foo/D ext4 rw,defaults 0 0" >> $MY_FSTAB +rm -rf "${TS_FSTAB}" +echo "${TS_DEVICE}1 /foo/A ext2 rw,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}2 /foo/B ext2 rw,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}3 /foo/C ext2 rw,defaults 0 0" >> "${TS_FSTAB}" +echo "${TS_DEVICE}4 /foo/D ext4 rw,defaults 0 0" >> "${TS_FSTAB}" # mount all to prefix $TS_CMD_MOUNT --all \ - --fstab $MY_FSTAB \ + --fstab "${TS_FSTAB}" \ --target-prefix $MY_ROOT \ -o X-mount.mkdir >> $TS_OUTPUT 2>> $TS_ERRLOG [ $? == 0 ] || ts_log "mount failed" diff --git a/tests/ts/mount/fstab-bind b/tests/ts/mount/fstab-bind index 2c799df..cae016d 100755 --- a/tests/ts/mount/fstab-bind +++ b/tests/ts/mount/fstab-bind @@ -20,7 +20,7 @@ ts_fstab_add $MY_SOURCE "$TS_MOUNTPOINT" "none" "bind,default,noauto" mkdir -p $MY_SOURCE mkdir -p $TS_MOUNTPOINT -$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG [ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT" $TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null diff --git a/tests/ts/mount/fstab-broken b/tests/ts/mount/fstab-broken index 19edc5f..ec4c342 100755 --- a/tests/ts/mount/fstab-broken +++ b/tests/ts/mount/fstab-broken @@ -34,11 +34,11 @@ mkdir -p $MNT ts_fstab_lock ts_fstab_open -echo "tmpd $MNT tmpfs" >> /etc/fstab +echo "tmpd $MNT tmpfs" >> "$TS_FSTAB" ts_fstab_close ts_init_subtest "mount" -$TS_CMD_MOUNT $MNT &> /dev/null +$TS_CMD_MOUNT -T "$TS_FSTAB" $MNT &> /dev/null [ "$?" = "0" ] || ts_log "error: mount $MNT" $TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null if [ "$?" != "0" ]; then @@ -57,7 +57,7 @@ ts_finalize_subtest ts_init_subtest "mount-all" -$TS_CMD_MOUNT -a &> /dev/null +$TS_CMD_MOUNT -T "$TS_FSTAB" -a &> /dev/null [ "$?" = "0" ] || ts_log "error: mount -a" $TS_CMD_FINDMNT --kernel --mountpoint "$MNT" &> /dev/null if [ "$?" != "0" ]; then diff --git a/tests/ts/mount/fstab-btrfs b/tests/ts/mount/fstab-btrfs index a1003ab..8e76dbb 100755 --- a/tests/ts/mount/fstab-btrfs +++ b/tests/ts/mount/fstab-btrfs @@ -94,8 +94,8 @@ ts_fstab_addline "$DEVICE" "$TS_MOUNTPOINT_SUBVOLID" "btrfs" "subvolid=$NON_DEFA ts_fstab_addline "$TS_MOUNTPOINT_SUBVOLID" "$TS_MOUNTPOINT_BIND" "auto" "bind" ts_fstab_close -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_UMOUNT "$TS_MOUNTPOINT_BIND" >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_UMOUNT "$TS_MOUNTPOINT_DEFAULT" >> $TS_OUTPUT 2>> $TS_ERRLOG @@ -124,8 +124,8 @@ ts_fstab_addline "$DEVICE" "$TS_MOUNTPOINT_SUBVOLID" "auto" "subvolid=$NON_DEFAU ts_fstab_addline "$TS_MOUNTPOINT_SUBVOL/bind-mnt" "$TS_MOUNTPOINT_BIND" "auto" "bind" ts_fstab_close -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_UMOUNT "$TS_MOUNTPOINT_BIND" >> $TS_OUTPUT 2>> $TS_ERRLOG $TS_CMD_UMOUNT "$TS_MOUNTPOINT_DEFAULT" >> $TS_OUTPUT 2>> $TS_ERRLOG diff --git a/tests/ts/mount/fstab-devname b/tests/ts/mount/fstab-devname index 5b64a32..6ac03b5 100755 --- a/tests/ts/mount/fstab-devname +++ b/tests/ts/mount/fstab-devname @@ -42,13 +42,13 @@ MOUNTPOINT=$TS_MOUNTPOINT ts_fstab_add $DEVICE ts_init_subtest "mountpoint" -$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE || >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "device-name" -$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-devname2label b/tests/ts/mount/fstab-devname2label index 1d85621..44066e1 100755 --- a/tests/ts/mount/fstab-devname2label +++ b/tests/ts/mount/fstab-devname2label @@ -41,7 +41,7 @@ ts_device_has "LABEL" $LABEL $DEVICE \ ts_fstab_add "LABEL=$LABEL" ts_udevadm_settle "$DEVICE" "LABEL" -$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" diff --git a/tests/ts/mount/fstab-devname2uuid b/tests/ts/mount/fstab-devname2uuid index 8105fa0..5039591 100755 --- a/tests/ts/mount/fstab-devname2uuid +++ b/tests/ts/mount/fstab-devname2uuid @@ -39,7 +39,7 @@ UUID=$(ts_uuid_by_devname "$DEVICE") || ts_die "Cannot find UUID on $DEVICE" ts_fstab_add "UUID=$UUID" ts_udevadm_settle "$DEVICE" "UUID" -$TS_CMD_MOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE" diff --git a/tests/ts/mount/fstab-label b/tests/ts/mount/fstab-label index 4b23e7f..a3cc06d 100755 --- a/tests/ts/mount/fstab-label +++ b/tests/ts/mount/fstab-label @@ -42,19 +42,19 @@ ts_fstab_add "LABEL=$LABEL" ts_udevadm_settle "$DEVICE" "LABEL" ts_init_subtest "no-option" -$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "L-option" -$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "LABEL-option" -$TS_CMD_MOUNT LABEL=$LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" LABEL=$LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-label2devname b/tests/ts/mount/fstab-label2devname index 75ca05e..fddbfa0 100755 --- a/tests/ts/mount/fstab-label2devname +++ b/tests/ts/mount/fstab-label2devname @@ -44,13 +44,13 @@ ts_udevadm_settle "$DEVICE" "LABEL" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_init_subtest "L-option" -$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "LABEL-option" -$TS_CMD_MOUNT "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-label2uuid b/tests/ts/mount/fstab-label2uuid index 4bfcae4..927cde9 100755 --- a/tests/ts/mount/fstab-label2uuid +++ b/tests/ts/mount/fstab-label2uuid @@ -46,13 +46,13 @@ ts_udevadm_settle "$DEVICE" "LABEL" "UUID" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_init_subtest "L-option" -$TS_CMD_MOUNT -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -L $LABEL >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "LABEL-option" -$TS_CMD_MOUNT "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" "LABEL=$LABEL" >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-loop b/tests/ts/mount/fstab-loop index 7cc589f..0541e3a 100755 --- a/tests/ts/mount/fstab-loop +++ b/tests/ts/mount/fstab-loop @@ -39,10 +39,10 @@ ts_fstab_lock ts_fstab_open ts_fstab_addline "$IMG" "$TS_MOUNTPOINT-1" "ext2" "loop" -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG ts_fstab_addline "$IMG" "$TS_MOUNTPOINT-2" "ext2" "loop" -$TS_CMD_MOUNT -a >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -a >> $TS_OUTPUT 2>> $TS_ERRLOG ts_fstab_close diff --git a/tests/ts/mount/fstab-none b/tests/ts/mount/fstab-none index 6a4d05b..95daa6c 100755 --- a/tests/ts/mount/fstab-none +++ b/tests/ts/mount/fstab-none @@ -17,7 +17,7 @@ ts_fstab_add "none" "$TS_MOUNTPOINT" "tmpfs" "rw,nosuid,nodev,relatime" mkdir -p $TS_MOUNTPOINT -$TS_CMD_MOUNT $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $TS_MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG [ "$?" = "0" ] || ts_log "error: mount $TS_MOUNTPOINT" $TS_CMD_FINDMNT --mountpoint "$TS_MOUNTPOINT" &> /dev/null diff --git a/tests/ts/mount/fstab-symlink b/tests/ts/mount/fstab-symlink index 4d3e37b..6d419f9 100755 --- a/tests/ts/mount/fstab-symlink +++ b/tests/ts/mount/fstab-symlink @@ -46,7 +46,7 @@ ln -s $DEVICE $LINKNAME ts_fstab_add $LINKNAME $TS_MOUNTPOINT "auto" "defaults,user" # variant A) -- UID=0 -$TS_CMD_MOUNT $LINKNAME >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $LINKNAME >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_die "A) Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $LINKNAME || ts_die "A) Cannot umount $LINKNAME" diff --git a/tests/ts/mount/fstab-uuid b/tests/ts/mount/fstab-uuid index 03917b7..f51bb29 100755 --- a/tests/ts/mount/fstab-uuid +++ b/tests/ts/mount/fstab-uuid @@ -42,19 +42,19 @@ ts_fstab_add "UUID=$UUID" ts_udevadm_settle "$DEVICE" "UUID" ts_init_subtest "no-option" -$TS_CMD_MOUNT $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "U-option" -$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "UUID-option" -$TS_CMD_MOUNT UUID=$UUID >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" UUID=$UUID >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-uuid2devname b/tests/ts/mount/fstab-uuid2devname index 9bf165e..2b338ac 100755 --- a/tests/ts/mount/fstab-uuid2devname +++ b/tests/ts/mount/fstab-uuid2devname @@ -42,13 +42,13 @@ ts_udevadm_settle "$DEVICE" "UUID" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_init_subtest "U-option" -$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "UUID-option" -$TS_CMD_MOUNT "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/fstab-uuid2label b/tests/ts/mount/fstab-uuid2label index de10ff0..02eb6b9 100755 --- a/tests/ts/mount/fstab-uuid2label +++ b/tests/ts/mount/fstab-uuid2label @@ -45,13 +45,13 @@ ts_udevadm_settle "$DEVICE" "LABEL" "UUID" [ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT ts_init_subtest "U-option" -$TS_CMD_MOUNT -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" -U $UUID >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG ts_finalize_subtest ts_init_subtest "UUID-option" -$TS_CMD_MOUNT "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_MOUNT -T "$TS_FSTAB" "UUID=$UUID" >> $TS_OUTPUT 2>> $TS_ERRLOG ts_is_mounted $DEVICE || ts_log "Cannot find $DEVICE in /proc/mounts" $TS_CMD_UMOUNT $DEVICE >> $TS_OUTPUT 2>>$TS_ERRLOG ts_finalize_subtest diff --git a/tests/ts/mount/special b/tests/ts/mount/special index 359d8aa..1771f5a 100755 --- a/tests/ts/mount/special +++ b/tests/ts/mount/special @@ -23,6 +23,7 @@ MOUNTER="/sbin/mount.mytest" ts_init "$*" ts_check_test_command "$TS_CMD_MOUNT" +ts_check_test_command "$TS_CMD_UMOUNT" ts_skip_nonroot @@ -55,7 +56,45 @@ ts_init_subtest "username" $TS_CMD_MOUNT -t mytest -ouser=name,abc /foo /bar &> $TS_OUTPUT ts_finalize_subtest -rm -f $MOUNTER -ts_finalize +ts_init_subtest "missing-options" +grep -q 'nodev[[:space:]]*tmpfs' /proc/filesystems +if [ "$?" == "0" ]; then +cat > $MOUNTER <<EOF +#!/bin/bash +# This util-linux regression test component +# It's safe to remove me... +# +exec $TS_CMD_MOUNT -t tmpfs -i "\$1" "\$2" -o x-foo=123 +EOF + chmod +x $MOUNTER + + mountpoint="$TS_OUTDIR/mnt" + mkdir -p "$mountpoint" + export LIBMOUNT_UTAB=$TS_OUTDIR/utab + rm -f $LIBMOUNT_UTAB + echo -n "" > $LIBMOUNT_UTAB + + $TS_CMD_MOUNT -t mytest -o x-bar=BAR /foo "$mountpoint" &> $TS_OUTPUT + udevadm settle + + grep -q "$mountpoint" /proc/mounts + if [ "$?" == "0" ]; then + cat "$LIBMOUNT_UTAB" \ + | grep "$mountpoint" \ + | sed -e "s|$mountpoint|/mountpoint|g" \ + -e 's/ID=[[:digit:]]* //g' \ + &> $TS_OUTPUT + $TS_CMD_UMOUNT "$mountpoint" + unset LIBMOUNT_UTAB + rm -f $MOUNTER + ts_finalize_subtest + else + ts_skip_subtest "tmpfs not mounted" + fi +else + ts_skip_subtest "tmpfs unsupported" +fi + +ts_finalize diff --git a/tests/ts/mount/umount-recursive b/tests/ts/mount/umount-recursive index 8b1fd47..94e3680 100755 --- a/tests/ts/mount/umount-recursive +++ b/tests/ts/mount/umount-recursive @@ -86,7 +86,7 @@ $TS_CMD_MOUNT ${TS_DEVICE}4 $TS_MOUNTPOINT/mntB/mntD >> $TS_OUTPUT 2>> $TS_ERRLO ts_log "E) Mount child-bind" mkdir -p $TS_MOUNTPOINT/bindC -$TS_CMD_MOUNT --bind $TS_MOUNTPOINT/mntB/mntC $TS_MOUNTPOINT/bindC &> /dev/nul +$TS_CMD_MOUNT --bind $TS_MOUNTPOINT/mntB/mntC $TS_MOUNTPOINT/bindC &> /dev/null ts_log "F) Mount mountpoint-bind" $TS_CMD_MOUNT --bind $TS_MOUNTPOINT $TS_MOUNTPOINT &> /dev/null diff --git a/tests/ts/rename/basic b/tests/ts/rename/basic index 786b092..28d1a57 100755 --- a/tests/ts/rename/basic +++ b/tests/ts/rename/basic @@ -72,4 +72,8 @@ touch rename_all_empty $TS_CMD_RENAME -v -a '' _ rename_all_empty >> $TS_OUTPUT 2>> $TS_ERRLOG rm -f _r_e_n_a_m_e___a_l_l___e_m_p_t_y_ +mkdir rename_dir +$TS_CMD_RENAME -v dir new_dir rename_dir/ >> $TS_OUTPUT 2>> $TS_ERRLOG +rmdir rename_new_dir + ts_finalize diff --git a/tests/ts/schedutils/chrt b/tests/ts/schedutils/chrt index aca735f..fd5f7af 100755 --- a/tests/ts/schedutils/chrt +++ b/tests/ts/schedutils/chrt @@ -21,9 +21,8 @@ ts_init "$*" ts_check_test_command "$TS_CMD_CHRT" ts_skip_nonroot - -# TODO: drone.io does not like FIFO and RR (container restriction?) -TS_KNOWN_FAIL="yes" +ts_skip_docker +ts_skip_qemu_user function do_chrt { $TS_CMD_CHRT $* $TS_CMD_CHRT --pid 0 | sed 's/.* policy: //; s/.* priority: //' >> $TS_OUTPUT 2>> $TS_ERRLOG @@ -93,9 +92,9 @@ fi ts_init_subtest "deadline" skip_policy SCHED_DEADLINE if [ $? == 0 ]; then - do_chrt --deadline --sched-period 13000 0 - do_chrt --deadline --sched-period 13000 --sched-deadline 12000 0 - do_chrt --deadline --sched-period 13000 --sched-deadline 12000 --sched-runtime 10000 0 + do_chrt --deadline --sched-period 130000 0 + do_chrt --deadline --sched-period 130000 --sched-deadline 120000 0 + do_chrt --deadline --sched-period 130000 --sched-deadline 120000 --sched-runtime 100000 0 cleanup_output ts_finalize_subtest fi diff --git a/tests/ts/setpriv/landlock b/tests/ts/setpriv/landlock new file mode 100755 index 0000000..d4ce5d1 --- /dev/null +++ b/tests/ts/setpriv/landlock @@ -0,0 +1,64 @@ +#!/bin/bash + +# Copyright (C) 2023 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="setpriv landlock" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +[[ "$COVERAGE" = yes ]] && ts_skip "does not work with coverage" + +ts_check_test_command "$TS_CMD_SETPRIV" + +"$TS_CMD_SETPRIV" --landlock-access fs \ + --landlock-rule path-beneath:execute:/ \ + --landlock-rule path-beneath:read-file:/ \ + true \ + || ts_skip "no landlock support in setpriv" + +ts_init_subtest "nothing-allowed" +"$TS_CMD_SETPRIV" --landlock-access fs true &> "$TS_OUTPUT" +ts_finalize_subtest + +ts_init_subtest "partial-access-fail" +"$TS_CMD_SETPRIV" --landlock-access \ + fs:write cp /dev/null /dev/zero \ + &> "$TS_OUTPUT" +ts_finalize_subtest + +ts_init_subtest "partial-access-success" +"$TS_CMD_SETPRIV" \ + --landlock-access fs:write --landlock-rule path-beneath:write:/dev/zero \ + cp /dev/null /dev/zero \ + &> "$TS_OUTPUT" +ts_finalize_subtest + +ts_init_subtest "combined-access" +"$TS_CMD_SETPRIV" --landlock-access fs:execute,read-file \ + --landlock-rule path-beneath:execute,read-file:/ \ + true \ + &> "$TS_OUTPUT" +ts_finalize_subtest + +ts_init_subtest "wildcard-access" +"$TS_CMD_SETPRIV" --landlock-access fs \ + --landlock-rule path-beneath::/ \ + true \ + &> "$TS_OUTPUT" +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/swapon/devname b/tests/ts/swapon/devname index d62b9d9..f4f9c16 100755 --- a/tests/ts/swapon/devname +++ b/tests/ts/swapon/devname @@ -36,11 +36,11 @@ $TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \ ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE" -$TS_CMD_SWAPON $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG +$TS_CMD_SWAPON $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG || ts_die "Swapon failed" grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps" -$TS_CMD_SWAPOFF $DEVICE +$TS_CMD_SWAPOFF $DEVICE || ts_die "Swapoff failed" # swapon/mkswap warns if system sets different permissions for loop devices sed --in-place '/insecure permissions .*, 0660 suggested/d' $TS_OUTPUT diff --git a/tests/ts/wipefs/images/bcachefs.img.xz b/tests/ts/wipefs/images/bcachefs.img.xz Binary files differnew file mode 100644 index 0000000..2c74b96 --- /dev/null +++ b/tests/ts/wipefs/images/bcachefs.img.xz diff --git a/tests/ts/wipefs/signatures b/tests/ts/wipefs/signatures new file mode 100755 index 0000000..7749588 --- /dev/null +++ b/tests/ts/wipefs/signatures @@ -0,0 +1,40 @@ +#!/bin/bash + +# +# Copyright (C) 2023 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="signatures" + +. "$TS_TOPDIR"/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_WIPEFS" +ts_check_prog "xz" + +mkdir -p "${TS_OUTDIR}/images" + +for img in $(ls "${TS_SELF}"/images/*.img.xz | sort); do + name="$(basename "$img" .img.xz)" + outimg="${TS_OUTDIR}/images/${name}.img" + + xz -dc "$img" > "$outimg" + + ts_init_subtest "$name" + "$TS_CMD_WIPEFS" --parsable --no-act "$outimg" 2> "$TS_ERRLOG" > "$TS_OUTPUT" + ts_finalize_subtest +done + +ts_finalize diff --git a/tests/ts/wipefs/wipefs b/tests/ts/wipefs/wipefs index c79be0c..0f0f8d8 100755 --- a/tests/ts/wipefs/wipefs +++ b/tests/ts/wipefs/wipefs @@ -7,25 +7,27 @@ TS_DESC="wipefs" ts_init "$*" ts_check_test_command "$TS_CMD_WIPEFS" +ts_check_test_command "$TS_CMD_MKMINIX" -ts_skip_nonroot +img="$(ts_image_init 50)" +backups="$TS_OUTDIR/backups" -# set global variable TS_DEVICE -ts_scsi_debug_init dev_size_mb=50 num_parts=2 +"$TS_CMD_MKMINIX" "$img" &>/dev/null # remove old backups -rm -rf $HOME/wipefs-$(basename ${TS_DEVICE})-*.bak +rm -rf "$backups" +mkdir -p "$backups" #remove the magic byte, back it up -$TS_CMD_WIPEFS --all --backup ${TS_DEVICE} &>/dev/null || ts_die "wipefs failed" +$TS_CMD_WIPEFS --all --backup="${backups}" ${img} &>/dev/null || ts_die "wipefs failed" #there should be just one magic string/backup file in this case -INFILE=$(ls $HOME/wipefs-$(basename ${TS_DEVICE})-*.bak) +INFILE=$(ls $backups/wipefs-$(basename ${img})-*.bak) OFFT=$(echo $INFILE | sed 's/^.*-\(.*\).bak$/\1/') -dd if=$INFILE of=$TS_DEVICE bs=1 conv=notrunc seek=$(($OFFT)) &>/dev/null +dd if=$INFILE of=$img bs=1 conv=notrunc seek=$(($OFFT)) &>/dev/null #the bytes should be copied back, check if wipefs can recognize it -$TS_CMD_WIPEFS -a ${TS_DEVICE} > $TS_OUTDIR/out 2>/dev/null +$TS_CMD_WIPEFS -a ${img} > $TS_OUTDIR/out 2>/dev/null # check for output [ -s $TS_OUTDIR/out ] && echo "OK" &> $TS_OUTPUT || exit 1 |