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