diff mbox series

[v2,5/9] fstests: add makefile target to show test results

Message ID 20250312214232.955450-6-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
Add 'fstests-show-results' makefile target to show test results.

Under the hood, it more or less just does 'find ... | xargs cat'.

By default, the xunit_result.txt file 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.13.4-300.fc41.x86_64 make fstests-show-results

You can change the files being shown by overriding the PATTERN variable.
For example, to just see the xml output files:
$ PATTERN="-name \"*.xml\"" make fstests-show-results

or to see the xunit_results.txt and the bad results:
$ PATTERN="\( -name xunit_results.txt -o -name \"*.bad\" \)" make fstests-show-results

or you can do any combination thereof, e.g.
$ LAST_KERNEL=6.13.4-300.fc41.x86_64 PATTERN="-name \"*.bad\"" make fstests-show-results

Finally, note that if you override the PATTERN variable, then the output
will also include the filename... otherwise it the output will not
include the filename.  The reason I did it this way for this workflow
specifically is so that Luis can use 'make fstests-show-results' in his
github workflow and he should get exactly the same output as he does
today.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 workflows/fstests/Makefile | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Luis Chamberlain March 12, 2025, 9:55 p.m. UTC | #1
On Wed, Mar 12, 2025 at 05:42:28PM -0400, Scott Mayhew wrote:
> Add 'fstests-show-results' makefile target to show test results.
> 
> Under the hood, it more or less just does 'find ... | xargs cat'.
> 
> By default, the xunit_result.txt file 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.13.4-300.fc41.x86_64 make fstests-show-results
> 
> You can change the files being shown by overriding the PATTERN variable.
> For example, to just see the xml output files:
> $ PATTERN="-name \"*.xml\"" make fstests-show-results
> 
> or to see the xunit_results.txt and the bad results:
> $ PATTERN="\( -name xunit_results.txt -o -name \"*.bad\" \)" make fstests-show-results
> 
> or you can do any combination thereof, e.g.
> $ LAST_KERNEL=6.13.4-300.fc41.x86_64 PATTERN="-name \"*.bad\"" make fstests-show-results
> 
> Finally, note that if you override the PATTERN variable, then the output
> will also include the filename... otherwise it the output will not
> include the filename.  The reason I did it this way for this workflow
> specifically is so that Luis can use 'make fstests-show-results' in his
> github workflow and he should get exactly the same output as he does
> today.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
 
  Luis
diff mbox series

Patch

diff --git a/workflows/fstests/Makefile b/workflows/fstests/Makefile
index 344a1f8..40629fd 100644
--- a/workflows/fstests/Makefile
+++ b/workflows/fstests/Makefile
@@ -115,6 +115,28 @@  ifneq (,$(COUNT))
 FSTESTS_DYNAMIC_RUNTIME_VARS += , "oscheck_extra_args": "-I $(COUNT)"
 endif
 
+ifndef LAST_KERNEL
+LAST_KERNEL := $(shell cat workflows/fstests/results/last-kernel.txt 2>/dev/null)
+endif
+
+ifeq ($(LAST_KERNEL), $(shell cat workflows/fstests/results/last-kernel.txt 2>/dev/null))
+FIND_PATH := workflows/fstests/results/last-run
+else
+FIND_PATH := workflows/fstests/results/$(LAST_KERNEL)
+endif
+
+ifndef PATTERN
+PATTERN := -name xunit_results.txt
+endif
+
+ifndef XARGS_ARGS
+ifeq (-name xunit_results.txt,$(PATTERN))
+XARGS_ARGS := cat
+else
+XARGS_ARGS := -I {} bash -c 'echo "{}:"; cat {}; echo;'
+endif
+endif
+
 fstests: $(FSTESTS_BASELINE_EXTRA)
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l localhost,baseline,dev \
 		-f 30 -i hosts playbooks/fstests.yml --skip-tags run_tests,copy_results $(LIMIT_HOSTS)
@@ -218,6 +240,11 @@  fstests-dev-results: $(KDEVOPS_EXTRA_VARS)
 		--extra-vars=@./extra_vars.yaml \
 		$(LIMIT_HOSTS)
 
+fstests-show-results:
+	@find $(FIND_PATH) -type f $(PATTERN) \
+		| xargs $(XARGS_ARGS) \
+		| sed '$${/^$$/d;}'
+
 fstests-help-menu:
 	@echo "fstests options:"
 	@echo "fstests                                 - Git clones fstests, builds and install it"