lin
2025-08-01 633231e833e21d5b8b1c00cb15aedb62b3b78e8f
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 "$@"