blob: b590c65dbb83d7de753b8848b487109afe793d74 [file] [log] [blame]
Jimmy Brissoncb545bd2021-01-06 13:52:58 -06001#
2# Copyright (c) 2021 Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#!/usr/bin/env awk
7#
8# This is a script to categorize tests within this repo by type. This script is
9# intended to be run with the output of `find group -type f`, run from within
10# the root directory of this repo piped into it. See the bash script with the
11# same name for an usage example.
12
13BEGIN {
14 # We're breaking records upon the "/" character so that we can have an
15 # aggregation that's keyed by test group, if we want to.
16 FS = "/";
17}
18
19# Here we filter out any records without exactly 3 fields (i.e. 3-level paths)
20# and categorize the rest.
21NF == 3 {
22 if (/-l1/) category = "\"l1 - Every Patch\"";
23 else if (/-l2/) category = "\"l2 - Risky or Big Patches\"";
24 else if (/-l3/) category = "\"l3 - Daily\"";
25 else if (/-manual/ || /-release/ ) category = "\"remainder - Every Release\"";
26 else if (/-unstable/) category = "\"unstable - Never Run\"";
27 else category = "\"remainder - Every Release\"";
28 cats[category] = 1
29 # Each of these categorizes a test into a category, based on a regular
30 # expression. When you add another test category, you should also add
31 # printing to the print group loop below.
32 if (/linux/ || /uboot/ || /edk2/ || /:fvp-([a-z0-9.]-)*spm/ || /:juno-([a-z0-9.]-)*scmi/) integration[category] += 1;
33 else if (/tftf/) component[category] += 1;
34 else if (/coverity/ || /misra/ || /scan_build/) static[category] += 1;
35 else if (/:nil/ || /norun/) build[category] += 1;
36 else print $0 " No test category; excluding from data" >> "/dev/stderr";
37}
38
39
40END {
41 for (name in cats)
42 # This prints a single test group, by name. When you add another
43 # category (with another map), add another field to this print.
44 printf("%s %d %d %d %d\n",
45 name,
46 build[name],
47 static[name],
48 component[name],
49 integration[name]);
50}