diff mbox series

[9/9] ltp: add makefile target to show test results

Message ID 20250305005755.697599-11-smayhew@redhat.com (mailing list archive)
State New
Headers show
Series tweak results organization and reporting | expand

Commit Message

Scott Mayhew March 5, 2025, 12:57 a.m. UTC
Under the hood, it more or less just does 'find ... | xargs cat'.

By default, the "*.failed" files will be shown for the most recent kernel
run.  You can show the results for a different kernel by overriding the
LAST_KERNEL variable, e.g.

$ LAST_KERNEL=6.11.9-100.fc39.x86_64 make ltp-show-results

You can change the files being shown by overriding the PATTERN variable.
For example, to just see the full test logs:

$ PATTERN="-name \"*.log\"" make ltp-show-results

Note that since the gitr log files have a date and timestamp in the
filename, it's possible to accumulate logs from multiple test runs.  If
you're showing the results from the most recent kernel, then we'll only
show the logs from the most recent run (i.e. logs that are newer than
the timestamp of the last-run directory). But if you're showing the
results from an older kernel, then we'll show all the logs in that
directory (but you can override that too if you get creative with the
PATTERN variable).

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 workflows/ltp/Makefile | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/workflows/ltp/Makefile b/workflows/ltp/Makefile
index 4e439da..8de76a0 100644
--- a/workflows/ltp/Makefile
+++ b/workflows/ltp/Makefile
@@ -96,6 +96,14 @@  LTP_KERNEL_CI_LOOP      := scripts/workflows/ltp/run_kernel_ci.sh
 LTP_KERNEL_CI_LOOP_KOTD := scripts/workflows/ltp/run_kernel_ci_kotd.sh
 endif # CONFIG_KERNEL_CI
 
+ifndef LAST_KERNEL
+LAST_KERNEL := $(shell cat workflows/ltp/results/last-kernel.txt 2>/dev/null)
+endif
+
+ifndef PATTERN
+PATTERN := -name "*.failed"
+endif
+
 ltp:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
 		-f 30 -i hosts playbooks/ltp.yml --skip-tags run_tests,copy_results
@@ -128,6 +136,19 @@  ltp-dev-reset:
 		-f 30 -i hosts -l dev playbooks/ltp.yml \
 		--tags vars,reset --extra-vars=@./extra_vars.yaml
 
+ltp-show-results:
+ifdef LAST_KERNEL
+ifeq ($(LAST_KERNEL), $(shell cat workflows/ltp/results/last-kernel.txt 2>/dev/null))
+	find workflows/ltp/results/$(LAST_KERNEL) -type f $(PATTERN) -newer workflows/ltp/results/last-run \
+		| xargs -I {} bash -c 'echo "{}:"; cat {}; echo;'
+else
+	@find workflows/ltp/results/$(LAST_KERNEL) -type f $(PATTERN) \
+		| xargs -I {} bash -c 'echo "{}:"; cat {}; echo;'
+endif
+else
+	@echo "No results."
+endif
+
 ltp-help-menu:
 	@echo "ltp options:"
 	@echo "ltp                              - Git clone ltp, build and install it"