Skip to content

Commit 8aa5012

Browse files
committed
ltp: add makefile target to show test results
Under the hood, it more or less just does 'find ... | xargs cat'. By default, the "*.log" 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 failures: $ PATTERN="-name \"*.failed\"" make ltp-show-results Note that since the ltp 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 override that too if you get creative with the PATTERN variable). Signed-off-by: Scott Mayhew <[email protected]>
1 parent d17a909 commit 8aa5012

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

workflows/ltp/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,24 @@ LTP_KERNEL_CI_LOOP := scripts/workflows/ltp/run_kernel_ci.sh
9696
LTP_KERNEL_CI_LOOP_KOTD := scripts/workflows/ltp/run_kernel_ci_kotd.sh
9797
endif # CONFIG_KERNEL_CI
9898

99+
ifndef LAST_KERNEL
100+
LAST_KERNEL := $(shell cat workflows/ltp/results/last-kernel.txt 2>/dev/null)
101+
endif
102+
103+
ifeq ($(LAST_KERNEL), $(shell cat workflows/ltp/results/last-kernel.txt 2>/dev/null))
104+
FIND_PATH := workflows/ltp/results/last-run
105+
else
106+
FIND_PATH := workflows/ltp/results/$(LAST_KERNEL)
107+
endif
108+
109+
ifndef PATTERN
110+
PATTERN := -name "*.log"
111+
endif
112+
113+
ifndef XARGS_ARGS
114+
XARGS_ARGS := -I {} bash -c 'echo "{}:"; cat {}; echo;'
115+
endif
116+
99117
ltp:
100118
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) -l baseline,dev \
101119
-f 30 -i hosts playbooks/ltp.yml --skip-tags run_tests,copy_results
@@ -128,6 +146,11 @@ ltp-dev-reset:
128146
-f 30 -i hosts -l dev playbooks/ltp.yml \
129147
--tags vars,reset --extra-vars=@./extra_vars.yaml
130148

149+
ltp-show-results:
150+
@find $(FIND_PATH) -type f $(PATTERN) \
151+
| xargs $(XARGS_ARGS) \
152+
| sed '$${/^$$/d;}'
153+
131154
ltp-help-menu:
132155
@echo "ltp options:"
133156
@echo "ltp - Git clone ltp, build and install it"

0 commit comments

Comments
 (0)