aboutsummaryrefslogtreecommitdiff
path: root/list_failed.sh
blob: 1000ae1c2475a72e7341ad83ee22eaf1dee2491f (plain)
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
#!/bin/bash
#
# This script lists the tests which are failing in the output of Robolectric
# tests.
# TODO: Remove this script and move the functionality into a custom JUnit runner.

# Matches the line specifying which test has failed and matches the test name
# and class name as the first and second matching group, respectively.
readonly FAILED_TEST_RE='^[1-9][0-9]*)\s\(\w\+\)(\(\(\w\|.\)\+\))$'

# Fails with a message.
function fatal() {
  echo 1>&2 "FATAL: $@"
  exit 113
}

function main() {
  test $# = 0 || fatal "Too many arguments: $@"

  sed -e '1,/^There \(was 1 failure\|were [0-9]* failures\):$/d' |
      grep "$FAILED_TEST_RE" |
      sed -e "s/$FAILED_TEST_RE/\2.\1/" ||
      true
}

set -e
set -o pipefail
main "$@"