blob: b057943df57c79aa4b7579a7c154f43ee99f912e [file] [log] [blame]
Jimmy Brissoncb545bd2021-01-06 13:52:58 -06001Scripts that Generate Graphs
2============================
3
4This directory contains scripts that generate graphs. Each script is run with
5bash and may require additional tools. All of the scripts require gnuplot.
6
7All scripts produce a PNG graph on stdout and the data on stderr.
8
Chris Kay32d73bc2021-12-09 14:37:06 +00009Tests by Category
10-----------------
Jimmy Brissoncb545bd2021-01-06 13:52:58 -060011
12The script `categorize-tests.bash`, and its associated awk and plot scripts,
Chris Kay32d73bc2021-12-09 14:37:06 +000013generate a stacked bar chart with bars representing groups of tests (L1 L2,
14etc.) and segments of the bars representing types. ``categorize-tests.bash``
Jimmy Brissoncb545bd2021-01-06 13:52:58 -060015accepts an argument to filter the tests included with grep.
16
Chris Kay32d73bc2021-12-09 14:37:06 +000017For example, the following will produce a graph of the Juno-specific tests:
18
19.. code-block::
Jimmy Brissoncb545bd2021-01-06 13:52:58 -060020
21 bash categorize-tests.bash juno > juno-tests.png 2> juno-tests.txt
22
Jimmy Brissonc7e28f52021-01-21 16:23:21 -060023Lines of Code by Module
24-----------------------
25
Chris Kay32d73bc2021-12-09 14:37:06 +000026The script ``sloc-viz.bash``, and its associated plot script, generate a stacked
27bar chart where each bar is a module and the bars' segments represent
28programming languages (or documentation languages). This script will produce a
29graph for whatever directory it's run within, and has special logic that
30includes more detail when run from the Trusted Firmware - A project's root
31directory.
Jimmy Brissonc7e28f52021-01-21 16:23:21 -060032
33This script has additional requirements:
Chris Kay32d73bc2021-12-09 14:37:06 +000034
Jimmy Brissonc7e28f52021-01-21 16:23:21 -060035* ``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 Kay32d73bc2021-12-09 14:37:06 +000039For example, when run from the root of TF-A, the following command line will
40graph SLOC of TF-A:
41
42.. code-block::
Jimmy Brissonc7e28f52021-01-21 16:23:21 -060043
Harrison Mutai4126dc72021-11-23 11:34:41 +000044 bash ../<this-repo>/script/graphs/sloc-viz.bash > sloc.png 2> sloc.tsv
45
46Test Results
47------------
48
49The script `tf-main-results.bash` uses curl to retrieve test results for a
50tf-a-main Jenkins job, and generates a CSV and stacked histogram PNG of the
51combined data.
52
53Usage:
54======
55
56 bash tf-main-results.bash <jenkins-url> [ci_gateway] [filter]
57
58The Jenkins URL is the URL for the target build job.
59
60 https://ci.trustedfirmware.org/job/tf-a-main/1/
61
62The sub-builds for this job will all be queried to find the ones that contain
63tests, 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
66specified with the optional "ci_gateway" argument. This option will be combined
67with the build numbers and the base Jenkins URL to retrieve the results of
68sub-builds.
69
70This can be filtered further using the optional "filter" argument, which will
71select only test groups that match the provided regex.
72
73Example Useful Queries
74======================
75
76Only show tests running the test framework:
77
78 bash tf-main-results.bash <jenkins-url> [ci_gateway] "tftf"
79
80Only show tests for N1SDP & Juno platforms:
81
82 bash tf-main-results.bash <jenkins-url> [ci_gateway] "n1sdp|juno"
83
84Only show boot tests on FVP platforms:
85
86 bash tf-main-results.bash <jenkins-url> [ci_gateway] 'fvp.*boot'
87
88Note: for filters that return a small number of test groups, the graph is not
89ideal as it is sized for a large number. A CSV file of the data is also produced,
90however, so that you can use it to create your own graph, if required.
91
92Additional Config
93=================
94
95The 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
99If 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
104If any of these files already exist then they will be overwritten.
Jimmy Brissonc7e28f52021-01-21 16:23:21 -0600105
Chris Kay32d73bc2021-12-09 14:37:06 +0000106*Copyright (c) 2021-2022, Arm Limited. All rights reserved.*