xfs: race freeze and fsmap for a while to see if we livelock
[xfstests-dev.git] / tools / compare-failures
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc.  All Rights Reserved.
4 #
5 # Compare test failures across runs
6 #
7 # Takes multiple "results" files as arguments, comprised of the
8 # stdout from a ./check run, each containing a Failures: line.
9 #
10 # Outputs a table of failures for comparison across runs
11 #
12 filter_names() {
13         sed -e s/btrfs/b/ \
14             -e s/cifs/c/g \
15             -e s/f2fs/f/g \
16             -e s/generic/g/g \
17             -e s/overlay/o/g \
18             -e s/shared/s/g \
19             -e s/udf/u/g \
20             -e s/xfs/x/g
21 }
22
23 # ALLFAILURES:   A B C D E F G
24 # THESEFAILURES: A   C D     G
25
26 # We want to print the header (ALLFAILURES) and then
27 # if a run didn't fail a particular test, print spaces instead
28
29 # All tests that failed in any run, all on one line, unique
30 ALLFAILURES=`grep -h ^Failures: $* \
31                 | tr " " "\n" \
32                 | sort | uniq \
33                 | filter_names \
34                 | tr "\n" " " \
35                 | sed -e "s/^Failures: //g"`
36
37 # Header
38 echo "Failures:"
39 echo $ALLFAILURES
40 echo $ALLFAILURES | sed -e "s/./-/g"
41
42 # Per-file failures
43 for FILE in $*; do
44         THESEFAILURES=`grep ^Failures: $FILE | filter_names`
45         for FAILURE in $ALLFAILURES; do
46                 CELL=`echo $THESEFAILURES \
47                       | grep -wo "$FAILURE" || echo $FAILURE | sed -e "s/./ /g"`
48                 echo -n "$CELL "
49         done
50         echo $FILE
51 done