File: unit-count.sh

package info (click to toggle)
tpm2-abrmd 3.0.0-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,468 kB
  • sloc: ansic: 17,633; makefile: 492; sh: 347; xml: 18
file content (15 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

# This is a quick script that parses the log files from 'make check' to
# extract the number of unit tests in each test binary. It keeps a running
# total of the tests dumping this count to stdout before exiting.

ls -1 test/*.log |
{
    VAL=0;
    while read FILE; do
        TMP=$(sed -e 's&^.*[[:space:]]\+\([0-9]\+\)[[:space:]]\+test(s) run\.$&\1&;tx;d;:x' ${FILE});
        VAL=$(expr "${VAL}" + "${TMP}");
    done;
    echo "Total number of unit tests: ${VAL}"
}