[PATCH] Add standard dmesg kmsg interface tests Issue: #2663

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Submission to Project: util-linux
Open Incident: #2663 at github.com/util-linux/util-linux/issues/2663
Component: util-linux/sys-utils
Files: tests/ts/dmesg kmsg interface files and related expected files

For issue #2609 Thomas and Zak pointed out the we need tests to verify
that the dmesg command works correctly and to allow us to compare the
results from PRINTK_CALLER id field tests provided by #2609 with the
standard (syslog interface) dmesg tests.

Except for a kmsg json test that Thomas added recently we don't have
basic dmesg tests for the kmsg interface to compare results against.

We added tests for the dmesg SYSLOG PRINTK_CALLER id interface so we
can compare against those tests.
Those tests were submitted with Issue #2637.

Those tests were created before Thomas added the new dmesg kmsg test
and I will rename those tests to match the naming scheme that Thomas
is using for tests that are specific to syslog interface and specific
to kmsg interface.

Issue #2609 introduces dmesg kmsg interface support for the PRINTK_CALLER
id field and provides tests to compare against the SYSLOG interface tests
added by #2637. Those tests also need to renamed to be consistent Thomas's
test naming scheme.

Here we've created tests for the dmesg kmsg interface following the
existing test structure for dmesg tests.

With the addition of this set of tests, we have tests for SYSLOG and
SYSLOG PRINTK_CALLER id field to compare against the kmsg and kmsg
PRINTK_CALLER id field tests.

Currently the only kmsg interface specific test that exists is the
kmsg-file test that Thomas added to test the dmesg kmsg interface for
json support.

Thomas also added code for the -K file interface to process dmesg ksmg
interface files for testing so we utilize that code here and add to it.

The kmsg-input file is expanded to provide statements and fields to
completely test the kmsg interface with tests that are equivalent to the
SYSLOG interface dmesg tests.

Additionally a ksmg-newlines file is added which provides kmsg format
for testing with indentation.

The output of the existing kmsg-file test is adjusted to match the
expanded kmsg-input file.

All tests follow the standard util-linux tests format used by dmesg for
unit tests.

Note: git doesn't handle binary files all that well and two files here
      are binary files kmsg-input and kmsg-newlines because the format
      of dmesg kmsg interface files requires binary format.
      So those two files can't be sent in this patch file
      Instead I will gzip those files and attach them to the Issue #2663
      Please gunzip them and install them in your tests/ts/dmesg
      directory that also holds the dmesg test files included here so
      that the tests will pass. Sorry for the inconvenience of having
      the binary files in separate gziped files.

Signed-off-by: Ivan Delalande <colona@xxxxxxxxxx>
Signed-off-by: Edward Chron <echron@xxxxxxxxxx>
---
 tests/expected/dmesg/kmsg-colors         |  45 ++++++++
 tests/expected/dmesg/kmsg-console-levels |  61 +++++++++++
 tests/expected/dmesg/kmsg-decode         |  45 ++++++++
 tests/expected/dmesg/kmsg-delta          |  45 ++++++++
 tests/expected/dmesg/kmsg-facilities     |  59 +++++++++++
 tests/expected/dmesg/kmsg-file           | 126 ++++++++++++++++++++---
 tests/expected/dmesg/kmsg-indentation    |  35 +++++++
 tests/expected/dmesg/kmsg-limit          |  31 ++++++
 tests/ts/dmesg/kmsg-colors               |  29 ++++++
 tests/ts/dmesg/kmsg-console-levels       |  43 ++++++++
 tests/ts/dmesg/kmsg-decode               |  28 +++++
 tests/ts/dmesg/kmsg-delta                |  28 +++++
 tests/ts/dmesg/kmsg-facilities           |  31 ++++++
 tests/ts/dmesg/kmsg-indentation          |  40 +++++++
 tests/ts/dmesg/kmsg-limit                |  29 ++++++
 18 files changed, 663 insertions(+), 17 deletions(-)
 create mode 100644 tests/expected/dmesg/kmsg-colors
 create mode 100644 tests/expected/dmesg/kmsg-console-levels
 create mode 100644 tests/expected/dmesg/kmsg-decode
 create mode 100644 tests/expected/dmesg/kmsg-delta
 create mode 100644 tests/expected/dmesg/kmsg-facilities
 create mode 100644 tests/expected/dmesg/kmsg-indentation
 create mode 100644 tests/expected/dmesg/kmsg-limit
 create mode 100755 tests/ts/dmesg/kmsg-colors
 create mode 100755 tests/ts/dmesg/kmsg-console-levels
 create mode 100755 tests/ts/dmesg/kmsg-decode
 create mode 100755 tests/ts/dmesg/kmsg-delta
 create mode 100755 tests/ts/dmesg/kmsg-facilities
 create mode 100755 tests/ts/dmesg/kmsg-indentation
 create mode 100755 tests/ts/dmesg/kmsg-limit
 create mode 100644 tests/ts/dmesg/kmsg-newlines

