File: verify-blocklist.sh

package info (click to toggle)
intel-gpu-tools 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,360 kB
  • sloc: xml: 781,458; ansic: 360,567; python: 8,336; yacc: 2,781; perl: 1,196; sh: 1,177; lex: 487; asm: 227; lisp: 35; makefile: 30
file content (61 lines) | stat: -rwxr-xr-x 1,226 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# SPDX-License-Identifier: MIT

# Verify that all entries in a blocklist file are still valid

usage() {
    echo "Usage: $0 <path-to-igt-runner> <test-binary-directory> <blocklist-files ...>"
    echo
    echo " path-to-igt-runner: For example build/runner/igt_runner"
    echo " test-binary-directory: For example build/tests"
    echo " blocklist-files: For example tests/intel-ci/i915.blocklist.txt"
    exit 2
}

if [ $# -lt 3 ]; then
    usage
fi

RUNNER="$1"
shift
BINDIR="$1"
shift
BLFILES="$*"

if [ ! -x "$RUNNER" ]; then
    echo "$RUNNER not found"
    echo
    usage
fi

if [ ! -f "$BINDIR/test-list.txt" ]; then
    echo "$BINDIR doesn't look like a test-binary directory"
    echo
    usage
fi

for BLFILE in $BLFILES; do
    if [ ! -f "$BLFILE" ]; then
	echo "$BLFILE not found"
	echo
	usage
    fi
done

STATUS=0

TESTLIST="$("$RUNNER" --list-all "$BINDIR")"

for BLFILE in $BLFILES; do
    cat "$BLFILE" | while read line; do
	blentry=$(echo "$line" | sed 's/#.*//' | tr -d '[:space:]')
	if [ "$blentry" = "" ]; then continue; fi

	if ! (echo "$TESTLIST" | grep -Pq "$blentry") >/dev/null 2>/dev/null; then
	    echo "$BLFILE: Useless entry: $blentry"
	    STATUS=1
	fi
    done
done

exit $STATUS