path: root/utils
diff options
authorGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2018-03-23 22:48:14 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2018-04-01 16:30:34 +0200
commit0534da0f9fe4ace9dccd30e47c620532c9affb29 (patch)
tree714b260a1bfca308a031fb3818639ffd04af8495 /utils
parent1fdd63ad372d7af555c71ae42e0a471c86a0cec9 (diff)
test-pkg: test a subset of toolchains by default, add -a and -n options
During the latest Buildroot Developers meeting, we discussed that test-pkg would perhaps be more widely used if it tested a smaller subset of toolchains. Indeed, it currently tests 47 toolchains, which takes very long to build. Several of the toolchain configurations are quite similar, and it is perhaps not necessary for contributors to test them all before submitting a package. Therefore, this commit changes the test-pkg script to only test a subset of the toolchain configurations by default. The N first configurations of the CSV files are tested, where N is hard-coded in the script. The CSV file has therefore been re-organized to have the first N toolchains be the most important ones. A -a/--all option is added to test with all toolchains, while a -n/--number option is added to test with the first N toolchains, N being passed on the command line. Note that the list of toolchains (built in the "toolchains" shell variable) is no longer sorted. Indeed, when the first N toolchains are tested, we want them to be tested in the same order as they are listed in the CSV file, as we are careful to order them in an interesting order. We only sort when all toolchains are tested. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Matt Weber <matthew.weber@rockwellcollins.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'utils')
1 files changed, 49 insertions, 7 deletions
diff --git a/utils/test-pkg b/utils/test-pkg
index cd7b9dad7b..2e069b6005 100755
--- a/utils/test-pkg
+++ b/utils/test-pkg
@@ -5,28 +5,37 @@ TOOLCHAINS_CSV='support/config-fragments/autobuild/toolchain-configs.csv'
main() {
local o O opts
- local cfg dir pkg random toolchains_dir toolchain
+ local cfg dir pkg random toolchains_dir toolchain all number mode
local ret nb nb_skip nb_fail nb_legal nb_tc build_dir
local -a toolchains
- o='hc:d:p:r:t:'
+ o='hac:d:n:p:r:t:'
opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")"
eval set -- "${opts}"
+ all=0
+ number=0
+ mode=0
while [ ${#} -gt 0 ]; do
case "${1}" in
help; exit 0
+ (-a|--all)
+ all=1; shift 1
+ ;;
cfg="${2}"; shift 2
dir="${2}"; shift 2
+ (-n|--number)
+ number="${2}"; shift 2
+ ;;
pkg="${2}"; shift 2
@@ -51,15 +60,37 @@ main() {
+ if [ ${random} -gt 0 ]; then
+ mode=$((mode+1))
+ fi
+ if [ ${number} -gt 0 ]; then
+ mode=$((mode+1))
+ fi
+ if [ ${all} -eq 1 ]; then
+ mode=$((mode+1))
+ fi
+ # Default mode is to test the N first toolchains, which have been
+ # chosen to be a good selection of toolchains.
+ if [ ${mode} -eq 0 ] ; then
+ number=7
+ elif [ ${mode} -gt 1 ] ; then
+ printf "error: --all, --number and --random are mutually exclusive\n" >&2; exit 1
+ fi
# Extract the URLs of the toolchains; drop internal toolchains
# E.g.: http://server/path/to/name.config,arch,libc
# --> http://server/path/to/name.config
toolchains=($(sed -r -e 's/,.*//; /internal/d; /^#/d; /^$/d;' "${toolchains_csv}" \
|if [ ${random} -gt 0 ]; then \
sort -R |head -n ${random}
- else
- cat
- fi |sort
+ elif [ ${number} -gt 0 ]; then \
+ head -n ${number}
+ else
+ sort
+ fi
@@ -154,6 +185,10 @@ toolchain config fragment and the required host architecture, separated by a
comma. The config fragments should contain only the toolchain and architecture
+By default, a useful subset of toolchains is tested. If needed, all
+toolchains can be tested (-a), an arbitrary number of toolchains (-n
+in order, -r for random).
-h, --help
@@ -170,9 +205,16 @@ Options:
Test-build the package PKG, by running 'make PKG'; if not specified,
just runs 'make'.
+ -a, --all
+ Test all toolchains, instead of the default subset defined by
+ Buildroot developers.
+ -n N, --number N
+ Test N toolchains, in the order defined in the toolchain CSV
+ file.
-r N, --random N
- Limit the tests to the N randomly selected toolchains, instead of
- building with all toolchains.
+ Limit the tests to the N randomly selected toolchains.
-t CSVFILE, --toolchains-csv CSVFILE
CSV file containing the paths to config fragments of toolchains to