Jimmy Brisson | cb545bd | 2021-01-06 13:52:58 -0600 | [diff] [blame] | 1 | Scripts that Generate Graphs |
| 2 | ============================ |
| 3 | |
| 4 | This directory contains scripts that generate graphs. Each script is run with |
| 5 | bash and may require additional tools. All of the scripts require gnuplot. |
| 6 | |
| 7 | All scripts produce a PNG graph on stdout and the data on stderr. |
| 8 | |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 9 | Tests by Category |
| 10 | ----------------- |
Jimmy Brisson | cb545bd | 2021-01-06 13:52:58 -0600 | [diff] [blame] | 11 | |
| 12 | The script `categorize-tests.bash`, and its associated awk and plot scripts, |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 13 | generate a stacked bar chart with bars representing groups of tests (L1 L2, |
| 14 | etc.) and segments of the bars representing types. ``categorize-tests.bash`` |
Jimmy Brisson | cb545bd | 2021-01-06 13:52:58 -0600 | [diff] [blame] | 15 | accepts an argument to filter the tests included with grep. |
| 16 | |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 17 | For example, the following will produce a graph of the Juno-specific tests: |
| 18 | |
| 19 | .. code-block:: |
Jimmy Brisson | cb545bd | 2021-01-06 13:52:58 -0600 | [diff] [blame] | 20 | |
| 21 | bash categorize-tests.bash juno > juno-tests.png 2> juno-tests.txt |
| 22 | |
Jimmy Brisson | c7e28f5 | 2021-01-21 16:23:21 -0600 | [diff] [blame] | 23 | Lines of Code by Module |
| 24 | ----------------------- |
| 25 | |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 26 | The script ``sloc-viz.bash``, and its associated plot script, generate a stacked |
| 27 | bar chart where each bar is a module and the bars' segments represent |
| 28 | programming languages (or documentation languages). This script will produce a |
| 29 | graph for whatever directory it's run within, and has special logic that |
| 30 | includes more detail when run from the Trusted Firmware - A project's root |
| 31 | directory. |
Jimmy Brisson | c7e28f5 | 2021-01-21 16:23:21 -0600 | [diff] [blame] | 32 | |
| 33 | This script has additional requirements: |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 34 | |
Jimmy Brisson | c7e28f5 | 2021-01-21 16:23:21 -0600 | [diff] [blame] | 35 | * ``tokei`` - a quick source lines of code counting tool |
| 36 | * ``jq`` - a JSON query language for the command line, version 1.6 or later |
| 37 | as the ``--jsonargs`` option is required |
| 38 | |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 39 | For example, when run from the root of TF-A, the following command line will |
| 40 | graph SLOC of TF-A: |
| 41 | |
| 42 | .. code-block:: |
Jimmy Brisson | c7e28f5 | 2021-01-21 16:23:21 -0600 | [diff] [blame] | 43 | |
Harrison Mutai | 4126dc7 | 2021-11-23 11:34:41 +0000 | [diff] [blame] | 44 | bash ../<this-repo>/script/graphs/sloc-viz.bash > sloc.png 2> sloc.tsv |
| 45 | |
| 46 | Test Results |
| 47 | ------------ |
| 48 | |
| 49 | The script `tf-main-results.bash` uses curl to retrieve test results for a |
| 50 | tf-a-main Jenkins job, and generates a CSV and stacked histogram PNG of the |
| 51 | combined data. |
| 52 | |
| 53 | Usage: |
| 54 | ====== |
| 55 | |
| 56 | bash tf-main-results.bash <jenkins-url> [ci_gateway] [filter] |
| 57 | |
| 58 | The Jenkins URL is the URL for the target build job. |
| 59 | |
| 60 | https://ci.trustedfirmware.org/job/tf-a-main/1/ |
| 61 | |
| 62 | The sub-builds for this job will all be queried to find the ones that contain |
| 63 | tests, ignoring child builds that only build and don't run any platform tests. |
| 64 | |
| 65 | `tf-a-ci-gateway` is the default gateway, although, different gateways may be |
| 66 | specified with the optional "ci_gateway" argument. This option will be combined |
| 67 | with the build numbers and the base Jenkins URL to retrieve the results of |
| 68 | sub-builds. |
| 69 | |
| 70 | This can be filtered further using the optional "filter" argument, which will |
| 71 | select only test groups that match the provided regex. |
| 72 | |
| 73 | Example Useful Queries |
| 74 | ====================== |
| 75 | |
| 76 | Only show tests running the test framework: |
| 77 | |
| 78 | bash tf-main-results.bash <jenkins-url> [ci_gateway] "tftf" |
| 79 | |
| 80 | Only show tests for N1SDP & Juno platforms: |
| 81 | |
| 82 | bash tf-main-results.bash <jenkins-url> [ci_gateway] "n1sdp|juno" |
| 83 | |
| 84 | Only show boot tests on FVP platforms: |
| 85 | |
| 86 | bash tf-main-results.bash <jenkins-url> [ci_gateway] 'fvp.*boot' |
| 87 | |
| 88 | Note: for filters that return a small number of test groups, the graph is not |
| 89 | ideal as it is sized for a large number. A CSV file of the data is also produced, |
| 90 | however, so that you can use it to create your own graph, if required. |
| 91 | |
| 92 | Additional Config |
| 93 | ================= |
| 94 | |
| 95 | The script also allows the three output files to be configured via ENV variables: |
| 96 | |
| 97 | PNGFILE=out.png CSVFILE=out.csv bash tf-main-results.bash |
| 98 | |
| 99 | If they are not set then default values based on the build number will be generated: |
| 100 | |
| 101 | PNGFILE_DEFAULT="tf-main_${build_number}.png" |
| 102 | CSVFILE_DEFAULT="tf-main_${build_number}.csv" |
| 103 | |
| 104 | If any of these files already exist then they will be overwritten. |
Jimmy Brisson | c7e28f5 | 2021-01-21 16:23:21 -0600 | [diff] [blame] | 105 | |
Chris Kay | 32d73bc | 2021-12-09 14:37:06 +0000 | [diff] [blame] | 106 | *Copyright (c) 2021-2022, Arm Limited. All rights reserved.* |