From 7a7df06f98db1d4b6e9fe15d8c48e7eef2010bc6 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 5 Sep 2023 22:03:15 +0200 Subject: [PATCH] btrfs-progs: tests: extend scan-results.sh to scan only a given file Scanning all results is meant for the whole testsuite, we'd like to make it more fine grained to verify them once a test is run via the test running wrappers. Signed-off-by: David Sterba --- tests/scan-results.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/scan-results.sh b/tests/scan-results.sh index fcdf10b1..c2b71473 100755 --- a/tests/scan-results.sh +++ b/tests/scan-results.sh @@ -1,9 +1,12 @@ #!/bin/sh +# Look for some frequent error message templates in test logs +# +# Usage: $0 [test-log.txt] -# look for some error messages in all test logs +scan_log() { + local file="$1" -for i in *.txt; do - echo "Scanning $i" + echo "Scanning $file" last= while read line; do case "$line" in @@ -17,5 +20,16 @@ for i in *.txt; do *extent\ buffer\ leak*) echo "EXTENT BUFFER LEAK: $last" ;; *) : ;; esac - done < "$i" + done < "$file" +} + +# Scan only the given file +if [ -n "$1" ]; then + scan_log "$1" + exit +fi + +# Scan all existing test logs +for file in *.txt; do + scan_log "$file" done