diff --git a/tests/expected/dmesg/kmsg-colors b/tests/expected/dmesg/kmsg-colors
new file mode 100644
index 000000000..35294c5fa
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-colors
@@ -0,0 +1,45 @@
+kern  :emerg : [    0.000000] 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] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system
+kern  :crit  : [    0.000002] BIOS-provided physical RAM map:
+kern  :err   : [    0.000003] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+kern  :warn  : [    0.000004] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+kern  :notice: [    0.000005] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+kern  :info  : [    0.000006] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+kern  :debug : [    0.000007] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+kern  :info  : [    0.000008] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+kern  :info  : [    0.000009] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+kern  :info  : [    0.000010] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+kern  :info  : [    0.201607] smp: Bringing up secondary CPUs ...
+kern  :info  : [    0.201607] smpboot: x86: Booting SMP configuration:
+kern  :warn  : [    0.209670]   #1  #3  #5  #7
+kern  :info  : [    0.212630] smp: Brought up 1 node, 16 CPUs
+kern  :notice: [    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+kern  :info  : [    0.215937] thermal_sys: Registered thermal governor 'fair_share'
+kern  :warn  : [    0.215966] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+kern  :info  : [    0.367657] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+kern  :info  : [    0.368615] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+kern  :info  : [    0.376316] ACPI: \_SB_.PRWL: New power resource
+kern  :info  : [    0.376343] ACPI: \_SB_.PRWB: New power resource
+kern  :info  : [    0.377373] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+kern  :info  : [    0.377378] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+kern  :info  : [    0.377569] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+kern  :info  : [    0.377933] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+kern  :info  : [    0.378458] PCI host bridge to bus 0000:00
+kern  :info  : [    0.378459] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+kern  :info  : [    0.378461] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+user  :notice: [    9.398562] user network daemon initialization complete
+daemon:info  : [   10.441520] systemd[1]: systemd 254.7-1.fc39 running in system mode
+daemon:info  : [   11.441524] systemd[1]: Detected architecture x86-64.
+daemon:info  : [   12.441525] systemd[1]: Running in initrd.
+daemon:info  : [   13.541598] systemd[1]: Hostname set to <catalina>.
+kern  :info  : [   15.641860] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+kern  :err   : [   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+kern  :err   : [   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+syslog:info  : [   18.820000] systemd-journald[723]: Received client request to flush runtime journal.
+syslog:warn  : [   20.840000] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+syslog:info  : [   21.852348] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+kern  :warn  : [   24.871100] PEFILE: Unsigned PE binary
+kern  :err   : [   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+kern  :info  : [  144.931785] usb 3-3.1: device firmware changed
+kern  :info  : [  145.953248] usb 3-3.1: USB disconnect, device number 44
+kern  :info  : [  147.981859] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
diff --git a/tests/expected/dmesg/kmsg-console-levels b/tests/expected/dmesg/kmsg-console-levels
new file mode 100644
index 000000000..d48312510
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-console-levels
@@ -0,0 +1,61 @@
+* Output level: err+
+<0>[    0.000000] 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
+<1>[    0.000001] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system
+<2>[    0.000002] BIOS-provided physical RAM map:
+<3>[    0.000003] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+<3>[   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+<3>[   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+<3>[   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+* Output level: emerg+
+<0>[    0.000000] 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
+* Output level: +err
+<3>[    0.000003] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+<4>[    0.000004] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+<5>[    0.000005] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+<6>[    0.000006] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+<7>[    0.000007] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+<6>[    0.000008] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+<6>[    0.000009] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+<6>[    0.000010] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+<6>[    0.201607] smp: Bringing up secondary CPUs ...
+<6>[    0.201607] smpboot: x86: Booting SMP configuration:
+<4>[    0.209670]   #1  #3  #5  #7
+<6>[    0.212630] smp: Brought up 1 node, 16 CPUs
+<5>[    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+<6>[    0.215937] thermal_sys: Registered thermal governor 'fair_share'
+<4>[    0.215966] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+<6>[    0.367657] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+<6>[    0.368615] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+<6>[    0.376316] ACPI: \_SB_.PRWL: New power resource
+<6>[    0.376343] ACPI: \_SB_.PRWB: New power resource
+<6>[    0.377373] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+<6>[    0.377378] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+<6>[    0.377569] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+<6>[    0.377933] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+<6>[    0.378458] PCI host bridge to bus 0000:00
+<6>[    0.378459] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+<6>[    0.378461] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+<13>[    9.398562] user network daemon initialization complete
+<30>[   10.441520] systemd[1]: systemd 254.7-1.fc39 running in system mode
+<30>[   11.441524] systemd[1]: Detected architecture x86-64.
+<30>[   12.441525] systemd[1]: Running in initrd.
+<30>[   13.541598] systemd[1]: Hostname set to <catalina>.
+<6>[   15.641860] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+<3>[   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+<3>[   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+<46>[   18.820000] systemd-journald[723]: Received client request to flush runtime journal.
+<44>[   20.840000] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+<46>[   21.852348] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+<4>[   24.871100] PEFILE: Unsigned PE binary
+<3>[   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+<6>[  144.931785] usb 3-3.1: device firmware changed
+<6>[  145.953248] usb 3-3.1: USB disconnect, device number 44
+<6>[  147.981859] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
+* Output level: +debug
+<7>[    0.000007] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+* Output level: notice
+<5>[    0.000005] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+<5>[    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+<13>[    9.398562] user network daemon initialization complete
+* Output level: +
+test_dmesg: unknown level '+'
diff --git a/tests/expected/dmesg/kmsg-decode b/tests/expected/dmesg/kmsg-decode
new file mode 100644
index 000000000..85a664a61
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-decode
@@ -0,0 +1,45 @@
+kern  :emerg : [    0.000000] 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] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system
+kern  :crit  : [    0.000002] BIOS-provided physical RAM map:
+kern  :err   : [    0.000003] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+kern  :warn  : [    0.000004] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+kern  :notice: [    0.000005] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+kern  :info  : [    0.000006] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+kern  :debug : [    0.000007] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+kern  :info  : [    0.000008] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+kern  :info  : [    0.000009] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+kern  :info  : [    0.000010] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+kern  :info  : [    0.201607] smp: Bringing up secondary CPUs ...
+kern  :info  : [    0.201607] smpboot: x86: Booting SMP configuration:
+kern  :warn  : [    0.209670]   #1  #3  #5  #7
+kern  :info  : [    0.212630] smp: Brought up 1 node, 16 CPUs
+kern  :notice: [    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+kern  :info  : [    0.215937] thermal_sys: Registered thermal governor 'fair_share'
+kern  :warn  : [    0.215966] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+kern  :info  : [    0.367657] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+kern  :info  : [    0.368615] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+kern  :info  : [    0.376316] ACPI: \_SB_.PRWL: New power resource
+kern  :info  : [    0.376343] ACPI: \_SB_.PRWB: New power resource
+kern  :info  : [    0.377373] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+kern  :info  : [    0.377378] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+kern  :info  : [    0.377569] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+kern  :info  : [    0.377933] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+kern  :info  : [    0.378458] PCI host bridge to bus 0000:00
+kern  :info  : [    0.378459] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+kern  :info  : [    0.378461] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+user  :notice: [    9.398562] user network daemon initialization complete
+daemon:info  : [   10.441520] systemd[1]: systemd 254.7-1.fc39 running in system mode
+daemon:info  : [   11.441524] systemd[1]: Detected architecture x86-64.
+daemon:info  : [   12.441525] systemd[1]: Running in initrd.
+daemon:info  : [   13.541598] systemd[1]: Hostname set to <catalina>.
+kern  :info  : [   15.641860] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+kern  :err   : [   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+kern  :err   : [   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+syslog:info  : [   18.820000] systemd-journald[723]: Received client request to flush runtime journal.
+syslog:warn  : [   20.840000] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+syslog:info  : [   21.852348] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+kern  :warn  : [   24.871100] PEFILE: Unsigned PE binary
+kern  :err   : [   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+kern  :info  : [  144.931785] usb 3-3.1: device firmware changed
+kern  :info  : [  145.953248] usb 3-3.1: USB disconnect, device number 44
+kern  :info  : [  147.981859] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
diff --git a/tests/expected/dmesg/kmsg-delta b/tests/expected/dmesg/kmsg-delta
new file mode 100644
index 000000000..caea3e9db
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-delta
@@ -0,0 +1,45 @@
+[    0.000000 <    0.000000>] 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>] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system
+[    0.000002 <    0.000000>] BIOS-provided physical RAM map:
+[    0.000003 <    0.000000>] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+[    0.000004 <    0.000000>] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+[    0.000005 <    0.000000>] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+[    0.000006 <    0.000000>] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+[    0.000007 <    0.000000>] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+[    0.000008 <    0.000000>] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+[    0.000009 <    0.000000>] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+[    0.000010 <    0.000000>] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+[    0.201607 <    0.000000>] smp: Bringing up secondary CPUs ...
+[    0.201607 <    0.000000>] smpboot: x86: Booting SMP configuration:
+[    0.209670 <    0.000000>]   #1  #3  #5  #7
+[    0.212630 <    0.000000>] smp: Brought up 1 node, 16 CPUs
+[    0.215936 <    0.000000>] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+[    0.215937 <    0.000000>] thermal_sys: Registered thermal governor 'fair_share'
+[    0.215966 <    0.000000>] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+[    0.367657 <    0.000000>] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+[    0.368615 <    0.000000>] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+[    0.376316 <    0.000000>] ACPI: \_SB_.PRWL: New power resource
+[    0.376343 <    0.000000>] ACPI: \_SB_.PRWB: New power resource
+[    0.377373 <    0.000000>] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+[    0.377378 <    0.000000>] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+[    0.377569 <    0.000000>] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+[    0.377933 <    0.000000>] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+[    0.378458 <    0.000000>] PCI host bridge to bus 0000:00
+[    0.378459 <    0.000000>] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+[    0.378461 <    0.000000>] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+[    9.398562 <    9.000000>] user network daemon initialization complete
+[   10.441520 <    1.000000>] systemd[1]: systemd 254.7-1.fc39 running in system mode
+[   11.441524 <    1.000000>] systemd[1]: Detected architecture x86-64.
+[   12.441525 <    1.000000>] systemd[1]: Running in initrd.
+[   13.541598 <    1.000000>] systemd[1]: Hostname set to <catalina>.
+[   15.641860 <    2.000000>] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+[   16.690000 <    1.000000>] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+[   17.710000 <    1.000000>] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[   18.820000 <    1.000000>] systemd-journald[723]: Received client request to flush runtime journal.
+[   20.840000 <    2.000000>] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+[   21.852348 <    1.000000>] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+[   24.871100 <    3.000000>] PEFILE: Unsigned PE binary
+[   33.918091 <    9.000000>] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[  144.931785 <  111.000000>] usb 3-3.1: device firmware changed
+[  145.953248 <    1.000000>] usb 3-3.1: USB disconnect, device number 44
+[  147.981859 <    2.000000>] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
diff --git a/tests/expected/dmesg/kmsg-facilities b/tests/expected/dmesg/kmsg-facilities
new file mode 100644
index 000000000..4b460951a
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-facilities
@@ -0,0 +1,59 @@
+dmesg Facility: -1
+dmesg Facility: 0
+[    0.000000] 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] Command line: initrd=\ucode.img initrd=\initramfs-linux.img rw cryptdevice=/dev/nvme0n1p3:system:discard root=/dev/mapper/system
+[    0.000002] BIOS-provided physical RAM map:
+[    0.000003] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+[    0.000004] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+[    0.000005] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+[    0.000006] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+[    0.000007] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+[    0.000008] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+[    0.000009] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+[    0.000010] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+[    0.201607] smp: Bringing up secondary CPUs ...
+[    0.201607] smpboot: x86: Booting SMP configuration:
+[    0.209670]   #1  #3  #5  #7
+[    0.212630] smp: Brought up 1 node, 16 CPUs
+[    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+[    0.215937] thermal_sys: Registered thermal governor 'fair_share'
+[    0.215966] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+[    0.367657] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+[    0.368615] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+[    0.376316] ACPI: \_SB_.PRWL: New power resource
+[    0.376343] ACPI: \_SB_.PRWB: New power resource
+[    0.377373] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+[    0.377378] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+[    0.377569] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+[    0.377933] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+[    0.378458] PCI host bridge to bus 0000:00
+[    0.378459] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+[    0.378461] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+[   15.641860] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+[   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+[   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[   24.871100] PEFILE: Unsigned PE binary
+[   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[  144.931785] usb 3-3.1: device firmware changed
+[  145.953248] usb 3-3.1: USB disconnect, device number 44
+[  147.981859] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
+dmesg Facility: 1
+[    9.398562] user network daemon initialization complete
+dmesg Facility: 2
+dmesg Facility: 3
+[   10.441520] systemd[1]: systemd 254.7-1.fc39 running in system mode
+[   11.441524] systemd[1]: Detected architecture x86-64.
+[   12.441525] systemd[1]: Running in initrd.
+[   13.541598] systemd[1]: Hostname set to <catalina>.
+dmesg Facility: 4
+dmesg Facility: 5
+[   18.820000] systemd-journald[723]: Received client request to flush runtime journal.
+[   20.840000] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+[   21.852348] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+dmesg Facility: 6
+dmesg Facility: 7
+dmesg Facility: 8
+dmesg Facility: 9
+dmesg Facility: 10
+dmesg Facility: 11
+dmesg Facility: 12
diff --git a/tests/expected/dmesg/kmsg-file b/tests/expected/dmesg/kmsg-file
index 54b5e612d..984588e3e 100644
--- a/tests/expected/dmesg/kmsg-file
+++ b/tests/expected/dmesg/kmsg-file
@@ -1,49 +1,77 @@
 {
    "dmesg": [
       {
-         "pri": 5,
+         "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": 6,
-         "time":     0.000000,
+         "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": 6,
-         "time":     0.000000,
+         "pri": 2,
+         "time":     0.000002,
          "msg": "BIOS-provided physical RAM map:"
       },{
-         "pri": 6,
-         "time":     0.000000,
+         "pri": 3,
+         "time":     0.000003,
          "msg": "BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable"
       },{
-         "pri": 6,
-         "time":     0.000000,
+         "pri": 4,
+         "time":     0.000004,
          "msg": "BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved"
       },{
-         "pri": 6,
-         "time":     0.000000,
+         "pri": 5,
+         "time":     0.000005,
          "msg": "BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable"
       },{
          "pri": 6,
-         "time":     0.000000,
+         "time":     0.000006,
          "msg": "BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved"
       },{
-         "pri": 6,
-         "time":     0.000000,
+         "pri": 7,
+         "time":     0.000007,
          "msg": "BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable"
       },{
          "pri": 6,
-         "time":     0.000000,
+         "time":     0.000008,
          "msg": "BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS"
       },{
          "pri": 6,
-         "time":     0.000000,
+         "time":     0.000009,
          "msg": "BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable"
       },{
          "pri": 6,
-         "time":     0.000000,
+         "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,
@@ -88,6 +116,70 @@
          "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/dmesg/kmsg-indentation b/tests/expected/dmesg/kmsg-indentation
new file mode 100644
index 000000000..25f41b454
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-indentation
@@ -0,0 +1,35 @@
+[    1.000000] line zero
+[    2.000000] line one
+[    4.000000] line two
+[    7.000000] line three
+[   11.000000] line four
+kern  :notice: [    1.000000] line zero
+user  :crit  : [    2.000000] line one
+mail  :warn  : [    4.000000] line two
+daemon:info  : [    7.000000] line three
+syslog:emerg : [   11.000000] line four
+[<    0.000000>] line zero
+[<    1.000000>] line one
+[<    2.000000>] line two
+[<    3.000000>] line three
+[<    4.000000>] line four
+line zero
+line one
+line two
+line three
+line four
+[Feb13 23:31] line zero
+[  +1.000000] line one
+[  +2.000000] line two
+[  +3.000000] line three
+[  +4.000000] line four
+[Fri Feb 13 23:31:31 2009] line zero
+[Fri Feb 13 23:31:32 2009] line one
+[Fri Feb 13 23:31:34 2009] line two
+[Fri Feb 13 23:31:37 2009] line three
+[Fri Feb 13 23:31:41 2009] line four
+2009-02-13T23:31:31,123456+00:00 line zero
+2009-02-13T23:31:32,123456+00:00 line one
+2009-02-13T23:31:34,123456+00:00 line two
+2009-02-13T23:31:37,123456+00:00 line three
+2009-02-13T23:31:41,123456+00:00 line four
diff --git a/tests/expected/dmesg/kmsg-limit b/tests/expected/dmesg/kmsg-limit
new file mode 100644
index 000000000..0c39b4762
--- /dev/null
+++ b/tests/expected/dmesg/kmsg-limit
@@ -0,0 +1,31 @@
+[    0.201607] smp: Bringing up secondary CPUs ...
+[    0.201607] smpboot: x86: Booting SMP configuration:
+[    0.209670]   #1  #3  #5  #7
+[    0.212630] smp: Brought up 1 node, 16 CPUs
+[    0.215936] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+[    0.215937] thermal_sys: Registered thermal governor 'fair_share'
+[    0.215966] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+[    0.367657] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+[    0.368615] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+[    0.376316] ACPI: \_SB_.PRWL: New power resource
+[    0.376343] ACPI: \_SB_.PRWB: New power resource
+[    0.377373] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+[    0.377378] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+[    0.377569] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+[    0.377933] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+[    0.378458] PCI host bridge to bus 0000:00
+[    0.378459] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
+[    0.378461] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
+[    9.398562] user network daemon initialization complete
+[   10.441520] systemd[1]: systemd 254.7-1.fc39 running in system mode
+[   11.441524] systemd[1]: Detected architecture x86-64.
+[   12.441525] systemd[1]: Running in initrd.
+[   13.541598] systemd[1]: Hostname set to <catalina>.
+[   15.641860] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+[   16.690000] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+[   17.710000] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[   18.820000] systemd-journald[723]: Received client request to flush runtime journal.
+[   20.840000] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+[   21.852348] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+[   24.871100] PEFILE: Unsigned PE binary
+[   33.918091] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
diff --git a/tests/ts/dmesg/kmsg-colors b/tests/ts/dmesg/kmsg-colors
new file mode 100755
index 000000000..959e7b547
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-colors
@@ -0,0 +1,29 @@
+#!/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-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/kmsg-input -x >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-console-levels b/tests/ts/dmesg/kmsg-console-levels
new file mode 100755
index 000000000..36f8ec097
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-console-levels
@@ -0,0 +1,43 @@
+#!/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-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
+	$TS_HELPER_DMESG -F $TS_SELF/kmsg-input -l $I >> $TS_OUTPUT 2>/dev/null
+done
+
+echo "* Output level: err+" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l err+ >> $TS_OUTPUT 2>/dev/null
+echo "* Output level: emerg+" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l emerg+ >> $TS_OUTPUT 2>/dev/null
+echo "* Output level: +err" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l +err >> $TS_OUTPUT 2>/dev/null
+echo "* Output level: +debug" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l +debug >> $TS_OUTPUT 2>/dev/null
+echo "* Output level: notice" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l notice >> $TS_OUTPUT 2>/dev/null
+echo "* Output level: +" >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -r -l + 2>> $TS_OUTPUT >/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-decode b/tests/ts/dmesg/kmsg-decode
new file mode 100755
index 000000000..51fef159d
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-decode
@@ -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-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/kmsg-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-delta b/tests/ts/dmesg/kmsg-delta
new file mode 100755
index 000000000..7ae082e76
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-delta
@@ -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-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/kmsg-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-facilities b/tests/ts/dmesg/kmsg-facilities
new file mode 100755
index 000000000..b274c5de4
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-facilities
@@ -0,0 +1,31 @@
+#!/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-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 "dmesg Facility: $I" >> $TS_OUTPUT
+	$TS_HELPER_DMESG -K $TS_SELF/kmsg-input -f $I >> $TS_OUTPUT 2>/dev/null
+done
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-indentation b/tests/ts/dmesg/kmsg-indentation
new file mode 100755
index 000000000..16870158f
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-indentation
@@ -0,0 +1,40 @@
+#!/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-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/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG -K $TS_SELF/kmsg-newlines -x >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=delta --kmsg-file $TS_SELF/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=notime --kmsg-file $TS_SELF/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=reltime --kmsg-file $TS_SELF/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=ctime --kmsg-file $TS_SELF/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=iso --kmsg-file $TS_SELF/kmsg-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/dmesg/kmsg-limit b/tests/ts/dmesg/kmsg-limit
new file mode 100755
index 000000000..ff70bcf83
--- /dev/null
+++ b/tests/ts/dmesg/kmsg-limit
@@ -0,0 +1,29 @@
+#!/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-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/kmsg-input \
+	>> $TS_OUTPUT 2> $TS_ERRLOG
+
+ts_finalize
-- 
2.43.0





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux