* Re: fdisk corrupts data on USB stick
From: Bill Unruh @ 2024-01-29 20:44 UTC (permalink / raw)
To: Thorsten Glaser; +Cc: Thomas Weißschuh, util-linux
In-Reply-To: <Pine.BSM.4.64L.2401292023270.19873@herc.mirbsd.org>
[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]
Perhaps if you told us what you really wanted to do, instead of asking why
your first method did not work and how to fix it. Eg, you wnat to add another
partition to the usb disk since the boot system only used 5GB of a 128GB usb,
and you don't want to waste 123GB of space. Or some other problem you want to
solve. That way you might get ways of solving your real problem you never
thought of.
William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ unruh@physics.ubc.ca
Canada V6T 1Z1 ____|____ and Gravity ______|_ theory.physics.ubc.ca/
On Mon, 29 Jan 2024, Thorsten Glaser wrote:
> [CAUTION: Non-UBC Email]
>
> Thomas Weißschuh dixit:
>
>> The device contains 'iso9660' signature and it will be removed by a
>> write command. See fdisk(8) man page and --wipe option for more
>> details.
>
>> I guess your version does the same, but maybe is not printing the
>> warning.
>
> Hm, maybe it does, maybe it doesn’t, but even so, why should it?
>
>> So the disk gets converted to a normal MBR layout and the ISO signature
>> get wiped. Which makes sense as the ISO image would need to be
>> remastered.
>
> Totally not! First of, the ISO already contained an MBR with a
> partition table in the first sector, which I extended, and second,
> it’s fdisk’s task to precisely edit the MBR partition table (and,
> if the 55h AAh magic is missing, create it), nothing else (okay,
> extended partitions if someone uses them, but nothing else).
>
>>> Is there a way we can make it not corrupt such media?
>>
>> Did you look into grml2usb?
>
> I know that, but I wanted to keep the original ISO 9660 filesystem
> so things don’t accidentally get changed on it. (And the original
> EFI thingy, in case it’s needed.)
>
> So, how do I get fdisk to not corrupt the ISO 9660 part?
> MirBSD fdisk doesn’t do that, it sticks to the MBR.
>
> Thanks,
> //mirabilos
> --
> „Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
> mksh auf jedem System zu installieren.“
> -- XTaran auf der OpenRheinRuhr, ganz begeistert
> (EN: “[…]uhr.gz is a reason to install mksh on every system.”)
>
>
^ permalink raw reply
* Re: Re: fdisk corrupts data on USB stick
From: Thomas Weißschuh @ 2024-01-29 20:44 UTC (permalink / raw)
To: Thorsten Glaser; +Cc: util-linux
In-Reply-To: <Pine.BSM.4.64L.2401292023270.19873@herc.mirbsd.org>
On 2024-01-29 20:27:13+0000, Thorsten Glaser wrote:
> Thomas Weißschuh dixit:
>
> > The device contains 'iso9660' signature and it will be removed by a
> > write command. See fdisk(8) man page and --wipe option for more
> > details.
>
> >I guess your version does the same, but maybe is not printing the
> >warning.
>
> Hm, maybe it does, maybe it doesn’t, but even so, why should it?
In the message you may or may not have seen there is a reference to the
`--wipe` option that describes the reasoning and possibilities.
Reproduced here for your convenience:
https://manpages.debian.org/bookworm/fdisk/fdisk.8.en.html
-w, --wipe when
Wipe filesystem, RAID and partition-table signatures from the
device, in order to avoid possible collisions. The argument when
can be auto, never or always. When this option is not given, the
default is auto, in which case signatures are wiped only when in
interactive mode. In all cases detected signatures are reported by
warning messages before a new partition table is created. See also
wipefs(8) command.
As for why: "in order to avoid possible collisions".
> >So the disk gets converted to a normal MBR layout and the ISO signature
> >get wiped. Which makes sense as the ISO image would need to be
> >remastered.
>
> Totally not! First of, the ISO already contained an MBR with a
> partition table in the first sector, which I extended, and second,
> it’s fdisk’s task to precisely edit the MBR partition table (and,
> if the 55h AAh magic is missing, create it), nothing else (okay,
> extended partitions if someone uses them, but nothing else).
This is your personal interpretation about what exactly fdisk is
supposed to do.
For convenience it even may have shown a prominent warning in bright red
letters with helpful pointers. Or maybe it didn't.
> >> Is there a way we can make it not corrupt such media?
> >
> >Did you look into grml2usb?
>
> I know that, but I wanted to keep the original ISO 9660 filesystem
> so things don’t accidentally get changed on it. (And the original
> EFI thingy, in case it’s needed.)
Fair enough.
> So, how do I get fdisk to not corrupt the ISO 9660 part?
> MirBSD fdisk doesn’t do that, it sticks to the MBR.
Try `--wipe never` as explained above.
Thomas
^ permalink raw reply
* Re: fdisk corrupts data on USB stick
From: Thorsten Glaser @ 2024-01-29 20:27 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: util-linux
In-Reply-To: <478ec62d-5485-42c3-b492-6ccfa9bf62c8@t-8ch.de>
Thomas Weißschuh dixit:
> The device contains 'iso9660' signature and it will be removed by a
> write command. See fdisk(8) man page and --wipe option for more
> details.
>I guess your version does the same, but maybe is not printing the
>warning.
Hm, maybe it does, maybe it doesn’t, but even so, why should it?
>So the disk gets converted to a normal MBR layout and the ISO signature
>get wiped. Which makes sense as the ISO image would need to be
>remastered.
Totally not! First of, the ISO already contained an MBR with a
partition table in the first sector, which I extended, and second,
it’s fdisk’s task to precisely edit the MBR partition table (and,
if the 55h AAh magic is missing, create it), nothing else (okay,
extended partitions if someone uses them, but nothing else).
>> Is there a way we can make it not corrupt such media?
>
>Did you look into grml2usb?
I know that, but I wanted to keep the original ISO 9660 filesystem
so things don’t accidentally get changed on it. (And the original
EFI thingy, in case it’s needed.)
So, how do I get fdisk to not corrupt the ISO 9660 part?
MirBSD fdisk doesn’t do that, it sticks to the MBR.
Thanks,
//mirabilos
--
„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
mksh auf jedem System zu installieren.“
-- XTaran auf der OpenRheinRuhr, ganz begeistert
(EN: “[…]uhr.gz is a reason to install mksh on every system.”)
^ permalink raw reply
* Re: fdisk corrupts data on USB stick
From: Thomas Weißschuh @ 2024-01-29 20:01 UTC (permalink / raw)
To: Thorsten Glaser; +Cc: util-linux
In-Reply-To: <Pine.BSM.4.64L.2401291659410.19873@herc.mirbsd.org>
Hi Thorsten,
On 2024-01-29 17:04:12+0000, Thorsten Glaser wrote:
> Background: https://github.com/grml/grml/issues/205
>
> Using fdisk 2.36.1-8+deb11u1 from util-linux to create an extra
> partition on a USB stick on which I had previously written an
> ISO 9660 image does something to the data on the stick to make
> klibc fstype not recognise it as ISO 9660 any more. Specifically,
> it corrupts some data at some location within the first 4 MiB of
> the stick but outside of the first 512 byte of it, as restoring
> those first 4 MiB then re-restoring the MBR to the state fdisk
> had written makes it work again.
>
> This is a data corruption bug. I expect fdisk to change precisely
> the MBR and nothing else unless told so.
When trying your reproduction steps with a newer version of fdisk I
instantly get greeted like this:
# fdisk /dev/loop0
Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
The device contains 'iso9660' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Command (m for help): p
Disk /dev/loop0: 492.25 MiB, 516161536 bytes, 1008128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x773b5e3b
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 0 1007615 1007616 492M 0 Empty
/dev/loop0p2 592 8783 8192 4M ef EFI (FAT-12/16/32)
I guess your version does the same, but maybe is not printing the
warning.
So the disk gets converted to a normal MBR layout and the ISO signature
get wiped. Which makes sense as the ISO image would need to be
remastered.
> Is there a way we can make it not corrupt such media?
Did you look into grml2usb?
This is what [0] recommends to achieve persistence.
[0] https://wiki.grml.org/doku.php?id=persistency
Thomas
^ permalink raw reply
* fdisk corrupts data on USB stick
From: Thorsten Glaser @ 2024-01-29 17:04 UTC (permalink / raw)
To: util-linux
Background: https://github.com/grml/grml/issues/205
Using fdisk 2.36.1-8+deb11u1 from util-linux to create an extra
partition on a USB stick on which I had previously written an
ISO 9660 image does something to the data on the stick to make
klibc fstype not recognise it as ISO 9660 any more. Specifically,
it corrupts some data at some location within the first 4 MiB of
the stick but outside of the first 512 byte of it, as restoring
those first 4 MiB then re-restoring the MBR to the state fdisk
had written makes it work again.
This is a data corruption bug. I expect fdisk to change precisely
the MBR and nothing else unless told so.
Is there a way we can make it not corrupt such media?
Thanks in advance,
//mirabilos
--
08:05⎜<XTaran:#grml> mika: Does grml have an tool to read Apple
⎜ System Log (asl) files? :)
08:08⎜<ft:#grml> yeah. /bin/rm. ;) 08:09⎜<mrud:#grml> hexdump -C
08:31⎜<XTaran:#grml> ft, mrud: *g*
^ permalink raw reply
* [ANNOUNCE] util-linux v2.40-rc1
From: Karel Zak @ 2024-01-24 11:36 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, util-linux
The util-linux release v2.40-rc1 is available at
http://www.kernel.org/pub/linux/utils/util-linux/v2.40/
Feedback and bug reports, as always, are welcomed.
Karel
util-linux 2.40 Release Notes
=============================
Release highlights
------------------
libmount:
The libmount monitor has been enhanced to be more user-friendly for
userspace-specific mount options (e.g., GNOME gVFS).
The new mount kernel API can be enabled/disabled using the environment
variable LIBMOUNT_FORCE_MOUNT2={always, never, auto}.
libsmartcols:
The library now supports filtering expressions (refer to the scols-filter(5)
man page). Applications can utilize the filter before gathering all data
for output, reducing resource usage and improving performance. Currently,
this feature is employed in lsfd and lsblk. Example:
lsblk --filter 'NAME !~ "sd[ab]"'q
The library now supports counters (based on filters). For instance:
lsfd --summary=only \
-C 'netlink sockets':'(NAME =~ "NETLINK:.*")' \
-C 'unix sockets':'(NAME =~ "UNIX:.*")'
VALUE COUNTER
57 netlink sockets
1552 unix sockets
* liblastlog2 and pam_lastlog2:
Introducing a new library, liblastlog2, to implement lastlog replacement
using a SQLite3 database in /var/lib/lastlog/lastlog2.db. This implementation
is Y2038 safe, and the database size is independent of UIDs.
A new command, lastlog2, is now available.
lastlog2 is utilized in pam_lastlog2.
* libuuid iImproved support for 64-bit time.
* A new command, lsclocks, is introduced to display system clocks (realtime,
monotonic, boottime, etc.).
* login(1) now supports systemd service credentials. 'login.noauth' is now
supported.
Changes between v2.39 and v2.40
-------------------------------
AUTHORS:
- add tools contributed by myself [Thomas Weißschuh]
Add Phytium FTC862 cpu model. fix:
- #2486 [unknown]
Documentation:
- add basic smoketest for boilerplate.c [Thomas Weißschuh]
Fix typo:
- octen -> octet [zeyun chen]
agetty:
- Load autologin user from agetty.autologin credential [Daan De Meyer]
- include fileutils.h [Thomas Weißschuh]
- remove duplicate include [Karel Zak]
- use get_terminal_default_type() [Karel Zak]
- use sd_get_sessions() for number of users (#2088) [Thorsten Kukuk]
audit-arch:
- add support for alpha [Thomas Weißschuh]
autotools:
- add missing dist_noinst_DATA [Karel Zak]
- check for flex in autogen.sh [Karel Zak]
- fix AC_DEFINE_UNQUOTED() use [Karel Zak]
- fix AC_PROG_LEX use [Karel Zak]
- fix librtas check [Karel Zak]
- fix non-Linux build [Karel Zak, Samuel Thibault]
- fix typos [Karel Zak]
- use stamp file to build filter parser, improve portability [Karel Zak]
bash-completion:
- (fadvise) fix a typo [Masatake YAMATO]
- (lslocks) add --bytes option to the rules [Masatake YAMATO]
- add -T to last [Karel Zak]
- make sure that "lastb" actually completes [Eli Schwartz]
- update for mkswap [Karel Zak]
blkdev.h:
- avoid some unused argument warnings [Thomas Weißschuh]
blkid:
- fix call to err_exclusive_options [Thomas Weißschuh]
blkpr:
- store return value of getopt_long in int [Thomas Weißschuh]
blkzone:
- don't take address of struct blk_zone [Thomas Weißschuh]
blockdev:
- add missing verbose output for --getsz [Christoph Anton Mitterer]
- add support for BLKGETZONESZ [Thomas Weißschuh]
- properly check for BLKGETZONESZ ioctl [Thomas Weißschuh]
build:
- use -std=c99 and -std=c++11 by default [Thomas Weißschuh]
build-sys:
- (tests) validate that time_t is 64bit [Thomas Weißschuh]
- add --disable-exch [Karel Zak]
- add --disable-waitpid [Frantisek Sumsal]
- add AX_COMPARE_VERSION [Thomas Weißschuh]
- add enosys and syscalls.h to gitignore [Enze Li]
- backport autoconf year2038 macros [Thomas Weißschuh]
- don't call pkg-config --static if unnecessary [Karel Zak]
- fail build for untracked files [Thomas Weißschuh]
- fix libmount/src/hooks.c use [Karel Zak]
- fix po-man clean [Karel Zak]
- fix typo in waitpid check [Thomas Weißschuh]
- improve checkadoc [Karel Zak]
- only build col on glibc [Thomas Weißschuh]
- only pass --failure-level if supported [Thomas Weißschuh]
- rearrange gitignore in alphabetical order [Enze Li]
- try to always use 64bit time support on glibc [Thomas Weißschuh]
buildsys:
- warn on usage of VLAs [Thomas Weißschuh]
- warn on usage of alloca() [Thomas Weißschuh]
c.h:
- make err_nonsys available [Thomas Weißschuh]
cal:
- avoid out of bound write [Thomas Weißschuh]
- fix error message for bad -c argument [Jakub Wilk]
- fix long option name for -c [Jakub Wilk]
cfdisk:
- add hint about labels for bootable flag [Karel Zak]
- ask y/n before wipe [Karel Zak]
- fix menu behavior after writing changes [Karel Zak]
- properly handle out-of-order partitions during resize [Thomas Weißschuh]
chrt:
- (man) add note about --sched-period lower limit [Karel Zak]
- (tests) don't mark tests as known failed [Thomas Weißschuh]
- (tests) increase deadline test parameters [Thomas Weißschuh]
- allow option separator [Thomas Weißschuh]
chsh:
- use libeconf to read /etc/shells [Thorsten Kukuk]
ci:
- (codeql) ignore cpp/uncontrolled-process-operation [Thomas Weißschuh]
- add OpenWrt SDK based CI jobs [Thomas Weißschuh]
- also use GCC 13 for sanitizer builds [Thomas Weißschuh]
- build on old distro [Thomas Weißschuh]
- build with GCC 13/11 [Thomas Weißschuh]
- build with clang 17 [Thomas Weißschuh]
- cache openwrt sdk [Thomas Weißschuh]
- cancel running jobs on push [Frantisek Sumsal]
- collect coverage on _exit() as well [Frantisek Sumsal]
- disable cpp/path-injection rule [Thomas Weißschuh]
- don't combine -Werror and -fsanitize [Thomas Weißschuh]
- enable -Werror for meson [Thomas Weißschuh]
- fix indentation [Frantisek Sumsal]
- hide coverage-related stuff begind --enable-coverage [Frantisek Sumsal]
- mark source directory as safe [Thomas Weißschuh]
- packit add flex [Karel Zak]
- prevent prompts during installation [Thomas Weißschuh]
- run full testsuite under musl libc [Thomas Weißschuh]
- tweak build dir's ACL when collecting coverage [Frantisek Sumsal]
- use clang 16 [Thomas Weißschuh]
column:
- fix -l [Karel Zak]
- fix memory leak [Thomas Weißschuh]
coverage.h:
- mark _exit as noreturn [Thomas Weißschuh]
ctrlaltdel:
- remove unnecessary uid check [JJ-Meng]
disk-utils:
- add SPDX and Copyright notices [Karel Zak]
dmesg:
- (tests) validate json output [Thomas Weißschuh]
- -r LOG_MAKEPRI needs fac << 3 [Edward Chron]
- Delete redundant pager setup [Karel Zak]
- add caller_id support [Edward Chron]
- add support for reserved and local facilities [Thomas Weißschuh]
- cleanup function names [Karel Zak]
- correctly print all supported facility names [Thomas Weißschuh]
- error out instead of silently ignoring force_prefix [Thomas Weißschuh]
- fix FD leak [Karel Zak]
- make kmsg read() buffer big enough for kernel [anteater]
- man and coding style changes [Karel Zak]
- only write one message to json [Thomas Weißschuh]
- open-code LOG_MAKEPRI [Thomas Weißschuh]
- support for additional human readable timestamp [Rishabh Thukral]
- support reading kmsg format from file [Thomas Weißschuh]
- use symbolic defines for second conversions [Thomas Weißschuh]
docs:
- add SPDX to boilerplate.c [Karel Zak]
- move Copyright in boilerplate.c [Karel Zak]
- update AUTHORS file [Karel Zak]
- use HTTPS for GitHub clone URLs [Jakub Wilk]
eject:
- (tests) don't write mount hint to terminal [Karel Zak]
enosys:
- add --list [Thomas Weißschuh]
- add bash completion [Thomas Weißschuh]
- add common arguments [Thomas Weißschuh]
- add manpage [Thomas Weißschuh]
- add support for MIPS, PowerPC and ARC [Thomas Weißschuh]
- add support for ioctl blocking [Thomas Weißschuh]
- add support for loongarch [Thomas Weißschuh]
- add support for sparc [Thomas Weißschuh]
- add test [Thomas Weißschuh]
- allow CPU speculation [Thomas Weißschuh]
- avoid warnings when no aliases are found [Thomas Weißschuh]
- build BPF dynamically [Thomas Weißschuh]
- don't require end-of-options marker [Thomas Weißschuh]
- don't validate that numbers are found from headers [Thomas Weißschuh]
- enable locale handling [Thomas Weißschuh]
- find syscalls at build time [Thomas Weißschuh]
- fix build on hppa [John David Anglin]
- fix native arch for s390x [Thomas Weißschuh]
- improve checks for EXIT_NOTSUPP [Thomas Weißschuh]
- include sys/syscall.h [Thomas Weißschuh]
- list syscall numbers [Thomas Weißschuh]
- make messages useful for users [Thomas Weißschuh]
- mark variable static [Thomas Weißschuh]
- move from tests/helpers/test_enosys.c [Thomas Weißschuh]
- only build if AUDIT_ARCH_NATIVE is defined [Thomas Weißschuh]
- properly block execve syscall [Thomas Weißschuh]
- provide a nicer build message for syscalls.h generation [Thomas Weißschuh]
- remove long jumps from BPF [Thomas Weißschuh]
- remove unneeded inline variable declaration [Thomas Weißschuh]
- split audit arch detection into dedicated header [Thomas Weißschuh]
- store blocked syscalls in list instead of array [Thomas Weißschuh]
- syscall numbers are "long" [Thomas Weißschuh]
- translate messages [Thomas Weißschuh]
- validate syscall architecture [Thomas Weißschuh]
exch:
- Add man page to po4a.cfg to make it translatable [Mario Blättermann]
- cosmetic changes [Karel Zak]
- fix typo [Karel Zak]
- new command exchaging two files atomically [Masatake YAMATO]
- properly terminate options array [Thomas Weißschuh]
- use NULL rather than zero [Karel Zak]
exec_shell:
- use xasprintf [Thomas Weißschuh]
fadvise:
- (test) don't compare fincore page counts [Thomas Weißschuh]
- (test) dynamically calculate expected test values [Thomas Weißschuh]
- (test) test with 64k blocks [Thomas Weißschuh]
- (tests) factor out calls to "fincore" [Thomas Weißschuh]
- Fix markup in man page [Mario Blättermann]
fallocate:
- fix the way to evaluate values returned from posix_fallocate [Masatake YAMATO]
fdisk:
- add support for partition resizing [Thomas Weißschuh]
- guard posix variable [Thomas Weißschuh]
- remove usage of VLA [Thomas Weißschuh]
fileeq:
- optimize size of ul_fileeq_method [Thomas Weißschuh]
fincore:
- (tests) adapt alternative testcases to new header format [Thomas Weißschuh]
- (tests) also use nosize error file [Thomas Weißschuh]
- (tests) fix double log output [Chris Hofstaedtler]
- add --output-all [Thomas Weißschuh]
- fix alignment of column listing in --help [Thomas Weißschuh]
- refactor output formatting [Thomas Weißschuh]
- report data from cachestat() [Thomas Weißschuh]
findmnt:
- add --list-columns [Karel Zak]
- add -I, --dfi options for imitating the output of df -i [Masatake YAMATO]
- add inode-related columns for implementing "df -i" like output [Masatake YAMATO]
- use zero to separate lines in multi-line cells [Karel Zak]
flock:
- initialize timevals [-Werror=maybe-uninitialized] [Karel Zak]
fsck:
- initialize timevals [-Werror=maybe-uninitialized] [Karel Zak]
fstab:
- Fix markup in man page [Mario Blättermann]
- add hint about systemd reload [Karel Zak]
github:
- add labeler [Karel Zak]
- check apt-cache in more robust way [Karel Zak]
- check apt-cache in more robust way (v2) [Masatake YAMATO]
- fix build with clang and in ubuntu build-root [Karel Zak]
gitignore:
- ignore exch [Thomas Weißschuh]
- ignore setpgid binary [Christian Göttsche]
hardlink:
- (man) add missing comma [Jakub Wilk]
- Fix markup in man page [Mario Blättermann]
- fix fiemap use [Karel Zak]
hexdump:
- Add missing section header in man page [Mario Blättermann]
- add '--one-byte-hex' format option [Tomasz Wojdat]
- add new format-strings test case [Tomasz Wojdat]
- use xasprintf to build string [Thomas Weißschuh]
hwclock:
- Improve set error in the face of jitter [Eric Badger]
- add --vl-read, --vl-clear documentation and bash-completion [Rasmus Villemoes]
- add support for RTC_VL_READ/RTC_VL_CLR ioctls [Rasmus Villemoes]
- handle failure of audit_log_user_message [Thomas Weißschuh]
- reuse error message [Karel Zak]
include:
- add DragonFlyBSD GPT partition types [Thomas Weißschuh]
- add U-Boot environment partition type [Thomas Weißschuh]
- add some more ChromeOS partition types [Thomas Weißschuh]
- define pidfd syscalls if needed [Markus Mayer]
include/audit-arch:
- add missing SPDX [Karel Zak]
include/bitops.h:
- Remove bswap* compatibility hack for FreeBSD [Daniel Engberg]
include/c.h:
- add helpers for unaligned structure access [Thomas Weißschuh]
- handle members of const struct [Thomas Weißschuh]
- implement reallocarray [Thomas Weißschuh]
include/crc64:
- add missing license header [Karel Zak]
include/strutils:
- add ul_strtold() [Karel Zak]
irqtop:
- fix numeric sorting [Valery Ushakov]
jsonwrt:
- add ul_jsonwrt_value_s_sized [Thomas Weißschuh]
last:
- Add -T option for tab-separated output [Trag Date]
last(1):
- Document -T option for tab-separated output [Trag Date]
ldattach:
- don't call exit() from signal handler [Thomas Weißschuh]
ldfd:
- delete unnecessary ';' [Masatake YAMATO]
lib:
- remove pager.c from libcommon [Karel Zak]
lib/ include/:
- cleanup licence headers [Karel Zak]
lib/buffer:
- make buffer usable for non-string data [Karel Zak]
lib/caputils:
- fix integer handling issues [coverity scan] [Karel Zak]
lib/color-names:
- fix licence header [Karel Zak]
lib/colors:
- correct documentation of colors_add_scheme() [Thomas Weißschuh]
lib/env:
- avoid underflow of read_all_alloc() return value [Thomas Weißschuh]
- fix function name remote_entry -> remove_entry [Thomas Weißschuh]
lib/idcache:
- always gracefully handle null cache [Thomas Weißschuh]
lib/jsonwrt:
- add support for float numbers [Karel Zak]
lib/loopdev:
- consistently return error values from loopcxt_find_unused() [Thomas Weißschuh]
- document function return values [Thomas Weißschuh]
lib/mbsalign:
- calculate size of decoded string [Karel Zak]
lib/mbsedit:
- remove usage of VLA [Thomas Weißschuh]
lib/pager:
- Allow PAGER commands with options [Dragan Simic]
- Apply pager-specific fixes only when needed [Dragan Simic]
lib/path:
- Set errno in case of fgets failure [Tobias Stoeckmann]
- fix possible out of boundary access [Tobias Stoeckmann]
- fix typos [Tobias Stoeckmann]
- remove ul_prefix_fopen [Tobias Stoeckmann]
- remove usage of VLA [Thomas Weißschuh]
- set errno in case of error [Tobias Stoeckmann]
lib/pty-session:
- initialize timevals [-Werror=maybe-uninitialized] [Karel Zak]
lib/shells:
- Plug econf memory leak [Tobias Stoeckmann]
- initialize free-able variables [Karel Zak]
- remove space after function name [Karel Zak]
lib/strutils:
- add strfappend and strvfappend [Masatake YAMATO]
- add ul_next_string() [Karel Zak]
- fix typo [Jakub Wilk]
lib/timeutils:
- (parse_timestamp_reference) report errors on overflow [Thomas Weißschuh]
- (tests) add test for formatting [Thomas Weißschuh]
- (tests) move to struct timespec [Thomas Weißschuh]
- constify some arguments [Thomas Weißschuh]
- don't use glibc strptime extension [Thomas Weißschuh]
- implement nanosecond formatting [Thomas Weißschuh]
- implement timespec formatting [Thomas Weißschuh]
- print error if timestamp can't be parsed [Thomas Weißschuh]
- test epoch timestamp [Thomas Weißschuh]
lib/ttyutils:
- add get_terminal_default_type() [Karel Zak]
libblkid:
- (adapted_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (bcache) also calculate checksum over journal buckets [Thomas Weißschuh]
- (bcache) extend superblock definition [Thomas Weißschuh]
- (bcache) report block size [Thomas Weißschuh]
- (bcache) report label [Thomas Weißschuh]
- (bcache) report version [Thomas Weißschuh]
- (bcachefs) adapt to major.minor version [Thomas Weißschuh]
- (bcachefs) add support for 2nd superblock at 2MiB [Thomas Weißschuh]
- (bcachefs) add support for sub-device labels [Thomas Weißschuh]
- (bcachefs) add support for superblock at end of disk [Thomas Weißschuh]
- (bcachefs) compare against offset from idmag [Thomas Weißschuh]
- (bcachefs) fix compiler warning [-Werror=sign-compare] [Karel Zak]
- (bcachefs) fix not detecting large superblocks [Colin Gillespie]
- (bcachefs) fix size validation [Thomas Weißschuh]
- (cramfs) use magic hint [Thomas Weißschuh]
- (ddf_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (dev) use strdup to duplicate string [Thomas Weißschuh]
- (drbd) avoid unaligned accesses [Thomas Weißschuh]
- (drbd) reduce false-positive [biubiuzy]
- (drbd) use magics [Thomas Weißschuh]
- (drbd) validate size in standard minsz predicate [Thomas Weißschuh]
- (drbd) validate zero padding [Thomas Weißschuh]
- (hfsplus) reduce false positive [Karel Zak]
- (highpoint_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (isw_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (jmicron_raid) avoid modifying shared buffer [Thomas Weißschuh]
- (jmicron_raid) use checksum APIs [Thomas Weißschuh]
- (jmicron_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (lsi_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (lvm2) read complete superblock [Thomas Weißschuh]
- (ntfs) validate that sector_size is a power of two [Thomas Weißschuh]
- (nvidia_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (probe) add magic hint [Thomas Weißschuh]
- (probe) allow superblock offset from end of device [Thomas Weißschuh]
- (probe) handle probe without chain gracefully [Thomas Weißschuh]
- (probe) read data in chunks [Thomas Weißschuh]
- (probe) remove chunking from blkid_probe_get_idmag() [Thomas Weißschuh]
- (probe) remove duplicate log [Thomas Weißschuh]
- (promise_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (silicon_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (stratis) remove usage of VLA [Thomas Weißschuh]
- (superblocks) add helper blkid32_to_cpu() [Thomas Weißschuh]
- (vfat) avoid modifying shared buffer [Thomas Weißschuh]
- (via_raid) validate size in standard minsz predicate [Thomas Weißschuh]
- (vxfs) add test files [Thomas Weißschuh]
- (vxfs) report endianness [Thomas Weißschuh]
- (vxfs) simplify prober [Thomas Weißschuh]
- (vxfs) use hex escape for magic [Thomas Weißschuh]
- (zonefs) avoid modifying shared buffer [Thomas Weißschuh]
- add remove_buffer helper [Thomas Weißschuh]
- avoid aligning out of probing area [Thomas Weißschuh]
- avoid memory leak of cachefile path [Thomas Weißschuh]
- avoid use of non-standard typeof() [Thomas Weißschuh]
- constify cached disk data [Thomas Weißschuh]
- constify return values of blkid_probe_get_sb [Thomas Weißschuh]
- exfat fix fail to find volume label [Yuezhang Mo]
- fix topology chain types mismatch [Karel Zak]
- improve portability [Samuel Thibault]
- introduce blkid_wipe_all [Thomas Weißschuh]
- introduce helper to get offset for idmag [Thomas Weißschuh]
- iso9660 Define all fields in iso_volume_descriptor according to ECMA-119 4th edition spec [Pali Rohár]
- iso9660 Implement full High Sierra CDROM format support [Pali Rohár]
- jfs - avoid undefined shift [Milan Broz]
- limit read buffer size [Thomas Weißschuh]
- make enum libblkid_endianness lowercase [Thomas Weißschuh]
- protect shared buffers against modifications [Thomas Weißschuh]
- prune unneeded buffers [Thomas Weißschuh]
- reset errno before calling probefuncs [Thomas Weißschuh]
libfdisk:
- (dos) remove usage of VLA [Thomas Weißschuh]
- (sgi) use strncpy over strcpy [Thomas Weißschuh]
- (sun) properly initialize partition data [Thomas Weißschuh]
- (tests) fix tests for removal of non-blockdev sync() [Thomas Weißschuh]
- add fdisk_partition_get_max_size [Thomas Weißschuh]
- add shortcut for Linux extended boot [Thomas Weißschuh]
- constify builtin fdisk_parttype [Thomas Weißschuh]
- fdisk_deassign_device only sync(2) blockdevs [наб]
- fix typo in debug message [Thomas Weißschuh]
- handle allocation failure in fdisk_new_partition [Thomas Weißschuh]
- reset errno before calling read() [Thomas Weißschuh]
- use new blkid_wipe_all helper [Thomas Weißschuh]
liblastlog2:
- fix leaks [Karel Zak]
libmount:
- (context) avoid dead store [Thomas Weißschuh]
- (optlist) correctly detect ro status [Thomas Weißschuh]
- (python) work around python 3.12 bug [Thomas Weißschuh]
- (tests) add helper for option list splitting [Thomas Weißschuh]
- (tests) don't require root for update tests [Thomas Weißschuh]
- (tests) fix --filesystems crash on invalid argument [Thomas Weißschuh]
- (tests) fix --filesystems test argument parsing [Thomas Weißschuh]
- (tests) split helper tests [Thomas Weißschuh]
- (utils) avoid dead store [Thomas Weißschuh]
- (utils) fix statx fallback [Thomas Weißschuh]
- (veritydev) use asprintf to build string [Thomas Weißschuh]
- Fix regression when mounting with atime [Filipe Manana]
- accept '\' as escape for options separator [Karel Zak]
- add helper to log mount messages as emitted by kernel [Thomas Weißschuh]
- add missing utab options after helper call [Karel Zak]
- add mnt_context_within_helper() wrapper [Karel Zak]
- add private mnt_optstr_get_missing() [Karel Zak]
- add sample to test fs and context relation [Karel Zak]
- add utab.act file [Karel Zak]
- always ignore user=<name> [Karel Zak]
- change syscall status macros to be functions [Thomas Weißschuh]
- check for availability of mount_setattr [Thomas Weißschuh]
- check for linux/mount.h [Markus Mayer]
- check for struct statx [Markus Mayer]
- cleanup --fake mode [Karel Zak]
- cleanup enosys returns from mount hoop [Karel Zak]
- cleanup locking in table update code [Karel Zak]
- don't assume errno after failed asprintf() [Karel Zak]
- don't call hooks after mount.<type> helper [Karel Zak]
- don't call mount.<type> helper with usernames [Karel Zak]
- don't canonicalize symlinks for bind operation [Karel Zak]
- don't pass option "defaults" to helper [Thomas Weißschuh]
- fix fsconfig value unescaping [Karel Zak]
- fix options prepend/insert and merging [Karel Zak]
- fix possible NULL dereference [coverity scan] [Karel Zak]
- fix statx() includes [Karel Zak]
- fix sync options between context and fs structs [Karel Zak]
- fix typo [Debarshi Ray]
- gracefully handle NULL path in mnt_resolve_target() [Thomas Weißschuh]
- guard against sysapi == NULL [Thomas Weißschuh]
- handle failure to apply flags as part of a mount operation [Debarshi Ray]
- ifdef statx() call [Karel Zak]
- ignore unwanted kernel events in monitor [Karel Zak]
- improve EPERM interpretation [Karel Zak]
- improve act file close [Karel Zak]
- improve mnt_table_next_child_fs() [Karel Zak]
- introduce /run/mount/utab.event [Karel Zak]
- introduce LIBMOUNT_FORCE_MOUNT2={always,never,auto} [Karel Zak]
- introduce reference counting for libmnt_lock [Karel Zak]
- make.stx_mnt_id use more robust [Karel Zak]
- reduce utab.lock permissions [Karel Zak]
- report all kernel messages for fd-based mount API [Thomas Weißschuh]
- report failed syscall name [Karel Zak]
- report statx in features list [Karel Zak]
- test utab options after helper call [Thomas Weißschuh]
- update documentation for MNT_ERR_APPLYFLAGS [Debarshi Ray]
- use mount(2) for remount on Linux < 5.14 [Karel Zak]
- use some MS_* flags as superblock flags [Karel Zak]
libmount (python):
- simplify struct initialization [Thomas Weißschuh]
libsmartcols:
- (cell) consistently handle NULL argument [Thomas Weißschuh]
- (filter) Add on-demand data filler [Karel Zak]
- (filter) add ability to cast data [Karel Zak]
- (filter) add regular expression operators [Karel Zak]
- (filter) add upper case EQ,NE,LE,LT,GT and GE operators [Karel Zak]
- (filter) cleanup __filter_new_node() [Karel Zak]
- (filter) cleanup data types [Karel Zak]
- (filter) cleanup function arguments [Karel Zak]
- (filter) evaluate params [Karel Zak]
- (filter) fix dereferences and leaks [coverity scann] [Karel Zak]
- (filter) fix regex deallocation [Karel Zak]
- (filter) implement data basic operators [Karel Zak]
- (filter) implement logical operators [Karel Zak]
- (filter) improve holder status [Karel Zak]
- (filter) improve holder use [Karel Zak]
- (filter) improve scols_filter_assign_column() [Karel Zak]
- (filter) make holders API more generic [Karel Zak]
- (filter) move struct filter_expr [Karel Zak]
- (filter) move struct filter_param [Karel Zak]
- (filter) normalize param strings [Karel Zak]
- (filter) param data refactoring [Karel Zak]
- (filter) split code [Karel Zak]
- (filter) support empty values [Karel Zak]
- (filter) support period in identifier [Karel Zak]
- (filter) use also rpmatch() for boolean [Karel Zak]
- (man) fix typos [Masatake YAMATO]
- (sample) fix error message [Karel Zak]
- (samples) fix format truncation warning [Thomas Weißschuh]
- (samples) remove filter.c [Karel Zak]
- (samples/fromfile) properly handle return value from getline() [Thomas Weißschuh]
- (tests) add test for continuous json output [Thomas Weißschuh]
- Add --highlight option to filter sample [Karel Zak]
- Export internally used types to API [Karel Zak]
- accept '% -' in column name for filters [Karel Zak]
- accept also '/' in column name for filters [Karel Zak]
- accept apostrophe as quote for strings in filter [Karel Zak]
- accept no data for custom wrapping cells [Karel Zak]
- add --{export,raw,json} to wrap sample [Karel Zak]
- add API to join filter and columns [Karel Zak]
- add filter API docs [Karel Zak]
- add filter sample [Karel Zak]
- add filter support to 'fromfile' sample [Karel Zak]
- add new functions to API docs [Karel Zak]
- add parser header files [Karel Zak]
- add scols-filter.5 man page [Karel Zak]
- add scols_cell_refer_memory() [Karel Zak]
- add support for zero separated wrap data [Karel Zak]
- add table cursor [Karel Zak]
- add wrap-zero test [Karel Zak]
- always print vertical symbol [Karel Zak]
- build filter scanner and parser header files too [Karel Zak]
- cleanup datafunc() API [Karel Zak]
- don't directly access struct members [Karel Zak]
- don't include hidden headers in column width calculation [Thomas Weißschuh]
- drop spourious newline in between streamed JSON objects [Thomas Weißschuh]
- fix columns reduction [Karel Zak]
- fix filter param copying [Karel Zak]
- fix filter parser initialization [Karel Zak]
- fix memory leak on filter parser error [Karel Zak]
- fix typo in comment [Karel Zak]
- fix typo in parser tokens [Karel Zak]
- fix uninitialized local variable in sample [Karel Zak]
- flush correct stream [Thomas Weißschuh]
- free after error in filter sample [Karel Zak]
- handle nameless tables in export format [Thomas Weißschuh]
- implement filter based counters [Karel Zak]
- improve and fix scols_column_set_properties() [Karel Zak]
- improve cell data preparation for non-wrapping cases [Karel Zak]
- improve filter integration, use JSON to dump [Karel Zak]
- improve parser error messages [Karel Zak]
- introduce basic files for filter implementation [Karel Zak]
- introduce column type [Karel Zak]
- make calculation more robust [Karel Zak]
- make cell data printing more robust [Karel Zak]
- make sure counter is initialized [Karel Zak]
- multi-line cells refactoring [Karel Zak]
- only recognize closed object as final element [Thomas Weißschuh]
- prefer float in filter expression [Karel Zak]
- reset cell wrapping if all done [Karel Zak]
- search also by normalized column names (aka 'shellvar' name) [Karel Zak]
- support SCOLS_JSON_FLOAT in print API [Karel Zak]
- support \x?? for data by samples/fromfile.c [Karel Zak]
- update gitignore [Karel Zak]
libuuid:
- (test_uuid) make reading UUIDs from file more robust [Thomas Weißschuh]
- Add uuid_time64 for 64bit time_t on 32bit [Thorsten Kukuk]
- avoid truncate clocks.txt to improve performance [Goldwyn Rodrigues]
- fix uint64_t printf and scanf format [Karel Zak]
libuuid/src/gen_uuid.c:
- fix cs_min declaration [Fabrice Fontaine]
logger:
- initialize socket credentials contol union [Karel Zak]
- make sure path is terminated [coverity scan] [Karel Zak]
- use strncpy instead of strcpy [Thomas Weißschuh]
login:
- Initialize noauth from login.noauth credential [Daan De Meyer]
- Use pid_t for child_pid [Tobias Stoeckmann]
- access login.noauth file directly [Tobias Stoeckmann]
- document blank treatment in shell field [Tobias Stoeckmann]
- fix memory leak [coverity scan] [Karel Zak]
- ignore return of audit_log_acct_message [Thomas Weißschuh]
- move comment [Tobias Stoeckmann]
- prevent undefined ioctl and tcsetattr calls [Tobias Stoeckmann]
- simplify name creation [Tobias Stoeckmann]
- unify pw_shell script test [Tobias Stoeckmann]
- use correct terminal fd during setup [Tobias Stoeckmann]
- use xasprintf [Tobias Stoeckmann]
login-utils:
- Report crashes on reboot lines insted of overlapping uptimes [Troy Rollo]
- include libgen.h for basename API [Khem Raj]
loopdev:
- report lost loop devices [Junxiao Bi, Karel Zak]
losetup:
- add --loop-ref and REF column [Karel Zak]
- add MAJ a MIN for device and backing-file [Karel Zak]
- cleanup device node modes [Karel Zak]
- deduplicate find_unused() logic [Thomas Weißschuh]
- fix JSON MAJ MIN [Karel Zak]
- improve "sector boundary" warning [Karel Zak]
- make --output-all more usable [Karel Zak]
- report lost loop devices for finding free loop [Junxiao Bi]
lsblk:
- add --filter [Karel Zak]
- add --highlight [Karel Zak]
- add --list-columns [Karel Zak]
- add docs for filters and counters [Karel Zak]
- add hint that partition start is in sectors [Karel Zak]
- add scols counters support [Karel Zak]
- add separate MAJ and MIN columns [Karel Zak]
- always set column type [Karel Zak]
- define cell data-types, use raw data for SIZEs [Karel Zak]
- explain FSAVAIL in better way [Karel Zak]
- fix in-tree filtering [Karel Zak]
- ignore duplicate lines for counters [Karel Zak]
- improve --tree description [Karel Zak]
- make sure all line data are deallocated [Karel Zak]
- rename sortdata to rawdata [Karel Zak]
- report all unknown columns in filter [Karel Zak]
- split filter allocation and initialization [Karel Zak]
- support normalized column names on command line [Karel Zak]
- update after rebase [Karel Zak]
- use zero to separate lines in multi-line cells [Karel Zak]
lsclocks:
- Fix markup and typos in man page [Mario Blättermann]
- Fix markup in man page [Mario Blättermann]
- add --output-all [Thomas Weißschuh]
- add COL_TYPE [Thomas Weißschuh]
- add NS_OFFSET column [Thomas Weißschuh]
- add column RESOL for clock resolution [Thomas Weißschuh]
- add relative time [Thomas Weißschuh]
- add support for RTC [Thomas Weißschuh]
- add support for cpu clocks [Thomas Weißschuh]
- add support for dynamic clocks [Thomas Weißschuh]
- automatically discover dynamic clocks [Thomas Weißschuh]
- don't fail without dynamic clocks [Thomas Weißschuh]
- factor out path based clocks [Thomas Weißschuh]
- improve dynamic clocks docs and completion [Thomas Weißschuh]
- new util to interact with system clocks [Thomas Weißschuh]
- refer to correct lsclocks(1) manpage [Thomas Weißschuh]
- remove unused code [Karel Zak]
- rename column RESOLUTION to RESOL_RAW [Thomas Weißschuh]
- split out data function [Thomas Weißschuh]
- trim default columns [Thomas Weißschuh]
lscpu:
- Even more Arm part numbers (early 2023) [Jeremy Linton]
- Use 4K buffer size instead of BUFSIZ [Khem Raj]
- add procfs-sysfs dump from VisionFive 2 [Jan Engelhardt]
- cure empty output of lscpu -b/-p [Jan Engelhardt]
- fix caches separator for --parse=<list> [Karel Zak]
- remove usage of VLA [Thomas Weißschuh]
lscpu-cputype.c:
- assign value to multiple variables (ar->bit32 and ar->bit64) clang with -Wcomma will emit an warning of "misuse of comma operator". Since the value that will be assigned, is the same for both (bit32 and bit64), just assigning directly to both variables seems reasonable. [rilysh]
lsdf:
- make the code for filling SOURCE, PARTITION, and MAJMIN reusable [Masatake YAMATO]
lsfd:
- (comment) fix a typo [Masatake YAMATO]
- (filter) accept floating point numbers in expressions [Masatake YAMATO]
- (filter) improve error message [Masatake YAMATO]
- (filter) reduce duplicated code in macro definitions [Masatake YAMATO]
- (filter) support floating point number used in columns [Masatake YAMATO]
- (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types [Masatake YAMATO]
- (man) add bps(8) and ss(8) to the "SEE ALSO" section [Masatake YAMATO]
- (man) document --list-columns as the way to list columns [Masatake YAMATO]
- (man) document the ENDPOINT column for UNIX socket [Masatake YAMATO]
- (man) fix the broken page output for the description of NAME column [Masatake YAMATO]
- (man) fix the form for the optional argument of --inet option [Masatake YAMATO]
- (man) refer to scols-filter(5) [Masatake YAMATO]
- (man) update the description of ENDPOINTS column of UNIX-Stream sockets [Masatake YAMATO]
- (man) write about SOCK.SHUTDOWN column [Masatake YAMATO]
- (man) write about XMODE.m and classical system calls for multiplexing [Masatake YAMATO]
- (refactor) introduce a content data type for char devices [Masatake YAMATO]
- (refactor) make the code comparing struct lock objects reusable [Masatake YAMATO]
- (refactor) make the code for traversing threads reusable [Masatake YAMATO]
- (refactor) make the way to handle character devices extensible [Masatake YAMATO]
- (refactor) move miscdev specific code to cdev_misc_ops [Masatake YAMATO]
- (refactor) unify the invocations of sysfs_get_byteorder() [Masatake YAMATO]
- (test) add a case for testing a unix socket including newline characters in its path name [Masatake YAMATO]
- (tests) don't run mqueue test on byteorder mismatch [Thomas Weißschuh]
- (tests) fix process leak [Masatake YAMATO]
- (tests) fix typo [Thomas Weißschuh]
- Fix typos in man page [Mario Blättermann]
- add "nsfs" to the nodev_table to fill SOURCE column for nsfs files [Masatake YAMATO]
- add 'D' flag for representing deleted files to XMODE column [Masatake YAMATO]
- add 'm' flag representing "multiplexed by epoll_wait(2)" to XMODE column [Masatake YAMATO]
- add BPF-MAP.TYPE, BPF-MAP.TYPE.RAW, and BPF-MAP.ID columns [Masatake YAMATO]
- add BPF-PROG.TYPE, BPF-PROG.TYPE.RAW, and BPF-PROG.ID columns [Masatake YAMATO]
- add BPF.NAME column [Masatake YAMATO]
- add EVENTFD.ID column [Masatake YAMATO]
- add PTMX.TTY-INDEX column [Masatake YAMATO]
- add SOCK.SHUTDOWN column [Masatake YAMATO]
- add TUN.IFFACE, a column for interfaces behind tun devices [Masatake YAMATO]
- add a back pointer as a member of anon_eventfd_data [Masatake YAMATO]
- add a helper function for adding a nodev to the nodev_table [Masatake YAMATO]
- add a helper function, add_endpoint [Masatake YAMATO]
- add a helper function, init_endpoint [Masatake YAMATO]
- add a helper function, new_ipc [Masatake YAMATO]
- add a helper macro, foreach_endpoint [Masatake YAMATO]
- add a new type "mqueue", a type for POSIX Mqueue [Masatake YAMATO]
- add a whitespace [Masatake YAMATO]
- add attach_xinfo and get_ipc_class methods to cdev_ops [Masatake YAMATO]
- add comment listing functions names importing via #include [Masatake YAMATO]
- add const modifier [Thomas Weißschuh]
- add flags, [-lL], representing file lock/lease states to XMODE column [Masatake YAMATO]
- add tmpfs as source of sysvipc to the the nodev_table [Masatake YAMATO]
- add xstrfappend and xstrvfappend [Masatake YAMATO]
- adjust coding style [Masatake YAMATO]
- append SOCK.SHUTDOWN value to ENDPOINTS column of UNIX-STREAM sockets [Masatake YAMATO]
- assign a class to the file in new_file() [Masatake YAMATO]
- avoid passing NULL to qsort() [Thomas Weißschuh]
- avoid undefined behavior [Thomas Weißschuh]
- build lsfd even if kcmp.h is not available [Masatake YAMATO]
- cache the result of checking whether "XMODE" column is enabled or not [Masatake YAMATO]
- call xinfo backend method before calling socket generic method when filling columns [Masatake YAMATO]
- choose anon_ops declarative way [Masatake YAMATO]
- cleanup --list-columns [Karel Zak]
- collect the device number for mqueue fs in the initialization stage [Masatake YAMATO]
- delete redundant parentheses surrounding return value [Masatake YAMATO]
- don't capitalize the help strings for the columns [Masatake YAMATO]
- don't check the value returned from new_file() [Masatake YAMATO]
- fill ENDPOINTS column for eventfd [Masatake YAMATO]
- fill ENDPOINTS column for pty devices [Masatake YAMATO]
- fill ENDPOINTS column of POSIX Mqueue [Masatake YAMATO]
- fill ENDPOINTS column of unix socket using UNIX_DIAG_PEER information [Masatake YAMATO]
- fill NAME column of inotify files with the information about their monitoring targets [Masatake YAMATO]
- fix a misleading parameter name [Masatake YAMATO]
- fix a sentence in comment [Masatake YAMATO]
- fix memory leak in append_filter_expr() [Karel Zak]
- fix specifying wrong JSON typs when building the help message [Masatake YAMATO]
- fix wrong inconsistency in extracting cwd and root associations [Masatake YAMATO]
- include common headers in lsfd.h [Masatake YAMATO]
- include system header files first [Masatake YAMATO]
- initialize pagesize in an earlier stage [Masatake YAMATO]
- initialize the ipc table before loading lists of unix socket peers via netlink diag [Masatake YAMATO]
- introduce -H, --list-columns option for making help messages short [Masatake YAMATO]
- introduce XMODE column, extensible variant of MODE [Masatake YAMATO]
- keep filter-only columns hidden [Karel Zak]
- make the order of calling finalize_* and initialize_* consistent [Masatake YAMATO]
- make the sock_xinfo layer be able to prepare an ipc_class for a given socket [Masatake YAMATO]
- mark XMODE.m on fds monitored by poll(2) and ppoll(2) [Masatake YAMATO]
- mark XMODE.m on fds monitored by select(2) and pselect6(2) [Masatake YAMATO]
- move a local variable to a narrower scope [Masatake YAMATO]
- print file descriptors targeted by eventpoll files [Masatake YAMATO]
- print the detail of the timer associated with a timerfd [Masatake YAMATO]
- print the masks specified in signalfds [Masatake YAMATO]
- re-fill unix socket paths with sockdiag netlink interface [Masatake YAMATO]
- rearrange the aligment of the help messages [Masatake YAMATO]
- show default columns in the help message [Masatake YAMATO]
- switch to c99-conformant alignment specification [Thomas Weißschuh]
- update the help message for XMODE column [Masatake YAMATO]
- use ARRAY_STRING and ARRAY_NUMBER json types in some columns [Masatake YAMATO]
- use SCOLS_JSON_FLOAT [Karel Zak]
- use \n as the separator in EVENTPOLL.TFDS column [Masatake YAMATO]
- use \n as the separator in INOTIFY.INODES and INOTIFY.INODES.RAW columns [Masatake YAMATO]
- use filter and counters from libsmartcols [Karel Zak]
- use helper functions in column-list-table.h [Masatake YAMATO]
- use scols_table_get_column_by_name [Masatake YAMATO]
- use the specified output stream for printing help messages [Masatake YAMATO]
- use xstrdup instead of xasprintf(...\"%s\" [Masatake YAMATO]
- utilize /proc/tty/drivers for filling SOURCE column of tty devices [Masatake YAMATO]
- write more about nsfs in comment [Masatake YAMATO]
lsfd,test_mkfds:
- (cosmetic) remove whitespaces between functions and their arglists [Masatake YAMATO]
lsfd-filter:
- constify filter logic [Thomas Weißschuh]
lsfd.1.adoc:
- document BPF.NAME column [Masatake YAMATO]
- fix a typo [Masatake YAMATO]
- fix typos [Masatake YAMATO]
- revise type names for columns [Masatake YAMATO]
- update for signalfds [Masatake YAMATO]
- write about timerfd [Masatake YAMATO]
lslocks:
- (fix) set JSON type for COL_SIZE even when --bytes is specified [Masatake YAMATO]
- (man) add missing fields [Masatake YAMATO]
- (man) document LEASE type [Masatake YAMATO]
- (man) update the note about OFDLCK [Masatake YAMATO]
- (preparation) add a fd number to the lock struct when loading lock info from /proc/$pid/fdinfo/$fd [Masatake YAMATO]
- (refactor) add a helper function returning JSON type for a given column [Masatake YAMATO]
- (refactor) lift up the code destroying the lock list for future extension [Masatake YAMATO]
- (refactor) make the data structure for storing lock information replacable [Masatake YAMATO]
- (refactor) remove 'pid' global variable [Masatake YAMATO]
- (refactor) use a tree for storing lock information extracted from /proc/$pid/fdinfo/$fd [Masatake YAMATO]
- (test) add a case [Masatake YAMATO]
- (test) add a case for OFDLCK type locks [Masatake YAMATO]
- add -H option printing avaiable columns [Masatake YAMATO]
- add HOLDERS column [Masatake YAMATO]
- add a missing "break;" in a switch/case statement [Masatake YAMATO]
- cleanup --list-columns [Karel Zak]
- don't attempt to open /proc/-1/fd/ [Jakub Wilk]
- improve --list-columns [Karel Zak]
- refactor the code reading /proc/locks [Masatake YAMATO]
- rename functions for future extension [Masatake YAMATO]
- store list_add_tail when storing information extracted from /proc/$pid/fdinfo/$fd [Masatake YAMATO]
- use information extracted from "locks " column of /proc/$pid/fdinfo/* [Masatake YAMATO]
lslogins:
- (man) fix -y option formatting [Thomas Weißschuh]
- fix realloc() loop allocation size [Thomas Weißschuh]
m4:
- update pkg.m4 [Thomas Weißschuh]
man:
- Add enosys and lsclocks to po4a.cfg [Mario Blättermann]
meson:
- add check for linux/mount.h [Thomas Weißschuh]
- add check for struct statx [Thomas Weißschuh]
- add conditionalization for test progs [Zbigniew Jędrzejewski-Szmek]
- add missing scols sample [Karel Zak]
- avoid int operation with non-int [Thomas Weißschuh]
- build test_mount_optlist [Thomas Weißschuh]
- bump required version to 0.60.0 [Thomas Weißschuh]
- check for HAVE_STRUCT_STATX_STX_MNT_ID [Karel Zak]
- check for _NL_TIME_WEEK_1STDAY in langinfo.h [Christian Hesse]
- conditionalize waitpid [Zbigniew Jędrzejewski-Szmek]
- don't try to build test_ca without libcap-ng [Thomas Weißschuh]
- fix copy & past error [Karel Zak]
- implement HAVE_PTY [Zbigniew Jędrzejewski-Szmek]
- include bash-completion for newgrp [Christian Hesse]
- include bash-completion for write [Christian Hesse]
- install chfn setuid [Christian Hesse]
- install chsh setuid [Christian Hesse]
- install mount setuid [Christian Hesse]
- install newgrp setuid [Christian Hesse]
- install su setuid [Christian Hesse]
- install symlink for vigr man page [Christian Hesse]
- install umount setuid [Christian Hesse]
- install wall executable with group 'tty' [Christian Hesse]
- install wall setgid [Christian Hesse]
- install write executable with group 'tty' [Christian Hesse]
- install write setgid [Christian Hesse]
- properly handle gettext non-existence [Thomas Weißschuh]
- remove scols filter sample [Karel Zak]
- require 0.57 [Thomas Weißschuh]
- run tests if with option program-tests [sewn]
- try to always use 64bit time support on glibc [Thomas Weißschuh]
- update for libsmartcols filter [Karel Zak]
- use bison --defines=HEADER [Karel Zak]
- use meson features instead of bash [sewn]
misc:
- constify some fields [Thomas Weißschuh]
mkfs.minix:
- handle 64bit time on 32bit system [Thomas Weißschuh]
mkswap:
- (tests) don't overwrite logfiles [Thomas Weißschuh]
- (tests) validate existence of truncate command [Thomas Weißschuh]
- implement --file [Vicki Pfau]
- implement --offset [Thomas Weißschuh]
more:
- avoid out-of-bound access [Thomas Weißschuh]
- exit if POLLERR and POLLHUP on stdin is received [Goldwyn Rodrigues]
- exit if POLLHUP or POLLERR on stdin is received [Goldwyn Rodrigues]
- remove usage of alloca() [Thomas Weißschuh]
mount:
- (tests) don't create /dev/nul [Thomas Weißschuh]
- (tests) explicitly use test fstab location [Thomas Weißschuh]
- (tests) reuse well-known per-test fstab location [Thomas Weißschuh]
- (tests) test mount helper with multiple filesystems [Thomas Weißschuh]
- Fix markup and typos in man page [Mario Blättermann]
- add --map-users and --map-groups convenience options [Chris Webb]
- improve code readability [Karel Zak]
nsenter:
- (man) add --keep-caps [Karel Zak]
- add missing free() [Karel Zak]
- add option `-c` to join the cgroup of target process [u2386]
- avoid NULL pointer dereference [coverity scan] [Karel Zak]
- fix possible NULL dereferece [coverity scan] [Karel Zak]
pg:
- use snprintf to build string [Thomas Weißschuh]
pipesz:
- avoid dead store [Thomas Weißschuh]
po:
- add ro.po (from translationproject.org) [Remus-Gabriel Chelu]
- merge changes [Karel Zak]
- update de.po (from translationproject.org) [Hermann Beckers]
- update es.po (from translationproject.org) [Antonio Ceballos Roa]
- update hr.po (from translationproject.org) [Božidar Putanec]
- update ja.po (from translationproject.org) [Takeshi Hamasaki]
- update sr.po (from translationproject.org) [Мирослав Николић]
- update tr.po (from translationproject.org) [Emir SARI]
po-man:
- add ko.po (from translationproject.org) [Seong-ho Cho]
- add ro.po (from translationproject.org) [Remus-Gabriel Chelu]
- merge changes [Karel Zak]
- update de.po (from translationproject.org) [Mario Blättermann]
- update fr.po (from translationproject.org) [Frédéric Marchal]
- update sr.po (from translationproject.org) [Мирослав Николић]
- update uk.po (from translationproject.org) [Yuri Chornoivan]
prlimit:
- (man) fix formatting [Jakub Wilk]
- reject trailing junk in limits without " " [Jakub Wilk]
procfs:
- add a helper function to access /proc/$pid/syscall [Masatake YAMATO]
readprofile:
- use xasprintf to build string [Thomas Weißschuh]
rename:
- properly handle directories with trailing slash [Thomas Weißschuh]
runuser.1.adoc:
- Move -m|-p|--preserve-environment in order [Sebastian Pipping]
runuser|su:
- Start supporting option -T|--no-pty [Sebastian Pipping]
script-playutils:
- close filestream in case ignore_line() fails [Thomas Weißschuh]
scriptreplay:
- support ctrl+s and ctrl+g [Karel Zak]
setarch:
- add PER_LINUX_FDPIC fallback [Karel Zak]
- add riscv64/riscv32 support [Michal Biesek]
setpriv:
- add landlock support [Thomas Weißschuh]
- fix group argument completion [Thomas Weißschuh]
setterm:
- avoid restoring flags from uninitialized memory [Chris Hofstaedtler]
sfdisk:
- Fix markup in man page [Mario Blättermann]
- add hint about duplicate UUIDs when use dump [Karel Zak]
sha1:
- properly wipe variables [Thomas Weißschuh]
strv:
- make strv_new_api static [Thomas Weißschuh]
sulogin:
- relabel terminal according to SELinux policy [Christian Göttsche]
- use get_terminal_default_type() [Karel Zak]
swapon:
- (man) fix --priority description [Karel Zak]
- (tests) abort test on failing commands [Thomas Weißschuh]
sys-utils:
- cleanup license lines, add SPDX [Karel Zak]
- fix SELinux context example in mount.8 [Todd Zullinger]
sys-utils/lscpu:
- Use ul_path_scanf where possible [Tobias Stoeckmann]
term-utils:
- fix indentation [Karel Zak]
test:
- (lsfd column-xmode) add mising "wait" invocation [Masatake YAMATO]
- (lsfd) add a case for l and L flags in XMODE column [Masatake YAMATO]
- (lsfd) add a case for testing BPF-MAP.TYPE and BPF-MAP.TYPE.RAW columns [Masatake YAMATO]
- (lsfd) add a case for testing BPF-PROG.TYPE and BPF-PROG.TYPE.RAW columns [Masatake YAMATO]
- (lsfd) add a case for testing DELETED column [Masatake YAMATO]
- (lsfd) add a subcase for testing NAME column for a deleted file [Masatake YAMATO]
- (mkfds bpf-map) new factory [Masatake YAMATO]
- (mkfds bpf-prog) new factory [Masatake YAMATO]
- (mkfds make-regular-file) add a parameter for file locking [Masatake YAMATO]
- (mkfds make-regular-file) add a parameter for making the new file readable [Masatake YAMATO]
- (mkfds make-regular-file) add a parameter for writing some bytes [Masatake YAMATO]
- (mkfds make-regular-file) delete the created file when an error occurs [Masatake YAMATO]
- (mkfds make-regular-file) make 'fd' local variable reusable [Masatake YAMATO]
- (mkfds ro-regular-file) add a parameter for a read lease [Masatake YAMATO]
- (mkfds) add "make-regular-file" factory [Masatake YAMATO]
test_enosys:
- fix build on old kernels [Thomas Weißschuh]
test_mkfds:
- avoid "ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’" [Masatake YAMATO]
test_uuidd:
- make pthread_t formatting more robust [Thomas Weißschuh]
tests:
- (cosmetic,lslocks) trim whitespaces at the end of line [Masatake YAMATO]
- (functions.sh) create variable for test fstab location [Thomas Weißschuh]
- (functions.sh) use per-test fstab file [Thomas Weißschuh]
- (lsfd column-xmode) do rm -f the file for testing before making it [Masatake YAMATO]
- (lsfd column-xmode) ignore "rwx" mappings [Masatake YAMATO]
- (lsfd column-xmode) skip some subtests if OFD locks are not available [Masatake YAMATO]
- (lsfd filter-floating-point-nums) use --raw output to make the case more robust [Masatake YAMATO]
- (lsfd mkfds-*) alter the L4 ports for avoiding the conflict with option-inet test case [Masatake YAMATO]
- (lsfd mkfds-bpf-map) chmod a+x [Masatake YAMATO]
- (lsfd mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers [Masatake YAMATO]
- (lsfd mkfds-socketpair) make a case for testing DGRAM a subtest and add a subtest for STREAM [Masatake YAMATO]
- (lsfd mkfds-unix-dgram) don't depend on the number of whitespaces in the output [Masatake YAMATO]
- (lsfd option-inet) get child-processes' pids via fifo [Masatake YAMATO]
- (lsfd) add a case for testing ENDPOINTS column of UNIX-STREAM sockets [Masatake YAMATO]
- (lsfd) add a case for testing EVENTPOLL.TFDS column [Masatake YAMATO]
- (lsfd) add a case for testing INOTIFY.INODES.RAW column [Masatake YAMATO]
- (lsfd) add a case for testing SOCK.SHUTDOWN column [Masatake YAMATO]
- (lsfd) add a case for testing SOURCE column for SysV shmem mappings [Masatake YAMATO]
- (lsfd) add a case for testing signalfd related columns [Masatake YAMATO]
- (lsfd) add a case for testing timerfd related columns [Masatake YAMATO]
- (lsfd) add a case for verifying ENDPOINTS column output in JSON mode [Masatake YAMATO]
- (lsfd) add a case testing 'm' flag in XMODE column [Masatake YAMATO]
- (lsfd) add a case testing INOTIFY.INODES.RAW column on btrfs [Masatake YAMATO]
- (lsfd) add a case testing NAME, SOURCE, ENDPOINTS, and PTMX.TTY-INDEX columns of pts fds [Masatake YAMATO]
- (lsfd) add a case testing TUN.IFACE column [Masatake YAMATO]
- (lsfd) add a case testing XMODE.m for classical syscalls for multiplexing [Masatake YAMATO]
- (lsfd) add cases for POSIX Mqueue [Masatake YAMATO]
- (lsfd) add cases for eventfd [Masatake YAMATO]
- (lsfd) add lsfd_check_mkfds_factory as a help function [Masatake YAMATO]
- (lsfd) avoid race conditions (part 1) [Masatake YAMATO]
- (lsfd) don't run the unix-stream testcase including newlines in the path on qemu-user [Masatake YAMATO]
- (lsfd) extend the cases for testing BPF.NAME column [Masatake YAMATO]
- (lsfd) extend the mkfds-socketpair case to test ENDPOINTS with SOCK.SHUTDOWN info [Masatake YAMATO]
- (lsfd) show the entry for mqueue in /proc/self/mountinfo [Masatake YAMATO]
- (lsfd) skip mkfds-netns if SIOCGSKNS is not defined [Masatake YAMATO]
- (lsfd/filter) add a case for comparing floating point numbers [Masatake YAMATO]
- (lslcoks) insert a sleep between taking a lock and running lslocks [Masatake YAMATO]
- (lslocks) add cases testing HOLDERS column [Masatake YAMATO]
- (lslocks) add missing ts_finalize call [Masatake YAMATO]
- (mkfds) add / and /etc/fstab as the monitoring targets to inotify [Masatake YAMATO]
- (mkfds) add a factor for opening tun device [Masatake YAMATO]
- (mkfds) add a factory to make SysV shmem [Masatake YAMATO]
- (mkfds) add a factory to make a signalfd [Masatake YAMATO]
- (mkfds) add a factory to make a timerfd [Masatake YAMATO]
- (mkfds) add a factory to make an eventpoll fd [Masatake YAMATO]
- (mkfds) add eventfd factory [Masatake YAMATO]
- (mkfds) add mqueue factory [Masatake YAMATO]
- (mkfds) print a whitespace only when the running factory has "report" method [Masatake YAMATO]
- (mkfds) provide the way to declare the number of extra printing values [Masatake YAMATO]
- (refactor (test_mkfds, lsfd)) use TS_EXIT_NOTSUPP instead of EXIT_ENOSYS [Masatake YAMATO]
- (run.sh) detect builddir from working directory [Thomas Weißschuh]
- (test_mkfds inotify) add "dir" and "file" parameters [Masatake YAMATO]
- (test_mkfds make-regular-file) add a new parameter, "dupfd" [Masatake YAMATO]
- (test_mkfds mkfds-multiplexing) dump /proc/$pid/syscall for debugging [Masatake YAMATO]
- (test_mkfds mkfds-multiplexing) make the output of ts_skip_subtest visible [Masatake YAMATO]
- (test_mkfds pty) add a new factory [Masatake YAMATO]
- (test_mkfds socketpair) add "halfclose" parameter [Masatake YAMATO]
- (test_mkfds {bpf-prog,bpf-map}) fix memory leaks [Masatake YAMATO]
- (test_mkfds) add --is-available option [Masatake YAMATO]
- (test_mkfds) add a new factory "multiplexing" [Masatake YAMATO]
- (test_mkfds) add missing PARAM_END marker [Masatake YAMATO]
- (test_mkfds) add poll multiplexer [Masatake YAMATO]
- (test_mkfds) add ppoll multiplexer [Masatake YAMATO]
- (test_mkfds) add pselect6 and select multiplexers [Masatake YAMATO]
- (test_mkfds) allow to add factory-made fds to the multiplexer as event source [Masatake YAMATO]
- (test_mkfds) include locale headers first to define _GNU_SOURCE [Masatake YAMATO]
- (test_mkfds) initialize a proper union member [Masatake YAMATO]
- (test_mkfds) monitor stdin by default [Masatake YAMATO]
- (test_mkfds) revise the usage of " __attribute__((__unused__))" [Masatake YAMATO]
- (test_mkfds) use SYS_bpf instead of __NR_bpf [Masatake YAMATO]
- (test_mkfds) use err() when a system call fails [Masatake YAMATO]
- (test_mkfds, refactor) make the function for waiting events plugable [Masatake YAMATO]
- add libsmartcols filter tests [Karel Zak]
- add missing file and improve options-missing test [Karel Zak]
- add omitted files [Karel Zak]
- add optlist tests [Karel Zak]
- add sysinfo to show sizeof(time_t) [Thomas Weißschuh]
- add ts_skip_capability [Masatake YAMATO]
- add ts_skip_docker [Thomas Weißschuh]
- add user and user=name mount test [Karel Zak]
- constify a sysinfo helpers struct [Thomas Weißschuh]
- don't keep bison messages in tests [Karel Zak]
- fix capability testing [Thomas Weißschuh]
- fix memory leak in scols fromfile [Karel Zak]
- fix subtests containing spaces in their name [Thomas Weißschuh]
- increase delay for waitpid test [Goldwyn Rodrigues]
- make mount/special more robust [Karel Zak]
- make ts_skip_capability accepts the output of older version of getpcaps [Masatake YAMATO]
- skip broken tests on docker [Thomas Weißschuh]
- update lsfd broken filter test [Karel Zak]
- use array keys in more robust way [Karel Zak]
- use scols_column_set_properties() in 'fromfile' sample [Karel Zak]
tests,autotools:
- add TESTS_COMPONENTS macro for specfying test components from make cmdline [Masatake YAMATO]
timeutils:
- add an inline funciton, is_timespecset() [Masatake YAMATO]
- add strtimespec_relative [Thomas Weißschuh]
tools:
- (asciidoctor) explicitly require extensions module [Thomas Weißschuh]
tools/all_syscalls:
- use pipefail [sewn]
- use sh and replace awk with grep & sed [sewn]
treewide:
- explicitly mark unused arguments [Thomas Weißschuh]
- fix newlines when using fputs [Thomas Weißschuh]
- use (x)reallocarray() when applicable [Thomas Weißschuh]
- use reallocarray to allocated memory that will be reallocated [Thomas Weißschuh]
ttyutils:
- improve get_terminal_default_type() code [Karel Zak]
uclampset:
- Remove validation logic [Qais Yousef]
- doc Add a reference to latest kernel documentation [Qais Yousef]
umount:
- handle bindmounts during --recursive [Thomas Weißschuh]
unshare:
- Add --map-users=all and --map-groups=all [Chris Webb]
- Move implementation of --keep-caps option to library function [David Gibson]
- Set uid and gid maps directly when run as root [Chris Webb]
- Support multiple ID ranges for user and group maps [Chris Webb]
- allow negative time offsets [Thomas Weißschuh]
- don't try to reset the disposition of SIGKILL [Chris Webb]
- fix error message for unexpected time offsets [Thomas Weißschuh]
- make sure map_range.next is initialized [coverity scan] [Karel Zak]
utmpdump:
- validate subsecond granularity [Thomas Weißschuh]
uuidd:
- Fix markup in man page (uuidd.8) [Mario Blättermann]
- add cont_clock persistence [Michael Trapp]
- enable cont-clock in service file [Karel Zak]
- improve man page for -cont-clock [Karel Zak]
uuidgen:
- add option --count [Karel Zak]
- mark some options mutually exclusive [Karel Zak]
verity:
- modernize example in manpage [Luca Boccassi]
- use <roothash>-verity as the device mapper name instead of libmnt_<image> [Luca Boccassi]
waitpid:
- only build when pidfd_open is available [Thomas Weißschuh]
- warn of "exited" only when --verbose is given [Masatake YAMATO]
wall:
- do not error for ttys that do not exist [Mike Gilbert]
- fix calloc cal [-Werror=calloc-transposed-args] [Karel Zak]
- query logind for list of users with tty (#2088) [Thorsten Kukuk]
wdctl:
- properyl test timeout conditions [Thomas Weißschuh]
- use only sysfs if sufficient [Thomas Weißschuh]
wipefs:
- (man) fix typos [codefiles]
- (tests) add test for all detected signatures [Thomas Weißschuh]
- (tests) remove necessity of root permissions [Thomas Weißschuh]
- allow storage of backups in specific location [Thomas Weißschuh]
write:
- Add missing section header in man page [Mario Blättermann]
- query logind for list of users with tty (#2088) [Thorsten Kukuk]
xalloc.h:
- add new functions xstrappend, xstrputc, xstrvfappend, and xstrfappend [Masatake YAMATO]
zramctl:
- add hint about supported algorithms [Karel Zak]
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Details of the order
From: Edmond Downton @ 2024-01-23 9:10 UTC (permalink / raw)
To: util-linux
Hi,
We are a manufacturing company from Poland, and we have created unique packaging solutions that are a novelty in the market and work perfectly not only for ice cream, sweets, and other snacks but also for funnels, candles, and lanterns.
This is a reusable product with a delicate structure, lightweight, and an attractive appearance. It offers an excellent alternative to traditional napkins that become unpleasantly sticky and soft when exposed to moisture.
If you are interested in such a solution, please contact us, and we will be happy to provide more details.
Best regards
Edmond Downton
^ permalink raw reply
* Re: [PATCH] gpt-partnames: add "ChromeOS firmware" & doc link
From: Thomas Weißschuh @ 2024-01-18 19:15 UTC (permalink / raw)
To: наб; +Cc: util-linux
In-Reply-To: <r3td5hqd23d4li67qtnkodkffgsduh6tehvek2kibz3yeizpck@tarta.nabijaczleweli.xyz>
Hi,
Jan 18, 2024 20:11:33 наб <nabijaczleweli@nabijaczleweli.xyz>:
> I have a Chromebook, with fdisk -l of the internal flash being:
...
> diff '--color=auto' -u -r util-linux-2.39.3.orig/include/pt-gpt-partnames.h util-linux-2.39.3/include/pt-gpt-partnames.h
> --- util-linux-2.39.3.orig/include/pt-gpt-partnames.h 2023-11-30 11:26:09.675522060 +0100
> +++ util-linux-2.39.3/include/pt-gpt-partnames.h 2024-01-18 19:00:19.208308527 +0100
> @@ -229,8 +229,10 @@
> DEF_GUID("49F48DAA-B10E-11DC-B99B-0019D1879648", N_("NetBSD RAID")),
>
> /* ChromeOS */
> +/* https://chromium.googlesource.com/chromiumos/docs/+/main/disk_format.md#partition-types */
> DEF_GUID("FE3A2A5D-4F32-41A7-B725-ACCC3285A309", N_("ChromeOS kernel")),
> DEF_GUID("3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC", N_("ChromeOS root fs")),
> +DEF_GUID("CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3", N_("ChromeOS firmware")),
> DEF_GUID("2E0A753D-9E48-43B0-8337-B15192CB1B5E", N_("ChromeOS reserved")),
>
> /* MidnightBSD */
In a weird coincidence this was already added last week in https://github.com/util-linux/util-linux/pull/2698
^ permalink raw reply
* [PATCH] gpt-partnames: add "ChromeOS firmware" & doc link
From: наб @ 2024-01-18 19:11 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 5053 bytes --]
I have a Chromebook, with fdisk -l of the internal flash being:
Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8648551F-D8FC-AC44-AA00-C0CA32C4A9BC
Device Start End Sectors Size Type
/dev/mmcblk0p1 8704000 61063119 52359120 25G Microsoft basic data
/dev/mmcblk0p2 20480 53247 32768 16M ChromeOS kernel
/dev/mmcblk0p3 4509696 8703999 4194304 2G ChromeOS root fs
/dev/mmcblk0p4 53248 86015 32768 16M ChromeOS kernel
/dev/mmcblk0p5 315392 4509695 4194304 2G ChromeOS root fs
/dev/mmcblk0p6 16448 16448 1 512B ChromeOS kernel
/dev/mmcblk0p7 16449 16449 1 512B ChromeOS root fs
/dev/mmcblk0p8 86016 118783 32768 16M Microsoft basic data
/dev/mmcblk0p9 16450 16450 1 512B ChromeOS reserved
/dev/mmcblk0p10 16451 16451 1 512B ChromeOS reserved
/dev/mmcblk0p11 64 16447 16384 8M unknown
/dev/mmcblk0p12 249856 315391 65536 32M EFI System
Partition table entries are not in disk order.
and -lx being:
Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8648551F-D8FC-AC44-AA00-C0CA32C4A9BC
First usable LBA: 34
Last usable LBA: 61063134
Alternative LBA: 61063167
Partition entries starting LBA: 2
Allocated partition entries: 128
Partition entries ending LBA: 33
Device Start End Sectors Type-UUID UUID Name Attrs
/dev/mmcblk0p1 8704000 61063119 52359120 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 D8331AD0-ED78-F442-87F4-78DF0130895A STATE
/dev/mmcblk0p2 20480 53247 32768 FE3A2A5D-4F32-41A7-B725-ACCC3285A309 CCFE5BD8-BBE4-A840-9C0B-BBA6427B6309 KERN-A GUID:49,56
/dev/mmcblk0p3 4509696 8703999 4194304 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC E71F6E02-1BC3-9D43-9EDD-2C7CA20D512A ROOT-A
/dev/mmcblk0p4 53248 86015 32768 FE3A2A5D-4F32-41A7-B725-ACCC3285A309 753B5AEB-254E-AE47-8B69-FF58D9AC7DEA KERN-B GUID:48,56
/dev/mmcblk0p5 315392 4509695 4194304 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC 8D0AAB90-FCDD-1B4E-88C1-25591367535A ROOT-B
/dev/mmcblk0p6 16448 16448 1 FE3A2A5D-4F32-41A7-B725-ACCC3285A309 A1F17DE0-C736-0749-9D46-C7AF964C0805 KERN-C GUID:52,53,54,55
/dev/mmcblk0p7 16449 16449 1 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC 9D3217B1-C796-694B-8F13-5266A7B03F3E ROOT-C
/dev/mmcblk0p8 86016 118783 32768 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 37A18CE9-ACF2-894B-9B67-C212C374C100 OEM
/dev/mmcblk0p9 16450 16450 1 2E0A753D-9E48-43B0-8337-B15192CB1B5E F534539C-EDAC-2C44-A6CD-827D7490CF50 reserved
/dev/mmcblk0p10 16451 16451 1 2E0A753D-9E48-43B0-8337-B15192CB1B5E E4248D3E-6EA0-B148-8215-B50269CE9678 reserved
/dev/mmcblk0p11 64 16447 16384 CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3 530A6C46-BDFA-7C40-A446-FC05001BDA82 RWFW
/dev/mmcblk0p12 249856 315391 65536 C12A7328-F81F-11D2-BA4B-00A0C93EC93B BCF61070-764A-004F-8ABD-590A44996A91 EFI-SYSTEM LegacyBIOSBootable
Partition table entries are not in disk order.
Note part 11/RWFW being "unknown".
The fdisk on the device doesn't know it, and upstream doesn't either.
The only google result is
https://chromium.googlesource.com/chromiumos/docs/+/d5eefaba799595d6cd302de047325ca8295dd87e/disk_format.md
which agrees with the other three ChromeOS definitions fdisk knows,
so add this one as well, and link to the live document.
fdisk -l now shows:
/dev/mmcblk0p10 16451 16451 1 512B ChromeOS reserved
/dev/mmcblk0p11 64 16447 16384 8M ChromeOS firmware
/dev/mmcblk0p12 249856 315391 65536 32M EFI System
---
diff '--color=auto' -u -r util-linux-2.39.3.orig/include/pt-gpt-partnames.h util-linux-2.39.3/include/pt-gpt-partnames.h
--- util-linux-2.39.3.orig/include/pt-gpt-partnames.h 2023-11-30 11:26:09.675522060 +0100
+++ util-linux-2.39.3/include/pt-gpt-partnames.h 2024-01-18 19:00:19.208308527 +0100
@@ -229,8 +229,10 @@
DEF_GUID("49F48DAA-B10E-11DC-B99B-0019D1879648", N_("NetBSD RAID")),
/* ChromeOS */
+/* https://chromium.googlesource.com/chromiumos/docs/+/main/disk_format.md#partition-types */
DEF_GUID("FE3A2A5D-4F32-41A7-B725-ACCC3285A309", N_("ChromeOS kernel")),
DEF_GUID("3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC", N_("ChromeOS root fs")),
+DEF_GUID("CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3", N_("ChromeOS firmware")),
DEF_GUID("2E0A753D-9E48-43B0-8337-B15192CB1B5E", N_("ChromeOS reserved")),
/* MidnightBSD */
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [PATCH v2] uuidd: add cont_clock persistence
From: Karel Zak @ 2024-01-15 9:41 UTC (permalink / raw)
To: Michael Trapp; +Cc: util-linux
In-Reply-To: <20240110162938.20672-1-michael.trapp@sap.com>
On Wed, Jan 10, 2024 at 05:29:38PM +0100, Michael Trapp wrote:
> libuuid/src/gen_uuid.c | 120 ++++++++++++++++++++++++++++++-----------
> libuuid/src/uuidP.h | 1 +
> misc-utils/uuidd.c | 9 ----
> 3 files changed, 90 insertions(+), 40 deletions(-)
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs
From: Karel Zak @ 2024-01-15 9:40 UTC (permalink / raw)
To: наб; +Cc: util-linux
In-Reply-To: <utso6yacwbluj5pou2vwllxfb5dxmhbly5qaumlshga3o5fbgg@tarta.nabijaczleweli.xyz>
On Sat, Jan 13, 2024 at 11:35:31PM +0100, наб wrote:
> When not editing a blockdev, syncing disks provides no benefit
> (we already fsync() above), takes a long time,
> and affects unrelated caches.
>
> BLKRRPART is similarly gated on !S_ISBLK(st_mode) in
> fdisk_reread_partition_table.
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH] libfdisk: fdisk_deassign_device: only sync(2) blockdevs
From: наб @ 2024-01-13 22:35 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
When not editing a blockdev, syncing disks provides no benefit
(we already fsync() above), takes a long time,
and affects unrelated caches.
BLKRRPART is similarly gated on !S_ISBLK(st_mode) in
fdisk_reread_partition_table.
---
Based on the 2.39 tarball.
diff '--color=auto' -ru util-linux-2.39.orig/libfdisk/src/context.c util-linux-2.39/libfdisk/src/context.c
--- util-linux-2.39.orig/libfdisk/src/context.c 2023-05-11 10:24:24.840187437 +0200
+++ util-linux-2.39/libfdisk/src/context.c 2024-01-13 23:25:56.358057182 +0100
@@ -773,7 +773,7 @@
cxt->dev_path);
return -errno;
}
- if (!nosync) {
+ if (S_ISBLK(cxt->dev_st.st_mode) && !nosync) {
fdisk_info(cxt, _("Syncing disks."));
sync();
}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* [PATCH v2] uuidd: add cont_clock persistence
From: Michael Trapp @ 2024-01-10 16:29 UTC (permalink / raw)
To: util-linux; +Cc: kzak
cont_clock requires a correct time setup and therefore it
must be possible to detect a step back between uuidd starts.
Reserving the next 10 seconds is sufficient and should not
have a noticeable performance impact. It will also provide
the possibility to start with the clock_reg from the previous
session when the system was rebooted.
Whith that, the early cont_clock initialization in uuidd
should be removed because writing the cont_clock persitence
when -C was not set is useless and might be confusing.
---
libuuid/src/gen_uuid.c | 120 ++++++++++++++++++++++++++++++-----------
libuuid/src/uuidP.h | 1 +
misc-utils/uuidd.c | 9 ----
3 files changed, 90 insertions(+), 40 deletions(-)
diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
index 826cd2245..79e5e285c 100644
--- a/libuuid/src/gen_uuid.c
+++ b/libuuid/src/gen_uuid.c
@@ -207,6 +207,28 @@ static int get_node_id(unsigned char *node_id)
return 0;
}
+enum { STATE_FD_ERROR = -1, STATE_FD_INIT = -2 };
+
+static int state_fd_init(const char *clock_file, FILE **fp)
+{
+ mode_t save_umask;
+ int state_fd;
+ FILE *state_f;
+
+ save_umask = umask(0);
+ state_fd = open(clock_file, O_RDWR|O_CREAT|O_CLOEXEC, 0660);
+ (void) umask(save_umask);
+ if (state_fd != -1) {
+ state_f = fdopen(state_fd, "r+" UL_CLOEXECSTR);
+ if (!state_f) {
+ close(state_fd);
+ state_fd = STATE_FD_ERROR;
+ } else
+ *fp = state_f;
+ }
+ return state_fd;
+}
+
/* Assume that the gettimeofday() has microsecond granularity */
#define MAX_ADJUSTMENT 10
/* Reserve a clock_seq value for the 'continuous clock' implementation */
@@ -223,32 +245,16 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
{
THREAD_LOCAL int adjustment = 0;
THREAD_LOCAL struct timeval last = {0, 0};
- THREAD_LOCAL int state_fd = -2;
+ THREAD_LOCAL int state_fd = STATE_FD_INIT;
THREAD_LOCAL FILE *state_f;
THREAD_LOCAL uint16_t clock_seq;
struct timeval tv;
uint64_t clock_reg;
- mode_t save_umask;
int ret = 0;
- if (state_fd == -1)
- ret = -1;
+ if (state_fd == STATE_FD_INIT)
+ state_fd = state_fd_init(LIBUUID_CLOCK_FILE, &state_f);
- if (state_fd == -2) {
- save_umask = umask(0);
- state_fd = open(LIBUUID_CLOCK_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0660);
- (void) umask(save_umask);
- if (state_fd != -1) {
- state_f = fdopen(state_fd, "r+" UL_CLOEXECSTR);
- if (!state_f) {
- close(state_fd);
- state_fd = -1;
- ret = -1;
- }
- }
- else
- ret = -1;
- }
if (state_fd >= 0) {
rewind(state_f);
while (flock(state_fd, LOCK_EX) < 0) {
@@ -256,11 +262,13 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
continue;
fclose(state_f);
close(state_fd);
- state_fd = -1;
+ state_fd = STATE_FD_ERROR;
ret = -1;
break;
}
- }
+ } else
+ ret = -1;
+
if (state_fd >= 0) {
unsigned int cl;
unsigned long tv1, tv2;
@@ -355,44 +363,94 @@ static uint64_t get_clock_counter(void)
/*
* Get continuous clock value.
*
- * Return -1 if there is no further clock counter available,
+ * Return -1 if there is no valid clock counter available,
* otherwise return 0.
*
* This implementation doesn't deliver clock counters based on
* the current time because last_clock_reg is only incremented
* by the number of requested UUIDs.
* max_clock_offset is used to limit the offset of last_clock_reg.
+ * used/reserved UUIDs are written to LIBUUID_CLOCK_CONT_FILE.
*/
static int get_clock_cont(uint32_t *clock_high,
uint32_t *clock_low,
int num,
uint32_t max_clock_offset)
{
- /* 100ns based time offset according to RFC 4122. 4.1.4. */
+ /* all 64bit clock_reg values in this function represent '100ns ticks'
+ * due to the combination of tv_usec + MAX_ADJUSTMENT */
+
+ /* time offset according to RFC 4122. 4.1.4. */
const uint64_t reg_offset = (((uint64_t) 0x01B21DD2) << 32) + 0x13814000;
static uint64_t last_clock_reg = 0;
- uint64_t clock_reg;
+ static uint64_t saved_clock_reg = 0;
+ static int state_fd = STATE_FD_INIT;
+ static FILE *state_f = NULL;
+ uint64_t clock_reg, next_clock_reg;
- if (last_clock_reg == 0)
- last_clock_reg = get_clock_counter();
+ if (state_fd == STATE_FD_ERROR)
+ return -1;
clock_reg = get_clock_counter();
+
+ if (state_fd == STATE_FD_INIT) {
+ struct stat st;
+
+ state_fd = state_fd_init(LIBUUID_CLOCK_CONT_FILE, &state_f);
+ if (state_fd == STATE_FD_ERROR)
+ return -1;
+
+ if (fstat(state_fd, &st))
+ goto error;
+
+ if (st.st_size) {
+ rewind(state_f);
+ if (fscanf(state_f, "cont: %lu\n", &last_clock_reg) != 1)
+ goto error;
+ } else
+ last_clock_reg = clock_reg;
+
+ saved_clock_reg = last_clock_reg;
+ }
+
if (max_clock_offset) {
- uint64_t clock_offset = max_clock_offset * 10000000ULL;
- if (last_clock_reg < (clock_reg - clock_offset))
- last_clock_reg = clock_reg - clock_offset;
+ uint64_t co = 10000000ULL * (uint64_t)max_clock_offset; // clock_offset in [100ns]
+
+ if ((last_clock_reg + co) < clock_reg)
+ last_clock_reg = clock_reg - co;
}
clock_reg += MAX_ADJUSTMENT;
- if ((last_clock_reg + num) >= clock_reg)
+ next_clock_reg = last_clock_reg + (uint64_t)num;
+ if (next_clock_reg >= clock_reg)
return -1;
+ if (next_clock_reg >= saved_clock_reg) {
+ uint64_t cl = next_clock_reg + 100000000ULL; // 10s interval in [100ns]
+ int l;
+
+ rewind(state_f);
+ l = fprintf(state_f, "cont: %020lu \n", cl);
+ if (l < 30 || fflush(state_f))
+ goto error;
+ saved_clock_reg = cl;
+ }
+
*clock_high = (last_clock_reg + reg_offset) >> 32;
*clock_low = last_clock_reg + reg_offset;
- last_clock_reg += num;
+ last_clock_reg = next_clock_reg;
return 0;
+
+error:
+ if (state_fd >= 0)
+ close(state_fd);
+ if (state_f)
+ fclose(state_f);
+ state_fd = STATE_FD_ERROR;
+ state_f = NULL;
+ return -1;
}
#if defined(HAVE_UUIDD) && defined(HAVE_SYS_UN_H)
diff --git a/libuuid/src/uuidP.h b/libuuid/src/uuidP.h
index 200702c1e..fef7e6cb5 100644
--- a/libuuid/src/uuidP.h
+++ b/libuuid/src/uuidP.h
@@ -40,6 +40,7 @@
#include "uuid.h"
#define LIBUUID_CLOCK_FILE "/var/lib/libuuid/clock.txt"
+#define LIBUUID_CLOCK_CONT_FILE "/var/lib/libuuid/clock-cont.txt"
/*
* Offset between 15-Oct-1582 and 1-Jan-70
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index fd121c5bc..42a252dd0 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -442,15 +442,6 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
pfd[POLLFD_SOCKET].fd = s;
pfd[POLLFD_SIGNAL].events = pfd[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP;
- num = 1;
- if (uuidd_cxt->cont_clock_offset) {
- /* trigger initialization */
- (void) __uuid_generate_time_cont(uu, &num, uuidd_cxt->cont_clock_offset);
- if (uuidd_cxt->debug)
- fprintf(stderr, _("max_clock_offset = %u sec\n"),
- uuidd_cxt->cont_clock_offset);
- }
-
while (1) {
ret = poll(pfd, ARRAY_SIZE(pfd),
uuidd_cxt->timeout ?
--
2.39.3 (Apple Git-145)
^ permalink raw reply related
* Re: [PATCH] uuidd: add cont_clock persistence
From: Trapp, Michael @ 2024-01-10 15:42 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux@vger.kernel.org
In-Reply-To: <20240104121230.3bi7nt52tb3fu6ww@ws.net.home>
Hi Karel,
> On 4. Jan 2024, at 13:12, Karel Zak <kzak@redhat.com> wrote:
>
> On Fri, Dec 15, 2023 at 11:18:29PM +0100, Michael Trapp wrote:
>> cont_clock requires a correct time setup and therefore it
>> must be possible to detect a step back between uuidd starts.
>> ...
>> + enum { fd_init = -2, fd_error = -1 };
>
> In the code (below) the enum items seems like variables, a little bit
> confusing. It would be better use upper-case, STATE_FD_INIT, STATE_FD_ERROR.
>> + static int state_fd = fd_init;
>> ...
>> + if (state_fd == fd_error)
Makes sense and will be fixed.
>> ...
>> + save_umask = umask(0);
>> + state_fd = open(LIBUUID_CLOCK_CONT_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0660);
>> + (void) umask(save_umask);
>> + if (state_fd == fd_error)
>> + return -1;
>> +
>> + state_f = fdopen(state_fd, "r+" UL_CLOEXECSTR);
>> + if (!state_f)
>> + goto error;
>
> Seems it duplicates code from get_clock(), what about introduce a generic
>
> state_fd_init(LIBUUID_CLOCK_CONT_FILE, &state_fd, &state_f);
>
> and use the same in get_clock() for LIBUUID_CLOCK_FILE?
That’s the case for the initialization with open()/fdopen().
I’ll move this into the new function state_fd_init().
>> + if (fstat(state_fd, &st))
>> + goto error;
>> +
>> + if (st.st_size) {
>> + rewind(state_f);
>> + if (fscanf(state_f, "cont: %lu\n", &last_clock_reg) != 1)
>> + goto error;
>> + } else
>> + last_clock_reg = clock_reg;
>
> For LIBUUID_CLOCK_FILE we use flock(), I guess it's unnecessary for
> LIBUUID_CLOCK_CONT_FILE as we assume only one uuidd instance, right?
That’s correct, based on the check in uuidd.c, there can't be multiple instances.
Michael
^ permalink raw reply
* New parts in stock/offering
From: Stanislav Kováč @ 2024-01-09 8:45 UTC (permalink / raw)
To: util-linux
Hi,
We are interested in collaborating with your company.
I am writing to you because we supply high-quality metal parts for sports cars to wholesalers and distribution networks worldwide, which could enrich your offerings.
Whether you need engine components, suspension systems, body modification kits, or interior enhancements, we offer a wide range of products that can meet your customers' needs.
Let us know if you're interested in additional profit while maintaining competitive prices and attractive margins.
Best regards
Stanislav Kováč
^ permalink raw reply
* Re: [PATCH] util-linux-demsg-issue-2666-patch-1.patch
From: Edward Chron @ 2024-01-08 14:07 UTC (permalink / raw)
To: Karel Zak; +Cc: Edward Chron, util-linux, colona
In-Reply-To: <CAFbqbibqO9wNc1JgaQ6FPTgoUP9u9J1wnTGxp+6W_QcAryLKAw@mail.gmail.com>
I've posted the revised patch series with the recommended fix.
Let me know if there is any additional work needed.
Thank you,
Edward
On Wed, Jan 3, 2024 at 6:51 AM Edward Chron <echron@gmail.com> wrote:
>
> Thank you Karel, I will fix this test issue and resubmit the patch series.
>
> On Tue, Jan 2, 2024 at 3:58 AM Karel Zak <kzak@redhat.com> wrote:
> >
> > On Sun, Dec 31, 2023 at 10:33:36AM -0800, Edward Chron wrote:
> > > + if (*rec->caller_id) {
> > > + if (ctl->json) {
> > > + ul_jsonwrt_value_s(&ctl->jfmt, "caller", rec->caller_id);
> > > + } else {
> > > + char cidbuf[PID_CHARS_MAX+3] = {'\0'};
> > > +
> > > + sprintf(cidbuf, "[%*s] ",
> > > + (char)ctl->caller_id_size, rec->caller_id);
> > > + ctl->indent += strnlen(cidbuf, sizeof(cidbuf));
> > > + fputs(cidbuf, stdout);
> > > + }
> > > + }
> >
> > The variable width (ctl->caller_id_size) of caller ID makes your
> > regression test fragile, see:
> >
> > https://github.com/util-linux/util-linux/actions/runs/7384780996/job/20088287790?pr=2647
> >
> > --- /home/runner/work/util-linux/util-linux/tests/expected/dmesg/cid-limit 2024-01-02 10:34:02.893193174 +0000
> > +++ /home/runner/work/util-linux/util-linux/tests/output/dmesg/cid-limit 2024-01-02 10:38:29.209015303 +0000
> > @@ -1,4 +1,4 @@
> > -[ 1.000000] [ T1] example[1]
> > -[ 8.000000] [ T2] example[2]
> > -[ 27.000000] [ T3] example[3]
> > -[ 64.000000] [ T4] example[4]
> > +[ 1.000000] [ T1] example[1]
> > +[ 8.000000] [ T2] example[2]
> > +[ 27.000000] [ T3] example[3]
> > +[ 64.000000] [ T4] example[4]
> >
> >
> > I see two possible ways to fix it:
> >
> > * "normalize" the output in the tests -- just use sed(1) to
> > remove all the blanks space "[ T4]" to "[T4]", so the output
> > will be always the same
> >
> > * or use fixed width for the caller_id in dmesg.c
> >
> >
> > Karel
> >
> > --
> > Karel Zak <kzak@redhat.com>
> > http://karelzak.blogspot.com
> >
^ permalink raw reply
* [PATCH] util-linux add dmesg caller_id Issue: 2666 patch 4 of 4
From: Edward Chron @ 2024-01-04 20:44 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
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
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Revision: no caller optional fields in any of the kmsg-input entries
Revision: retrofitted to apply on top of Issue: #2609 and Issue #2637
This is patch 2 of 2 (second in the series)
A second patch needed to hold 2nd binary file (git binary files issue)
This patch is needed because git format does not produce correct
output if two binary files are included in the same patch.
So adding the second binary file in a second patch to resolve the
issue.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
tests/ts/dmesg/kmsg-newlines | Bin 0 -> 182 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 tests/ts/dmesg/kmsg-newlines
diff --git a/tests/ts/dmesg/kmsg-newlines b/tests/ts/dmesg/kmsg-newlines
new file mode 100644
index 0000000000000000000000000000000000000000..a1f96c562ec4da27e24117908a7a1e78f10f9f97
GIT binary patch
literal 182
zcmZ9GQ3`-C3`6(bQ+R*~-JJO0c`6EOVNL{3?>7CJf##!mg!EuoE<!u5%P!3=LCM(k
zhpQ9ag)&0MF&uoI#!D$*CJr(kqr>n+<{(0`_@?1)ORQ&j*x!yx&p^cr8s&&zH$C?_
BGAjT8
literal 0
HcmV?d00001
--
2.43.0
^ permalink raw reply
* [PATCH] util-linux add dmesg caller_id Issue: 2666 patch 3 of 4
From: Edward Chron @ 2024-01-04 20:44 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
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
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Revision: no caller optional fields in any of the kmsg-input entries
Revision: retrofitted to apply on top of Issue: #2609 and Issue #2637
This is patch 1 of 2 (first in the series)
Second patch needed to hold second binary file (git binary files issue)
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.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
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-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
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 : ^[[32m[ 0.000000] ^[[0mLinux 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^[[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^[[1m^[[31mBIOS-provided physical RAM map:^[[0m
+kern :err : ^[[32m[ 0.000003] ^[[0m^[[33mBIOS-e820: ^[[0m^[[31m[mem 0x0000000000000000-0x000000000009efff] usable^[[0m
+kern :warn : ^[[32m[ 0.000004] ^[[0m^[[33mBIOS-e820: ^[[0m^[[1m[mem 0x000000000009f000-0x00000000000bffff] reserved^[[0m
+kern :notice: ^[[32m[ 0.000005] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000000100000-0x0000000009afffff] usable
+kern :info : ^[[32m[ 0.000006] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009b00000-0x0000000009dfffff] reserved
+kern :debug : ^[[32m[ 0.000007] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009e00000-0x0000000009efffff] usable
+kern :info : ^[[32m[ 0.000008] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+kern :info : ^[[32m[ 0.000009] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009f3c000-0x000000004235ffff] usable
+kern :info : ^[[32m[ 0.000010] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000042360000-0x000000004455ffff] reserved
+kern :info : ^[[32m[ 0.201607] ^[[0m^[[33msmp: ^[[0mBringing up secondary CPUs ...
+kern :info : ^[[32m[ 0.201607] ^[[0m^[[33msmpboot: ^[[0mx86: Booting SMP configuration:
+kern :warn : ^[[32m[ 0.209670] ^[[0m^[[1m #1 #3 #5 #7^[[0m
+kern :info : ^[[32m[ 0.212630] ^[[0m^[[33msmp: ^[[0mBrought up 1 node, 16 CPUs
+kern :notice: ^[[32m[ 0.215936] ^[[0m^[[33maudit: ^[[0mtype=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+kern :info : ^[[32m[ 0.215937] ^[[0m^[[33mthermal_sys: ^[[0mRegistered thermal governor 'fair_share'
+kern :warn : ^[[32m[ 0.215966] ^[[0m^[[33mENERGY_PERF_BIAS: ^[[0m^[[1mSet to 'normal', was 'performance'^[[0m
+kern :info : ^[[32m[ 0.367657] ^[[0m^[[33mACPI: ^[[0m\_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+kern :info : ^[[32m[ 0.368615] ^[[0m^[[33mACPI: ^[[0m\_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+kern :info : ^[[32m[ 0.376316] ^[[0m^[[33mACPI: ^[[0m\_SB_.PRWL: New power resource
+kern :info : ^[[32m[ 0.376343] ^[[0m^[[33mACPI: ^[[0m\_SB_.PRWB: New power resource
+kern :info : ^[[32m[ 0.377373] ^[[0m^[[33mACPI: ^[[0mPCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+kern :info : ^[[32m[ 0.377378] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+kern :info : ^[[32m[ 0.377569] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: platform does not support [SHPCHotplug AER]
+kern :info : ^[[32m[ 0.377933] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+kern :info : ^[[32m[ 0.378458] ^[[0mPCI host bridge to bus 0000:00
+kern :info : ^[[32m[ 0.378459] ^[[0m^[[33mpci_bus 0000:00: ^[[0mroot bus resource [io 0x0000-0x0cf7 window]
+kern :info : ^[[32m[ 0.378461] ^[[0m^[[33mpci_bus 0000:00: ^[[0mroot bus resource [io 0x0d00-0xffff window]
+user :notice: ^[[32m[ 9.398562] ^[[0muser network daemon initialization complete
+daemon:info : ^[[32m[ 10.441520] ^[[0m^[[33msystemd[1]: ^[[0msystemd 254.7-1.fc39 running in system mode
+daemon:info : ^[[32m[ 11.441524] ^[[0m^[[33msystemd[1]: ^[[0mDetected architecture x86-64.
+daemon:info : ^[[32m[ 12.441525] ^[[0m^[[33msystemd[1]: ^[[0mRunning in initrd.
+daemon:info : ^[[32m[ 13.541598] ^[[0m^[[33msystemd[1]: ^[[0mHostname set to <catalina>.
+kern :info : ^[[32m[ 15.641860] ^[[0m^[[33musb 3-3: ^[[0mNew USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+kern :err : ^[[32m[ 16.690000] ^[[0m^[[33mSerial bus multi instantiate pseudo device driver INT3515:00: ^[[0m^[[31merror -ENXIO: IRQ index 1 not found.^[[0m
+kern :err : ^[[32m[ 17.710000] ^[[0m^[[33msnd_hda_intel 0000:00:1f.3: ^[[0m^[[31mCORB reset timeout#2, CORBRP = 65535^[[0m
+syslog:info : ^[[32m[ 18.820000] ^[[0m^[[33msystemd-journald[723]: ^[[0mReceived client request to flush runtime journal.
+syslog:warn : ^[[32m[ 20.840000] ^[[0m^[[33msystemd-journald[723]: ^[[0m^[[1mFile /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.^[[0m
+syslog:info : ^[[32m[ 21.852348] ^[[0m^[[33msystemd-journald[723]: ^[[0m/var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+kern :warn : ^[[32m[ 24.871100] ^[[0m^[[33mPEFILE: ^[[0m^[[1mUnsigned PE binary^[[0m
+kern :err : ^[[32m[ 33.918091] ^[[0m^[[33msnd_hda_intel 0000:00:1f.3: ^[[0m^[[31mCORB reset timeout#2, CORBRP = 65535^[[0m
+kern :info : ^[[32m[ 144.931785] ^[[0m^[[33musb 3-3.1: ^[[0mdevice firmware changed
+kern :info : ^[[32m[ 145.953248] ^[[0m^[[33musb 3-3.1: ^[[0mUSB disconnect, device number 44
+kern :info : ^[[32m[ 147.981859] ^[[0m^[[33musb 3-3.1: ^[[0mNew 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-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
^ permalink raw reply related
* [PATCH] util-linux add dmesg caller_id Issue: 2666 patch 2 of 4
From: Edward Chron @ 2024-01-04 20:44 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
Submission to Project: util-linux
Open Incident: #2637 at github.com/util-linux/util-linux/issues/2637
Component: util-linux/sys-utils
Files: tests/ts/dmesg syslog interface caller-id files, tests
and related expected files
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Retro-fitted to merge on top of the patch for Issue: #2609
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.
Currently, dmesg only has standard syslog interface tests even though
dmesg -S the syslog interface supports the caller_id field. There
are no syslog caller-id tests.
We would like syslog caller-id tests both to validate that the dmesg
code works correctly with the caller-id field being present and also
to compare against the addition of dmesg kmsg caller_id support added
by Issue #2609.
These tests are for the dmesg syslog interface with caller-id follow the
existing test structure for dmesg tests. The existing dmesg -F interface
is used to input our test files.
Until Thomas added a dmesg kmsg interface for json format testing
there were no dmesg tests except the tests for the generic dmesg
syslog tests. So we're naming the syslog caller-id tests to follow
the test naming convention that Thomas introduced.
For caller_id tests we prefix the test name with cid- abbreviating
the caller_id name to keep the names short. There is no unqiue
indentifier for syslog tests, so syslog tests are currently:
colors, console-levels, decode, delta, facilities, indentation,
limit, json
The cid versions of these test files are just prefixed with cid-
The patch for Issue: #2609 has the files:
cid-input and cid-json and the expected file for cide-json
Additional new dmesg tests are found with Issue #2663 which add
standard dmesg kmsg interface tests providing equivalent tests to
the existing dmesg syslog interface tests.
Also, Issue #2609 introduces dmesg kmsg interface caller-id tests
equivalent to the dmesg syslog interface with caller-id tests introduced
here along with the necessary dmesg kmsg interface caller-id support
needed to accomodate the PRINTK_CALLER id field.
Just for reference, on a Linux system with the CONFIG_PRINTK_CALLER
configuration option set the output from dmesg -S looks like:
[ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
on a system where the PRINTK_CALLER configuration option is not set the
output looks like:
[ 520.899558] hub 3-3:1.0: USB hub found
the additional field specifies either a Thread Id or CPU id depending on
the context of the task or thread at the time the printk that added the
message to the kernel ring buffer was executed.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
tests/expected/dmesg/cid-colors | 106 ++++++++++
tests/expected/dmesg/cid-console-levels | 253 ++++++++++++++++++++++++
tests/expected/dmesg/cid-decode | 106 ++++++++++
tests/expected/dmesg/cid-delta | 106 ++++++++++
tests/expected/dmesg/cid-facilities | 104 ++++++++++
tests/expected/dmesg/cid-indentation | 35 ++++
tests/expected/dmesg/cid-limit | 4 +
tests/ts/dmesg/cid-colors | 29 +++
tests/ts/dmesg/cid-console-levels | 36 ++++
tests/ts/dmesg/cid-decode | 28 +++
tests/ts/dmesg/cid-delta | 27 +++
tests/ts/dmesg/cid-facilities | 30 +++
tests/ts/dmesg/cid-indentation | 40 ++++
tests/ts/dmesg/cid-limit | 29 +++
tests/ts/dmesg/cid-newlines | 5 +
15 files changed, 938 insertions(+)
create mode 100644 tests/expected/dmesg/cid-colors
create mode 100644 tests/expected/dmesg/cid-console-levels
create mode 100644 tests/expected/dmesg/cid-decode
create mode 100644 tests/expected/dmesg/cid-delta
create mode 100644 tests/expected/dmesg/cid-facilities
create mode 100644 tests/expected/dmesg/cid-indentation
create mode 100644 tests/expected/dmesg/cid-limit
create mode 100755 tests/ts/dmesg/cid-colors
create mode 100755 tests/ts/dmesg/cid-console-levels
create mode 100755 tests/ts/dmesg/cid-decode
create mode 100755 tests/ts/dmesg/cid-delta
create mode 100755 tests/ts/dmesg/cid-facilities
create mode 100755 tests/ts/dmesg/cid-indentation
create mode 100755 tests/ts/dmesg/cid-limit
create mode 100644 tests/ts/dmesg/cid-newlines
diff --git a/tests/expected/dmesg/cid-colors b/tests/expected/dmesg/cid-colors
new file mode 100644
index 000000000..3b7aff6d7
--- /dev/null
+++ b/tests/expected/dmesg/cid-colors
@@ -0,0 +1,106 @@
+kern :emerg : ^[[32m[ 0.000000] ^[[0m[ T0] example[0]
+kern :alert : ^[[32m[ 1.000000] ^[[0m[ T1] ^[[7m^[[31mexample[1]^[[0m
+kern :crit : ^[[32m[ 8.000000] ^[[0m[ T2] ^[[1m^[[31mexample[2]^[[0m
+kern :err : ^[[32m[ 27.000000] ^[[0m[ T3] ^[[31mexample[3]^[[0m
+kern :warn : ^[[32m[ 64.000000] ^[[0m[ T4] ^[[1mexample[4]^[[0m
+kern :notice: ^[[32m[ 125.000000] ^[[0m[ T5] example[5]
+kern :info : ^[[32m[ 216.000000] ^[[0m[ T6] example[6]
+kern :debug : ^[[32m[ 343.000000] ^[[0m[ T7] example[7]
+user :emerg : ^[[32m[ 512.000000] ^[[0m[ T8] example[8]
+user :alert : ^[[32m[ 729.000000] ^[[0m[ T9] ^[[7m^[[31mexample[9]^[[0m
+user :crit : ^[[32m[ 1000.000000] ^[[0m[ T10] ^[[1m^[[31mexample[10]^[[0m
+user :err : ^[[32m[ 1331.000000] ^[[0m[ T11] ^[[31mexample[11]^[[0m
+user :warn : ^[[32m[ 1728.000000] ^[[0m[ T12] ^[[1mexample[12]^[[0m
+user :notice: ^[[32m[ 2197.000000] ^[[0m[ T13] example[13]
+user :info : ^[[32m[ 2744.000000] ^[[0m[ T14] example[14]
+user :debug : ^[[32m[ 3375.000000] ^[[0m[ T15] example[15]
+mail :emerg : ^[[32m[ 4096.000000] ^[[0m[ T16] example[16]
+mail :alert : ^[[32m[ 4913.000000] ^[[0m[ T17] ^[[7m^[[31mexample[17]^[[0m
+mail :crit : ^[[32m[ 5832.000000] ^[[0m[ T18] ^[[1m^[[31mexample[18]^[[0m
+mail :err : ^[[32m[ 6859.000000] ^[[0m[ T19] ^[[31mexample[19]^[[0m
+mail :warn : ^[[32m[ 8000.000000] ^[[0m[ T20] ^[[1mexample[20]^[[0m
+mail :notice: ^[[32m[ 9261.000000] ^[[0m[ T21] example[21]
+mail :info : ^[[32m[10648.000000] ^[[0m[ T22] example[22]
+mail :debug : ^[[32m[12167.000000] ^[[0m[ T23] example[23]
+daemon:emerg : ^[[32m[13824.000000] ^[[0m[ T24] example[24]
+daemon:alert : ^[[32m[15625.000000] ^[[0m[ T25] ^[[7m^[[31mexample[25]^[[0m
+daemon:crit : ^[[32m[17576.000000] ^[[0m[ T26] ^[[1m^[[31mexample[26]^[[0m
+daemon:err : ^[[32m[19683.000000] ^[[0m[ T27] ^[[31mexample[27]^[[0m
+daemon:warn : ^[[32m[21952.000000] ^[[0m[ T28] ^[[1mexample[28]^[[0m
+daemon:notice: ^[[32m[24389.000000] ^[[0m[ T29] example[29]
+daemon:info : ^[[32m[27000.000000] ^[[0m[ T10] example[30]
+daemon:debug : ^[[32m[29791.000000] ^[[0m[ T31] example[31]
+auth :emerg : ^[[32m[32768.000000] ^[[0m[ T32] example[32]
+auth :alert : ^[[32m[35937.000000] ^[[0m[ T33] ^[[7m^[[31mexample[33]^[[0m
+auth :crit : ^[[32m[39304.000000] ^[[0m[ T34] ^[[1m^[[31mexample[34]^[[0m
+auth :err : ^[[32m[42875.000000] ^[[0m[ T35] ^[[31mexample[35]^[[0m
+auth :warn : ^[[32m[46656.000000] ^[[0m[ T36] ^[[1mexample[36]^[[0m
+auth :notice: ^[[32m[50653.000000] ^[[0m[ T37] example[37]
+auth :info : ^[[32m[54872.000000] ^[[0m[ T38] example[38]
+auth :debug : ^[[32m[59319.000000] ^[[0m[ T39] example[39]
+syslog:emerg : ^[[32m[64000.000000] ^[[0m[ T40] example[40]
+syslog:alert : ^[[32m[68921.000000] ^[[0m[ T41] ^[[7m^[[31mexample[41]^[[0m
+syslog:crit : ^[[32m[74088.000000] ^[[0m[ T42] ^[[1m^[[31mexample[42]^[[0m
+syslog:err : ^[[32m[79507.000000] ^[[0m[ T43] ^[[31mexample[43]^[[0m
+syslog:warn : ^[[32m[85184.000000] ^[[0m[ T44] ^[[1mexample[44]^[[0m
+syslog:notice: ^[[32m[91125.000000] ^[[0m[ T45] example[45]
+syslog:info : ^[[32m[97336.000000] ^[[0m[ T46] example[46]
+syslog:debug : ^[[32m[103823.000000] ^[[0m[ T47] example[47]
+lpr :emerg : ^[[32m[110592.000000] ^[[0m[ T48] example[48]
+lpr :alert : ^[[32m[117649.000000] ^[[0m[ T49] ^[[7m^[[31mexample[49]^[[0m
+lpr :crit : ^[[32m[125000.000000] ^[[0m[ T50] ^[[1m^[[31mexample[50]^[[0m
+lpr :err : ^[[32m[132651.000000] ^[[0m[ T51] ^[[31mexample[51]^[[0m
+lpr :warn : ^[[32m[140608.000000] ^[[0m[ T52] ^[[1mexample[52]^[[0m
+lpr :notice: ^[[32m[148877.000000] ^[[0m[ T53] example[53]
+lpr :info : ^[[32m[157464.000000] ^[[0m[ T54] example[54]
+lpr :debug : ^[[32m[166375.000000] ^[[0m[ T55] example[55]
+news :emerg : ^[[32m[175616.000000] ^[[0m[ T56] example[56]
+news :alert : ^[[32m[185193.000000] ^[[0m[ T57] ^[[7m^[[31mexample[57]^[[0m
+news :crit : ^[[32m[195112.000000] ^[[0m[ T58] ^[[1m^[[31mexample[58]^[[0m
+news :err : ^[[32m[205379.000000] ^[[0m[ T59] ^[[31mexample[59]^[[0m
+news :warn : ^[[32m[216000.000000] ^[[0m[ T60] ^[[1mexample[60]^[[0m
+news :notice: ^[[32m[226981.000000] ^[[0m[ T61] example[61]
+news :info : ^[[32m[238328.000000] ^[[0m[ T62] example[62]
+news :debug : ^[[32m[250047.000000] ^[[0m[ T63] example[63]
+uucp :emerg : ^[[32m[262144.000000] ^[[0m[ T64] example[64]
+uucp :alert : ^[[32m[274625.000000] ^[[0m[ T65] ^[[7m^[[31mexample[65]^[[0m
+uucp :crit : ^[[32m[287496.000000] ^[[0m[ T66] ^[[1m^[[31mexample[66]^[[0m
+uucp :err : ^[[32m[300763.000000] ^[[0m[ T67] ^[[31mexample[67]^[[0m
+uucp :warn : ^[[32m[314432.000000] ^[[0m[ T68] ^[[1mexample[68]^[[0m
+uucp :notice: ^[[32m[328509.000000] ^[[0m[ T69] example[69]
+uucp :info : ^[[32m[343000.000000] ^[[0m[ T70] example[70]
+uucp :debug : ^[[32m[357911.000000] ^[[0m[ T71] example[71]
+cron :emerg : ^[[32m[373248.000000] ^[[0m[ T72] example[72]
+cron :alert : ^[[32m[389017.000000] ^[[0m[ T73] ^[[7m^[[31mexample[73]^[[0m
+cron :crit : ^[[32m[405224.000000] ^[[0m[ T74] ^[[1m^[[31mexample[74]^[[0m
+cron :err : ^[[32m[421875.000000] ^[[0m[ T75] ^[[31mexample[75]^[[0m
+cron :warn : ^[[32m[438976.000000] ^[[0m[ T76] ^[[1mexample[76]^[[0m
+cron :notice: ^[[32m[456533.000000] ^[[0m[ T77] example[77]
+cron :info : ^[[32m[474552.000000] ^[[0m[ T78] example[78]
+cron :debug : ^[[32m[493039.000000] ^[[0m[ T79] example[79]
+authpriv:emerg : ^[[32m[512000.000000] ^[[0m[ T80] example[80]
+authpriv:alert : ^[[32m[531441.000000] ^[[0m[ T81] ^[[7m^[[31mexample[81]^[[0m
+authpriv:crit : ^[[32m[551368.000000] ^[[0m[ T82] ^[[1m^[[31mexample[82]^[[0m
+authpriv:err : ^[[32m[571787.000000] ^[[0m[ T83] ^[[31mexample[83]^[[0m
+authpriv:warn : ^[[32m[592704.000000] ^[[0m[ T84] ^[[1mexample[84]^[[0m
+authpriv:notice: ^[[32m[614125.000000] ^[[0m[ T85] example[85]
+authpriv:info : ^[[32m[636056.000000] ^[[0m[ T86] example[86]
+authpriv:debug : ^[[32m[658503.000000] ^[[0m[ T87] example[87]
+ftp :emerg : ^[[32m[681472.000000] ^[[0m[ T88] example[88]
+ftp :alert : ^[[32m[704969.000000] ^[[0m[ T89] ^[[7m^[[31mexample[89]^[[0m
+ftp :crit : ^[[32m[729000.000000] ^[[0m[ T90] ^[[1m^[[31mexample[90]^[[0m
+ftp :err : ^[[32m[753571.000000] ^[[0m[ T91] ^[[31mexample[91]^[[0m
+ftp :warn : ^[[32m[778688.000000] ^[[0m[ T92] ^[[1mexample[92]^[[0m
+ftp :notice: ^[[32m[804357.000000] ^[[0m[ T93] example[93]
+ftp :info : ^[[32m[830584.000000] ^[[0m[ T94] example[94]
+ftp :debug : ^[[32m[857375.000000] ^[[0m[ T95] example[95]
+res0 :emerg : ^[[32m[884736.000000] ^[[0m[ T96] example[96]
+res0 :alert : ^[[32m[912673.000000] ^[[0m[ T97] ^[[7m^[[31mexample[97]^[[0m
+res0 :crit : ^[[32m[941192.000000] ^[[0m[ T98] ^[[1m^[[31mexample[98]^[[0m
+res0 :err : ^[[32m[970299.000000] ^[[0m[ T99] ^[[31mexample[99]^[[0m
+res0 :warn : ^[[32m[1000000.000000] ^[[0m[ T100] ^[[1mexample[100]^[[0m
+res0 :notice: ^[[32m[1030301.000000] ^[[0m[ T101] example[101]
+res0 :info : ^[[32m[1061208.000000] ^[[0m[ T102] example[102]
+res0 :debug : ^[[32m[1092727.000000] ^[[0m[ T103] example[103]
+res1 :emerg : ^[[32m[1124864.000000] ^[[0m[ T104] example[104]
+local2:info : ^[[32m[4557523.000000] ^[[0m[ T105] example[105]
diff --git a/tests/expected/dmesg/cid-console-levels b/tests/expected/dmesg/cid-console-levels
new file mode 100644
index 000000000..9fe993b20
--- /dev/null
+++ b/tests/expected/dmesg/cid-console-levels
@@ -0,0 +1,253 @@
+[ 0.000000] [ T0] example[0]
+[ 512.000000] [ T8] example[8]
+[ 4096.000000] [ T16] example[16]
+[13824.000000] [ T24] example[24]
+[32768.000000] [ T32] example[32]
+[64000.000000] [ T40] example[40]
+[110592.000000] [ T48] example[48]
+[175616.000000] [ T56] example[56]
+[262144.000000] [ T64] example[64]
+[373248.000000] [ T72] example[72]
+[512000.000000] [ T80] example[80]
+[681472.000000] [ T88] example[88]
+[884736.000000] [ T96] example[96]
+[1124864.000000] [ T104] example[104]
+[ 1.000000] [ T1] example[1]
+[ 729.000000] [ T9] example[9]
+[ 4913.000000] [ T17] example[17]
+[15625.000000] [ T25] example[25]
+[35937.000000] [ T33] example[33]
+[68921.000000] [ T41] example[41]
+[117649.000000] [ T49] example[49]
+[185193.000000] [ T57] example[57]
+[274625.000000] [ T65] example[65]
+[389017.000000] [ T73] example[73]
+[531441.000000] [ T81] example[81]
+[704969.000000] [ T89] example[89]
+[912673.000000] [ T97] example[97]
+[ 8.000000] [ T2] example[2]
+[ 1000.000000] [ T10] example[10]
+[ 5832.000000] [ T18] example[18]
+[17576.000000] [ T26] example[26]
+[39304.000000] [ T34] example[34]
+[74088.000000] [ T42] example[42]
+[125000.000000] [ T50] example[50]
+[195112.000000] [ T58] example[58]
+[287496.000000] [ T66] example[66]
+[405224.000000] [ T74] example[74]
+[551368.000000] [ T82] example[82]
+[729000.000000] [ T90] example[90]
+[941192.000000] [ T98] example[98]
+[ 27.000000] [ T3] example[3]
+[ 1331.000000] [ T11] example[11]
+[ 6859.000000] [ T19] example[19]
+[19683.000000] [ T27] example[27]
+[42875.000000] [ T35] example[35]
+[79507.000000] [ T43] example[43]
+[132651.000000] [ T51] example[51]
+[205379.000000] [ T59] example[59]
+[300763.000000] [ T67] example[67]
+[421875.000000] [ T75] example[75]
+[571787.000000] [ T83] example[83]
+[753571.000000] [ T91] example[91]
+[970299.000000] [ T99] example[99]
+[ 64.000000] [ T4] example[4]
+[ 1728.000000] [ T12] example[12]
+[ 8000.000000] [ T20] example[20]
+[21952.000000] [ T28] example[28]
+[46656.000000] [ T36] example[36]
+[85184.000000] [ T44] example[44]
+[140608.000000] [ T52] example[52]
+[216000.000000] [ T60] example[60]
+[314432.000000] [ T68] example[68]
+[438976.000000] [ T76] example[76]
+[592704.000000] [ T84] example[84]
+[778688.000000] [ T92] example[92]
+[1000000.000000] [ T100] example[100]
+[ 125.000000] [ T5] example[5]
+[ 2197.000000] [ T13] example[13]
+[ 9261.000000] [ T21] example[21]
+[24389.000000] [ T29] example[29]
+[50653.000000] [ T37] example[37]
+[91125.000000] [ T45] example[45]
+[148877.000000] [ T53] example[53]
+[226981.000000] [ T61] example[61]
+[328509.000000] [ T69] example[69]
+[456533.000000] [ T77] example[77]
+[614125.000000] [ T85] example[85]
+[804357.000000] [ T93] example[93]
+[1030301.000000] [ T101] example[101]
+[ 216.000000] [ T6] example[6]
+[ 2744.000000] [ T14] example[14]
+[10648.000000] [ T22] example[22]
+[27000.000000] [ T10] example[30]
+[54872.000000] [ T38] example[38]
+[97336.000000] [ T46] example[46]
+[157464.000000] [ T54] example[54]
+[238328.000000] [ T62] example[62]
+[343000.000000] [ T70] example[70]
+[474552.000000] [ T78] example[78]
+[636056.000000] [ T86] example[86]
+[830584.000000] [ T94] example[94]
+[1061208.000000] [ T102] example[102]
+[4557523.000000] [ T105] example[105]
+[ 343.000000] [ T7] example[7]
+[ 3375.000000] [ T15] example[15]
+[12167.000000] [ T23] example[23]
+[29791.000000] [ T31] example[31]
+[59319.000000] [ T39] example[39]
+[103823.000000] [ T47] example[47]
+[166375.000000] [ T55] example[55]
+[250047.000000] [ T63] example[63]
+[357911.000000] [ T71] example[71]
+[493039.000000] [ T79] example[79]
+[658503.000000] [ T87] example[87]
+[857375.000000] [ T95] example[95]
+[1092727.000000] [ T103] example[103]
+[ 0.000000] [ T0] example[0]
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 512.000000] [ T8] example[8]
+[ 729.000000] [ T9] example[9]
+[ 1000.000000] [ T10] example[10]
+[ 1331.000000] [ T11] example[11]
+[ 4096.000000] [ T16] example[16]
+[ 4913.000000] [ T17] example[17]
+[ 5832.000000] [ T18] example[18]
+[ 6859.000000] [ T19] example[19]
+[13824.000000] [ T24] example[24]
+[15625.000000] [ T25] example[25]
+[17576.000000] [ T26] example[26]
+[19683.000000] [ T27] example[27]
+[32768.000000] [ T32] example[32]
+[35937.000000] [ T33] example[33]
+[39304.000000] [ T34] example[34]
+[42875.000000] [ T35] example[35]
+[64000.000000] [ T40] example[40]
+[68921.000000] [ T41] example[41]
+[74088.000000] [ T42] example[42]
+[79507.000000] [ T43] example[43]
+[110592.000000] [ T48] example[48]
+[117649.000000] [ T49] example[49]
+[125000.000000] [ T50] example[50]
+[132651.000000] [ T51] example[51]
+[175616.000000] [ T56] example[56]
+[185193.000000] [ T57] example[57]
+[195112.000000] [ T58] example[58]
+[205379.000000] [ T59] example[59]
+[262144.000000] [ T64] example[64]
+[274625.000000] [ T65] example[65]
+[287496.000000] [ T66] example[66]
+[300763.000000] [ T67] example[67]
+[373248.000000] [ T72] example[72]
+[389017.000000] [ T73] example[73]
+[405224.000000] [ T74] example[74]
+[421875.000000] [ T75] example[75]
+[512000.000000] [ T80] example[80]
+[531441.000000] [ T81] example[81]
+[551368.000000] [ T82] example[82]
+[571787.000000] [ T83] example[83]
+[681472.000000] [ T88] example[88]
+[704969.000000] [ T89] example[89]
+[729000.000000] [ T90] example[90]
+[753571.000000] [ T91] example[91]
+[884736.000000] [ T96] example[96]
+[912673.000000] [ T97] example[97]
+[941192.000000] [ T98] example[98]
+[970299.000000] [ T99] example[99]
+[1124864.000000] [ T104] example[104]
+[ 0.000000] [ T0] example[0]
+[ 512.000000] [ T8] example[8]
+[ 4096.000000] [ T16] example[16]
+[13824.000000] [ T24] example[24]
+[32768.000000] [ T32] example[32]
+[64000.000000] [ T40] example[40]
+[110592.000000] [ T48] example[48]
+[175616.000000] [ T56] example[56]
+[262144.000000] [ T64] example[64]
+[373248.000000] [ T72] example[72]
+[512000.000000] [ T80] example[80]
+[681472.000000] [ T88] example[88]
+[884736.000000] [ T96] example[96]
+[1124864.000000] [ T104] example[104]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
+[ 125.000000] [ T5] example[5]
+[ 216.000000] [ T6] example[6]
+[ 343.000000] [ T7] example[7]
+[ 1331.000000] [ T11] example[11]
+[ 1728.000000] [ T12] example[12]
+[ 2197.000000] [ T13] example[13]
+[ 2744.000000] [ T14] example[14]
+[ 3375.000000] [ T15] example[15]
+[ 6859.000000] [ T19] example[19]
+[ 8000.000000] [ T20] example[20]
+[ 9261.000000] [ T21] example[21]
+[10648.000000] [ T22] example[22]
+[12167.000000] [ T23] example[23]
+[19683.000000] [ T27] example[27]
+[21952.000000] [ T28] example[28]
+[24389.000000] [ T29] example[29]
+[27000.000000] [ T10] example[30]
+[29791.000000] [ T31] example[31]
+[42875.000000] [ T35] example[35]
+[46656.000000] [ T36] example[36]
+[50653.000000] [ T37] example[37]
+[54872.000000] [ T38] example[38]
+[59319.000000] [ T39] example[39]
+[79507.000000] [ T43] example[43]
+[85184.000000] [ T44] example[44]
+[91125.000000] [ T45] example[45]
+[97336.000000] [ T46] example[46]
+[103823.000000] [ T47] example[47]
+[132651.000000] [ T51] example[51]
+[140608.000000] [ T52] example[52]
+[148877.000000] [ T53] example[53]
+[157464.000000] [ T54] example[54]
+[166375.000000] [ T55] example[55]
+[205379.000000] [ T59] example[59]
+[216000.000000] [ T60] example[60]
+[226981.000000] [ T61] example[61]
+[238328.000000] [ T62] example[62]
+[250047.000000] [ T63] example[63]
+[300763.000000] [ T67] example[67]
+[314432.000000] [ T68] example[68]
+[328509.000000] [ T69] example[69]
+[343000.000000] [ T70] example[70]
+[357911.000000] [ T71] example[71]
+[421875.000000] [ T75] example[75]
+[438976.000000] [ T76] example[76]
+[456533.000000] [ T77] example[77]
+[474552.000000] [ T78] example[78]
+[493039.000000] [ T79] example[79]
+[571787.000000] [ T83] example[83]
+[592704.000000] [ T84] example[84]
+[614125.000000] [ T85] example[85]
+[636056.000000] [ T86] example[86]
+[658503.000000] [ T87] example[87]
+[753571.000000] [ T91] example[91]
+[778688.000000] [ T92] example[92]
+[804357.000000] [ T93] example[93]
+[830584.000000] [ T94] example[94]
+[857375.000000] [ T95] example[95]
+[970299.000000] [ T99] example[99]
+[1000000.000000] [ T100] example[100]
+[1030301.000000] [ T101] example[101]
+[1061208.000000] [ T102] example[102]
+[1092727.000000] [ T103] example[103]
+[4557523.000000] [ T105] example[105]
+[ 343.000000] [ T7] example[7]
+[ 3375.000000] [ T15] example[15]
+[12167.000000] [ T23] example[23]
+[29791.000000] [ T31] example[31]
+[59319.000000] [ T39] example[39]
+[103823.000000] [ T47] example[47]
+[166375.000000] [ T55] example[55]
+[250047.000000] [ T63] example[63]
+[357911.000000] [ T71] example[71]
+[493039.000000] [ T79] example[79]
+[658503.000000] [ T87] example[87]
+[857375.000000] [ T95] example[95]
+[1092727.000000] [ T103] example[103]
+test_dmesg: unknown level '+'
diff --git a/tests/expected/dmesg/cid-decode b/tests/expected/dmesg/cid-decode
new file mode 100644
index 000000000..757b9284d
--- /dev/null
+++ b/tests/expected/dmesg/cid-decode
@@ -0,0 +1,106 @@
+kern :emerg : [ 0.000000] [ T0] example[0]
+kern :alert : [ 1.000000] [ T1] example[1]
+kern :crit : [ 8.000000] [ T2] example[2]
+kern :err : [ 27.000000] [ T3] example[3]
+kern :warn : [ 64.000000] [ T4] example[4]
+kern :notice: [ 125.000000] [ T5] example[5]
+kern :info : [ 216.000000] [ T6] example[6]
+kern :debug : [ 343.000000] [ T7] example[7]
+user :emerg : [ 512.000000] [ T8] example[8]
+user :alert : [ 729.000000] [ T9] example[9]
+user :crit : [ 1000.000000] [ T10] example[10]
+user :err : [ 1331.000000] [ T11] example[11]
+user :warn : [ 1728.000000] [ T12] example[12]
+user :notice: [ 2197.000000] [ T13] example[13]
+user :info : [ 2744.000000] [ T14] example[14]
+user :debug : [ 3375.000000] [ T15] example[15]
+mail :emerg : [ 4096.000000] [ T16] example[16]
+mail :alert : [ 4913.000000] [ T17] example[17]
+mail :crit : [ 5832.000000] [ T18] example[18]
+mail :err : [ 6859.000000] [ T19] example[19]
+mail :warn : [ 8000.000000] [ T20] example[20]
+mail :notice: [ 9261.000000] [ T21] example[21]
+mail :info : [10648.000000] [ T22] example[22]
+mail :debug : [12167.000000] [ T23] example[23]
+daemon:emerg : [13824.000000] [ T24] example[24]
+daemon:alert : [15625.000000] [ T25] example[25]
+daemon:crit : [17576.000000] [ T26] example[26]
+daemon:err : [19683.000000] [ T27] example[27]
+daemon:warn : [21952.000000] [ T28] example[28]
+daemon:notice: [24389.000000] [ T29] example[29]
+daemon:info : [27000.000000] [ T10] example[30]
+daemon:debug : [29791.000000] [ T31] example[31]
+auth :emerg : [32768.000000] [ T32] example[32]
+auth :alert : [35937.000000] [ T33] example[33]
+auth :crit : [39304.000000] [ T34] example[34]
+auth :err : [42875.000000] [ T35] example[35]
+auth :warn : [46656.000000] [ T36] example[36]
+auth :notice: [50653.000000] [ T37] example[37]
+auth :info : [54872.000000] [ T38] example[38]
+auth :debug : [59319.000000] [ T39] example[39]
+syslog:emerg : [64000.000000] [ T40] example[40]
+syslog:alert : [68921.000000] [ T41] example[41]
+syslog:crit : [74088.000000] [ T42] example[42]
+syslog:err : [79507.000000] [ T43] example[43]
+syslog:warn : [85184.000000] [ T44] example[44]
+syslog:notice: [91125.000000] [ T45] example[45]
+syslog:info : [97336.000000] [ T46] example[46]
+syslog:debug : [103823.000000] [ T47] example[47]
+lpr :emerg : [110592.000000] [ T48] example[48]
+lpr :alert : [117649.000000] [ T49] example[49]
+lpr :crit : [125000.000000] [ T50] example[50]
+lpr :err : [132651.000000] [ T51] example[51]
+lpr :warn : [140608.000000] [ T52] example[52]
+lpr :notice: [148877.000000] [ T53] example[53]
+lpr :info : [157464.000000] [ T54] example[54]
+lpr :debug : [166375.000000] [ T55] example[55]
+news :emerg : [175616.000000] [ T56] example[56]
+news :alert : [185193.000000] [ T57] example[57]
+news :crit : [195112.000000] [ T58] example[58]
+news :err : [205379.000000] [ T59] example[59]
+news :warn : [216000.000000] [ T60] example[60]
+news :notice: [226981.000000] [ T61] example[61]
+news :info : [238328.000000] [ T62] example[62]
+news :debug : [250047.000000] [ T63] example[63]
+uucp :emerg : [262144.000000] [ T64] example[64]
+uucp :alert : [274625.000000] [ T65] example[65]
+uucp :crit : [287496.000000] [ T66] example[66]
+uucp :err : [300763.000000] [ T67] example[67]
+uucp :warn : [314432.000000] [ T68] example[68]
+uucp :notice: [328509.000000] [ T69] example[69]
+uucp :info : [343000.000000] [ T70] example[70]
+uucp :debug : [357911.000000] [ T71] example[71]
+cron :emerg : [373248.000000] [ T72] example[72]
+cron :alert : [389017.000000] [ T73] example[73]
+cron :crit : [405224.000000] [ T74] example[74]
+cron :err : [421875.000000] [ T75] example[75]
+cron :warn : [438976.000000] [ T76] example[76]
+cron :notice: [456533.000000] [ T77] example[77]
+cron :info : [474552.000000] [ T78] example[78]
+cron :debug : [493039.000000] [ T79] example[79]
+authpriv:emerg : [512000.000000] [ T80] example[80]
+authpriv:alert : [531441.000000] [ T81] example[81]
+authpriv:crit : [551368.000000] [ T82] example[82]
+authpriv:err : [571787.000000] [ T83] example[83]
+authpriv:warn : [592704.000000] [ T84] example[84]
+authpriv:notice: [614125.000000] [ T85] example[85]
+authpriv:info : [636056.000000] [ T86] example[86]
+authpriv:debug : [658503.000000] [ T87] example[87]
+ftp :emerg : [681472.000000] [ T88] example[88]
+ftp :alert : [704969.000000] [ T89] example[89]
+ftp :crit : [729000.000000] [ T90] example[90]
+ftp :err : [753571.000000] [ T91] example[91]
+ftp :warn : [778688.000000] [ T92] example[92]
+ftp :notice: [804357.000000] [ T93] example[93]
+ftp :info : [830584.000000] [ T94] example[94]
+ftp :debug : [857375.000000] [ T95] example[95]
+res0 :emerg : [884736.000000] [ T96] example[96]
+res0 :alert : [912673.000000] [ T97] example[97]
+res0 :crit : [941192.000000] [ T98] example[98]
+res0 :err : [970299.000000] [ T99] example[99]
+res0 :warn : [1000000.000000] [ T100] example[100]
+res0 :notice: [1030301.000000] [ T101] example[101]
+res0 :info : [1061208.000000] [ T102] example[102]
+res0 :debug : [1092727.000000] [ T103] example[103]
+res1 :emerg : [1124864.000000] [ T104] example[104]
+local2:info : [4557523.000000] [ T105] example[105]
diff --git a/tests/expected/dmesg/cid-delta b/tests/expected/dmesg/cid-delta
new file mode 100644
index 000000000..9b75c63af
--- /dev/null
+++ b/tests/expected/dmesg/cid-delta
@@ -0,0 +1,106 @@
+[ 0.000000 < 0.000000>] [ T0] example[0]
+[ 1.000000 < 0.000000>] [ T1] example[1]
+[ 8.000000 < 7.000000>] [ T2] example[2]
+[ 27.000000 < 19.000000>] [ T3] example[3]
+[ 64.000000 < 37.000000>] [ T4] example[4]
+[ 125.000000 < 61.000000>] [ T5] example[5]
+[ 216.000000 < 91.000000>] [ T6] example[6]
+[ 343.000000 < 127.000000>] [ T7] example[7]
+[ 512.000000 < 169.000000>] [ T8] example[8]
+[ 729.000000 < 217.000000>] [ T9] example[9]
+[ 1000.000000 < 271.000000>] [ T10] example[10]
+[ 1331.000000 < 331.000000>] [ T11] example[11]
+[ 1728.000000 < 397.000000>] [ T12] example[12]
+[ 2197.000000 < 469.000000>] [ T13] example[13]
+[ 2744.000000 < 547.000000>] [ T14] example[14]
+[ 3375.000000 < 631.000000>] [ T15] example[15]
+[ 4096.000000 < 721.000000>] [ T16] example[16]
+[ 4913.000000 < 817.000000>] [ T17] example[17]
+[ 5832.000000 < 919.000000>] [ T18] example[18]
+[ 6859.000000 < 1027.000000>] [ T19] example[19]
+[ 8000.000000 < 1141.000000>] [ T20] example[20]
+[ 9261.000000 < 1261.000000>] [ T21] example[21]
+[10648.000000 < 1387.000000>] [ T22] example[22]
+[12167.000000 < 1519.000000>] [ T23] example[23]
+[13824.000000 < 1657.000000>] [ T24] example[24]
+[15625.000000 < 1801.000000>] [ T25] example[25]
+[17576.000000 < 1951.000000>] [ T26] example[26]
+[19683.000000 < 2107.000000>] [ T27] example[27]
+[21952.000000 < 2269.000000>] [ T28] example[28]
+[24389.000000 < 2437.000000>] [ T29] example[29]
+[27000.000000 < 2611.000000>] [ T10] example[30]
+[29791.000000 < 2791.000000>] [ T31] example[31]
+[32768.000000 < 2977.000000>] [ T32] example[32]
+[35937.000000 < 3169.000000>] [ T33] example[33]
+[39304.000000 < 3367.000000>] [ T34] example[34]
+[42875.000000 < 3571.000000>] [ T35] example[35]
+[46656.000000 < 3781.000000>] [ T36] example[36]
+[50653.000000 < 3997.000000>] [ T37] example[37]
+[54872.000000 < 4219.000000>] [ T38] example[38]
+[59319.000000 < 4447.000000>] [ T39] example[39]
+[64000.000000 < 4681.000000>] [ T40] example[40]
+[68921.000000 < 4921.000000>] [ T41] example[41]
+[74088.000000 < 5167.000000>] [ T42] example[42]
+[79507.000000 < 5419.000000>] [ T43] example[43]
+[85184.000000 < 5677.000000>] [ T44] example[44]
+[91125.000000 < 5941.000000>] [ T45] example[45]
+[97336.000000 < 6211.000000>] [ T46] example[46]
+[103823.000000 < 6487.000000>] [ T47] example[47]
+[110592.000000 < 6769.000000>] [ T48] example[48]
+[117649.000000 < 7057.000000>] [ T49] example[49]
+[125000.000000 < 7351.000000>] [ T50] example[50]
+[132651.000000 < 7651.000000>] [ T51] example[51]
+[140608.000000 < 7957.000000>] [ T52] example[52]
+[148877.000000 < 8269.000000>] [ T53] example[53]
+[157464.000000 < 8587.000000>] [ T54] example[54]
+[166375.000000 < 8911.000000>] [ T55] example[55]
+[175616.000000 < 9241.000000>] [ T56] example[56]
+[185193.000000 < 9577.000000>] [ T57] example[57]
+[195112.000000 < 9919.000000>] [ T58] example[58]
+[205379.000000 <10267.000000>] [ T59] example[59]
+[216000.000000 <10621.000000>] [ T60] example[60]
+[226981.000000 <10981.000000>] [ T61] example[61]
+[238328.000000 <11347.000000>] [ T62] example[62]
+[250047.000000 <11719.000000>] [ T63] example[63]
+[262144.000000 <12097.000000>] [ T64] example[64]
+[274625.000000 <12481.000000>] [ T65] example[65]
+[287496.000000 <12871.000000>] [ T66] example[66]
+[300763.000000 <13267.000000>] [ T67] example[67]
+[314432.000000 <13669.000000>] [ T68] example[68]
+[328509.000000 <14077.000000>] [ T69] example[69]
+[343000.000000 <14491.000000>] [ T70] example[70]
+[357911.000000 <14911.000000>] [ T71] example[71]
+[373248.000000 <15337.000000>] [ T72] example[72]
+[389017.000000 <15769.000000>] [ T73] example[73]
+[405224.000000 <16207.000000>] [ T74] example[74]
+[421875.000000 <16651.000000>] [ T75] example[75]
+[438976.000000 <17101.000000>] [ T76] example[76]
+[456533.000000 <17557.000000>] [ T77] example[77]
+[474552.000000 <18019.000000>] [ T78] example[78]
+[493039.000000 <18487.000000>] [ T79] example[79]
+[512000.000000 <18961.000000>] [ T80] example[80]
+[531441.000000 <19441.000000>] [ T81] example[81]
+[551368.000000 <19927.000000>] [ T82] example[82]
+[571787.000000 <20419.000000>] [ T83] example[83]
+[592704.000000 <20917.000000>] [ T84] example[84]
+[614125.000000 <21421.000000>] [ T85] example[85]
+[636056.000000 <21931.000000>] [ T86] example[86]
+[658503.000000 <22447.000000>] [ T87] example[87]
+[681472.000000 <22969.000000>] [ T88] example[88]
+[704969.000000 <23497.000000>] [ T89] example[89]
+[729000.000000 <24031.000000>] [ T90] example[90]
+[753571.000000 <24571.000000>] [ T91] example[91]
+[778688.000000 <25117.000000>] [ T92] example[92]
+[804357.000000 <25669.000000>] [ T93] example[93]
+[830584.000000 <26227.000000>] [ T94] example[94]
+[857375.000000 <26791.000000>] [ T95] example[95]
+[884736.000000 <27361.000000>] [ T96] example[96]
+[912673.000000 <27937.000000>] [ T97] example[97]
+[941192.000000 <28519.000000>] [ T98] example[98]
+[970299.000000 <29107.000000>] [ T99] example[99]
+[1000000.000000 <29701.000000>] [ T100] example[100]
+[1030301.000000 <30301.000000>] [ T101] example[101]
+[1061208.000000 <30907.000000>] [ T102] example[102]
+[1092727.000000 <31519.000000>] [ T103] example[103]
+[1124864.000000 <32137.000000>] [ T104] example[104]
+[4557523.000000 <3432659.000000>] [ T105] example[105]
diff --git a/tests/expected/dmesg/cid-facilities b/tests/expected/dmesg/cid-facilities
new file mode 100644
index 000000000..b8afa3809
--- /dev/null
+++ b/tests/expected/dmesg/cid-facilities
@@ -0,0 +1,104 @@
+[ 0.000000] [ T0] example[0]
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
+[ 125.000000] [ T5] example[5]
+[ 216.000000] [ T6] example[6]
+[ 343.000000] [ T7] example[7]
+[ 512.000000] [ T8] example[8]
+[ 729.000000] [ T9] example[9]
+[ 1000.000000] [ T10] example[10]
+[ 1331.000000] [ T11] example[11]
+[ 1728.000000] [ T12] example[12]
+[ 2197.000000] [ T13] example[13]
+[ 2744.000000] [ T14] example[14]
+[ 3375.000000] [ T15] example[15]
+[ 4096.000000] [ T16] example[16]
+[ 4913.000000] [ T17] example[17]
+[ 5832.000000] [ T18] example[18]
+[ 6859.000000] [ T19] example[19]
+[ 8000.000000] [ T20] example[20]
+[ 9261.000000] [ T21] example[21]
+[10648.000000] [ T22] example[22]
+[12167.000000] [ T23] example[23]
+[13824.000000] [ T24] example[24]
+[15625.000000] [ T25] example[25]
+[17576.000000] [ T26] example[26]
+[19683.000000] [ T27] example[27]
+[21952.000000] [ T28] example[28]
+[24389.000000] [ T29] example[29]
+[27000.000000] [ T10] example[30]
+[29791.000000] [ T31] example[31]
+[32768.000000] [ T32] example[32]
+[35937.000000] [ T33] example[33]
+[39304.000000] [ T34] example[34]
+[42875.000000] [ T35] example[35]
+[46656.000000] [ T36] example[36]
+[50653.000000] [ T37] example[37]
+[54872.000000] [ T38] example[38]
+[59319.000000] [ T39] example[39]
+[64000.000000] [ T40] example[40]
+[68921.000000] [ T41] example[41]
+[74088.000000] [ T42] example[42]
+[79507.000000] [ T43] example[43]
+[85184.000000] [ T44] example[44]
+[91125.000000] [ T45] example[45]
+[97336.000000] [ T46] example[46]
+[103823.000000] [ T47] example[47]
+[110592.000000] [ T48] example[48]
+[117649.000000] [ T49] example[49]
+[125000.000000] [ T50] example[50]
+[132651.000000] [ T51] example[51]
+[140608.000000] [ T52] example[52]
+[148877.000000] [ T53] example[53]
+[157464.000000] [ T54] example[54]
+[166375.000000] [ T55] example[55]
+[175616.000000] [ T56] example[56]
+[185193.000000] [ T57] example[57]
+[195112.000000] [ T58] example[58]
+[205379.000000] [ T59] example[59]
+[216000.000000] [ T60] example[60]
+[226981.000000] [ T61] example[61]
+[238328.000000] [ T62] example[62]
+[250047.000000] [ T63] example[63]
+[262144.000000] [ T64] example[64]
+[274625.000000] [ T65] example[65]
+[287496.000000] [ T66] example[66]
+[300763.000000] [ T67] example[67]
+[314432.000000] [ T68] example[68]
+[328509.000000] [ T69] example[69]
+[343000.000000] [ T70] example[70]
+[357911.000000] [ T71] example[71]
+[373248.000000] [ T72] example[72]
+[389017.000000] [ T73] example[73]
+[405224.000000] [ T74] example[74]
+[421875.000000] [ T75] example[75]
+[438976.000000] [ T76] example[76]
+[456533.000000] [ T77] example[77]
+[474552.000000] [ T78] example[78]
+[493039.000000] [ T79] example[79]
+[512000.000000] [ T80] example[80]
+[531441.000000] [ T81] example[81]
+[551368.000000] [ T82] example[82]
+[571787.000000] [ T83] example[83]
+[592704.000000] [ T84] example[84]
+[614125.000000] [ T85] example[85]
+[636056.000000] [ T86] example[86]
+[658503.000000] [ T87] example[87]
+[681472.000000] [ T88] example[88]
+[704969.000000] [ T89] example[89]
+[729000.000000] [ T90] example[90]
+[753571.000000] [ T91] example[91]
+[778688.000000] [ T92] example[92]
+[804357.000000] [ T93] example[93]
+[830584.000000] [ T94] example[94]
+[857375.000000] [ T95] example[95]
+[884736.000000] [ T96] example[96]
+[912673.000000] [ T97] example[97]
+[941192.000000] [ T98] example[98]
+[970299.000000] [ T99] example[99]
+[1000000.000000] [ T100] example[100]
+[1030301.000000] [ T101] example[101]
+[1061208.000000] [ T102] example[102]
+[1092727.000000] [ T103] example[103]
diff --git a/tests/expected/dmesg/cid-indentation b/tests/expected/dmesg/cid-indentation
new file mode 100644
index 000000000..573682795
--- /dev/null
+++ b/tests/expected/dmesg/cid-indentation
@@ -0,0 +1,35 @@
+[ 1.000000] [ T1] new
+ line
+[ 2.000000] [ T2] two
+ new
+ lines
+user :crit : [ 1.000000] [ T1] new
+ line
+mail :warn : [ 2.000000] [ T2] two
+ new
+ lines
+[< 0.000000>] [ T1] new
+ line
+[< 1.000000>] [ T2] two
+ new
+ lines
+[ T1] new
+ line
+[ T2] two
+ new
+ lines
+[Feb13 23:31] [ T1] new
+ line
+[ +1.000000] [ T2] two
+ new
+ lines
+[Fri Feb 13 23:31:31 2009] [ T1] new
+ line
+[Fri Feb 13 23:31:32 2009] [ T2] two
+ new
+ lines
+2009-02-13T23:31:31,123456+00:00 [ T1] new
+ line
+2009-02-13T23:31:32,123456+00:00 [ T2] two
+ new
+ lines
diff --git a/tests/expected/dmesg/cid-limit b/tests/expected/dmesg/cid-limit
new file mode 100644
index 000000000..c30b4ac9a
--- /dev/null
+++ b/tests/expected/dmesg/cid-limit
@@ -0,0 +1,4 @@
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
diff --git a/tests/ts/dmesg/cid-colors b/tests/ts/dmesg/cid-colors
new file mode 100755
index 000000000..d17dd17c0
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-input -x >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-console-levels b/tests/ts/dmesg/cid-console-levels
new file mode 100755
index 000000000..e2f241bde
--- /dev/null
+++ b/tests/ts/dmesg/cid-console-levels
@@ -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-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/cid-input -l $I >> $TS_OUTPUT 2>/dev/null
+done
+
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l err+ >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l emerg+ >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l +err >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l +debug >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l + 2>> $TS_OUTPUT >/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-decode b/tests/ts/dmesg/cid-decode
new file mode 100755
index 000000000..488f52a32
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-delta b/tests/ts/dmesg/cid-delta
new file mode 100755
index 000000000..8ba952a5d
--- /dev/null
+++ b/tests/ts/dmesg/cid-delta
@@ -0,0 +1,27 @@
+#!/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-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 -F $TS_SELF/cid-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-facilities b/tests/ts/dmesg/cid-facilities
new file mode 100755
index 000000000..b4b613e8b
--- /dev/null
+++ b/tests/ts/dmesg/cid-facilities
@@ -0,0 +1,30 @@
+#!/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-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
+ $TS_HELPER_DMESG -F $TS_SELF/cid-input -f $I >> $TS_OUTPUT 2>/dev/null
+done
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-indentation b/tests/ts/dmesg/cid-indentation
new file mode 100755
index 000000000..434e1694b
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG -F $TS_SELF/cid-newlines -x >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=delta --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=notime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=reltime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=ctime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=iso --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-limit b/tests/ts/dmesg/cid-limit
new file mode 100755
index 000000000..34f928a9e
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 \
+ -F $TS_SELF/cid-input >> $TS_OUTPUT 2> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-newlines b/tests/ts/dmesg/cid-newlines
new file mode 100644
index 000000000..682ce40bb
--- /dev/null
+++ b/tests/ts/dmesg/cid-newlines
@@ -0,0 +1,5 @@
+<10>[ 1.000000] [ T1] new
+line
+<20>[ 2.000000] [ T2] two
+new
+lines
--
2.43.0
^ permalink raw reply related
* [PATCH] util-linux add dmesg caller_id Issue: 2666 patch 1 of 4
From: Edward Chron @ 2024-01-04 20:43 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
Submission to Project: util-linux
Open Incident: #2609 at github.com/util-linux/util-linux/issues/2609
Component: util-linux/sys-utils
File: dmesg.c
Code level patch applied against: 2.39.3 - latest code pulled from
git.github.com:util-linux/util-linux.git
Revision: #1 on 2023/12/08 per Review from Karel Zak
Revision: #2 on 2023/12/12 Adjust line offsets for master update and
Add caller_id_size init to dmesg -K
Revision: #3 on 2023/12/12 Use of sizeof for cidbuf and limit search
for caller_id to dmesg prefix to msg text
Revision: #4 on 2023/12/15 Ensure SYSLOG and kmsg inputs have
caller_id_size set appropriately
Revision: #5 on 2023/12/24 Make caller_id width consistent with
makedumpfile
Revision: #6 on 2023/12/30 Use updated test naming convention
Revision: #7 on 2024/01/04 Normalize kmsg caller_id spacing for test
platforms by removing caller_id padding
in test generated output.
Add support to standard dmesg command for the optional Linux Kernel
debug CONFIG option PRINTK_CALLER which adds an optional dmesg field
that contains the Thread Id or CPU Id that is issuing the printk to
add the message to the kernel ring buffer. This makes debugging simpler
as dmesg entries for a specific thread or CPU can be recognized.
The dmesg -S using the old syslog interface supports printing the
PRINTK_CALLER field but currently standard dmesg does not support
printing the field if present. There are utilities that use dmesg and
so it would be optimal if dmesg supported PRINTK_CALLER as well.
The additional field provided by PRINTK_CALLER is only present
if it was configured for the Linux kernel where the dmesg command
is run. It is a debug option and not configured by default so the
dmesg output will only change for those kernels where the option was
configured when the kernel was built. For users who went to the
trouble to configure PRINTK_CALLER and have the extra field available
for debugging, having dmesg print the field is very helpful.
Size of the PRINTK_CALLER field is determined by the maximum number
tasks that can be run on the system which is limited by the value of
/proc/sys/kernel/pid_max as pid values are from 0 to value - 1.
This value determines the number of id digits needed by the caller id.
The PRINTK_CALLER field is printed as T<id> for a Task Id or C<id>
for a CPU Id for a printk in CPU context. The values are left space
padded and enclosed in parentheses such as: [ T123] or [ C16]
For consistency with dmesg -S which supports the PRINTK_CALLER field
the field is printed followed by a space. For JSON format output the
PRINTK_CALLER field is identified as caller as that is consistent with
it's naming in /dev/kmsg. No space padding is used to reduce space
consumed by the JSON output. So the output from the command on a system
with PRINTK_CALLER field enabled in the Linux .config file the dmesg
output appears as:
> dmesg
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -J
...
},{
"pri": 6,
"time": 520.897104,
"caller": "T3919",
"msg": "usb 3-3: Product: USB 2.0 Hub"
},{
and
> dmesg -J -x
...
},{
"fac": "kern",
"pri": "info",
"time": 520.897104,
"caller": "T3919",
"msg": "usb 3-3: Product: USB 2.0 Hub"
},{
>
For comparison:
> dmesg -S
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -S -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
Note: When dmesg uses the old syslog interface the reserved space for
the PRINTK_CALLER field is capped at 5 digits because 32-bit
kernels are capped at 32768 as the max number of PIDs. However,
64-bit systems are currently capped at 2^22 PIDs (0 - 4194303).
The PID cap is set by PID_MAX_LIMIT but the system limit can be
less so we use /proc/sys/kernel/pid_max to determine the size
needed to hold the maximum PID value size for the current system.
Many 64-bit systems support 2^22 PIDs (0 - 4194303) and you see:
> dmesg -x
...
kern :info : [ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
...
kern :info : [ 9830.456898] [ T98982] cgroup: fork rejected by pids ...
kern :info : [14301.158878] [ T137336] cgroup: fork rejected by pids ...
kern :info : [18980.803190] [T1637865] cgroup: fork rejected by pids ...
> dmesg -S -x
...
kern :info : [ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
...
kern :info : [ 9830.456898] [T98982] cgroup: fork rejected by pids ...
kern :info : [14301.158878] [T137336] cgroup: fork rejected by pids ...
kern :info : [18980.803190] [T1637865] cgroup: fork rejected by pids ...
This is the only difference seen with PRINTK_CALLER configured and
printing between the dmesg /dev/kmsg interface and the dmesg -S syslog
interface.
Tests naming has been revised based on naming convention Thomas used to
introduce dmest json tests. The naming of test and input files that
reside in tests/ts/dmeg include:
<name> are existing dmesg syslog interface tests and input files.
cid-<name> are dmesg syslog interface caller_id tests and input files.
json-<name> are dmesg kmsg interface tests and input files.
cid-json-<name> are dmesg kmsg interface caller_id tests and input files.
Resulting expected files match the test names.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
include/pathnames.h | 3 +
sys-utils/dmesg.c | 128 ++++-
tests/expected/dmesg/cid-json | 535 +++++++++++++++++++
tests/expected/dmesg/cid-kmsg-colors | 59 ++
tests/expected/dmesg/cid-kmsg-console-levels | 146 +++++
tests/expected/dmesg/cid-kmsg-decode | 59 ++
tests/expected/dmesg/cid-kmsg-delta | 59 ++
tests/expected/dmesg/cid-kmsg-facilities | 73 +++
tests/expected/dmesg/cid-kmsg-indentation | 28 +
tests/expected/dmesg/cid-kmsg-json | 295 ++++++++++
tests/expected/dmesg/cid-kmsg-limit | 31 ++
tests/expected/dmesg/kmsg-file | 126 ++++-
tests/ts/dmesg/cid-input | 106 ++++
tests/ts/dmesg/cid-json | 28 +
tests/ts/dmesg/cid-kmsg-colors | 34 ++
tests/ts/dmesg/cid-kmsg-console-levels | 49 ++
tests/ts/dmesg/cid-kmsg-decode | 33 ++
tests/ts/dmesg/cid-kmsg-delta | 33 ++
tests/ts/dmesg/cid-kmsg-facilities | 36 ++
tests/ts/dmesg/cid-kmsg-indentation | 45 ++
tests/ts/dmesg/cid-kmsg-input | Bin 0 -> 5464 bytes
tests/ts/dmesg/cid-kmsg-json | 28 +
tests/ts/dmesg/cid-kmsg-limit | 34 ++
tests/ts/dmesg/cid-kmsg-newlines | Bin 0 -> 152 bytes
tests/ts/dmesg/kmsg-input | Bin 1955 -> 3944 bytes
25 files changed, 1948 insertions(+), 20 deletions(-)
create mode 100644 tests/expected/dmesg/cid-json
create mode 100644 tests/expected/dmesg/cid-kmsg-colors
create mode 100644 tests/expected/dmesg/cid-kmsg-console-levels
create mode 100644 tests/expected/dmesg/cid-kmsg-decode
create mode 100644 tests/expected/dmesg/cid-kmsg-delta
create mode 100644 tests/expected/dmesg/cid-kmsg-facilities
create mode 100644 tests/expected/dmesg/cid-kmsg-indentation
create mode 100644 tests/expected/dmesg/cid-kmsg-json
create mode 100644 tests/expected/dmesg/cid-kmsg-limit
create mode 100644 tests/ts/dmesg/cid-input
create mode 100755 tests/ts/dmesg/cid-json
create mode 100755 tests/ts/dmesg/cid-kmsg-colors
create mode 100755 tests/ts/dmesg/cid-kmsg-console-levels
create mode 100755 tests/ts/dmesg/cid-kmsg-decode
create mode 100755 tests/ts/dmesg/cid-kmsg-delta
create mode 100755 tests/ts/dmesg/cid-kmsg-facilities
create mode 100755 tests/ts/dmesg/cid-kmsg-indentation
create mode 100644 tests/ts/dmesg/cid-kmsg-input
create mode 100755 tests/ts/dmesg/cid-kmsg-json
create mode 100755 tests/ts/dmesg/cid-kmsg-limit
create mode 100644 tests/ts/dmesg/cid-kmsg-newlines
diff --git a/include/pathnames.h b/include/pathnames.h
index caf0e63d4..81fa405f6 100644
--- a/include/pathnames.h
+++ b/include/pathnames.h
@@ -230,4 +230,7 @@
/* cgroup path */
#define _PATH_SYS_CGROUP "/sys/fs/cgroup"
+/* Maximum number of PIDs system supports */
+#define _PATH_PROC_PIDMAX "/proc/sys/kernel/pid_max"
+
#endif /* PATHNAMES_H */
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 48928b095..1bb44f2c6 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -13,7 +13,9 @@
*/
#include <stdio.h>
#include <getopt.h>
+#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/klog.h>
#include <sys/syslog.h>
#include <sys/time.h>
@@ -41,6 +43,7 @@
#include "mangle.h"
#include "pager.h"
#include "jsonwrt.h"
+#include "pathnames.h"
/* Close the log. Currently a NOP. */
#define SYSLOG_ACTION_CLOSE 0
@@ -65,6 +68,12 @@
/* Return size of the log buffer */
#define SYSLOG_ACTION_SIZE_BUFFER 10
+#define PID_CHARS_MAX sizeof(stringify_value(LONG_MAX))
+#define PID_CHARS_DEFAULT sizeof(stringify_value(INT_MAX))
+#define SYSLOG_DEFAULT_CALLER_ID_CHARS sizeof(stringify_value(SHRT_MAX))-1
+#define DMESG_CALLER_PREFIX "caller="
+#define DMESG_CALLER_PREFIXSZ (sizeof(DMESG_CALLER_PREFIX)-1)
+
/*
* Color scheme
*/
@@ -237,6 +246,7 @@ struct dmesg_control {
force_prefix:1; /* force timestamp and decode prefix
on each line */
int indent; /* due to timestamps if newline */
+ size_t caller_id_size; /* PRINTK_CALLERID max field size */
};
struct dmesg_record {
@@ -246,6 +256,7 @@ struct dmesg_record {
int level;
int facility;
struct timeval tv;
+ char caller_id[PID_CHARS_MAX];
const char *next; /* buffer with next unparsed record */
size_t next_size; /* size of the next buffer */
@@ -258,6 +269,7 @@ struct dmesg_record {
(_r)->level = -1; \
(_r)->tv.tv_sec = 0; \
(_r)->tv.tv_usec = 0; \
+ (_r)->caller_id[0] = 0; \
} while (0)
static int process_kmsg(struct dmesg_control *ctl);
@@ -602,6 +614,45 @@ static int get_syslog_buffer_size(void)
return n > 0 ? n : 0;
}
+/*
+ * Get the number of characters needed to hold the maximum number
+ * of tasks this system supports. This size of string could hold
+ * a thread id large enough for the highest thread id.
+ * This is needed to determine the number of characters reserved for
+ * the PRINTK_CALLER field if it has been configured in the Linux Kernel.
+ *
+ * The number of digits sets the max value since the value can't exceed
+ * a value of that size. The /proc field defined by _PATH_PROC_PIDMAX
+ * holds the maximum number of PID values that may be ussed by the system,
+ * so 0 to that value minus one.
+ *
+ * For determining the size of the PRINTK_CALLER field, we make the safe
+ * assumption that the number of threads >= number of cpus. This because
+ * the PRINTK_CALLER field can hold either a thread id or a CPU id value.
+ *
+ * If we can't access the pid max kernel proc entry we assign a default
+ * field size of 5 characters as that is what the old syslog interface
+ * uses as the reserved field size. This is justified because 32-bit Linux
+ * systems are limited to PID values between (0-32767).
+ *
+ */
+static size_t max_threads_id_size(void)
+{
+ char taskmax[PID_CHARS_MAX] = {'\0'};
+ ssize_t rdsize;
+ int fd;
+
+ fd = open(_PATH_PROC_PIDMAX, O_RDONLY);
+ if (fd == -1)
+ return PID_CHARS_DEFAULT;
+
+ rdsize = read(fd, taskmax, sizeof(taskmax));
+ if (rdsize == -1)
+ return PID_CHARS_DEFAULT;
+
+ return strnlen(taskmax, sizeof(taskmax));
+}
+
/*
* Reads messages from regular file by mmap
*/
@@ -675,6 +726,8 @@ static ssize_t process_buffer(struct dmesg_control *ctl, char **buf)
ctl->bufsize = get_syslog_buffer_size();
n = read_syslog_buffer(ctl, buf);
+ /* Set number of PID characters for caller_id spacing */
+ ctl->caller_id_size = SYSLOG_DEFAULT_CALLER_ID_CHARS;
break;
case DMESG_METHOD_KMSG:
if (ctl->filename)
@@ -779,6 +832,39 @@ static const char *skip_item(const char *begin, const char *end, const char *sep
return begin;
}
+/*
+ * Checks to see if the caller (caller id) field is present in the kmsg record.
+ * This is true if the PRINTK_CALLER config option has been set in the kernel.
+ *
+ * If the caller_id is found in the kmsg buffer then return the id and id type
+ * to the caller in dmesg caller_id. Returns string pointer to next value.
+ *
+ */
+static const char *parse_callerid(const char *p_str, const char *end,
+ struct dmesg_record *p_drec)
+{
+ const char *p_after;
+ const char *p_next;
+ size_t cid_size;
+ char *p_scn;
+ char *p_cid;
+
+ /* Check for PRINTK_CALLER prefix, must be before msg text */
+ p_cid = strstr(p_str, DMESG_CALLER_PREFIX);
+ p_scn = strchr(p_str, ';');
+ if (p_cid != NULL && p_drec != NULL && p_scn != NULL && p_cid < p_scn) {
+ p_next = p_cid + DMESG_CALLER_PREFIXSZ;
+ p_after = skip_item(p_next, end, ",;");
+ cid_size = p_after - p_next;
+ if (cid_size < sizeof(p_drec->caller_id))
+ xstrncpy(p_drec->caller_id, p_next, cid_size);
+ else
+ return p_str;
+ return p_after;
+ }
+ return p_str;
+}
+
/*
* Parses one record from syslog(2) buffer
*/
@@ -846,8 +932,22 @@ static int get_next_syslog_record(struct dmesg_control *ctl,
begin++;
}
- rec->mesg = begin;
- rec->mesg_size = end - begin;
+ if (*begin == '[' && (*(begin + 1) == ' ' ||
+ (*(begin + 1) == 'T' || *(begin + 1) == 'C'))) {
+ const char *start = begin + 1;
+ size_t id_size;
+
+ start = start + strspn(start, " ");
+ begin = skip_item(begin, end, "]");
+ id_size = begin - start;
+ if (id_size < sizeof(rec->caller_id))
+ xstrncpy(rec->caller_id, start, id_size);
+ rec->mesg = begin + 1;
+ rec->mesg_size = end - begin - 1;
+ } else {
+ rec->mesg = begin;
+ rec->mesg_size = end - begin;
+ }
/* Don't count \n from the last message to the message size */
if (*end != '\n' && *(end - 1) == '\n')
@@ -1165,6 +1265,19 @@ full_output:
color_disable();
}
+ if (*rec->caller_id) {
+ if (ctl->json) {
+ ul_jsonwrt_value_s(&ctl->jfmt, "caller", rec->caller_id);
+ } else {
+ char cidbuf[PID_CHARS_MAX+3] = {'\0'};
+
+ sprintf(cidbuf, "[%*s] ",
+ (char)ctl->caller_id_size, rec->caller_id);
+ ctl->indent += strnlen(cidbuf, sizeof(cidbuf));
+ fputs(cidbuf, stdout);
+ }
+ }
+
/*
* A kernel message may contain several lines of output, separated
* by '\n'. If the timestamp and decode outputs are forced then each
@@ -1348,7 +1461,10 @@ static int parse_kmsg_record(struct dmesg_control *ctl,
goto mesg;
/* D) optional fields (ignore) */
- p = skip_item(p, end, ";");
+ p = skip_item(p, end, ",;");
+
+ /* Include optional PRINTK_CALLER field if it is present */
+ p = parse_callerid(p, end, rec);
mesg:
/* E) message text */
@@ -1400,6 +1516,9 @@ static int process_kmsg(struct dmesg_control *ctl)
if (ctl->method != DMESG_METHOD_KMSG || ctl->kmsg < 0)
return -1;
+ /* Determine number of PID characters for caller_id spacing */
+ ctl->caller_id_size = max_threads_id_size();
+
/*
* The very first read() call is done in kmsg_init() where we test
* /dev/kmsg usability. The return code from the initial read() is
@@ -1512,6 +1631,7 @@ int main(int argc, char *argv[])
.kmsg = -1,
.ntime_fmts = 0,
.indent = 0,
+ .caller_id_size = 0,
};
int colormode = UL_COLORMODE_UNDEF;
enum {
@@ -1606,10 +1726,12 @@ int main(int argc, char *argv[])
case 'F':
ctl.filename = optarg;
ctl.method = DMESG_METHOD_MMAP;
+ ctl.caller_id_size = SYSLOG_DEFAULT_CALLER_ID_CHARS;
break;
case 'K':
ctl.filename = optarg;
ctl.method = DMESG_METHOD_KMSG;
+ ctl.caller_id_size = max_threads_id_size();
break;
case 'f':
ctl.fltr_fac = 1;
diff --git a/tests/expected/dmesg/cid-json b/tests/expected/dmesg/cid-json
new file mode 100644
index 000000000..8a4d0e23d
--- /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 000000000..d3dbd1e2c
--- /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 000000000..ef2e83c46
--- /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 000000000..e1cecfa88
--- /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 000000000..82eea8e13
--- /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.000000>] [T3] BIOS-provided physical RAM map:
+[ 0.000003 < 0.000000>] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+[ 0.000004 < 0.000000>] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+[ 0.000005 < 0.000000>] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+[ 0.000006 < 0.000000>] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+[ 0.000007 < 0.000000>] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+[ 0.000008 < 0.000000>] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+[ 0.000009 < 0.000000>] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+[ 0.000010 < 0.000000>] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+[ 0.201607 < 0.000000>] [T12] smp: Bringing up secondary CPUs ...
+[ 0.201607 < 0.000000>] [T13] smpboot: x86: Booting SMP configuration:
+[ 0.209670 < 0.000000>] [T14] #1 #3 #5 #7
+[ 0.212630 < 0.000000>] [T15] smp: Brought up 1 node, 16 CPUs
+[ 0.215936 < 0.000000>] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+[ 0.215937 < 0.000000>] [T17] thermal_sys: Registered thermal governor 'fair_share'
+[ 0.215966 < 0.000000>] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+[ 0.367657 < 0.000000>] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+[ 0.368615 < 0.000000>] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+[ 0.376316 < 0.000000>] [T21] ACPI: \_SB_.PRWL: New power resource
+[ 0.376343 < 0.000000>] [T22] ACPI: \_SB_.PRWB: New power resource
+[ 0.377373 < 0.000000>] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+[ 0.377378 < 0.000000>] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+[ 0.377569 < 0.000000>] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+[ 0.377933 < 0.000000>] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+[ 0.378458 < 0.000000>] [T27] PCI host bridge to bus 0000:00
+[ 0.378459 < 0.000000>] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
+[ 0.378461 < 0.000000>] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
+[ 9.398562 < 9.000000>] [T30] user network daemon initialization complete
+[ 10.441520 < 1.000000>] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode
+[ 11.441524 < 1.000000>] [T32] systemd[1]: Detected architecture x86-64.
+[ 12.441525 < 1.000000>] [T33] systemd[1]: Running in initrd.
+[ 13.541598 < 1.000000>] [T34] systemd[1]: Hostname set to <catalina>.
+[ 15.641860 < 2.000000>] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+[ 16.690000 < 1.000000>] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+[ 17.710000 < 1.000000>] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[ 18.720000 < 1.000000>] [T38] systemd-journald[723]: Received client request to flush runtime journal.
+[ 20.740000 < 2.000000>] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+[ 21.752348 < 1.000000>] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+[ 24.761100 < 3.000000>] [T41] PEFILE: Unsigned PE binary
+[ 35.768091 < 11.000000>] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[ 137.791785 < 102.000000>] [C1] usb 3-3.1: device firmware changed
+[ 146.803248 < 9.000000>] [C2] usb 3-3.1: USB disconnect, device number 44
+[ 148.821859 < 2.000000>] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
+[ 149.840480 < 1.000000>] [C4] perf: interrupt took too long (2518 > 2500)
+[ 150.853128 < 1.000000>] [C5] perf: interrupt took too long (3217 > 3147)
+[ 153.859311 < 3.000000>] [C12] perf: interrupt took too long (3654 > 3239)
+[ 155.861908 < 2.000000>] [C123] perf: interrupt took too long (3789 > 3545)
+[ 158.870434 < 3.000000>] [C1234] perf: interrupt took too long (3891 > 3647)
+[ 161.887625 < 3.000000>] [C12345] perf: interrupt took too long (3947 > 3789)
+[ 163.898434 < 2.000000>] [C123456] perf: interrupt took too long (4011 > 3898)
+[ 166.909842 < 3.000000>] [C1234567] perf: interrupt took too long (4174 > 3987)
+[ 169.911147 < 3.000000>] [T123] User program Dmesg Test Message at warn priority
+[ 178.927435 < 9.000000>] [T1234] User program Dmesg Test Message at warn priority
+[ 185.943456 < 7.000000>] [T12345] User program Dmesg Test Message at notice priority
+[ 189.963238 < 4.000000>] [T123456] User program Dmesg Test Message at info priority
+[ 207.987439 < 18.000000>] [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 000000000..bacfbd1d6
--- /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 000000000..28c01996c
--- /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 000000000..942506ceb
--- /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 000000000..372432d5f
--- /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/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/ts/dmesg/cid-input b/tests/ts/dmesg/cid-input
new file mode 100644
index 000000000..7dbd89d8f
--- /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 000000000..78363793d
--- /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 000000000..b94e8a9ee
--- /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 000000000..19d80040a
--- /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 000000000..b92099770
--- /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 000000000..1b5f57270
--- /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 000000000..38ca9c565
--- /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 000000000..c3f8e066a
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..2575be8d732c30c5346738a871579edf1dd892ff
GIT binary patch
literal 5464
zcmbtYX>;027WHTUid&Tru`2?r)!o_{UX6`O%v9_!VCUtPC*=}SgY}|?(c)!({hSsM
zL_D^WH^>;Y^y$-gIrlcEVdCf*VUQ%M=wGtl$2hAW=uQ=7oM&Wr?XKtqMR?0Pj1Cfg
z^Y8k!`F2PLi!h{v4}-xWG2XShj4adQrfV{TK3rT;65%dBPcX2Glk$+Pu3%mBklrww
zo{wof84l0Kmp7+>TpXW|26Uch2AP6RRoFn0Y5JDuGmqYxc<t{oLmyklR&S7}X^=$(
zO3J4=i>o5)|LZ}9b(lx08>fr*#pZsH&dW}-gywc}Phs)6tRi(6hpK;s&!g-vRc6MP
z+%F%?N~L}jmtjyuROETJdL#{&OH~}L?(gqehCa5;c<*HNY1&y9`CS~Th?cjHWeh{p
z<oKL0*5BXbhCa4K#A=9gEz_s#RHbA-=w-KGot;abn$PE7sV;+AqW1TMp^q(~d>PQ2
z19=y420Q>3s#L|DiuU)Up^q)3{URi5sJ0=!KqIy|+J-*1fX+*R-s~x0v<BRAbPRoL
zA>9`t)l*1q#a)iB;kE$17Xh^uckSrSxi;iiIv$Kibn$t*zh@gBjx9%KzKqGkT})wd
z`6EeY8u)8rvKKG`VE@2V2)V}G+R`?-X&RQvY_n}rX7$Q+>C;IOXAAsMy`)lwc@_o5
zBMrt^C3U-9y-beee>$A&;WOlpPY<pQ9DLO<S_FVHj~8_jRL~rxg)lhN7@qBzMz|Fx
z(Ic%J^oHXt@phW|81jx;Hs7&?+|bSI#cie8GRmL_1~I##t0S9R4u(pPx8sr7y`YX_
z5Un1Us&Bz&)Lb}Vj%j(8%^a_5GU>BJpUNtzR9}lq93=67kmk*!H!9N!8TCz_NqyGv
zwA|HXJ7#ry)vYShAi05#_%u<A7;;kpXnma)In+4I3wk>b;^L;f4GQ(PF%n;~w|CgP
zz2U`h^5Ku0@o@6~=45m{^=Yaqs&aY@6wLJ2p!=Ytw-B$nzL13)&o%^y8rhC5cL;ht
z9m76pMZKAx+;qo-k=gw)W?uK=Y{a_b-zS*iLfz9czgLA`Z(bK6#7HB;m9}fMwt!gX
z^N3&02I3V&c+IgnYp>a2PY@@+e|(-4ViXXft-O}?KOjz?hj0MlaAyaCuOVO{njpM&
zu0#t(*V<xV=^)C}AkI+H5Kz~%y2Q5*G~#e&DR+g~Rvk<9f^Zqr_+o4xo34*qNH?FR
z1D`%ksjQdFyr@dL9zIkmLxmYMX++1<@i`5WJp6{wsam8e!&B$e5e-i#bT<CdxkOy^
zulqE;I+^}4y&RtR^)&l*I{Z8u4Eyi&nZKQM#n03Hq}`S<OFqYMnFN)NEsAngBJZjV
zUAms0jR$9WwM^;-9S<kJNJE&KhKESqs-A^}eb!7_j^dtYRgot!6+EFflaJ4bq|XPz
zGML3lTs_jq%L$#12fxaRfs-rbj_aJB4ujjgtZ23h10>+e>2Ra&WRM=hT8-Q>s@q$J
z@lESdzv(%e!JFiw>o})%bD)cDICtni&Z7K&hx;06>)G`M%-<q`tOtF2r>pXQg+$a8
zKV6*u8VSY?$3u1Go-6I07Rv0^=tC$|)qP%kqbN`*y3+4*+Y}7AH(e&Gg5sbAxZFZb
z6oN^sT@N_xt@^a+ntg?AH$7cMmK0s5!@Bd3dsNg}rb`lXbakIn6pS@0HyCSB+wB!c
zQCuN4sHY$iR=NhDLyq<Lx=^~@b!>ss*sv1@vl^VXByv>87S3c#WYx}Y21|o+iKTh%
zP~&1}@EJlb3sQyZ+=%|)!k|KF%7WjT>g=M{F=-3t+B^1<u=I?0hp#m6YI;Jec9`aQ
zoka%4(PyYkUi4XjB*f{s$fG)}`X<xe{w$16SM4*gE@N$R0r2+-44LcsmPFy^aFt^)
z+xB!Yw$ho~y{RftPMe5N>!ga|5)|4DHMUZ;EL9!l8+K6<qdd~+;*v|$WG#`ZC{Qgs
z!;3GYPd<$%|HSY}Jv0qKwOUTM&2J-C-$}mPT=BQCny`m<fjLgo<F*Mqy)uh#ZlmBP
z&MK8O3a^>4c^Bp!e43mz{WRPWrz)?jH<r;{os6kZwv=3=oTERK*xI;`Za8-A;coof
z`4g2j3zF#Cu{ff5qC$n$M-(P8L>`m;yH*e!D9t>n%Ud1MdP-W4LjVYYY0xj3j`(pJ
z@40E-$BCk&yP!Bq^2N~_>nK1RtH87POy`B^;XIPkiDVE;juvUXFY2zJN0t^vz0}zO
z=hRu4s31!osl2T#REc|R`wBEosZKz>n=2HY5aLXe*0$kjo*Zd$(T;s#K1cc~-^dA&
z?oJSz3Vn$c;H_-^5pWeKaio=|qkX%f?9)G1_NKYE0PdF*P!!MS=+9v8Qkxsi6J>Qe
z(=m98HRNar*Q`NW7?yBs2Gmx(2-X`9-;X{HeY(oZc#**-;~~wEqs60+GiD*sxO8mS
z^xCQ{AUFSapxFjGSS=(dqs(zzGBjWt4d^m|lV9_=Nbk{cQg|C=3v38mUBlDF_B>tJ
zFabnHfIhd{?iyI_2^xvPraI3uD5bHPaBWN>esU%cGr6wCT-mCk1KyrVH>WQNnxp1z
zL9<Qa><Aj~a`Qzt*fBNh_E2+}@LXXEx8?DH=;>Zt|2ToxUS|PPH2<dmQIaFz4=l-C
z`VHmCG@Eu1+YGErnl4fa+lKGG&Op9~#E~UH;!HSeB$OQ{In1LsRa+!%=w2bkZ7DRA
z#k~y_1WHQu^Pbrz#Vr0Rmg9OFOA5KcLY<bb>zI0z(58iY_8KwQV;aoft`SLNGoabl
zPC!F0UbmPh8jFG9h8l{r&0YBM2{mcIMoyTlA&21`IAohHbHHmgHv?ErNZWZ8k2#GO
zJXbqZ?{z)xQQPwvI+C5O8r*QD+a>(uv?zj<PE%Db=u(%2b5)iB_98)ry<d^xkvK2V
z@@^2}SghZ21aH~zQd9gZkkD#R_hAS+m{7L&YR#&D1{0eG{213J3Nh7<KRO7{Mo_jQ
puptW9{KV?xY@WA4r3MAE>A=8(w=`r8>ii69q-NO8d^hU;e*yZ}It~B;
literal 0
HcmV?d00001
diff --git a/tests/ts/dmesg/cid-kmsg-json b/tests/ts/dmesg/cid-kmsg-json
new file mode 100755
index 000000000..ad1e3e785
--- /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 000000000..06f1c8bfb
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..574d2177796677b73f1efcf273005169ed832c60
GIT binary patch
literal 152
zcmXrjF#tkco#e!voYW%Q5CiL+%)C^Es??%<E(Svb9YY;M128~RV`!b1TFwPh$Hia-
tQeuRm#K^j&Jf91MLCT7`7>o^cjC71K)EQfsWE7>QazV)4{GwE-1^{d2D<=Q|
literal 0
HcmV?d00001
diff --git a/tests/ts/dmesg/kmsg-input b/tests/ts/dmesg/kmsg-input
index b000f4c951ccdcec96c820d37efc64ac8b68a93c..c08331dbf2bfdc9622105e120be99e448cfa89ea 100644
GIT binary patch
literal 3944
zcmbtXYg5};66G_$qO0-&sK`QBZz=1o1>*#71<=}%Ns6Uh*V47E89lsu@R(mer)3jN
zD9C0P;j&(R`rN*Ky4!|k;OKq$oEGgp-Kwfi%Yt0p)$N|F;-%;b+RymmKlrjcJD~kV
z9Mk@%!Qg;|rJK4S(=aW=H-tu?&aWs-@D$(2Fl^GSJ|I)Kg>D?sJ3*7Ph@$aucotnw
zPrjWWos9-`Ru&o=Hl3)rgCfHS%^(y3y*Kc;yCXC{dLIU5p35R35K$qeMcPzJ|KImc
z+{R_1^fX^=-|U{td|vlD;@#uwj^gTJ)g<aRjaB~;--pF*u8cygtgwEl8<mGiTF0_V
zs4B~5{YoxZD^(q?pYQIN8Xvt6$D@l$Z&j7IX`&KZEg$MMmKlwY&IlIa?vADLv3XJX
zrV-M0u5vQ&d12dsy=S)qHJ{IKsIBEJQ@cC1#>Y=!f;sS>!_0sJm`c^Ex>d>Uj-&DM
zHjwCOZ36|8aklul8Xs@M1hbbg$p+?$kEikRHjsJ=#L;=q$JhLyz;JY)$0wLu9H1LI
z8bl*H|1#O#akT))+kEC${2a(OE$2r*!qD*l77(o59~jxTvjKXFkgHjSp_zto4GvVD
zuR=Pm(qe&sYFAXNxGWM`J<uS!s!7*%UWElMZrjX|$syhQE{t)?wk$-L&eKI($p*Sd
zy4sp0*f4NCLyJEU3zptl_&E4@9kM{`3)8iDbsIKiyI3|%Mo<AAY9!o_4d<I>dU)Rn
zEY26%CMkF{4=dF-v3Tlk><iB@1Je~=pc}#o#X(4QBOBFc1*bAg|Ae}_SEs6AMI?QL
zle#ZDMy9{^!0~C8s>)?Hg;GNrt3?VySFqmPr$vb>SCkd)&1G6m>!qyJUbk>-&C_L`
z!}H<z)3<3f9Dkf1kB%lGO;kfoNqaB_{GLX4vZg)MggM_RVg_+F+k)I(&vlpzXH`gC
zou-rHsU8hRhW;rMfqs5E5_<I87_jH+j#lNJs(3kNTg4DN!(by^-xVy?S7E-M4(y-6
zApD+d30~5VFyr4ozwRCh1Us86*Gs$O*X=ymd6xHNhegvE3CAg$EEHXH6mDogDRY??
zsPo8y>sedltOq3?tXJ=^VOY^JUZoVBN5+xihiD5ly_gI_x|mSiu2yB$)O0<(Z&ZN-
zJm|8SjwaC=4YD%+1K$(1$W?*2&L$%oo{Z@<`r5lh{#iG>G`TvSe4AVj&-(0UmrjOX
zMuTDhJzs@SPS>OYCgr$X9bO@|%4EaoKuM`;D4}`eNY|6oXmDCKtE^qn(Qy2WzHNhj
z2S~10eIp=6iQZNgO;u(H3IeSjJw|6k;_HE2$yu7E%>#YD9MefO_*EhTM10%fo#Cxr
zmUTn3_0~ci>y5-NanD8?+vfUpj@c?sr(4g%uDNy=kC{)`X-S*T$lWKNdvuo;NqP5-
z<p$_!w>CH6bjvez2%;_z4Zq+y=^6yr^8d}Vurx0~2eAU*ad|*!(Ris)&0SgjL5Wm3
z#;fl|t*g4&vV4`P2Es>4^(_;9!?uNEcJ;NJN0MuCgNnF5C)2TYuP5|*Yz0)cMZv`!
zT3SD+90hm-WobfmP&_(p%sZ$PxQiREsTk@~K5r|<-J$2&XdfL9TN7qy%r$7+c>LsY
zJ%Bx0IGV5=Fb_C8wk=MPC56ltdR13M{}#&zMZJ)J?|PMw)*u|$7QV}CZtEFYJ!@TL
zt|rH{9@S`Gwnd^*ntXxS%c?IVWP!`5Dw8&D`i9{7a~3Bj>(P#cF2uIR0sK8_V&Mm&
z>7b)oh`FZ;*9|y-;D4ejw45$8^EPWz#1_q{Kp$!pt!mXK<s+q}O3_Vdbbe_$=v!Q#
zR8^t5^oHkOM;9TD#{YtOqVBuS*sRx}Z<Bhg8Q+<`f4mbu!7|GLeN=c}H=J>Ni)6Y?
z<TNcBm34KL-HW-7zzr_O$KA|_Xs5X<+vc6Ab$7=R^~rS{%R$S-tm9y;_A!;NSH9V^
z-tTBch0Ky`&$N(uV-+i`God(3QA&aQpH@Nl5d1uA>m?^4`=N~;Hr2L)jXA;a?YFT%
zrkSF{TUi}u<>GJya43;_N(QDi<NP%OTqlm>C60_83sb^o4%avDLqb*6t~j9)`?iQP
zC5!BV>Sf!Y7T@8=MTNN`XQA+~he{#FF|L>?N5R7U;5(*eZ)NU}QFuu*@g%h9$=Fb6
z*rvosx%?$9C6#^1+VAmxJ@O3cpX<odoR^K~HAza+`5Yq(0$X!nF-lO;<}=Q#6A&*k
z2yLi>sjZo|?+KtH2cqG}(dS`ES4EvJ3amaF(hRby9ynoyiHxzVK=?+$W$^#c7+1rL
z29?`(fL-vpFl@xCi||ns^R&wEFjP^zl*IzSIkvj&O9ci2HwwU_1lSIC0?T_2+f@Mk
z9xICibxM15vk8%H|Cjgy@V&stHghxDqRkW7TUEwW^X)3*8n*YW%2>K(yvYIM`|e+I
CU~KgO
delta 113
zcmaDMx0s*NbRy$&Rx=$#9fOH$yMYWN9fQfXj4CW<I>tJa<Cx_pH#4dNIVKR!DMoc5
m#}vX5X3_+!h++Z>nnMH^Lj_+kX@ez=nYDnl`{n@F|I7fH$sSVx
--
2.43.0
^ permalink raw reply related
* [PATCH] Add standard dmesg kmsg interface tests Issue: #2663 patch #2
From: Edward Chron @ 2024-01-04 20:11 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
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
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Revision: no caller optional fields in any of the kmsg-input entries
Revision: retrofitted to apply on top of Issue: #2609 and Issue #2637
This is patch 2 of 2 (second in the series)
A second patch needed to hold 2nd binary file (git binary files issue)
This patch is needed because git format does not produce correct
output if two binary files are included in the same patch.
So adding the second binary file in a second patch to resolve the
issue.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
tests/ts/dmesg/kmsg-newlines | Bin 0 -> 182 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 tests/ts/dmesg/kmsg-newlines
diff --git a/tests/ts/dmesg/kmsg-newlines b/tests/ts/dmesg/kmsg-newlines
new file mode 100644
index 0000000000000000000000000000000000000000..a1f96c562ec4da27e24117908a7a1e78f10f9f97
GIT binary patch
literal 182
zcmZ9GQ3`-C3`6(bQ+R*~-JJO0c`6EOVNL{3?>7CJf##!mg!EuoE<!u5%P!3=LCM(k
zhpQ9ag)&0MF&uoI#!D$*CJr(kqr>n+<{(0`_@?1)ORQ&j*x!yx&p^cr8s&&zH$C?_
BGAjT8
literal 0
HcmV?d00001
--
2.43.0
^ permalink raw reply
* [PATCH] Add standard dmesg kmsg interface tests Issue: #2663
From: Edward Chron @ 2024-01-04 20:10 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
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
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Revision: no caller optional fields in any of the kmsg-input entries
Revision: retrofitted to apply on top of Issue: #2609 and Issue #2637
This is patch 1 of 2 (first in the series)
Second patch needed to hold second binary file (git binary files issue)
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.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
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-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
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 : ^[[32m[ 0.000000] ^[[0mLinux 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^[[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^[[1m^[[31mBIOS-provided physical RAM map:^[[0m
+kern :err : ^[[32m[ 0.000003] ^[[0m^[[33mBIOS-e820: ^[[0m^[[31m[mem 0x0000000000000000-0x000000000009efff] usable^[[0m
+kern :warn : ^[[32m[ 0.000004] ^[[0m^[[33mBIOS-e820: ^[[0m^[[1m[mem 0x000000000009f000-0x00000000000bffff] reserved^[[0m
+kern :notice: ^[[32m[ 0.000005] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000000100000-0x0000000009afffff] usable
+kern :info : ^[[32m[ 0.000006] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009b00000-0x0000000009dfffff] reserved
+kern :debug : ^[[32m[ 0.000007] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009e00000-0x0000000009efffff] usable
+kern :info : ^[[32m[ 0.000008] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+kern :info : ^[[32m[ 0.000009] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000009f3c000-0x000000004235ffff] usable
+kern :info : ^[[32m[ 0.000010] ^[[0m^[[33mBIOS-e820: ^[[0m[mem 0x0000000042360000-0x000000004455ffff] reserved
+kern :info : ^[[32m[ 0.201607] ^[[0m^[[33msmp: ^[[0mBringing up secondary CPUs ...
+kern :info : ^[[32m[ 0.201607] ^[[0m^[[33msmpboot: ^[[0mx86: Booting SMP configuration:
+kern :warn : ^[[32m[ 0.209670] ^[[0m^[[1m #1 #3 #5 #7^[[0m
+kern :info : ^[[32m[ 0.212630] ^[[0m^[[33msmp: ^[[0mBrought up 1 node, 16 CPUs
+kern :notice: ^[[32m[ 0.215936] ^[[0m^[[33maudit: ^[[0mtype=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+kern :info : ^[[32m[ 0.215937] ^[[0m^[[33mthermal_sys: ^[[0mRegistered thermal governor 'fair_share'
+kern :warn : ^[[32m[ 0.215966] ^[[0m^[[33mENERGY_PERF_BIAS: ^[[0m^[[1mSet to 'normal', was 'performance'^[[0m
+kern :info : ^[[32m[ 0.367657] ^[[0m^[[33mACPI: ^[[0m\_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+kern :info : ^[[32m[ 0.368615] ^[[0m^[[33mACPI: ^[[0m\_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+kern :info : ^[[32m[ 0.376316] ^[[0m^[[33mACPI: ^[[0m\_SB_.PRWL: New power resource
+kern :info : ^[[32m[ 0.376343] ^[[0m^[[33mACPI: ^[[0m\_SB_.PRWB: New power resource
+kern :info : ^[[32m[ 0.377373] ^[[0m^[[33mACPI: ^[[0mPCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+kern :info : ^[[32m[ 0.377378] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+kern :info : ^[[32m[ 0.377569] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: platform does not support [SHPCHotplug AER]
+kern :info : ^[[32m[ 0.377933] ^[[0m^[[33macpi PNP0A08:00: ^[[0m_OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+kern :info : ^[[32m[ 0.378458] ^[[0mPCI host bridge to bus 0000:00
+kern :info : ^[[32m[ 0.378459] ^[[0m^[[33mpci_bus 0000:00: ^[[0mroot bus resource [io 0x0000-0x0cf7 window]
+kern :info : ^[[32m[ 0.378461] ^[[0m^[[33mpci_bus 0000:00: ^[[0mroot bus resource [io 0x0d00-0xffff window]
+user :notice: ^[[32m[ 9.398562] ^[[0muser network daemon initialization complete
+daemon:info : ^[[32m[ 10.441520] ^[[0m^[[33msystemd[1]: ^[[0msystemd 254.7-1.fc39 running in system mode
+daemon:info : ^[[32m[ 11.441524] ^[[0m^[[33msystemd[1]: ^[[0mDetected architecture x86-64.
+daemon:info : ^[[32m[ 12.441525] ^[[0m^[[33msystemd[1]: ^[[0mRunning in initrd.
+daemon:info : ^[[32m[ 13.541598] ^[[0m^[[33msystemd[1]: ^[[0mHostname set to <catalina>.
+kern :info : ^[[32m[ 15.641860] ^[[0m^[[33musb 3-3: ^[[0mNew USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+kern :err : ^[[32m[ 16.690000] ^[[0m^[[33mSerial bus multi instantiate pseudo device driver INT3515:00: ^[[0m^[[31merror -ENXIO: IRQ index 1 not found.^[[0m
+kern :err : ^[[32m[ 17.710000] ^[[0m^[[33msnd_hda_intel 0000:00:1f.3: ^[[0m^[[31mCORB reset timeout#2, CORBRP = 65535^[[0m
+syslog:info : ^[[32m[ 18.820000] ^[[0m^[[33msystemd-journald[723]: ^[[0mReceived client request to flush runtime journal.
+syslog:warn : ^[[32m[ 20.840000] ^[[0m^[[33msystemd-journald[723]: ^[[0m^[[1mFile /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.^[[0m
+syslog:info : ^[[32m[ 21.852348] ^[[0m^[[33msystemd-journald[723]: ^[[0m/var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+kern :warn : ^[[32m[ 24.871100] ^[[0m^[[33mPEFILE: ^[[0m^[[1mUnsigned PE binary^[[0m
+kern :err : ^[[32m[ 33.918091] ^[[0m^[[33msnd_hda_intel 0000:00:1f.3: ^[[0m^[[31mCORB reset timeout#2, CORBRP = 65535^[[0m
+kern :info : ^[[32m[ 144.931785] ^[[0m^[[33musb 3-3.1: ^[[0mdevice firmware changed
+kern :info : ^[[32m[ 145.953248] ^[[0m^[[33musb 3-3.1: ^[[0mUSB disconnect, device number 44
+kern :info : ^[[32m[ 147.981859] ^[[0m^[[33musb 3-3.1: ^[[0mNew 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-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
^ permalink raw reply related
* [PATCH] Add dmesg syslog interface caller_id tests Issue: #2637
From: Edward Chron @ 2024-01-04 20:10 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
Submission to Project: util-linux
Open Incident: #2637 at github.com/util-linux/util-linux/issues/2637
Component: util-linux/sys-utils
Files: tests/ts/dmesg syslog interface caller-id files, tests
and related expected files
Testing on Fedora 39 with Linux-6.6.6 Kernel and CONFIG_PRINTK_CALLER
config option set.
Patch tested and generated with the latest util-linux code pulled.
Retro-fitted to merge on top of the patch for Issue: #2609
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.
Currently, dmesg only has standard syslog interface tests even though
dmesg -S the syslog interface supports the caller_id field. There
are no syslog caller-id tests.
We would like syslog caller-id tests both to validate that the dmesg
code works correctly with the caller-id field being present and also
to compare against the addition of dmesg kmsg caller_id support added
by Issue #2609.
These tests are for the dmesg syslog interface with caller-id follow the
existing test structure for dmesg tests. The existing dmesg -F interface
is used to input our test files.
Until Thomas added a dmesg kmsg interface for json format testing
there were no dmesg tests except the tests for the generic dmesg
syslog tests. So we're naming the syslog caller-id tests to follow
the test naming convention that Thomas introduced.
For caller_id tests we prefix the test name with cid- abbreviating
the caller_id name to keep the names short. There is no unqiue
indentifier for syslog tests, so syslog tests are currently:
colors, console-levels, decode, delta, facilities, indentation,
limit, json
The cid versions of these test files are just prefixed with cid-
The patch for Issue: #2609 has the files:
cid-input and cid-json and the expected file for cide-json
Additional new dmesg tests are found with Issue #2663 which add
standard dmesg kmsg interface tests providing equivalent tests to
the existing dmesg syslog interface tests.
Also, Issue #2609 introduces dmesg kmsg interface caller-id tests
equivalent to the dmesg syslog interface with caller-id tests introduced
here along with the necessary dmesg kmsg interface caller-id support
needed to accomodate the PRINTK_CALLER id field.
Just for reference, on a Linux system with the CONFIG_PRINTK_CALLER
configuration option set the output from dmesg -S looks like:
[ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
on a system where the PRINTK_CALLER configuration option is not set the
output looks like:
[ 520.899558] hub 3-3:1.0: USB hub found
the additional field specifies either a Thread Id or CPU id depending on
the context of the task or thread at the time the printk that added the
message to the kernel ring buffer was executed.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
tests/expected/dmesg/cid-colors | 106 ++++++++++
tests/expected/dmesg/cid-console-levels | 253 ++++++++++++++++++++++++
tests/expected/dmesg/cid-decode | 106 ++++++++++
tests/expected/dmesg/cid-delta | 106 ++++++++++
tests/expected/dmesg/cid-facilities | 104 ++++++++++
tests/expected/dmesg/cid-indentation | 35 ++++
tests/expected/dmesg/cid-limit | 4 +
tests/ts/dmesg/cid-colors | 29 +++
tests/ts/dmesg/cid-console-levels | 36 ++++
tests/ts/dmesg/cid-decode | 28 +++
tests/ts/dmesg/cid-delta | 27 +++
tests/ts/dmesg/cid-facilities | 30 +++
tests/ts/dmesg/cid-indentation | 40 ++++
tests/ts/dmesg/cid-limit | 29 +++
tests/ts/dmesg/cid-newlines | 5 +
15 files changed, 938 insertions(+)
create mode 100644 tests/expected/dmesg/cid-colors
create mode 100644 tests/expected/dmesg/cid-console-levels
create mode 100644 tests/expected/dmesg/cid-decode
create mode 100644 tests/expected/dmesg/cid-delta
create mode 100644 tests/expected/dmesg/cid-facilities
create mode 100644 tests/expected/dmesg/cid-indentation
create mode 100644 tests/expected/dmesg/cid-limit
create mode 100755 tests/ts/dmesg/cid-colors
create mode 100755 tests/ts/dmesg/cid-console-levels
create mode 100755 tests/ts/dmesg/cid-decode
create mode 100755 tests/ts/dmesg/cid-delta
create mode 100755 tests/ts/dmesg/cid-facilities
create mode 100755 tests/ts/dmesg/cid-indentation
create mode 100755 tests/ts/dmesg/cid-limit
create mode 100644 tests/ts/dmesg/cid-newlines
diff --git a/tests/expected/dmesg/cid-colors b/tests/expected/dmesg/cid-colors
new file mode 100644
index 000000000..3b7aff6d7
--- /dev/null
+++ b/tests/expected/dmesg/cid-colors
@@ -0,0 +1,106 @@
+kern :emerg : ^[[32m[ 0.000000] ^[[0m[ T0] example[0]
+kern :alert : ^[[32m[ 1.000000] ^[[0m[ T1] ^[[7m^[[31mexample[1]^[[0m
+kern :crit : ^[[32m[ 8.000000] ^[[0m[ T2] ^[[1m^[[31mexample[2]^[[0m
+kern :err : ^[[32m[ 27.000000] ^[[0m[ T3] ^[[31mexample[3]^[[0m
+kern :warn : ^[[32m[ 64.000000] ^[[0m[ T4] ^[[1mexample[4]^[[0m
+kern :notice: ^[[32m[ 125.000000] ^[[0m[ T5] example[5]
+kern :info : ^[[32m[ 216.000000] ^[[0m[ T6] example[6]
+kern :debug : ^[[32m[ 343.000000] ^[[0m[ T7] example[7]
+user :emerg : ^[[32m[ 512.000000] ^[[0m[ T8] example[8]
+user :alert : ^[[32m[ 729.000000] ^[[0m[ T9] ^[[7m^[[31mexample[9]^[[0m
+user :crit : ^[[32m[ 1000.000000] ^[[0m[ T10] ^[[1m^[[31mexample[10]^[[0m
+user :err : ^[[32m[ 1331.000000] ^[[0m[ T11] ^[[31mexample[11]^[[0m
+user :warn : ^[[32m[ 1728.000000] ^[[0m[ T12] ^[[1mexample[12]^[[0m
+user :notice: ^[[32m[ 2197.000000] ^[[0m[ T13] example[13]
+user :info : ^[[32m[ 2744.000000] ^[[0m[ T14] example[14]
+user :debug : ^[[32m[ 3375.000000] ^[[0m[ T15] example[15]
+mail :emerg : ^[[32m[ 4096.000000] ^[[0m[ T16] example[16]
+mail :alert : ^[[32m[ 4913.000000] ^[[0m[ T17] ^[[7m^[[31mexample[17]^[[0m
+mail :crit : ^[[32m[ 5832.000000] ^[[0m[ T18] ^[[1m^[[31mexample[18]^[[0m
+mail :err : ^[[32m[ 6859.000000] ^[[0m[ T19] ^[[31mexample[19]^[[0m
+mail :warn : ^[[32m[ 8000.000000] ^[[0m[ T20] ^[[1mexample[20]^[[0m
+mail :notice: ^[[32m[ 9261.000000] ^[[0m[ T21] example[21]
+mail :info : ^[[32m[10648.000000] ^[[0m[ T22] example[22]
+mail :debug : ^[[32m[12167.000000] ^[[0m[ T23] example[23]
+daemon:emerg : ^[[32m[13824.000000] ^[[0m[ T24] example[24]
+daemon:alert : ^[[32m[15625.000000] ^[[0m[ T25] ^[[7m^[[31mexample[25]^[[0m
+daemon:crit : ^[[32m[17576.000000] ^[[0m[ T26] ^[[1m^[[31mexample[26]^[[0m
+daemon:err : ^[[32m[19683.000000] ^[[0m[ T27] ^[[31mexample[27]^[[0m
+daemon:warn : ^[[32m[21952.000000] ^[[0m[ T28] ^[[1mexample[28]^[[0m
+daemon:notice: ^[[32m[24389.000000] ^[[0m[ T29] example[29]
+daemon:info : ^[[32m[27000.000000] ^[[0m[ T10] example[30]
+daemon:debug : ^[[32m[29791.000000] ^[[0m[ T31] example[31]
+auth :emerg : ^[[32m[32768.000000] ^[[0m[ T32] example[32]
+auth :alert : ^[[32m[35937.000000] ^[[0m[ T33] ^[[7m^[[31mexample[33]^[[0m
+auth :crit : ^[[32m[39304.000000] ^[[0m[ T34] ^[[1m^[[31mexample[34]^[[0m
+auth :err : ^[[32m[42875.000000] ^[[0m[ T35] ^[[31mexample[35]^[[0m
+auth :warn : ^[[32m[46656.000000] ^[[0m[ T36] ^[[1mexample[36]^[[0m
+auth :notice: ^[[32m[50653.000000] ^[[0m[ T37] example[37]
+auth :info : ^[[32m[54872.000000] ^[[0m[ T38] example[38]
+auth :debug : ^[[32m[59319.000000] ^[[0m[ T39] example[39]
+syslog:emerg : ^[[32m[64000.000000] ^[[0m[ T40] example[40]
+syslog:alert : ^[[32m[68921.000000] ^[[0m[ T41] ^[[7m^[[31mexample[41]^[[0m
+syslog:crit : ^[[32m[74088.000000] ^[[0m[ T42] ^[[1m^[[31mexample[42]^[[0m
+syslog:err : ^[[32m[79507.000000] ^[[0m[ T43] ^[[31mexample[43]^[[0m
+syslog:warn : ^[[32m[85184.000000] ^[[0m[ T44] ^[[1mexample[44]^[[0m
+syslog:notice: ^[[32m[91125.000000] ^[[0m[ T45] example[45]
+syslog:info : ^[[32m[97336.000000] ^[[0m[ T46] example[46]
+syslog:debug : ^[[32m[103823.000000] ^[[0m[ T47] example[47]
+lpr :emerg : ^[[32m[110592.000000] ^[[0m[ T48] example[48]
+lpr :alert : ^[[32m[117649.000000] ^[[0m[ T49] ^[[7m^[[31mexample[49]^[[0m
+lpr :crit : ^[[32m[125000.000000] ^[[0m[ T50] ^[[1m^[[31mexample[50]^[[0m
+lpr :err : ^[[32m[132651.000000] ^[[0m[ T51] ^[[31mexample[51]^[[0m
+lpr :warn : ^[[32m[140608.000000] ^[[0m[ T52] ^[[1mexample[52]^[[0m
+lpr :notice: ^[[32m[148877.000000] ^[[0m[ T53] example[53]
+lpr :info : ^[[32m[157464.000000] ^[[0m[ T54] example[54]
+lpr :debug : ^[[32m[166375.000000] ^[[0m[ T55] example[55]
+news :emerg : ^[[32m[175616.000000] ^[[0m[ T56] example[56]
+news :alert : ^[[32m[185193.000000] ^[[0m[ T57] ^[[7m^[[31mexample[57]^[[0m
+news :crit : ^[[32m[195112.000000] ^[[0m[ T58] ^[[1m^[[31mexample[58]^[[0m
+news :err : ^[[32m[205379.000000] ^[[0m[ T59] ^[[31mexample[59]^[[0m
+news :warn : ^[[32m[216000.000000] ^[[0m[ T60] ^[[1mexample[60]^[[0m
+news :notice: ^[[32m[226981.000000] ^[[0m[ T61] example[61]
+news :info : ^[[32m[238328.000000] ^[[0m[ T62] example[62]
+news :debug : ^[[32m[250047.000000] ^[[0m[ T63] example[63]
+uucp :emerg : ^[[32m[262144.000000] ^[[0m[ T64] example[64]
+uucp :alert : ^[[32m[274625.000000] ^[[0m[ T65] ^[[7m^[[31mexample[65]^[[0m
+uucp :crit : ^[[32m[287496.000000] ^[[0m[ T66] ^[[1m^[[31mexample[66]^[[0m
+uucp :err : ^[[32m[300763.000000] ^[[0m[ T67] ^[[31mexample[67]^[[0m
+uucp :warn : ^[[32m[314432.000000] ^[[0m[ T68] ^[[1mexample[68]^[[0m
+uucp :notice: ^[[32m[328509.000000] ^[[0m[ T69] example[69]
+uucp :info : ^[[32m[343000.000000] ^[[0m[ T70] example[70]
+uucp :debug : ^[[32m[357911.000000] ^[[0m[ T71] example[71]
+cron :emerg : ^[[32m[373248.000000] ^[[0m[ T72] example[72]
+cron :alert : ^[[32m[389017.000000] ^[[0m[ T73] ^[[7m^[[31mexample[73]^[[0m
+cron :crit : ^[[32m[405224.000000] ^[[0m[ T74] ^[[1m^[[31mexample[74]^[[0m
+cron :err : ^[[32m[421875.000000] ^[[0m[ T75] ^[[31mexample[75]^[[0m
+cron :warn : ^[[32m[438976.000000] ^[[0m[ T76] ^[[1mexample[76]^[[0m
+cron :notice: ^[[32m[456533.000000] ^[[0m[ T77] example[77]
+cron :info : ^[[32m[474552.000000] ^[[0m[ T78] example[78]
+cron :debug : ^[[32m[493039.000000] ^[[0m[ T79] example[79]
+authpriv:emerg : ^[[32m[512000.000000] ^[[0m[ T80] example[80]
+authpriv:alert : ^[[32m[531441.000000] ^[[0m[ T81] ^[[7m^[[31mexample[81]^[[0m
+authpriv:crit : ^[[32m[551368.000000] ^[[0m[ T82] ^[[1m^[[31mexample[82]^[[0m
+authpriv:err : ^[[32m[571787.000000] ^[[0m[ T83] ^[[31mexample[83]^[[0m
+authpriv:warn : ^[[32m[592704.000000] ^[[0m[ T84] ^[[1mexample[84]^[[0m
+authpriv:notice: ^[[32m[614125.000000] ^[[0m[ T85] example[85]
+authpriv:info : ^[[32m[636056.000000] ^[[0m[ T86] example[86]
+authpriv:debug : ^[[32m[658503.000000] ^[[0m[ T87] example[87]
+ftp :emerg : ^[[32m[681472.000000] ^[[0m[ T88] example[88]
+ftp :alert : ^[[32m[704969.000000] ^[[0m[ T89] ^[[7m^[[31mexample[89]^[[0m
+ftp :crit : ^[[32m[729000.000000] ^[[0m[ T90] ^[[1m^[[31mexample[90]^[[0m
+ftp :err : ^[[32m[753571.000000] ^[[0m[ T91] ^[[31mexample[91]^[[0m
+ftp :warn : ^[[32m[778688.000000] ^[[0m[ T92] ^[[1mexample[92]^[[0m
+ftp :notice: ^[[32m[804357.000000] ^[[0m[ T93] example[93]
+ftp :info : ^[[32m[830584.000000] ^[[0m[ T94] example[94]
+ftp :debug : ^[[32m[857375.000000] ^[[0m[ T95] example[95]
+res0 :emerg : ^[[32m[884736.000000] ^[[0m[ T96] example[96]
+res0 :alert : ^[[32m[912673.000000] ^[[0m[ T97] ^[[7m^[[31mexample[97]^[[0m
+res0 :crit : ^[[32m[941192.000000] ^[[0m[ T98] ^[[1m^[[31mexample[98]^[[0m
+res0 :err : ^[[32m[970299.000000] ^[[0m[ T99] ^[[31mexample[99]^[[0m
+res0 :warn : ^[[32m[1000000.000000] ^[[0m[ T100] ^[[1mexample[100]^[[0m
+res0 :notice: ^[[32m[1030301.000000] ^[[0m[ T101] example[101]
+res0 :info : ^[[32m[1061208.000000] ^[[0m[ T102] example[102]
+res0 :debug : ^[[32m[1092727.000000] ^[[0m[ T103] example[103]
+res1 :emerg : ^[[32m[1124864.000000] ^[[0m[ T104] example[104]
+local2:info : ^[[32m[4557523.000000] ^[[0m[ T105] example[105]
diff --git a/tests/expected/dmesg/cid-console-levels b/tests/expected/dmesg/cid-console-levels
new file mode 100644
index 000000000..9fe993b20
--- /dev/null
+++ b/tests/expected/dmesg/cid-console-levels
@@ -0,0 +1,253 @@
+[ 0.000000] [ T0] example[0]
+[ 512.000000] [ T8] example[8]
+[ 4096.000000] [ T16] example[16]
+[13824.000000] [ T24] example[24]
+[32768.000000] [ T32] example[32]
+[64000.000000] [ T40] example[40]
+[110592.000000] [ T48] example[48]
+[175616.000000] [ T56] example[56]
+[262144.000000] [ T64] example[64]
+[373248.000000] [ T72] example[72]
+[512000.000000] [ T80] example[80]
+[681472.000000] [ T88] example[88]
+[884736.000000] [ T96] example[96]
+[1124864.000000] [ T104] example[104]
+[ 1.000000] [ T1] example[1]
+[ 729.000000] [ T9] example[9]
+[ 4913.000000] [ T17] example[17]
+[15625.000000] [ T25] example[25]
+[35937.000000] [ T33] example[33]
+[68921.000000] [ T41] example[41]
+[117649.000000] [ T49] example[49]
+[185193.000000] [ T57] example[57]
+[274625.000000] [ T65] example[65]
+[389017.000000] [ T73] example[73]
+[531441.000000] [ T81] example[81]
+[704969.000000] [ T89] example[89]
+[912673.000000] [ T97] example[97]
+[ 8.000000] [ T2] example[2]
+[ 1000.000000] [ T10] example[10]
+[ 5832.000000] [ T18] example[18]
+[17576.000000] [ T26] example[26]
+[39304.000000] [ T34] example[34]
+[74088.000000] [ T42] example[42]
+[125000.000000] [ T50] example[50]
+[195112.000000] [ T58] example[58]
+[287496.000000] [ T66] example[66]
+[405224.000000] [ T74] example[74]
+[551368.000000] [ T82] example[82]
+[729000.000000] [ T90] example[90]
+[941192.000000] [ T98] example[98]
+[ 27.000000] [ T3] example[3]
+[ 1331.000000] [ T11] example[11]
+[ 6859.000000] [ T19] example[19]
+[19683.000000] [ T27] example[27]
+[42875.000000] [ T35] example[35]
+[79507.000000] [ T43] example[43]
+[132651.000000] [ T51] example[51]
+[205379.000000] [ T59] example[59]
+[300763.000000] [ T67] example[67]
+[421875.000000] [ T75] example[75]
+[571787.000000] [ T83] example[83]
+[753571.000000] [ T91] example[91]
+[970299.000000] [ T99] example[99]
+[ 64.000000] [ T4] example[4]
+[ 1728.000000] [ T12] example[12]
+[ 8000.000000] [ T20] example[20]
+[21952.000000] [ T28] example[28]
+[46656.000000] [ T36] example[36]
+[85184.000000] [ T44] example[44]
+[140608.000000] [ T52] example[52]
+[216000.000000] [ T60] example[60]
+[314432.000000] [ T68] example[68]
+[438976.000000] [ T76] example[76]
+[592704.000000] [ T84] example[84]
+[778688.000000] [ T92] example[92]
+[1000000.000000] [ T100] example[100]
+[ 125.000000] [ T5] example[5]
+[ 2197.000000] [ T13] example[13]
+[ 9261.000000] [ T21] example[21]
+[24389.000000] [ T29] example[29]
+[50653.000000] [ T37] example[37]
+[91125.000000] [ T45] example[45]
+[148877.000000] [ T53] example[53]
+[226981.000000] [ T61] example[61]
+[328509.000000] [ T69] example[69]
+[456533.000000] [ T77] example[77]
+[614125.000000] [ T85] example[85]
+[804357.000000] [ T93] example[93]
+[1030301.000000] [ T101] example[101]
+[ 216.000000] [ T6] example[6]
+[ 2744.000000] [ T14] example[14]
+[10648.000000] [ T22] example[22]
+[27000.000000] [ T10] example[30]
+[54872.000000] [ T38] example[38]
+[97336.000000] [ T46] example[46]
+[157464.000000] [ T54] example[54]
+[238328.000000] [ T62] example[62]
+[343000.000000] [ T70] example[70]
+[474552.000000] [ T78] example[78]
+[636056.000000] [ T86] example[86]
+[830584.000000] [ T94] example[94]
+[1061208.000000] [ T102] example[102]
+[4557523.000000] [ T105] example[105]
+[ 343.000000] [ T7] example[7]
+[ 3375.000000] [ T15] example[15]
+[12167.000000] [ T23] example[23]
+[29791.000000] [ T31] example[31]
+[59319.000000] [ T39] example[39]
+[103823.000000] [ T47] example[47]
+[166375.000000] [ T55] example[55]
+[250047.000000] [ T63] example[63]
+[357911.000000] [ T71] example[71]
+[493039.000000] [ T79] example[79]
+[658503.000000] [ T87] example[87]
+[857375.000000] [ T95] example[95]
+[1092727.000000] [ T103] example[103]
+[ 0.000000] [ T0] example[0]
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 512.000000] [ T8] example[8]
+[ 729.000000] [ T9] example[9]
+[ 1000.000000] [ T10] example[10]
+[ 1331.000000] [ T11] example[11]
+[ 4096.000000] [ T16] example[16]
+[ 4913.000000] [ T17] example[17]
+[ 5832.000000] [ T18] example[18]
+[ 6859.000000] [ T19] example[19]
+[13824.000000] [ T24] example[24]
+[15625.000000] [ T25] example[25]
+[17576.000000] [ T26] example[26]
+[19683.000000] [ T27] example[27]
+[32768.000000] [ T32] example[32]
+[35937.000000] [ T33] example[33]
+[39304.000000] [ T34] example[34]
+[42875.000000] [ T35] example[35]
+[64000.000000] [ T40] example[40]
+[68921.000000] [ T41] example[41]
+[74088.000000] [ T42] example[42]
+[79507.000000] [ T43] example[43]
+[110592.000000] [ T48] example[48]
+[117649.000000] [ T49] example[49]
+[125000.000000] [ T50] example[50]
+[132651.000000] [ T51] example[51]
+[175616.000000] [ T56] example[56]
+[185193.000000] [ T57] example[57]
+[195112.000000] [ T58] example[58]
+[205379.000000] [ T59] example[59]
+[262144.000000] [ T64] example[64]
+[274625.000000] [ T65] example[65]
+[287496.000000] [ T66] example[66]
+[300763.000000] [ T67] example[67]
+[373248.000000] [ T72] example[72]
+[389017.000000] [ T73] example[73]
+[405224.000000] [ T74] example[74]
+[421875.000000] [ T75] example[75]
+[512000.000000] [ T80] example[80]
+[531441.000000] [ T81] example[81]
+[551368.000000] [ T82] example[82]
+[571787.000000] [ T83] example[83]
+[681472.000000] [ T88] example[88]
+[704969.000000] [ T89] example[89]
+[729000.000000] [ T90] example[90]
+[753571.000000] [ T91] example[91]
+[884736.000000] [ T96] example[96]
+[912673.000000] [ T97] example[97]
+[941192.000000] [ T98] example[98]
+[970299.000000] [ T99] example[99]
+[1124864.000000] [ T104] example[104]
+[ 0.000000] [ T0] example[0]
+[ 512.000000] [ T8] example[8]
+[ 4096.000000] [ T16] example[16]
+[13824.000000] [ T24] example[24]
+[32768.000000] [ T32] example[32]
+[64000.000000] [ T40] example[40]
+[110592.000000] [ T48] example[48]
+[175616.000000] [ T56] example[56]
+[262144.000000] [ T64] example[64]
+[373248.000000] [ T72] example[72]
+[512000.000000] [ T80] example[80]
+[681472.000000] [ T88] example[88]
+[884736.000000] [ T96] example[96]
+[1124864.000000] [ T104] example[104]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
+[ 125.000000] [ T5] example[5]
+[ 216.000000] [ T6] example[6]
+[ 343.000000] [ T7] example[7]
+[ 1331.000000] [ T11] example[11]
+[ 1728.000000] [ T12] example[12]
+[ 2197.000000] [ T13] example[13]
+[ 2744.000000] [ T14] example[14]
+[ 3375.000000] [ T15] example[15]
+[ 6859.000000] [ T19] example[19]
+[ 8000.000000] [ T20] example[20]
+[ 9261.000000] [ T21] example[21]
+[10648.000000] [ T22] example[22]
+[12167.000000] [ T23] example[23]
+[19683.000000] [ T27] example[27]
+[21952.000000] [ T28] example[28]
+[24389.000000] [ T29] example[29]
+[27000.000000] [ T10] example[30]
+[29791.000000] [ T31] example[31]
+[42875.000000] [ T35] example[35]
+[46656.000000] [ T36] example[36]
+[50653.000000] [ T37] example[37]
+[54872.000000] [ T38] example[38]
+[59319.000000] [ T39] example[39]
+[79507.000000] [ T43] example[43]
+[85184.000000] [ T44] example[44]
+[91125.000000] [ T45] example[45]
+[97336.000000] [ T46] example[46]
+[103823.000000] [ T47] example[47]
+[132651.000000] [ T51] example[51]
+[140608.000000] [ T52] example[52]
+[148877.000000] [ T53] example[53]
+[157464.000000] [ T54] example[54]
+[166375.000000] [ T55] example[55]
+[205379.000000] [ T59] example[59]
+[216000.000000] [ T60] example[60]
+[226981.000000] [ T61] example[61]
+[238328.000000] [ T62] example[62]
+[250047.000000] [ T63] example[63]
+[300763.000000] [ T67] example[67]
+[314432.000000] [ T68] example[68]
+[328509.000000] [ T69] example[69]
+[343000.000000] [ T70] example[70]
+[357911.000000] [ T71] example[71]
+[421875.000000] [ T75] example[75]
+[438976.000000] [ T76] example[76]
+[456533.000000] [ T77] example[77]
+[474552.000000] [ T78] example[78]
+[493039.000000] [ T79] example[79]
+[571787.000000] [ T83] example[83]
+[592704.000000] [ T84] example[84]
+[614125.000000] [ T85] example[85]
+[636056.000000] [ T86] example[86]
+[658503.000000] [ T87] example[87]
+[753571.000000] [ T91] example[91]
+[778688.000000] [ T92] example[92]
+[804357.000000] [ T93] example[93]
+[830584.000000] [ T94] example[94]
+[857375.000000] [ T95] example[95]
+[970299.000000] [ T99] example[99]
+[1000000.000000] [ T100] example[100]
+[1030301.000000] [ T101] example[101]
+[1061208.000000] [ T102] example[102]
+[1092727.000000] [ T103] example[103]
+[4557523.000000] [ T105] example[105]
+[ 343.000000] [ T7] example[7]
+[ 3375.000000] [ T15] example[15]
+[12167.000000] [ T23] example[23]
+[29791.000000] [ T31] example[31]
+[59319.000000] [ T39] example[39]
+[103823.000000] [ T47] example[47]
+[166375.000000] [ T55] example[55]
+[250047.000000] [ T63] example[63]
+[357911.000000] [ T71] example[71]
+[493039.000000] [ T79] example[79]
+[658503.000000] [ T87] example[87]
+[857375.000000] [ T95] example[95]
+[1092727.000000] [ T103] example[103]
+test_dmesg: unknown level '+'
diff --git a/tests/expected/dmesg/cid-decode b/tests/expected/dmesg/cid-decode
new file mode 100644
index 000000000..757b9284d
--- /dev/null
+++ b/tests/expected/dmesg/cid-decode
@@ -0,0 +1,106 @@
+kern :emerg : [ 0.000000] [ T0] example[0]
+kern :alert : [ 1.000000] [ T1] example[1]
+kern :crit : [ 8.000000] [ T2] example[2]
+kern :err : [ 27.000000] [ T3] example[3]
+kern :warn : [ 64.000000] [ T4] example[4]
+kern :notice: [ 125.000000] [ T5] example[5]
+kern :info : [ 216.000000] [ T6] example[6]
+kern :debug : [ 343.000000] [ T7] example[7]
+user :emerg : [ 512.000000] [ T8] example[8]
+user :alert : [ 729.000000] [ T9] example[9]
+user :crit : [ 1000.000000] [ T10] example[10]
+user :err : [ 1331.000000] [ T11] example[11]
+user :warn : [ 1728.000000] [ T12] example[12]
+user :notice: [ 2197.000000] [ T13] example[13]
+user :info : [ 2744.000000] [ T14] example[14]
+user :debug : [ 3375.000000] [ T15] example[15]
+mail :emerg : [ 4096.000000] [ T16] example[16]
+mail :alert : [ 4913.000000] [ T17] example[17]
+mail :crit : [ 5832.000000] [ T18] example[18]
+mail :err : [ 6859.000000] [ T19] example[19]
+mail :warn : [ 8000.000000] [ T20] example[20]
+mail :notice: [ 9261.000000] [ T21] example[21]
+mail :info : [10648.000000] [ T22] example[22]
+mail :debug : [12167.000000] [ T23] example[23]
+daemon:emerg : [13824.000000] [ T24] example[24]
+daemon:alert : [15625.000000] [ T25] example[25]
+daemon:crit : [17576.000000] [ T26] example[26]
+daemon:err : [19683.000000] [ T27] example[27]
+daemon:warn : [21952.000000] [ T28] example[28]
+daemon:notice: [24389.000000] [ T29] example[29]
+daemon:info : [27000.000000] [ T10] example[30]
+daemon:debug : [29791.000000] [ T31] example[31]
+auth :emerg : [32768.000000] [ T32] example[32]
+auth :alert : [35937.000000] [ T33] example[33]
+auth :crit : [39304.000000] [ T34] example[34]
+auth :err : [42875.000000] [ T35] example[35]
+auth :warn : [46656.000000] [ T36] example[36]
+auth :notice: [50653.000000] [ T37] example[37]
+auth :info : [54872.000000] [ T38] example[38]
+auth :debug : [59319.000000] [ T39] example[39]
+syslog:emerg : [64000.000000] [ T40] example[40]
+syslog:alert : [68921.000000] [ T41] example[41]
+syslog:crit : [74088.000000] [ T42] example[42]
+syslog:err : [79507.000000] [ T43] example[43]
+syslog:warn : [85184.000000] [ T44] example[44]
+syslog:notice: [91125.000000] [ T45] example[45]
+syslog:info : [97336.000000] [ T46] example[46]
+syslog:debug : [103823.000000] [ T47] example[47]
+lpr :emerg : [110592.000000] [ T48] example[48]
+lpr :alert : [117649.000000] [ T49] example[49]
+lpr :crit : [125000.000000] [ T50] example[50]
+lpr :err : [132651.000000] [ T51] example[51]
+lpr :warn : [140608.000000] [ T52] example[52]
+lpr :notice: [148877.000000] [ T53] example[53]
+lpr :info : [157464.000000] [ T54] example[54]
+lpr :debug : [166375.000000] [ T55] example[55]
+news :emerg : [175616.000000] [ T56] example[56]
+news :alert : [185193.000000] [ T57] example[57]
+news :crit : [195112.000000] [ T58] example[58]
+news :err : [205379.000000] [ T59] example[59]
+news :warn : [216000.000000] [ T60] example[60]
+news :notice: [226981.000000] [ T61] example[61]
+news :info : [238328.000000] [ T62] example[62]
+news :debug : [250047.000000] [ T63] example[63]
+uucp :emerg : [262144.000000] [ T64] example[64]
+uucp :alert : [274625.000000] [ T65] example[65]
+uucp :crit : [287496.000000] [ T66] example[66]
+uucp :err : [300763.000000] [ T67] example[67]
+uucp :warn : [314432.000000] [ T68] example[68]
+uucp :notice: [328509.000000] [ T69] example[69]
+uucp :info : [343000.000000] [ T70] example[70]
+uucp :debug : [357911.000000] [ T71] example[71]
+cron :emerg : [373248.000000] [ T72] example[72]
+cron :alert : [389017.000000] [ T73] example[73]
+cron :crit : [405224.000000] [ T74] example[74]
+cron :err : [421875.000000] [ T75] example[75]
+cron :warn : [438976.000000] [ T76] example[76]
+cron :notice: [456533.000000] [ T77] example[77]
+cron :info : [474552.000000] [ T78] example[78]
+cron :debug : [493039.000000] [ T79] example[79]
+authpriv:emerg : [512000.000000] [ T80] example[80]
+authpriv:alert : [531441.000000] [ T81] example[81]
+authpriv:crit : [551368.000000] [ T82] example[82]
+authpriv:err : [571787.000000] [ T83] example[83]
+authpriv:warn : [592704.000000] [ T84] example[84]
+authpriv:notice: [614125.000000] [ T85] example[85]
+authpriv:info : [636056.000000] [ T86] example[86]
+authpriv:debug : [658503.000000] [ T87] example[87]
+ftp :emerg : [681472.000000] [ T88] example[88]
+ftp :alert : [704969.000000] [ T89] example[89]
+ftp :crit : [729000.000000] [ T90] example[90]
+ftp :err : [753571.000000] [ T91] example[91]
+ftp :warn : [778688.000000] [ T92] example[92]
+ftp :notice: [804357.000000] [ T93] example[93]
+ftp :info : [830584.000000] [ T94] example[94]
+ftp :debug : [857375.000000] [ T95] example[95]
+res0 :emerg : [884736.000000] [ T96] example[96]
+res0 :alert : [912673.000000] [ T97] example[97]
+res0 :crit : [941192.000000] [ T98] example[98]
+res0 :err : [970299.000000] [ T99] example[99]
+res0 :warn : [1000000.000000] [ T100] example[100]
+res0 :notice: [1030301.000000] [ T101] example[101]
+res0 :info : [1061208.000000] [ T102] example[102]
+res0 :debug : [1092727.000000] [ T103] example[103]
+res1 :emerg : [1124864.000000] [ T104] example[104]
+local2:info : [4557523.000000] [ T105] example[105]
diff --git a/tests/expected/dmesg/cid-delta b/tests/expected/dmesg/cid-delta
new file mode 100644
index 000000000..9b75c63af
--- /dev/null
+++ b/tests/expected/dmesg/cid-delta
@@ -0,0 +1,106 @@
+[ 0.000000 < 0.000000>] [ T0] example[0]
+[ 1.000000 < 0.000000>] [ T1] example[1]
+[ 8.000000 < 7.000000>] [ T2] example[2]
+[ 27.000000 < 19.000000>] [ T3] example[3]
+[ 64.000000 < 37.000000>] [ T4] example[4]
+[ 125.000000 < 61.000000>] [ T5] example[5]
+[ 216.000000 < 91.000000>] [ T6] example[6]
+[ 343.000000 < 127.000000>] [ T7] example[7]
+[ 512.000000 < 169.000000>] [ T8] example[8]
+[ 729.000000 < 217.000000>] [ T9] example[9]
+[ 1000.000000 < 271.000000>] [ T10] example[10]
+[ 1331.000000 < 331.000000>] [ T11] example[11]
+[ 1728.000000 < 397.000000>] [ T12] example[12]
+[ 2197.000000 < 469.000000>] [ T13] example[13]
+[ 2744.000000 < 547.000000>] [ T14] example[14]
+[ 3375.000000 < 631.000000>] [ T15] example[15]
+[ 4096.000000 < 721.000000>] [ T16] example[16]
+[ 4913.000000 < 817.000000>] [ T17] example[17]
+[ 5832.000000 < 919.000000>] [ T18] example[18]
+[ 6859.000000 < 1027.000000>] [ T19] example[19]
+[ 8000.000000 < 1141.000000>] [ T20] example[20]
+[ 9261.000000 < 1261.000000>] [ T21] example[21]
+[10648.000000 < 1387.000000>] [ T22] example[22]
+[12167.000000 < 1519.000000>] [ T23] example[23]
+[13824.000000 < 1657.000000>] [ T24] example[24]
+[15625.000000 < 1801.000000>] [ T25] example[25]
+[17576.000000 < 1951.000000>] [ T26] example[26]
+[19683.000000 < 2107.000000>] [ T27] example[27]
+[21952.000000 < 2269.000000>] [ T28] example[28]
+[24389.000000 < 2437.000000>] [ T29] example[29]
+[27000.000000 < 2611.000000>] [ T10] example[30]
+[29791.000000 < 2791.000000>] [ T31] example[31]
+[32768.000000 < 2977.000000>] [ T32] example[32]
+[35937.000000 < 3169.000000>] [ T33] example[33]
+[39304.000000 < 3367.000000>] [ T34] example[34]
+[42875.000000 < 3571.000000>] [ T35] example[35]
+[46656.000000 < 3781.000000>] [ T36] example[36]
+[50653.000000 < 3997.000000>] [ T37] example[37]
+[54872.000000 < 4219.000000>] [ T38] example[38]
+[59319.000000 < 4447.000000>] [ T39] example[39]
+[64000.000000 < 4681.000000>] [ T40] example[40]
+[68921.000000 < 4921.000000>] [ T41] example[41]
+[74088.000000 < 5167.000000>] [ T42] example[42]
+[79507.000000 < 5419.000000>] [ T43] example[43]
+[85184.000000 < 5677.000000>] [ T44] example[44]
+[91125.000000 < 5941.000000>] [ T45] example[45]
+[97336.000000 < 6211.000000>] [ T46] example[46]
+[103823.000000 < 6487.000000>] [ T47] example[47]
+[110592.000000 < 6769.000000>] [ T48] example[48]
+[117649.000000 < 7057.000000>] [ T49] example[49]
+[125000.000000 < 7351.000000>] [ T50] example[50]
+[132651.000000 < 7651.000000>] [ T51] example[51]
+[140608.000000 < 7957.000000>] [ T52] example[52]
+[148877.000000 < 8269.000000>] [ T53] example[53]
+[157464.000000 < 8587.000000>] [ T54] example[54]
+[166375.000000 < 8911.000000>] [ T55] example[55]
+[175616.000000 < 9241.000000>] [ T56] example[56]
+[185193.000000 < 9577.000000>] [ T57] example[57]
+[195112.000000 < 9919.000000>] [ T58] example[58]
+[205379.000000 <10267.000000>] [ T59] example[59]
+[216000.000000 <10621.000000>] [ T60] example[60]
+[226981.000000 <10981.000000>] [ T61] example[61]
+[238328.000000 <11347.000000>] [ T62] example[62]
+[250047.000000 <11719.000000>] [ T63] example[63]
+[262144.000000 <12097.000000>] [ T64] example[64]
+[274625.000000 <12481.000000>] [ T65] example[65]
+[287496.000000 <12871.000000>] [ T66] example[66]
+[300763.000000 <13267.000000>] [ T67] example[67]
+[314432.000000 <13669.000000>] [ T68] example[68]
+[328509.000000 <14077.000000>] [ T69] example[69]
+[343000.000000 <14491.000000>] [ T70] example[70]
+[357911.000000 <14911.000000>] [ T71] example[71]
+[373248.000000 <15337.000000>] [ T72] example[72]
+[389017.000000 <15769.000000>] [ T73] example[73]
+[405224.000000 <16207.000000>] [ T74] example[74]
+[421875.000000 <16651.000000>] [ T75] example[75]
+[438976.000000 <17101.000000>] [ T76] example[76]
+[456533.000000 <17557.000000>] [ T77] example[77]
+[474552.000000 <18019.000000>] [ T78] example[78]
+[493039.000000 <18487.000000>] [ T79] example[79]
+[512000.000000 <18961.000000>] [ T80] example[80]
+[531441.000000 <19441.000000>] [ T81] example[81]
+[551368.000000 <19927.000000>] [ T82] example[82]
+[571787.000000 <20419.000000>] [ T83] example[83]
+[592704.000000 <20917.000000>] [ T84] example[84]
+[614125.000000 <21421.000000>] [ T85] example[85]
+[636056.000000 <21931.000000>] [ T86] example[86]
+[658503.000000 <22447.000000>] [ T87] example[87]
+[681472.000000 <22969.000000>] [ T88] example[88]
+[704969.000000 <23497.000000>] [ T89] example[89]
+[729000.000000 <24031.000000>] [ T90] example[90]
+[753571.000000 <24571.000000>] [ T91] example[91]
+[778688.000000 <25117.000000>] [ T92] example[92]
+[804357.000000 <25669.000000>] [ T93] example[93]
+[830584.000000 <26227.000000>] [ T94] example[94]
+[857375.000000 <26791.000000>] [ T95] example[95]
+[884736.000000 <27361.000000>] [ T96] example[96]
+[912673.000000 <27937.000000>] [ T97] example[97]
+[941192.000000 <28519.000000>] [ T98] example[98]
+[970299.000000 <29107.000000>] [ T99] example[99]
+[1000000.000000 <29701.000000>] [ T100] example[100]
+[1030301.000000 <30301.000000>] [ T101] example[101]
+[1061208.000000 <30907.000000>] [ T102] example[102]
+[1092727.000000 <31519.000000>] [ T103] example[103]
+[1124864.000000 <32137.000000>] [ T104] example[104]
+[4557523.000000 <3432659.000000>] [ T105] example[105]
diff --git a/tests/expected/dmesg/cid-facilities b/tests/expected/dmesg/cid-facilities
new file mode 100644
index 000000000..b8afa3809
--- /dev/null
+++ b/tests/expected/dmesg/cid-facilities
@@ -0,0 +1,104 @@
+[ 0.000000] [ T0] example[0]
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
+[ 125.000000] [ T5] example[5]
+[ 216.000000] [ T6] example[6]
+[ 343.000000] [ T7] example[7]
+[ 512.000000] [ T8] example[8]
+[ 729.000000] [ T9] example[9]
+[ 1000.000000] [ T10] example[10]
+[ 1331.000000] [ T11] example[11]
+[ 1728.000000] [ T12] example[12]
+[ 2197.000000] [ T13] example[13]
+[ 2744.000000] [ T14] example[14]
+[ 3375.000000] [ T15] example[15]
+[ 4096.000000] [ T16] example[16]
+[ 4913.000000] [ T17] example[17]
+[ 5832.000000] [ T18] example[18]
+[ 6859.000000] [ T19] example[19]
+[ 8000.000000] [ T20] example[20]
+[ 9261.000000] [ T21] example[21]
+[10648.000000] [ T22] example[22]
+[12167.000000] [ T23] example[23]
+[13824.000000] [ T24] example[24]
+[15625.000000] [ T25] example[25]
+[17576.000000] [ T26] example[26]
+[19683.000000] [ T27] example[27]
+[21952.000000] [ T28] example[28]
+[24389.000000] [ T29] example[29]
+[27000.000000] [ T10] example[30]
+[29791.000000] [ T31] example[31]
+[32768.000000] [ T32] example[32]
+[35937.000000] [ T33] example[33]
+[39304.000000] [ T34] example[34]
+[42875.000000] [ T35] example[35]
+[46656.000000] [ T36] example[36]
+[50653.000000] [ T37] example[37]
+[54872.000000] [ T38] example[38]
+[59319.000000] [ T39] example[39]
+[64000.000000] [ T40] example[40]
+[68921.000000] [ T41] example[41]
+[74088.000000] [ T42] example[42]
+[79507.000000] [ T43] example[43]
+[85184.000000] [ T44] example[44]
+[91125.000000] [ T45] example[45]
+[97336.000000] [ T46] example[46]
+[103823.000000] [ T47] example[47]
+[110592.000000] [ T48] example[48]
+[117649.000000] [ T49] example[49]
+[125000.000000] [ T50] example[50]
+[132651.000000] [ T51] example[51]
+[140608.000000] [ T52] example[52]
+[148877.000000] [ T53] example[53]
+[157464.000000] [ T54] example[54]
+[166375.000000] [ T55] example[55]
+[175616.000000] [ T56] example[56]
+[185193.000000] [ T57] example[57]
+[195112.000000] [ T58] example[58]
+[205379.000000] [ T59] example[59]
+[216000.000000] [ T60] example[60]
+[226981.000000] [ T61] example[61]
+[238328.000000] [ T62] example[62]
+[250047.000000] [ T63] example[63]
+[262144.000000] [ T64] example[64]
+[274625.000000] [ T65] example[65]
+[287496.000000] [ T66] example[66]
+[300763.000000] [ T67] example[67]
+[314432.000000] [ T68] example[68]
+[328509.000000] [ T69] example[69]
+[343000.000000] [ T70] example[70]
+[357911.000000] [ T71] example[71]
+[373248.000000] [ T72] example[72]
+[389017.000000] [ T73] example[73]
+[405224.000000] [ T74] example[74]
+[421875.000000] [ T75] example[75]
+[438976.000000] [ T76] example[76]
+[456533.000000] [ T77] example[77]
+[474552.000000] [ T78] example[78]
+[493039.000000] [ T79] example[79]
+[512000.000000] [ T80] example[80]
+[531441.000000] [ T81] example[81]
+[551368.000000] [ T82] example[82]
+[571787.000000] [ T83] example[83]
+[592704.000000] [ T84] example[84]
+[614125.000000] [ T85] example[85]
+[636056.000000] [ T86] example[86]
+[658503.000000] [ T87] example[87]
+[681472.000000] [ T88] example[88]
+[704969.000000] [ T89] example[89]
+[729000.000000] [ T90] example[90]
+[753571.000000] [ T91] example[91]
+[778688.000000] [ T92] example[92]
+[804357.000000] [ T93] example[93]
+[830584.000000] [ T94] example[94]
+[857375.000000] [ T95] example[95]
+[884736.000000] [ T96] example[96]
+[912673.000000] [ T97] example[97]
+[941192.000000] [ T98] example[98]
+[970299.000000] [ T99] example[99]
+[1000000.000000] [ T100] example[100]
+[1030301.000000] [ T101] example[101]
+[1061208.000000] [ T102] example[102]
+[1092727.000000] [ T103] example[103]
diff --git a/tests/expected/dmesg/cid-indentation b/tests/expected/dmesg/cid-indentation
new file mode 100644
index 000000000..573682795
--- /dev/null
+++ b/tests/expected/dmesg/cid-indentation
@@ -0,0 +1,35 @@
+[ 1.000000] [ T1] new
+ line
+[ 2.000000] [ T2] two
+ new
+ lines
+user :crit : [ 1.000000] [ T1] new
+ line
+mail :warn : [ 2.000000] [ T2] two
+ new
+ lines
+[< 0.000000>] [ T1] new
+ line
+[< 1.000000>] [ T2] two
+ new
+ lines
+[ T1] new
+ line
+[ T2] two
+ new
+ lines
+[Feb13 23:31] [ T1] new
+ line
+[ +1.000000] [ T2] two
+ new
+ lines
+[Fri Feb 13 23:31:31 2009] [ T1] new
+ line
+[Fri Feb 13 23:31:32 2009] [ T2] two
+ new
+ lines
+2009-02-13T23:31:31,123456+00:00 [ T1] new
+ line
+2009-02-13T23:31:32,123456+00:00 [ T2] two
+ new
+ lines
diff --git a/tests/expected/dmesg/cid-limit b/tests/expected/dmesg/cid-limit
new file mode 100644
index 000000000..c30b4ac9a
--- /dev/null
+++ b/tests/expected/dmesg/cid-limit
@@ -0,0 +1,4 @@
+[ 1.000000] [ T1] example[1]
+[ 8.000000] [ T2] example[2]
+[ 27.000000] [ T3] example[3]
+[ 64.000000] [ T4] example[4]
diff --git a/tests/ts/dmesg/cid-colors b/tests/ts/dmesg/cid-colors
new file mode 100755
index 000000000..d17dd17c0
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-input -x >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-console-levels b/tests/ts/dmesg/cid-console-levels
new file mode 100755
index 000000000..e2f241bde
--- /dev/null
+++ b/tests/ts/dmesg/cid-console-levels
@@ -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-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/cid-input -l $I >> $TS_OUTPUT 2>/dev/null
+done
+
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l err+ >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l emerg+ >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l +err >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l +debug >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -F $TS_SELF/cid-input -l + 2>> $TS_OUTPUT >/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-decode b/tests/ts/dmesg/cid-decode
new file mode 100755
index 000000000..488f52a32
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-delta b/tests/ts/dmesg/cid-delta
new file mode 100755
index 000000000..8ba952a5d
--- /dev/null
+++ b/tests/ts/dmesg/cid-delta
@@ -0,0 +1,27 @@
+#!/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-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 -F $TS_SELF/cid-input >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-facilities b/tests/ts/dmesg/cid-facilities
new file mode 100755
index 000000000..b4b613e8b
--- /dev/null
+++ b/tests/ts/dmesg/cid-facilities
@@ -0,0 +1,30 @@
+#!/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-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
+ $TS_HELPER_DMESG -F $TS_SELF/cid-input -f $I >> $TS_OUTPUT 2>/dev/null
+done
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-indentation b/tests/ts/dmesg/cid-indentation
new file mode 100755
index 000000000..434e1694b
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 -F $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG -F $TS_SELF/cid-newlines -x >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=delta --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=notime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=reltime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=ctime --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+$TS_HELPER_DMESG --time-format=iso --file $TS_SELF/cid-newlines >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-limit b/tests/ts/dmesg/cid-limit
new file mode 100755
index 000000000..34f928a9e
--- /dev/null
+++ b/tests/ts/dmesg/cid-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="cid-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 \
+ -F $TS_SELF/cid-input >> $TS_OUTPUT 2> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/dmesg/cid-newlines b/tests/ts/dmesg/cid-newlines
new file mode 100644
index 000000000..682ce40bb
--- /dev/null
+++ b/tests/ts/dmesg/cid-newlines
@@ -0,0 +1,5 @@
+<10>[ 1.000000] [ T1] new
+line
+<20>[ 2.000000] [ T2] two
+new
+lines
--
2.43.0
^ permalink raw reply related
* [PATCH] util-linux/sys-utils dmesg add PRINTK_CALLER support
From: Edward Chron @ 2024-01-04 20:10 UTC (permalink / raw)
To: util-linux; +Cc: colona, echron, echron
Submission to Project: util-linux
Open Incident: #2609 at github.com/util-linux/util-linux/issues/2609
Component: util-linux/sys-utils
File: dmesg.c
Code level patch applied against: 2.39.3 - latest code pulled from
git.github.com:util-linux/util-linux.git
Revision: #1 on 2023/12/08 per Review from Karel Zak
Revision: #2 on 2023/12/12 Adjust line offsets for master update and
Add caller_id_size init to dmesg -K
Revision: #3 on 2023/12/12 Use of sizeof for cidbuf and limit search
for caller_id to dmesg prefix to msg text
Revision: #4 on 2023/12/15 Ensure SYSLOG and kmsg inputs have
caller_id_size set appropriately
Revision: #5 on 2023/12/24 Make caller_id width consistent with
makedumpfile
Revision: #6 on 2023/12/30 Use updated test naming convention
Revision: #7 on 2024/01/04 Normalize kmsg caller_id spacing for test
platforms by removing caller_id padding
in test generated output.
Add support to standard dmesg command for the optional Linux Kernel
debug CONFIG option PRINTK_CALLER which adds an optional dmesg field
that contains the Thread Id or CPU Id that is issuing the printk to
add the message to the kernel ring buffer. This makes debugging simpler
as dmesg entries for a specific thread or CPU can be recognized.
The dmesg -S using the old syslog interface supports printing the
PRINTK_CALLER field but currently standard dmesg does not support
printing the field if present. There are utilities that use dmesg and
so it would be optimal if dmesg supported PRINTK_CALLER as well.
The additional field provided by PRINTK_CALLER is only present
if it was configured for the Linux kernel where the dmesg command
is run. It is a debug option and not configured by default so the
dmesg output will only change for those kernels where the option was
configured when the kernel was built. For users who went to the
trouble to configure PRINTK_CALLER and have the extra field available
for debugging, having dmesg print the field is very helpful.
Size of the PRINTK_CALLER field is determined by the maximum number
tasks that can be run on the system which is limited by the value of
/proc/sys/kernel/pid_max as pid values are from 0 to value - 1.
This value determines the number of id digits needed by the caller id.
The PRINTK_CALLER field is printed as T<id> for a Task Id or C<id>
for a CPU Id for a printk in CPU context. The values are left space
padded and enclosed in parentheses such as: [ T123] or [ C16]
For consistency with dmesg -S which supports the PRINTK_CALLER field
the field is printed followed by a space. For JSON format output the
PRINTK_CALLER field is identified as caller as that is consistent with
it's naming in /dev/kmsg. No space padding is used to reduce space
consumed by the JSON output. So the output from the command on a system
with PRINTK_CALLER field enabled in the Linux .config file the dmesg
output appears as:
> dmesg
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -J
...
},{
"pri": 6,
"time": 520.897104,
"caller": "T3919",
"msg": "usb 3-3: Product: USB 2.0 Hub"
},{
and
> dmesg -J -x
...
},{
"fac": "kern",
"pri": "info",
"time": 520.897104,
"caller": "T3919",
"msg": "usb 3-3: Product: USB 2.0 Hub"
},{
>
For comparison:
> dmesg -S
...
[ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
and
> dmesg -S -x
...
kern :info : [ 520.897104] [ T3919] usb 3-3: Product: USB 2.0 Hub
Note: When dmesg uses the old syslog interface the reserved space for
the PRINTK_CALLER field is capped at 5 digits because 32-bit
kernels are capped at 32768 as the max number of PIDs. However,
64-bit systems are currently capped at 2^22 PIDs (0 - 4194303).
The PID cap is set by PID_MAX_LIMIT but the system limit can be
less so we use /proc/sys/kernel/pid_max to determine the size
needed to hold the maximum PID value size for the current system.
Many 64-bit systems support 2^22 PIDs (0 - 4194303) and you see:
> dmesg -x
...
kern :info : [ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
...
kern :info : [ 9830.456898] [ T98982] cgroup: fork rejected by pids ...
kern :info : [14301.158878] [ T137336] cgroup: fork rejected by pids ...
kern :info : [18980.803190] [T1637865] cgroup: fork rejected by pids ...
> dmesg -S -x
...
kern :info : [ 520.899558] [ T3919] hub 3-3:1.0: USB hub found
...
kern :info : [ 9830.456898] [T98982] cgroup: fork rejected by pids ...
kern :info : [14301.158878] [T137336] cgroup: fork rejected by pids ...
kern :info : [18980.803190] [T1637865] cgroup: fork rejected by pids ...
This is the only difference seen with PRINTK_CALLER configured and
printing between the dmesg /dev/kmsg interface and the dmesg -S syslog
interface.
Tests naming has been revised based on naming convention Thomas used to
introduce dmest json tests. The naming of test and input files that
reside in tests/ts/dmeg include:
<name> are existing dmesg syslog interface tests and input files.
cid-<name> are dmesg syslog interface caller_id tests and input files.
json-<name> are dmesg kmsg interface tests and input files.
cid-json-<name> are dmesg kmsg interface caller_id tests and input files.
Resulting expected files match the test names.
Signed-off-by: Ivan Delalande <colona@arista.com>
Signed-off-by: Edward Chron <echron@arista.com>
---
include/pathnames.h | 3 +
sys-utils/dmesg.c | 128 ++++-
tests/expected/dmesg/cid-json | 535 +++++++++++++++++++
tests/expected/dmesg/cid-kmsg-colors | 59 ++
tests/expected/dmesg/cid-kmsg-console-levels | 146 +++++
tests/expected/dmesg/cid-kmsg-decode | 59 ++
tests/expected/dmesg/cid-kmsg-delta | 59 ++
tests/expected/dmesg/cid-kmsg-facilities | 73 +++
tests/expected/dmesg/cid-kmsg-indentation | 28 +
tests/expected/dmesg/cid-kmsg-json | 295 ++++++++++
tests/expected/dmesg/cid-kmsg-limit | 31 ++
tests/expected/dmesg/kmsg-file | 126 ++++-
tests/ts/dmesg/cid-input | 106 ++++
tests/ts/dmesg/cid-json | 28 +
tests/ts/dmesg/cid-kmsg-colors | 34 ++
tests/ts/dmesg/cid-kmsg-console-levels | 49 ++
tests/ts/dmesg/cid-kmsg-decode | 33 ++
tests/ts/dmesg/cid-kmsg-delta | 33 ++
tests/ts/dmesg/cid-kmsg-facilities | 36 ++
tests/ts/dmesg/cid-kmsg-indentation | 45 ++
tests/ts/dmesg/cid-kmsg-input | Bin 0 -> 5464 bytes
tests/ts/dmesg/cid-kmsg-json | 28 +
tests/ts/dmesg/cid-kmsg-limit | 34 ++
tests/ts/dmesg/cid-kmsg-newlines | Bin 0 -> 152 bytes
tests/ts/dmesg/kmsg-input | Bin 1955 -> 3944 bytes
25 files changed, 1948 insertions(+), 20 deletions(-)
create mode 100644 tests/expected/dmesg/cid-json
create mode 100644 tests/expected/dmesg/cid-kmsg-colors
create mode 100644 tests/expected/dmesg/cid-kmsg-console-levels
create mode 100644 tests/expected/dmesg/cid-kmsg-decode
create mode 100644 tests/expected/dmesg/cid-kmsg-delta
create mode 100644 tests/expected/dmesg/cid-kmsg-facilities
create mode 100644 tests/expected/dmesg/cid-kmsg-indentation
create mode 100644 tests/expected/dmesg/cid-kmsg-json
create mode 100644 tests/expected/dmesg/cid-kmsg-limit
create mode 100644 tests/ts/dmesg/cid-input
create mode 100755 tests/ts/dmesg/cid-json
create mode 100755 tests/ts/dmesg/cid-kmsg-colors
create mode 100755 tests/ts/dmesg/cid-kmsg-console-levels
create mode 100755 tests/ts/dmesg/cid-kmsg-decode
create mode 100755 tests/ts/dmesg/cid-kmsg-delta
create mode 100755 tests/ts/dmesg/cid-kmsg-facilities
create mode 100755 tests/ts/dmesg/cid-kmsg-indentation
create mode 100644 tests/ts/dmesg/cid-kmsg-input
create mode 100755 tests/ts/dmesg/cid-kmsg-json
create mode 100755 tests/ts/dmesg/cid-kmsg-limit
create mode 100644 tests/ts/dmesg/cid-kmsg-newlines
diff --git a/include/pathnames.h b/include/pathnames.h
index caf0e63d4..81fa405f6 100644
--- a/include/pathnames.h
+++ b/include/pathnames.h
@@ -230,4 +230,7 @@
/* cgroup path */
#define _PATH_SYS_CGROUP "/sys/fs/cgroup"
+/* Maximum number of PIDs system supports */
+#define _PATH_PROC_PIDMAX "/proc/sys/kernel/pid_max"
+
#endif /* PATHNAMES_H */
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 48928b095..1bb44f2c6 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -13,7 +13,9 @@
*/
#include <stdio.h>
#include <getopt.h>
+#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/klog.h>
#include <sys/syslog.h>
#include <sys/time.h>
@@ -41,6 +43,7 @@
#include "mangle.h"
#include "pager.h"
#include "jsonwrt.h"
+#include "pathnames.h"
/* Close the log. Currently a NOP. */
#define SYSLOG_ACTION_CLOSE 0
@@ -65,6 +68,12 @@
/* Return size of the log buffer */
#define SYSLOG_ACTION_SIZE_BUFFER 10
+#define PID_CHARS_MAX sizeof(stringify_value(LONG_MAX))
+#define PID_CHARS_DEFAULT sizeof(stringify_value(INT_MAX))
+#define SYSLOG_DEFAULT_CALLER_ID_CHARS sizeof(stringify_value(SHRT_MAX))-1
+#define DMESG_CALLER_PREFIX "caller="
+#define DMESG_CALLER_PREFIXSZ (sizeof(DMESG_CALLER_PREFIX)-1)
+
/*
* Color scheme
*/
@@ -237,6 +246,7 @@ struct dmesg_control {
force_prefix:1; /* force timestamp and decode prefix
on each line */
int indent; /* due to timestamps if newline */
+ size_t caller_id_size; /* PRINTK_CALLERID max field size */
};
struct dmesg_record {
@@ -246,6 +256,7 @@ struct dmesg_record {
int level;
int facility;
struct timeval tv;
+ char caller_id[PID_CHARS_MAX];
const char *next; /* buffer with next unparsed record */
size_t next_size; /* size of the next buffer */
@@ -258,6 +269,7 @@ struct dmesg_record {
(_r)->level = -1; \
(_r)->tv.tv_sec = 0; \
(_r)->tv.tv_usec = 0; \
+ (_r)->caller_id[0] = 0; \
} while (0)
static int process_kmsg(struct dmesg_control *ctl);
@@ -602,6 +614,45 @@ static int get_syslog_buffer_size(void)
return n > 0 ? n : 0;
}
+/*
+ * Get the number of characters needed to hold the maximum number
+ * of tasks this system supports. This size of string could hold
+ * a thread id large enough for the highest thread id.
+ * This is needed to determine the number of characters reserved for
+ * the PRINTK_CALLER field if it has been configured in the Linux Kernel.
+ *
+ * The number of digits sets the max value since the value can't exceed
+ * a value of that size. The /proc field defined by _PATH_PROC_PIDMAX
+ * holds the maximum number of PID values that may be ussed by the system,
+ * so 0 to that value minus one.
+ *
+ * For determining the size of the PRINTK_CALLER field, we make the safe
+ * assumption that the number of threads >= number of cpus. This because
+ * the PRINTK_CALLER field can hold either a thread id or a CPU id value.
+ *
+ * If we can't access the pid max kernel proc entry we assign a default
+ * field size of 5 characters as that is what the old syslog interface
+ * uses as the reserved field size. This is justified because 32-bit Linux
+ * systems are limited to PID values between (0-32767).
+ *
+ */
+static size_t max_threads_id_size(void)
+{
+ char taskmax[PID_CHARS_MAX] = {'\0'};
+ ssize_t rdsize;
+ int fd;
+
+ fd = open(_PATH_PROC_PIDMAX, O_RDONLY);
+ if (fd == -1)
+ return PID_CHARS_DEFAULT;
+
+ rdsize = read(fd, taskmax, sizeof(taskmax));
+ if (rdsize == -1)
+ return PID_CHARS_DEFAULT;
+
+ return strnlen(taskmax, sizeof(taskmax));
+}
+
/*
* Reads messages from regular file by mmap
*/
@@ -675,6 +726,8 @@ static ssize_t process_buffer(struct dmesg_control *ctl, char **buf)
ctl->bufsize = get_syslog_buffer_size();
n = read_syslog_buffer(ctl, buf);
+ /* Set number of PID characters for caller_id spacing */
+ ctl->caller_id_size = SYSLOG_DEFAULT_CALLER_ID_CHARS;
break;
case DMESG_METHOD_KMSG:
if (ctl->filename)
@@ -779,6 +832,39 @@ static const char *skip_item(const char *begin, const char *end, const char *sep
return begin;
}
+/*
+ * Checks to see if the caller (caller id) field is present in the kmsg record.
+ * This is true if the PRINTK_CALLER config option has been set in the kernel.
+ *
+ * If the caller_id is found in the kmsg buffer then return the id and id type
+ * to the caller in dmesg caller_id. Returns string pointer to next value.
+ *
+ */
+static const char *parse_callerid(const char *p_str, const char *end,
+ struct dmesg_record *p_drec)
+{
+ const char *p_after;
+ const char *p_next;
+ size_t cid_size;
+ char *p_scn;
+ char *p_cid;
+
+ /* Check for PRINTK_CALLER prefix, must be before msg text */
+ p_cid = strstr(p_str, DMESG_CALLER_PREFIX);
+ p_scn = strchr(p_str, ';');
+ if (p_cid != NULL && p_drec != NULL && p_scn != NULL && p_cid < p_scn) {
+ p_next = p_cid + DMESG_CALLER_PREFIXSZ;
+ p_after = skip_item(p_next, end, ",;");
+ cid_size = p_after - p_next;
+ if (cid_size < sizeof(p_drec->caller_id))
+ xstrncpy(p_drec->caller_id, p_next, cid_size);
+ else
+ return p_str;
+ return p_after;
+ }
+ return p_str;
+}
+
/*
* Parses one record from syslog(2) buffer
*/
@@ -846,8 +932,22 @@ static int get_next_syslog_record(struct dmesg_control *ctl,
begin++;
}
- rec->mesg = begin;
- rec->mesg_size = end - begin;
+ if (*begin == '[' && (*(begin + 1) == ' ' ||
+ (*(begin + 1) == 'T' || *(begin + 1) == 'C'))) {
+ const char *start = begin + 1;
+ size_t id_size;
+
+ start = start + strspn(start, " ");
+ begin = skip_item(begin, end, "]");
+ id_size = begin - start;
+ if (id_size < sizeof(rec->caller_id))
+ xstrncpy(rec->caller_id, start, id_size);
+ rec->mesg = begin + 1;
+ rec->mesg_size = end - begin - 1;
+ } else {
+ rec->mesg = begin;
+ rec->mesg_size = end - begin;
+ }
/* Don't count \n from the last message to the message size */
if (*end != '\n' && *(end - 1) == '\n')
@@ -1165,6 +1265,19 @@ full_output:
color_disable();
}
+ if (*rec->caller_id) {
+ if (ctl->json) {
+ ul_jsonwrt_value_s(&ctl->jfmt, "caller", rec->caller_id);
+ } else {
+ char cidbuf[PID_CHARS_MAX+3] = {'\0'};
+
+ sprintf(cidbuf, "[%*s] ",
+ (char)ctl->caller_id_size, rec->caller_id);
+ ctl->indent += strnlen(cidbuf, sizeof(cidbuf));
+ fputs(cidbuf, stdout);
+ }
+ }
+
/*
* A kernel message may contain several lines of output, separated
* by '\n'. If the timestamp and decode outputs are forced then each
@@ -1348,7 +1461,10 @@ static int parse_kmsg_record(struct dmesg_control *ctl,
goto mesg;
/* D) optional fields (ignore) */
- p = skip_item(p, end, ";");
+ p = skip_item(p, end, ",;");
+
+ /* Include optional PRINTK_CALLER field if it is present */
+ p = parse_callerid(p, end, rec);
mesg:
/* E) message text */
@@ -1400,6 +1516,9 @@ static int process_kmsg(struct dmesg_control *ctl)
if (ctl->method != DMESG_METHOD_KMSG || ctl->kmsg < 0)
return -1;
+ /* Determine number of PID characters for caller_id spacing */
+ ctl->caller_id_size = max_threads_id_size();
+
/*
* The very first read() call is done in kmsg_init() where we test
* /dev/kmsg usability. The return code from the initial read() is
@@ -1512,6 +1631,7 @@ int main(int argc, char *argv[])
.kmsg = -1,
.ntime_fmts = 0,
.indent = 0,
+ .caller_id_size = 0,
};
int colormode = UL_COLORMODE_UNDEF;
enum {
@@ -1606,10 +1726,12 @@ int main(int argc, char *argv[])
case 'F':
ctl.filename = optarg;
ctl.method = DMESG_METHOD_MMAP;
+ ctl.caller_id_size = SYSLOG_DEFAULT_CALLER_ID_CHARS;
break;
case 'K':
ctl.filename = optarg;
ctl.method = DMESG_METHOD_KMSG;
+ ctl.caller_id_size = max_threads_id_size();
break;
case 'f':
ctl.fltr_fac = 1;
diff --git a/tests/expected/dmesg/cid-json b/tests/expected/dmesg/cid-json
new file mode 100644
index 000000000..8a4d0e23d
--- /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 000000000..d3dbd1e2c
--- /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 000000000..ef2e83c46
--- /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 000000000..e1cecfa88
--- /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 000000000..82eea8e13
--- /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.000000>] [T3] BIOS-provided physical RAM map:
+[ 0.000003 < 0.000000>] [T4] BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
+[ 0.000004 < 0.000000>] [T5] BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
+[ 0.000005 < 0.000000>] [T6] BIOS-e820: [mem 0x0000000000100000-0x0000000009afffff] usable
+[ 0.000006 < 0.000000>] [T7] BIOS-e820: [mem 0x0000000009b00000-0x0000000009dfffff] reserved
+[ 0.000007 < 0.000000>] [T8] BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
+[ 0.000008 < 0.000000>] [T9] BIOS-e820: [mem 0x0000000009f00000-0x0000000009f3bfff] ACPI NVS
+[ 0.000009 < 0.000000>] [T10] BIOS-e820: [mem 0x0000000009f3c000-0x000000004235ffff] usable
+[ 0.000010 < 0.000000>] [T11] BIOS-e820: [mem 0x0000000042360000-0x000000004455ffff] reserved
+[ 0.201607 < 0.000000>] [T12] smp: Bringing up secondary CPUs ...
+[ 0.201607 < 0.000000>] [T13] smpboot: x86: Booting SMP configuration:
+[ 0.209670 < 0.000000>] [T14] #1 #3 #5 #7
+[ 0.212630 < 0.000000>] [T15] smp: Brought up 1 node, 16 CPUs
+[ 0.215936 < 0.000000>] [T16] audit: type=2000 audit(1702926179.015:1): state=initialized audit_enabled=0 res=1
+[ 0.215937 < 0.000000>] [T17] thermal_sys: Registered thermal governor 'fair_share'
+[ 0.215966 < 0.000000>] [T18] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
+[ 0.367657 < 0.000000>] [T19] ACPI: \_SB_.PCI0.GP19.NHI1.PWRS: New power resource
+[ 0.368615 < 0.000000>] [T20] ACPI: \_SB_.PCI0.GP19.XHC4.PWRS: New power resource
+[ 0.376316 < 0.000000>] [T21] ACPI: \_SB_.PRWL: New power resource
+[ 0.376343 < 0.000000>] [T22] ACPI: \_SB_.PRWB: New power resource
+[ 0.377373 < 0.000000>] [T23] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
+[ 0.377378 < 0.000000>] [T24] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
+[ 0.377569 < 0.000000>] [T25] acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
+[ 0.377933 < 0.000000>] [T26] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
+[ 0.378458 < 0.000000>] [T27] PCI host bridge to bus 0000:00
+[ 0.378459 < 0.000000>] [T28] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
+[ 0.378461 < 0.000000>] [T29] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
+[ 9.398562 < 9.000000>] [T30] user network daemon initialization complete
+[ 10.441520 < 1.000000>] [T31] systemd[1]: systemd 254.7-1.fc39 running in system mode
+[ 11.441524 < 1.000000>] [T32] systemd[1]: Detected architecture x86-64.
+[ 12.441525 < 1.000000>] [T33] systemd[1]: Running in initrd.
+[ 13.541598 < 1.000000>] [T34] systemd[1]: Hostname set to <catalina>.
+[ 15.641860 < 2.000000>] [T35] usb 3-3: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
+[ 16.690000 < 1.000000>] [T36] Serial bus multi instantiate pseudo device driver INT3515:00: error -ENXIO: IRQ index 1 not found.
+[ 17.710000 < 1.000000>] [T37] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[ 18.720000 < 1.000000>] [T38] systemd-journald[723]: Received client request to flush runtime journal.
+[ 20.740000 < 2.000000>] [T39] systemd-journald[723]: File /var/log/journal/a124ea923b144109a12d557d5ac53179/system.journal corrupted or uncleanly shut down, renaming and replacing.
+[ 21.752348 < 1.000000>] [T40] systemd-journald[723]: /var/log/journal/ad7a2547ac0e4342a342e62a34a3eae4/user-1000.journal: Journal file uses a different sequence number ID, rotating.
+[ 24.761100 < 3.000000>] [T41] PEFILE: Unsigned PE binary
+[ 35.768091 < 11.000000>] [T42] snd_hda_intel 0000:00:1f.3: CORB reset timeout#2, CORBRP = 65535
+[ 137.791785 < 102.000000>] [C1] usb 3-3.1: device firmware changed
+[ 146.803248 < 9.000000>] [C2] usb 3-3.1: USB disconnect, device number 44
+[ 148.821859 < 2.000000>] [C3] usb 3-3.1: New USB device found, idVendor=17ef, idProduct=6047, bcdDevice= 3.30
+[ 149.840480 < 1.000000>] [C4] perf: interrupt took too long (2518 > 2500)
+[ 150.853128 < 1.000000>] [C5] perf: interrupt took too long (3217 > 3147)
+[ 153.859311 < 3.000000>] [C12] perf: interrupt took too long (3654 > 3239)
+[ 155.861908 < 2.000000>] [C123] perf: interrupt took too long (3789 > 3545)
+[ 158.870434 < 3.000000>] [C1234] perf: interrupt took too long (3891 > 3647)
+[ 161.887625 < 3.000000>] [C12345] perf: interrupt took too long (3947 > 3789)
+[ 163.898434 < 2.000000>] [C123456] perf: interrupt took too long (4011 > 3898)
+[ 166.909842 < 3.000000>] [C1234567] perf: interrupt took too long (4174 > 3987)
+[ 169.911147 < 3.000000>] [T123] User program Dmesg Test Message at warn priority
+[ 178.927435 < 9.000000>] [T1234] User program Dmesg Test Message at warn priority
+[ 185.943456 < 7.000000>] [T12345] User program Dmesg Test Message at notice priority
+[ 189.963238 < 4.000000>] [T123456] User program Dmesg Test Message at info priority
+[ 207.987439 < 18.000000>] [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 000000000..bacfbd1d6
--- /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 000000000..28c01996c
--- /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 000000000..942506ceb
--- /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 000000000..372432d5f
--- /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/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/ts/dmesg/cid-input b/tests/ts/dmesg/cid-input
new file mode 100644
index 000000000..7dbd89d8f
--- /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 000000000..78363793d
--- /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 000000000..b94e8a9ee
--- /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 000000000..19d80040a
--- /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 000000000..b92099770
--- /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 000000000..1b5f57270
--- /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 000000000..38ca9c565
--- /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 000000000..c3f8e066a
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..2575be8d732c30c5346738a871579edf1dd892ff
GIT binary patch
literal 5464
zcmbtYX>;027WHTUid&Tru`2?r)!o_{UX6`O%v9_!VCUtPC*=}SgY}|?(c)!({hSsM
zL_D^WH^>;Y^y$-gIrlcEVdCf*VUQ%M=wGtl$2hAW=uQ=7oM&Wr?XKtqMR?0Pj1Cfg
z^Y8k!`F2PLi!h{v4}-xWG2XShj4adQrfV{TK3rT;65%dBPcX2Glk$+Pu3%mBklrww
zo{wof84l0Kmp7+>TpXW|26Uch2AP6RRoFn0Y5JDuGmqYxc<t{oLmyklR&S7}X^=$(
zO3J4=i>o5)|LZ}9b(lx08>fr*#pZsH&dW}-gywc}Phs)6tRi(6hpK;s&!g-vRc6MP
z+%F%?N~L}jmtjyuROETJdL#{&OH~}L?(gqehCa5;c<*HNY1&y9`CS~Th?cjHWeh{p
z<oKL0*5BXbhCa4K#A=9gEz_s#RHbA-=w-KGot;abn$PE7sV;+AqW1TMp^q(~d>PQ2
z19=y420Q>3s#L|DiuU)Up^q)3{URi5sJ0=!KqIy|+J-*1fX+*R-s~x0v<BRAbPRoL
zA>9`t)l*1q#a)iB;kE$17Xh^uckSrSxi;iiIv$Kibn$t*zh@gBjx9%KzKqGkT})wd
z`6EeY8u)8rvKKG`VE@2V2)V}G+R`?-X&RQvY_n}rX7$Q+>C;IOXAAsMy`)lwc@_o5
zBMrt^C3U-9y-beee>$A&;WOlpPY<pQ9DLO<S_FVHj~8_jRL~rxg)lhN7@qBzMz|Fx
z(Ic%J^oHXt@phW|81jx;Hs7&?+|bSI#cie8GRmL_1~I##t0S9R4u(pPx8sr7y`YX_
z5Un1Us&Bz&)Lb}Vj%j(8%^a_5GU>BJpUNtzR9}lq93=67kmk*!H!9N!8TCz_NqyGv
zwA|HXJ7#ry)vYShAi05#_%u<A7;;kpXnma)In+4I3wk>b;^L;f4GQ(PF%n;~w|CgP
zz2U`h^5Ku0@o@6~=45m{^=Yaqs&aY@6wLJ2p!=Ytw-B$nzL13)&o%^y8rhC5cL;ht
z9m76pMZKAx+;qo-k=gw)W?uK=Y{a_b-zS*iLfz9czgLA`Z(bK6#7HB;m9}fMwt!gX
z^N3&02I3V&c+IgnYp>a2PY@@+e|(-4ViXXft-O}?KOjz?hj0MlaAyaCuOVO{njpM&
zu0#t(*V<xV=^)C}AkI+H5Kz~%y2Q5*G~#e&DR+g~Rvk<9f^Zqr_+o4xo34*qNH?FR
z1D`%ksjQdFyr@dL9zIkmLxmYMX++1<@i`5WJp6{wsam8e!&B$e5e-i#bT<CdxkOy^
zulqE;I+^}4y&RtR^)&l*I{Z8u4Eyi&nZKQM#n03Hq}`S<OFqYMnFN)NEsAngBJZjV
zUAms0jR$9WwM^;-9S<kJNJE&KhKESqs-A^}eb!7_j^dtYRgot!6+EFflaJ4bq|XPz
zGML3lTs_jq%L$#12fxaRfs-rbj_aJB4ujjgtZ23h10>+e>2Ra&WRM=hT8-Q>s@q$J
z@lESdzv(%e!JFiw>o})%bD)cDICtni&Z7K&hx;06>)G`M%-<q`tOtF2r>pXQg+$a8
zKV6*u8VSY?$3u1Go-6I07Rv0^=tC$|)qP%kqbN`*y3+4*+Y}7AH(e&Gg5sbAxZFZb
z6oN^sT@N_xt@^a+ntg?AH$7cMmK0s5!@Bd3dsNg}rb`lXbakIn6pS@0HyCSB+wB!c
zQCuN4sHY$iR=NhDLyq<Lx=^~@b!>ss*sv1@vl^VXByv>87S3c#WYx}Y21|o+iKTh%
zP~&1}@EJlb3sQyZ+=%|)!k|KF%7WjT>g=M{F=-3t+B^1<u=I?0hp#m6YI;Jec9`aQ
zoka%4(PyYkUi4XjB*f{s$fG)}`X<xe{w$16SM4*gE@N$R0r2+-44LcsmPFy^aFt^)
z+xB!Yw$ho~y{RftPMe5N>!ga|5)|4DHMUZ;EL9!l8+K6<qdd~+;*v|$WG#`ZC{Qgs
z!;3GYPd<$%|HSY}Jv0qKwOUTM&2J-C-$}mPT=BQCny`m<fjLgo<F*Mqy)uh#ZlmBP
z&MK8O3a^>4c^Bp!e43mz{WRPWrz)?jH<r;{os6kZwv=3=oTERK*xI;`Za8-A;coof
z`4g2j3zF#Cu{ff5qC$n$M-(P8L>`m;yH*e!D9t>n%Ud1MdP-W4LjVYYY0xj3j`(pJ
z@40E-$BCk&yP!Bq^2N~_>nK1RtH87POy`B^;XIPkiDVE;juvUXFY2zJN0t^vz0}zO
z=hRu4s31!osl2T#REc|R`wBEosZKz>n=2HY5aLXe*0$kjo*Zd$(T;s#K1cc~-^dA&
z?oJSz3Vn$c;H_-^5pWeKaio=|qkX%f?9)G1_NKYE0PdF*P!!MS=+9v8Qkxsi6J>Qe
z(=m98HRNar*Q`NW7?yBs2Gmx(2-X`9-;X{HeY(oZc#**-;~~wEqs60+GiD*sxO8mS
z^xCQ{AUFSapxFjGSS=(dqs(zzGBjWt4d^m|lV9_=Nbk{cQg|C=3v38mUBlDF_B>tJ
zFabnHfIhd{?iyI_2^xvPraI3uD5bHPaBWN>esU%cGr6wCT-mCk1KyrVH>WQNnxp1z
zL9<Qa><Aj~a`Qzt*fBNh_E2+}@LXXEx8?DH=;>Zt|2ToxUS|PPH2<dmQIaFz4=l-C
z`VHmCG@Eu1+YGErnl4fa+lKGG&Op9~#E~UH;!HSeB$OQ{In1LsRa+!%=w2bkZ7DRA
z#k~y_1WHQu^Pbrz#Vr0Rmg9OFOA5KcLY<bb>zI0z(58iY_8KwQV;aoft`SLNGoabl
zPC!F0UbmPh8jFG9h8l{r&0YBM2{mcIMoyTlA&21`IAohHbHHmgHv?ErNZWZ8k2#GO
zJXbqZ?{z)xQQPwvI+C5O8r*QD+a>(uv?zj<PE%Db=u(%2b5)iB_98)ry<d^xkvK2V
z@@^2}SghZ21aH~zQd9gZkkD#R_hAS+m{7L&YR#&D1{0eG{213J3Nh7<KRO7{Mo_jQ
puptW9{KV?xY@WA4r3MAE>A=8(w=`r8>ii69q-NO8d^hU;e*yZ}It~B;
literal 0
HcmV?d00001
diff --git a/tests/ts/dmesg/cid-kmsg-json b/tests/ts/dmesg/cid-kmsg-json
new file mode 100755
index 000000000..ad1e3e785
--- /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 000000000..06f1c8bfb
--- /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
new file mode 100644
index 0000000000000000000000000000000000000000..574d2177796677b73f1efcf273005169ed832c60
GIT binary patch
literal 152
zcmXrjF#tkco#e!voYW%Q5CiL+%)C^Es??%<E(Svb9YY;M128~RV`!b1TFwPh$Hia-
tQeuRm#K^j&Jf91MLCT7`7>o^cjC71K)EQfsWE7>QazV)4{GwE-1^{d2D<=Q|
literal 0
HcmV?d00001
diff --git a/tests/ts/dmesg/kmsg-input b/tests/ts/dmesg/kmsg-input
index b000f4c951ccdcec96c820d37efc64ac8b68a93c..c08331dbf2bfdc9622105e120be99e448cfa89ea 100644
GIT binary patch
literal 3944
zcmbtXYg5};66G_$qO0-&sK`QBZz=1o1>*#71<=}%Ns6Uh*V47E89lsu@R(mer)3jN
zD9C0P;j&(R`rN*Ky4!|k;OKq$oEGgp-Kwfi%Yt0p)$N|F;-%;b+RymmKlrjcJD~kV
z9Mk@%!Qg;|rJK4S(=aW=H-tu?&aWs-@D$(2Fl^GSJ|I)Kg>D?sJ3*7Ph@$aucotnw
zPrjWWos9-`Ru&o=Hl3)rgCfHS%^(y3y*Kc;yCXC{dLIU5p35R35K$qeMcPzJ|KImc
z+{R_1^fX^=-|U{td|vlD;@#uwj^gTJ)g<aRjaB~;--pF*u8cygtgwEl8<mGiTF0_V
zs4B~5{YoxZD^(q?pYQIN8Xvt6$D@l$Z&j7IX`&KZEg$MMmKlwY&IlIa?vADLv3XJX
zrV-M0u5vQ&d12dsy=S)qHJ{IKsIBEJQ@cC1#>Y=!f;sS>!_0sJm`c^Ex>d>Uj-&DM
zHjwCOZ36|8aklul8Xs@M1hbbg$p+?$kEikRHjsJ=#L;=q$JhLyz;JY)$0wLu9H1LI
z8bl*H|1#O#akT))+kEC${2a(OE$2r*!qD*l77(o59~jxTvjKXFkgHjSp_zto4GvVD
zuR=Pm(qe&sYFAXNxGWM`J<uS!s!7*%UWElMZrjX|$syhQE{t)?wk$-L&eKI($p*Sd
zy4sp0*f4NCLyJEU3zptl_&E4@9kM{`3)8iDbsIKiyI3|%Mo<AAY9!o_4d<I>dU)Rn
zEY26%CMkF{4=dF-v3Tlk><iB@1Je~=pc}#o#X(4QBOBFc1*bAg|Ae}_SEs6AMI?QL
zle#ZDMy9{^!0~C8s>)?Hg;GNrt3?VySFqmPr$vb>SCkd)&1G6m>!qyJUbk>-&C_L`
z!}H<z)3<3f9Dkf1kB%lGO;kfoNqaB_{GLX4vZg)MggM_RVg_+F+k)I(&vlpzXH`gC
zou-rHsU8hRhW;rMfqs5E5_<I87_jH+j#lNJs(3kNTg4DN!(by^-xVy?S7E-M4(y-6
zApD+d30~5VFyr4ozwRCh1Us86*Gs$O*X=ymd6xHNhegvE3CAg$EEHXH6mDogDRY??
zsPo8y>sedltOq3?tXJ=^VOY^JUZoVBN5+xihiD5ly_gI_x|mSiu2yB$)O0<(Z&ZN-
zJm|8SjwaC=4YD%+1K$(1$W?*2&L$%oo{Z@<`r5lh{#iG>G`TvSe4AVj&-(0UmrjOX
zMuTDhJzs@SPS>OYCgr$X9bO@|%4EaoKuM`;D4}`eNY|6oXmDCKtE^qn(Qy2WzHNhj
z2S~10eIp=6iQZNgO;u(H3IeSjJw|6k;_HE2$yu7E%>#YD9MefO_*EhTM10%fo#Cxr
zmUTn3_0~ci>y5-NanD8?+vfUpj@c?sr(4g%uDNy=kC{)`X-S*T$lWKNdvuo;NqP5-
z<p$_!w>CH6bjvez2%;_z4Zq+y=^6yr^8d}Vurx0~2eAU*ad|*!(Ris)&0SgjL5Wm3
z#;fl|t*g4&vV4`P2Es>4^(_;9!?uNEcJ;NJN0MuCgNnF5C)2TYuP5|*Yz0)cMZv`!
zT3SD+90hm-WobfmP&_(p%sZ$PxQiREsTk@~K5r|<-J$2&XdfL9TN7qy%r$7+c>LsY
zJ%Bx0IGV5=Fb_C8wk=MPC56ltdR13M{}#&zMZJ)J?|PMw)*u|$7QV}CZtEFYJ!@TL
zt|rH{9@S`Gwnd^*ntXxS%c?IVWP!`5Dw8&D`i9{7a~3Bj>(P#cF2uIR0sK8_V&Mm&
z>7b)oh`FZ;*9|y-;D4ejw45$8^EPWz#1_q{Kp$!pt!mXK<s+q}O3_Vdbbe_$=v!Q#
zR8^t5^oHkOM;9TD#{YtOqVBuS*sRx}Z<Bhg8Q+<`f4mbu!7|GLeN=c}H=J>Ni)6Y?
z<TNcBm34KL-HW-7zzr_O$KA|_Xs5X<+vc6Ab$7=R^~rS{%R$S-tm9y;_A!;NSH9V^
z-tTBch0Ky`&$N(uV-+i`God(3QA&aQpH@Nl5d1uA>m?^4`=N~;Hr2L)jXA;a?YFT%
zrkSF{TUi}u<>GJya43;_N(QDi<NP%OTqlm>C60_83sb^o4%avDLqb*6t~j9)`?iQP
zC5!BV>Sf!Y7T@8=MTNN`XQA+~he{#FF|L>?N5R7U;5(*eZ)NU}QFuu*@g%h9$=Fb6
z*rvosx%?$9C6#^1+VAmxJ@O3cpX<odoR^K~HAza+`5Yq(0$X!nF-lO;<}=Q#6A&*k
z2yLi>sjZo|?+KtH2cqG}(dS`ES4EvJ3amaF(hRby9ynoyiHxzVK=?+$W$^#c7+1rL
z29?`(fL-vpFl@xCi||ns^R&wEFjP^zl*IzSIkvj&O9ci2HwwU_1lSIC0?T_2+f@Mk
z9xICibxM15vk8%H|Cjgy@V&stHghxDqRkW7TUEwW^X)3*8n*YW%2>K(yvYIM`|e+I
CU~KgO
delta 113
zcmaDMx0s*NbRy$&Rx=$#9fOH$yMYWN9fQfXj4CW<I>tJa<Cx_pH#4dNIVKR!DMoc5
m#}vX5X3_+!h++Z>nnMH^Lj_+kX@ez=nYDnl`{n@F|I7fH$sSVx
--
2.43.0
^ permalink raw reply related
* Re: [PATCH] uuidd: add cont_clock persistence
From: Karel Zak @ 2024-01-04 12:12 UTC (permalink / raw)
To: Michael Trapp; +Cc: util-linux
In-Reply-To: <20231215221829.46932-1-michael.trapp@sap.com>
On Fri, Dec 15, 2023 at 11:18:29PM +0100, Michael Trapp wrote:
> cont_clock requires a correct time setup and therefore it
> must be possible to detect a step back between uuidd starts.
>
> Reserving the next 10 seconds in clock-cont.txt is sufficient
> and should not have a noticeable performance impact.
> It will also provide the possibility to start with the clock_reg
> from the previous session when the system was rebooted.
>
> Whith that, the early cont_clock initialization in uuidd
> should be removed because writing the cont_clock persitence
> when -C was not set is useless and might be confusing.
Hi Michael,
that is an interesting idea; I have only a few pedantic notes ;-)
> ---
> libuuid/src/gen_uuid.c | 78 ++++++++++++++++++++++++++++++++++++------
> libuuid/src/uuidP.h | 1 +
> misc-utils/uuidd.c | 9 -----
> 3 files changed, 69 insertions(+), 19 deletions(-)
>
> diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c
> index 826cd2245..94b99f1bd 100644
> --- a/libuuid/src/gen_uuid.c
> +++ b/libuuid/src/gen_uuid.c
> @@ -355,44 +355,102 @@ static uint64_t get_clock_counter(void)
> /*
> * Get continuous clock value.
> *
> - * Return -1 if there is no further clock counter available,
> + * Return -1 if there is no valid clock counter available,
> * otherwise return 0.
> *
> * This implementation doesn't deliver clock counters based on
> * the current time because last_clock_reg is only incremented
> * by the number of requested UUIDs.
> * max_clock_offset is used to limit the offset of last_clock_reg.
> + * used/reserved UUIDs are written to LIBUUID_CLOCK_CONT_FILE.
> */
> static int get_clock_cont(uint32_t *clock_high,
> uint32_t *clock_low,
> int num,
> uint32_t max_clock_offset)
> {
> - /* 100ns based time offset according to RFC 4122. 4.1.4. */
> + /* all 64bit clock_reg values in this function represent '100ns ticks'
> + * due to the combination of tv_usec + MAX_ADJUSTMENT */
> +
> + enum { fd_init = -2, fd_error = -1 };
In the code (below) the enum items seems like variables, a little bit
confusing. It would be better use upper-case, STATE_FD_INIT, STATE_FD_ERROR.
> + /* time offset according to RFC 4122. 4.1.4. */
> const uint64_t reg_offset = (((uint64_t) 0x01B21DD2) << 32) + 0x13814000;
> static uint64_t last_clock_reg = 0;
> - uint64_t clock_reg;
> + static uint64_t saved_clock_reg = 0;
> + static int state_fd = fd_init;
> + static FILE *state_f = NULL;
> + uint64_t clock_reg, next_clock_reg;
>
> - if (last_clock_reg == 0)
> - last_clock_reg = get_clock_counter();
> + if (state_fd == fd_error)
> + return -1;
>
> clock_reg = get_clock_counter();
> +
> + if (state_fd == fd_init) {
> + mode_t save_umask;
> + struct stat st;
> +
> + save_umask = umask(0);
> + state_fd = open(LIBUUID_CLOCK_CONT_FILE, O_RDWR|O_CREAT|O_CLOEXEC, 0660);
> + (void) umask(save_umask);
> + if (state_fd == fd_error)
> + return -1;
> +
> + state_f = fdopen(state_fd, "r+" UL_CLOEXECSTR);
> + if (!state_f)
> + goto error;
Seems it duplicates code from get_clock(), what about introduce a generic
state_fd_init(LIBUUID_CLOCK_CONT_FILE, &state_fd, &state_f);
and use the same in get_clock() for LIBUUID_CLOCK_FILE?
> + if (fstat(state_fd, &st))
> + goto error;
> +
> + if (st.st_size) {
> + rewind(state_f);
> + if (fscanf(state_f, "cont: %lu\n", &last_clock_reg) != 1)
> + goto error;
> + } else
> + last_clock_reg = clock_reg;
For LIBUUID_CLOCK_FILE we use flock(), I guess it's unnecessary for
LIBUUID_CLOCK_CONT_FILE as we assume only one uuidd instance, right?
Thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox