is_debugfs_mounted();
Checks whether debugfs is mounted at /sys/kernel/debug, same check as blktests' _have_debugfs(). Returns true/false.
my $mount = get_mount_info($path);
Returns a hash reference with target, source, fstype and options of the file system that $path is on, from findmnt -T. For example, target /var, source /dev/sda2[/@/var], fstype btrfs. Dies if $path is on no mounted file system.
enable_debugfs();
Mounts debugfs at /sys/kernel/debug (e.g. on SLE 16.1+, where it is disabled by default per PED-8812).
get_kernel_config();
Locates the running kernel's config file (/boot/config-$(uname -r), falling back to /usr/lib/modules/$(uname -r)/config and then /proc/config.gz) and records its full contents via record_info(), prefixed with a comment naming the source file (as done in LTP::utils::log_versions).
get_verified_shallow_tar(tree => 'stable', branch => 'linux-6.12.y', commit => '...');
Downloads the kernel.org shallow-clone tarball for the given tree and branch, verifies it via the signed checksums, and checks out commit into ./linux. commit should always be supplied in CI; omitting it checks out the current tip (the bundle is published nightly).
See https://people.kernel.org/monsieuricon/using-shallow-git-tarballs-for-ci.
start_trace_events(\@events);
start_trace_events(\@events, filters => {$event => $filter}, buffer_kb => $kb);
Enable kernel tracepoints in tracefs and start to trace. Each event is system/event, a shell glob selects several events, e.g. nfs4/pnfs_*. Events that the kernel does not provide are skipped.
The events go to the trace ring buffer, which keeps the newest events when it is full. Thus the trace can run for a long time without filling the disk. save_trace saves it.
If the first event is enabled already, e.g. by an earlier call before each subtest, only clear the trace. This keeps repeated calls short. After a reboot the events are enabled again.
Arguments: \@events - Events to enable filters - Optional event filters, e.g. 'dev == 7340033' buffer_kb - Optional ring buffer size per CPU in KiB (default: 8192)
save_trace($file);
Save the trace started by start_trace_events to $file.
install_fio_debug_wrapper($dir);
Install a wrapper as /usr/local/bin/fio, so that tests which call fio from PATH run it with --debug=file,mem and strace of the failed syscalls. For each fio run the wrapper keeps the job file, the command line, the debug output and the strace output in $dir, named by the pid of the wrapper.
Only fio runs that write the results to a file with --output= are changed, else the debug output would change the output of the test. The debug output is kept out of the --output file too, tests often copy this file to their logs.
Without strace 5.2 or newer (for -Z) fio runs without strace.
my $traces = find_kernel_traces([file => $file] [, since => $text]
[, ignore => \@regexps] [, ignore_file => $file]);
Find the kernel log lines that show a call trace, a kernel BUG, an Oops, a kernel panic or a hung task. The function reads dmesg, or file if you give it.
With since, the function only reads the last line that contains $text and the lines after it. If no line contains $text, for example because the SUT rebooted, the function returns undef.
ignore is a list of extended regular expressions. The function removes the lines that match before it does the check. ignore_file is a file with more of these expressions, one for each line. The function uses it only if it exists.
Each step writes its result to a file in $KERNEL_TRACE_DIR on the SUT (0-log, 1-since, 2-ignore, 3-ignore_file, 4-traces), so you can look at them when the result is not what you expect. The next call overwrites them.
Returns a reference to the list of lines that it found (the list can be empty, at most 100 lines).