diff mbox series

[v2,7/9] nfstest: add makefile target to show test results

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

Commit Message

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

It shows the text results files 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.13.4-300.fc41.x86_64 make nfstest-show-results

Note that since the nfstest 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 in 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
change that by overriding the PATTERN variable).

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

Patch

diff --git a/workflows/nfstest/Makefile b/workflows/nfstest/Makefile
index 638ec1f..7cac039 100644
--- a/workflows/nfstest/Makefile
+++ b/workflows/nfstest/Makefile
@@ -53,6 +53,24 @@  NFSTEST_KERNEL_CI_LOOP      := scripts/workflows/nfstest/run_kernel_ci.sh
 NFSTEST_KERNEL_CI_LOOP_KOTD := scripts/workflows/nfstest/run_kernel_ci_kotd.sh
 endif # CONFIG_KERNEL_CI
 
+ifndef LAST_KERNEL
+LAST_KERNEL := $(shell cat workflows/nfstest/results/last-kernel.txt 2>/dev/null)
+endif
+
+ifeq ($(LAST_KERNEL), $(shell cat workflows/nfstest/results/last-kernel.txt 2>/dev/null))
+FIND_PATH := workflows/nfstest/results/last-run
+else
+FIND_PATH := workflows/nfstest/results/$(LAST_KERNEL)
+endif
+
+ifndef PATTERN
+PATTERN := -name "*.log"
+endif
+
+ifndef XARGS_ARGS
+XARGS_ARGS := -I {} bash -c 'echo "{}:"; cat {}; echo;'
+endif
+
 nfstest:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
 		-f 30 -i hosts playbooks/nfstest.yml \
@@ -88,6 +106,11 @@  nfstest-dev-reset:
 		--tags vars,reset \
 		--extra-vars=@./extra_vars.yaml
 
+nfstest-show-results:
+	@find $(FIND_PATH) -type f $(PATTERN) \
+		| xargs $(XARGS_ARGS) \
+		| sed '$${/^$$/d;}'
+
 nfstest-help-menu:
 	@echo "nfstest options:"
 	@echo "nfstest                              - Git clone nfstest and install it"