All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-08 22:00   ` Cam Hutchison
                     ` (3 more replies)
  2017-02-08 20:15 ` [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton Yann E. MORIN
                   ` (4 subsequent siblings)
  5 siblings, 4 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

This script helps in testing that a package builds fine on a wide range
of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[yann.morin.1998 at free.fr:
 - completely rewrite the script from Thomas, with help from Luca
]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

---
Changes v2 -> v3:
  - grammar  (Luca)
---
 support/scripts/test-pkg | 168 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 168 insertions(+)
 create mode 100755 support/scripts/test-pkg

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
new file mode 100755
index 0000000..008b32c
--- /dev/null
+++ b/support/scripts/test-pkg
@@ -0,0 +1,168 @@
+#!/bin/bash
+set -e
+
+TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv'
+
+main() {
+    local o O opts
+    local cfg dir pkg toolchain
+    local -a toolchains
+
+    o='hc:d:p:'
+    O='help,config-snippet:build-dir:package:'
+    opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
+    eval set -- "${opts}"
+
+    while [ ${#} -gt 0 ]; do
+        case "${1}" in
+        (-h|--help)
+            help; exit 0
+            ;;
+        (-c|--config-snippet)
+            cfg="${2}"; shift 2
+            ;;
+        (-d|--build-dir)
+            dir="${2}"; shift 2
+            ;;
+        (-p|--package)
+            pkg="${2}"; shift 2
+            ;;
+        (--)
+            shift; break
+            ;;
+        esac
+    done
+    if [ -z "${cfg}" ]; then
+        printf "error: no config snippet specified\n" >&2; exit 1
+    fi
+    if [ -z "${dir}" ]; then
+        dir="${HOME}/br-test-pkg"
+    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=( $( curl -s "${TOOLCHAINS_URL}" \
+                    |sed -r -e 's/,.*//; /internal/d;'
+                  )
+               )
+
+    if [ ${#toolchains[@]} -eq 0 ]; then
+        printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
+    fi
+
+    for toolchain in "${toolchains[@]}"; do
+        build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}"
+    done
+}
+
+build_one() {
+    local dir="${1}"
+    local url="${2}"
+    local cfg="${3}"
+    local pkg="${4}"
+    local toolchain line
+
+    # Using basename(1) on a URL works nicely
+    toolchain="$( basename "${url}" .config )"
+
+    printf "%40s: " "${toolchain}"
+
+    dir="${dir}/${toolchain}"
+    mkdir -p "${dir}"
+
+    printf "download config"
+    if ! curl -s "${url}" >"${dir}/.config"; then
+        printf ": FAILED\n"
+        return
+    fi
+
+    cat >>"${dir}/.config" <<-_EOF_
+	BR2_INIT_NONE=y
+	BR2_SYSTEM_BIN_SH_NONE=y
+	# BR2_PACKAGE_BUSYBOX is not set
+	# BR2_TARGET_ROOTFS_TAR is not set
+	_EOF_
+    cat "${cfg}" >>"${dir}/.config"
+
+    printf ", olddefconfig"
+    if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then
+        printf ": FAILED\n"
+        return
+    fi
+    # We want all the options from the snippet to be present as-is (set
+    # or not set) in the actual .config; if one of them is not, it means
+    # some dependency from the toolchain or arch is not available, in
+    # which case this config is untestable and we skip it.
+    while read line; do
+        if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then
+            printf ", SKIPPED\n"
+            return
+        fi
+    done <"${cfg}"
+
+    if [ -n "${pkg}" ]; then
+        printf ", dirclean"
+        if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1; then
+            printf ": FAILED\n"
+            return
+        fi
+    fi
+
+    printf ", build"
+    # shellcheck disable=SC2086
+    if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
+        printf ": FAILED\n"
+        return
+    fi
+
+    printf ": OK\n"
+}
+
+help() {
+    cat <<_EOF_
+test-pkg: test-build a package against various toolchains and architectures
+
+The supplied config snippet is appended to each toolchain config, the
+resulting configuration is checked to ensure it still contains all options
+specified in the snippet; if any is missing, the build is skipped, on the
+assumption that the package under test requires a toolchain or architecture
+feature that is missing.
+
+In case failures are noticed, you can fix the package and just re-run the
+same command again; it will re-run the test where it failed. If you did
+specify a package (with -p), the package build dir will be removed first.
+
+The list of toolchains is retrieved from the Buildroot autobuilders, available
+at ${TOOLCHAINS_URL}.
+
+Options:
+
+    -h, --help
+        Print this help.
+
+    -c CFG, --config-snippet CFG
+        Use the CFG file as the source for the config snippet. This file
+        should contain all the config options required to build a package.
+
+    -d DIR, --build-dir DIR
+        Do the builds in directory DIR, one sub-dir per toolchain.
+
+    -p PKG, --package PKG
+        Test-build the package PKG, by running 'make PKG'; if not specified,
+        just runs 'make'.
+
+Example:
+
+    Testing libcec would require a config snippet that contains:
+        BR2_PACKAGE_LIBCEC=y
+
+    Testing libcurl with openSSL support would require a snippet such as:
+        BR2_PACKAGE_OPENSSL=y
+        BR2_PACKAGE_LIBCURL=y
+
+_EOF_
+}
+
+my_name="${0##*/}"
+main "${@}"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 0/6 v3] support: script to build-test packages
@ 2017-02-08 20:15 Yann E. MORIN
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
                   ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

Hello All!

As Thomas Petazzoni initially wrote (and slightly edited to match the
new script):

This has been often asked, and yesterday I needed it, so I did a quick
and dirty hack. The following script takes as argument a defconfig
fragment that defines a bunch of Buildroot configuration options, and
will built this fragment against all the toolchain configurations
tested in the autobuilders.

Example:

    $ cat test-jack2.snippet
    BR2_PACKAGE_JACK2=y
    BR2_PACKAGE_JACK2_LEGACY=y
    BR2_PACKAGE_JACK2_DBUS=y
    $ ./support/scripts/test-pkg -c test-jack2.snippet -d ~/br-test-jack2 -p jack2
             armv5-ctng-linux-gnueabi : download config, olddefconfig, dirclean, build: OK
           armv7-ctng-linux-gnueabihf : download config, olddefconfig, dirclean, build: OK
                     br-aarch64-glibc : download config, olddefconfig, dirclean, build: OK
                        br-arcle-hs38 : download config, olddefconfig, dirclean, build: OK
                         br-arm-basic : download config, olddefconfig, SKIPPED
               br-arm-cortex-a9-glibc : download config, olddefconfig, dirclean, build: OK
                br-arm-cortex-a9-musl : download config, olddefconfig, dirclean, build: OK
                br-arm-cortex-m4-full : download config, olddefconfig, SKIPPED
                          br-arm-full : download config, olddefconfig, dirclean, build: OK
                 br-arm-full-nothread : download config, olddefconfig, SKIPPED
                   br-arm-full-static : download config, olddefconfig, SKIPPED
                         br-bfin-full : download config, olddefconfig, SKIPPED
                br-i386-pentium4-full : download config, olddefconfig, dirclean, build: OK
             br-i386-pentium-mmx-musl : download config, olddefconfig, dirclean, build: OK
                    br-m68k-5208-full : download config, olddefconfig, SKIPPED
                   br-m68k-68040-full : download config, olddefconfig, dirclean, build: OK
                 br-microblazeel-full : download config, olddefconfig, dirclean, build: OK
                   br-mips64-n64-full : download config, olddefconfig, dirclean, build: OK
              br-mips32r6-el-hf-glibc : download config, olddefconfig, dirclean, build: OK
              br-mips64r6-el-hf-glibc : download config, olddefconfig, dirclean, build: OK
                   br-mipsel-o32-full : download config, olddefconfig, dirclean, build: OK
                       br-nios2-glibc : download config, olddefconfig, dirclean, build: OK
            br-powerpc-603e-basic-cpp : download config, olddefconfig, SKIPPED
          br-powerpc64le-power8-glibc : download config, olddefconfig, dirclean, build: OK
            br-powerpc64-power7-glibc : download config, olddefconfig, dirclean, build: OK
               br-powerpc-e500mc-full : download config, olddefconfig, dirclean, build: OK
                          br-sh4-full : download config, olddefconfig, dirclean, build: OK
                      br-sparc-uclibc : download config, olddefconfig, SKIPPED
                     br-sparc64-glibc : download config, olddefconfig, dirclean, build: OK
                 br-x86-64-core2-full : download config, olddefconfig, dirclean, build: OK
                       br-x86-64-musl : download config, olddefconfig, dirclean, build: OK
                       br-xtensa-full : download config, olddefconfig, dirclean, build: OK
                  i686-ctng-linux-gnu : download config, olddefconfig, dirclean, build: OK
                       linaro-aarch64 : download config, olddefconfig, dirclean, build: FAILED
                           linaro-arm : download config, olddefconfig, dirclean, build: FAILED
          mips64el-ctng_n32-linux-gnu : download config, olddefconfig, dirclean, build: OK
          mips64el-ctng_n64-linux-gnu : download config, olddefconfig, dirclean, build: FAILED
     powerpc-ctng_e500v2-linux-gnuspe : download config, olddefconfig, dirclean, build: OK
                  sourcery-arm-armv4t : download config, olddefconfig, dirclean, build: OK
                         sourcery-arm : download config, olddefconfig, dirclean, build: OK
                  sourcery-arm-thumb2 : download config, olddefconfig, dirclean, build: OK
                      sourcery-mips64 : download config, olddefconfig, dirclean, build: OK
                        sourcery-mips : download config, olddefconfig, dirclean, build: OK
                       sourcery-nios2 : download config, olddefconfig, dirclean, build: OK
                          sourcery-sh : download config, olddefconfig, dirclean, build: FAILED
                      sourcery-x86-64 : download config, olddefconfig, dirclean, build: OK
                         sourcery-x86 : download config, olddefconfig, dirclean, build: OK
        x86_64-ctng_locales-linux-gnu : download config, olddefconfig, dirclean, build: OK
    8 configurations were skipped
    4 configurations would not build

So, the jack2 package, with both its "legacy" and "dbus" backends has
been built in all those configurations.

It says "OK" when the build was successful, "FAILED" when it failed and
"SKIPPED" when for some reason the options could not be enabled for the
current toolchain configuration (for example if this package is
disabled on this architecture, or if a toolchain feature is missing,
etc.).

Note that the script excludes the "internal toolchain" configurations,
because they take too long to build.

One nice trick is that you can re-run the script, and it will simply
restart the build. So after fixing your package, if you want to test it
again, you don't have to clean everything and restart from scratch: the
build directory for your package is removed in each output directory,
and the build resumed.


Changes v2 -> v3:
  - simplify the code to store missing config lines  (Luca)
  - properly run when -r is not provided
  - add 5th path to use an alternate list
  - add 6th patch to print the progress [n/N] for each toolchain


Regards,
Yann E. MORIN.


The following changes since commit 5d065ef1da3c213ad6fc0d039f92dbbb68dca921

  wget: add upstream patch to fix build failure (2017-02-08 15:41:53 +0100)


are available in the git repository at:

  git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to aeb2ab98194fac3ad0a73727707023552624d52e

  support/test-pkg: print number of toolchain and progress (2017-02-08 21:05:35 +0100)


----------------------------------------------------------------
Yann E. MORIN (6):
      support/scripts: add script to test a package
      support/test-pkg: store lines missing from resulting configuraiton
      support/test-pkg: report number and types of failures
      supprt/test-pkg: add option to limit the number of tests
      support/test-pkg: add option to use an alternate list of toolchains
      support/test-pkg: print number of toolchain and progress

 support/scripts/test-pkg | 257 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 257 insertions(+)
 create mode 100755 support/scripts/test-pkg

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-09 17:07   ` Luca Ceresoli
  2017-02-09 21:58   ` Thomas Petazzoni
  2017-02-08 20:15 ` [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures Yann E. MORIN
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

When a build is skipped, store the lines from the config snippet, that
are missing in the resulting configuration, in a file in the build
directory, for the user to inspect.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>

---
Changes v2 -> v3:
  - simplify the code a bit  (Luca)
---
 support/scripts/test-pkg | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
index 008b32c..5eeaf63 100755
--- a/support/scripts/test-pkg
+++ b/support/scripts/test-pkg
@@ -61,7 +61,7 @@ build_one() {
     local url="${2}"
     local cfg="${3}"
     local pkg="${4}"
-    local toolchain line
+    local toolchain line skip
 
     # Using basename(1) on a URL works nicely
     toolchain="$( basename "${url}" .config )"
@@ -94,12 +94,19 @@ build_one() {
     # or not set) in the actual .config; if one of them is not, it means
     # some dependency from the toolchain or arch is not available, in
     # which case this config is untestable and we skip it.
+    skip=false
     while read line; do
         if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then
-            printf ", SKIPPED\n"
-            return
+            printf "%s\n" "${line}"
+            skip=true
         fi
-    done <"${cfg}"
+    done <"${cfg}" >"${dir}/missing.config"
+    if ${skip}; then
+        printf ", SKIPPED\n"
+        return
+    fi
+    # Remove file, it's empty anyway.
+    rm -f "${dir}/missing.config"
 
     if [ -n "${pkg}" ]; then
         printf ", dirclean"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
  2017-02-08 20:15 ` [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-09 17:09   ` Luca Ceresoli
  2017-02-09 21:59   ` Thomas Petazzoni
  2017-02-08 20:15 ` [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests Yann E. MORIN
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 support/scripts/test-pkg | 42 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
index 5eeaf63..f40b51d 100755
--- a/support/scripts/test-pkg
+++ b/support/scripts/test-pkg
@@ -6,6 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
 main() {
     local o O opts
     local cfg dir pkg toolchain
+    local ret nb_dl nb_cfg nb_skip nb_clean nb_build
     local -a toolchains
 
     o='hc:d:p:'
@@ -51,9 +52,38 @@ main() {
         printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
     fi
 
+    nb_dl=0
+    nb_cfg=0
+    nb_skip=0
+    nb_clean=0
+    nb_build=0
     for toolchain in "${toolchains[@]}"; do
-        build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}"
+        build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}" && ret=0 || ret=${?}
+        case ${ret} in
+        (0) ;;
+        (1) : $((nb_dl++));;
+        (2) : $((nb_cfg++));;
+        (3) : $((nb_skip++));;
+        (4) : $((nb_clean++));;
+        (5) : $((nb_build++));;
+        esac
     done
+
+    if [ ${nb_dl} -ne 0 ]; then
+        printf "%d configurations could not be downloaded\n" ${nb_dl}
+    fi
+    if [ ${nb_cfg} -ne 0 ]; then
+        printf "%d configurations could not be applied\n" ${nb_cfg}
+    fi
+    if [ ${nb_skip} -ne 0 ]; then
+        printf "%d configurations were skipped\n" ${nb_skip}
+    fi
+    if [ ${nb_clean} -ne 0 ]; then
+        printf "%d configurations could not be dircleaned\n" ${nb_clean}
+    fi
+    if [ ${nb_build} -ne 0 ]; then
+        printf "%d configurations would not build\n" ${nb_build}
+    fi
 }
 
 build_one() {
@@ -74,7 +104,7 @@ build_one() {
     printf "download config"
     if ! curl -s "${url}" >"${dir}/.config"; then
         printf ": FAILED\n"
-        return
+        return 1
     fi
 
     cat >>"${dir}/.config" <<-_EOF_
@@ -88,7 +118,7 @@ build_one() {
     printf ", olddefconfig"
     if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then
         printf ": FAILED\n"
-        return
+        return 2
     fi
     # We want all the options from the snippet to be present as-is (set
     # or not set) in the actual .config; if one of them is not, it means
@@ -103,7 +133,7 @@ build_one() {
     done <"${cfg}" >"${dir}/missing.config"
     if ${skip}; then
         printf ", SKIPPED\n"
-        return
+        return 3
     fi
     # Remove file, it's empty anyway.
     rm -f "${dir}/missing.config"
@@ -112,7 +142,7 @@ build_one() {
         printf ", dirclean"
         if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1; then
             printf ": FAILED\n"
-            return
+            return 4
         fi
     fi
 
@@ -120,7 +150,7 @@ build_one() {
     # shellcheck disable=SC2086
     if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
         printf ": FAILED\n"
-        return
+        return 5
     fi
 
     printf ": OK\n"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
                   ` (2 preceding siblings ...)
  2017-02-08 20:15 ` [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-09 22:13   ` Thomas Petazzoni
  2017-02-08 20:15 ` [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains Yann E. MORIN
  2017-02-08 20:15 ` [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress Yann E. MORIN
  5 siblings, 1 reply; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

Sometimes, it interesting to have a global overview of whether the
package builds at all or not, rather than test on all toolchains.

Add an option that allows testing on a limited set of randomly choosen
toolchains.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>

---
Changes v1 -> v2;
  - fix when option is not provided
---
 support/scripts/test-pkg | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
index f40b51d..59c9f23 100755
--- a/support/scripts/test-pkg
+++ b/support/scripts/test-pkg
@@ -5,15 +5,16 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
 
 main() {
     local o O opts
-    local cfg dir pkg toolchain
+    local cfg dir pkg random toolchain
     local ret nb_dl nb_cfg nb_skip nb_clean nb_build
     local -a toolchains
 
-    o='hc:d:p:'
-    O='help,config-snippet:build-dir:package:'
+    o='hc:d:p:r:'
+    O='help,config-snippet:build-dir:package:,random:'
     opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
     eval set -- "${opts}"
 
+    random=0
     while [ ${#} -gt 0 ]; do
         case "${1}" in
         (-h|--help)
@@ -28,6 +29,9 @@ main() {
         (-p|--package)
             pkg="${2}"; shift 2
             ;;
+        (-r|--random)
+            random="${2}"; shift 2
+            ;;
         (--)
             shift; break
             ;;
@@ -44,7 +48,12 @@ main() {
     # E.g.: http://server/path/to/name.config,arch,libc
     #  -->  http://server/path/to/name.config
     toolchains=( $( curl -s "${TOOLCHAINS_URL}" \
-                    |sed -r -e 's/,.*//; /internal/d;'
+                    |sed -r -e 's/,.*//; /internal/d;' \
+                    |if [ ${random} -gt 0 ]; then \
+                        sort -R |head -n ${random}
+                     else
+                        cat
+                     fi |sort
                   )
                )
 
@@ -189,6 +198,10 @@ Options:
         Test-build the package PKG, by running 'make PKG'; if not specified,
         just runs 'make'.
 
+    -r N, --random N
+        Limit the tests to the N randomly selected toolchains, instead of
+        building with all toolchains.
+
 Example:
 
     Testing libcec would require a config snippet that contains:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
                   ` (3 preceding siblings ...)
  2017-02-08 20:15 ` [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-11 19:53   ` Thomas De Schampheleire
  2017-02-08 20:15 ` [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress Yann E. MORIN
  5 siblings, 1 reply; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

For now, testing a package requires network access. However, there are
situations where everything is already cached locally (especially the
toolchains tarballs) and network is not available (e.g. in the train,
travelling back from FOSDEM...)

Alternatively, one may also want to test against a subset of the default
toolchains (e.g. the ones known to have a specific issue).

Add an option to use an alternate URL, which can be remote or a path to
a local file.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 support/scripts/test-pkg | 47 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 41 insertions(+), 6 deletions(-)

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
index 59c9f23..e77c804 100755
--- a/support/scripts/test-pkg
+++ b/support/scripts/test-pkg
@@ -5,16 +5,17 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
 
 main() {
     local o O opts
-    local cfg dir pkg random toolchain
+    local cfg dir pkg random url toolchain
     local ret nb_dl nb_cfg nb_skip nb_clean nb_build
     local -a toolchains
 
-    o='hc:d:p:r:'
-    O='help,config-snippet:build-dir:package:,random:'
+    o='hc:d:p:r:t:'
+    O='help,config-snippet:build-dir:package:,random:,toolchains:'
     opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
     eval set -- "${opts}"
 
     random=0
+    url="${TOOLCHAINS_URL}"
     while [ ${#} -gt 0 ]; do
         case "${1}" in
         (-h|--help)
@@ -32,6 +33,9 @@ main() {
         (-r|--random)
             random="${2}"; shift 2
             ;;
+        (-t|--toolchains)
+            url="${2}"; shift 2
+            ;;
         (--)
             shift; break
             ;;
@@ -44,10 +48,16 @@ main() {
         dir="${HOME}/br-test-pkg"
     fi
 
+    # Transform local paths to URI to make curl happy and simplify
+    # our code path
+    case "${url}" in
+    (/*)    url="file://${url}";;
+    esac
+
     # 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=( $( curl -s "${TOOLCHAINS_URL}" \
+    toolchains=( $( curl -s "${url}" \
                     |sed -r -e 's/,.*//; /internal/d;' \
                     |if [ ${random} -gt 0 ]; then \
                         sort -R |head -n ${random}
@@ -102,6 +112,12 @@ build_one() {
     local pkg="${4}"
     local toolchain line skip
 
+    # Transform local paths to URI to make curl happy and simplify
+    # our code path
+    case "${url}" in
+    (/*)    url="file://${url}";;
+    esac
+
     # Using basename(1) on a URL works nicely
     toolchain="$( basename "${url}" .config )"
 
@@ -179,8 +195,22 @@ In case failures are noticed, you can fix the package and just re-run the
 same command again; it will re-run the test where it failed. If you did
 specify a package (with -p), the package build dir will be removed first.
 
-The list of toolchains is retrieved from the Buildroot autobuilders, available
-at ${TOOLCHAINS_URL}.
+Unless specified with -t, the list of toolchains is retrieved from the
+Buildroot autobuilders, available at:
+    ${TOOLCHAINS_URL}
+
+The list of toolchains should contain the URLs to all toolchains, one per
+line, along with the architecture and C library used, separated by commas,
+"URL,ARCH,LIBC" (only the first field, URL, is used by this script). For
+example:
+
+    https://server/path/to/toolchain-1.config,arm,glibc
+    /path/to/local-toolchain.config,i386,musl
+
+The URL for each toolchain should point to a .config file that contains
+only the toolchain and architecture settings. URLs that contain the string
+'internal' are skipped, on the assumption that the configuration would
+build an internal toolchain (which takes a lot of time).
 
 Options:
 
@@ -202,6 +232,11 @@ Options:
         Limit the tests to the N randomly selected toolchains, instead of
         building with all toolchains.
 
+    -t URL, --toolchains URL
+        Use the toolchains described at URL instead of the toolchains used
+        by the Buildroot autobuilders (see above). URL can be a path to a
+        local file.
+
 Example:
 
     Testing libcec would require a config snippet that contains:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress
  2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
                   ` (4 preceding siblings ...)
  2017-02-08 20:15 ` [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains Yann E. MORIN
@ 2017-02-08 20:15 ` Yann E. MORIN
  2017-02-11 20:09   ` Thomas De Schampheleire
  5 siblings, 1 reply; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-08 20:15 UTC (permalink / raw)
  To: buildroot

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 support/scripts/test-pkg | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
index e77c804..919200d 100755
--- a/support/scripts/test-pkg
+++ b/support/scripts/test-pkg
@@ -6,7 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
 main() {
     local o O opts
     local cfg dir pkg random url toolchain
-    local ret nb_dl nb_cfg nb_skip nb_clean nb_build
+    local ret nb nb_dl nb_cfg nb_skip nb_clean nb_build
     local -a toolchains
 
     o='hc:d:p:r:t:'
@@ -71,13 +71,18 @@ main() {
         printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
     fi
 
+    printf "Found %d toolchains\n" ${#toolchains[@]}
+
+    nb=1
     nb_dl=0
     nb_cfg=0
     nb_skip=0
     nb_clean=0
     nb_build=0
     for toolchain in "${toolchains[@]}"; do
+        printf "%40s [%3d/%3d]: " "$( basename "${toolchain}" .config)" ${nb} ${#toolchains[@]}
         build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}" && ret=0 || ret=${?}
+        printf "\n"
         case ${ret} in
         (0) ;;
         (1) : $((nb_dl++));;
@@ -86,6 +91,7 @@ main() {
         (4) : $((nb_clean++));;
         (5) : $((nb_build++));;
         esac
+        : $((nb++))
     done
 
     if [ ${nb_dl} -ne 0 ]; then
@@ -121,14 +127,12 @@ build_one() {
     # Using basename(1) on a URL works nicely
     toolchain="$( basename "${url}" .config )"
 
-    printf "%40s: " "${toolchain}"
-
     dir="${dir}/${toolchain}"
     mkdir -p "${dir}"
 
     printf "download config"
     if ! curl -s "${url}" >"${dir}/.config"; then
-        printf ": FAILED\n"
+        printf ": FAILED"
         return 1
     fi
 
@@ -142,7 +146,7 @@ build_one() {
 
     printf ", olddefconfig"
     if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then
-        printf ": FAILED\n"
+        printf ": FAILED"
         return 2
     fi
     # We want all the options from the snippet to be present as-is (set
@@ -157,7 +161,7 @@ build_one() {
         fi
     done <"${cfg}" >"${dir}/missing.config"
     if ${skip}; then
-        printf ", SKIPPED\n"
+        printf ", SKIPPED"
         return 3
     fi
     # Remove file, it's empty anyway.
@@ -166,7 +170,7 @@ build_one() {
     if [ -n "${pkg}" ]; then
         printf ", dirclean"
         if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1; then
-            printf ": FAILED\n"
+            printf ": FAILED"
             return 4
         fi
     fi
@@ -174,11 +178,11 @@ build_one() {
     printf ", build"
     # shellcheck disable=SC2086
     if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
-        printf ": FAILED\n"
+        printf ": FAILED"
         return 5
     fi
 
-    printf ": OK\n"
+    printf ": OK"
 }
 
 help() {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
@ 2017-02-08 22:00   ` Cam Hutchison
  2017-02-08 22:39     ` Cam Hutchison
  2017-02-11 16:08     ` Yann E. MORIN
  2017-02-09 13:41   ` Luca Ceresoli
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 29+ messages in thread
From: Cam Hutchison @ 2017-02-08 22:00 UTC (permalink / raw)
  To: buildroot

"Yann E. MORIN" <yann.morin.1998@free.fr> writes:

>This script helps in testing that a package builds fine on a wide range
>of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...

>Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>[yann.morin.1998 at free.fr:
> - completely rewrite the script from Thomas, with help from Luca
>]
>Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>Cc: Luca Ceresoli <luca@lucaceresoli.net>
>Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
>Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
>Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

>---
>Changes v2 -> v3:
>  - grammar  (Luca)
>---
> support/scripts/test-pkg | 168 +++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 168 insertions(+)
> create mode 100755 support/scripts/test-pkg

>diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
>new file mode 100755
>index 0000000..008b32c
>--- /dev/null
>+++ b/support/scripts/test-pkg
>@@ -0,0 +1,168 @@
>+#!/bin/bash
>+set -e
>+
>+TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv'
>+
>+main() {
>+    local o O opts
>+    local cfg dir pkg toolchain
>+    local -a toolchains
>+
>+    o='hc:d:p:'
>+    O='help,config-snippet:build-dir:package:'
>+    opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
>+    eval set -- "${opts}"
>+
>+    while [ ${#} -gt 0 ]; do
>+        case "${1}" in
>+        (-h|--help)
>+            help; exit 0
>+            ;;
>+        (-c|--config-snippet)
>+            cfg="${2}"; shift 2
>+            ;;
>+        (-d|--build-dir)
>+            dir="${2}"; shift 2
>+            ;;
>+        (-p|--package)
>+            pkg="${2}"; shift 2
>+            ;;
>+        (--)
>+            shift; break
>+            ;;
>+        esac
>+    done
>+    if [ -z "${cfg}" ]; then
>+        printf "error: no config snippet specified\n" >&2; exit 1
>+    fi
>+    if [ -z "${dir}" ]; then
>+        dir="${HOME}/br-test-pkg"
>+    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=( $( curl -s "${TOOLCHAINS_URL}" \
>+                    |sed -r -e 's/,.*//; /internal/d;'
>+                  )
>+               )
>+
>+    if [ ${#toolchains[@]} -eq 0 ]; then
>+        printf "error: no toolchain found (networking issue?)\n" >&2; exit 1

The format string should be in single quotes as it contains a glob char.

I usually put all printf format strings in single quotes since printf is
doing the substitutions, not the shell.

>+    fi
>+
>+    for toolchain in "${toolchains[@]}"; do
>+        build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}"
>+    done
>+}
>+
>+build_one() {
>+    local dir="${1}"
>+    local url="${2}"
>+    local cfg="${3}"
>+    local pkg="${4}"
>+    local toolchain line
>+
>+    # Using basename(1) on a URL works nicely
>+    toolchain="$( basename "${url}" .config )"
>+
>+    printf "%40s: " "${toolchain}"
>+
>+    dir="${dir}/${toolchain}"
>+    mkdir -p "${dir}"
>+
>+    printf "download config"
>+    if ! curl -s "${url}" >"${dir}/.config"; then
>+        printf ": FAILED\n"
>+        return
>+    fi
>+
>+    cat >>"${dir}/.config" <<-_EOF_
>+	BR2_INIT_NONE=y
>+	BR2_SYSTEM_BIN_SH_NONE=y
>+	# BR2_PACKAGE_BUSYBOX is not set
>+	# BR2_TARGET_ROOTFS_TAR is not set
>+	_EOF_
>+    cat "${cfg}" >>"${dir}/.config"
>+
>+    printf ", olddefconfig"
>+    if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then
>+        printf ": FAILED\n"
>+        return
>+    fi
>+    # We want all the options from the snippet to be present as-is (set
>+    # or not set) in the actual .config; if one of them is not, it means
>+    # some dependency from the toolchain or arch is not available, in
>+    # which case this config is untestable and we skip it.
>+    while read line; do
>+        if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then

You should use grep -Fx here since ${line} might contains regex chars:

        if ! grep -Fx "${line}" "${dir}/.config" >/dev/null 2>&1; then

....

>+            printf ", SKIPPED\n"
>+            return
>+        fi
>+    done <"${cfg}"

.... but I'd get rid of the loop altogether and use comm(1); something like:

    if [ -n "$( comm -23 <(sort "${cfg}") <(sort "${dir/.config}") )" ]; then
        printf ", SKIPPED\n"
	return
    fi

>+
>+    if [ -n "${pkg}" ]; then
>+        printf ", dirclean"
>+        if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1; then
>+            printf ": FAILED\n"
>+            return
>+        fi
>+    fi
>+
>+    printf ", build"
>+    # shellcheck disable=SC2086
>+    if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
>+        printf ": FAILED\n"
>+        return
>+    fi
>+
>+    printf ": OK\n"
>+}
>+
>+help() {
>+    cat <<_EOF_
>+test-pkg: test-build a package against various toolchains and architectures
>+
>+The supplied config snippet is appended to each toolchain config, the
>+resulting configuration is checked to ensure it still contains all options
>+specified in the snippet; if any is missing, the build is skipped, on the
>+assumption that the package under test requires a toolchain or architecture
>+feature that is missing.
>+
>+In case failures are noticed, you can fix the package and just re-run the
>+same command again; it will re-run the test where it failed. If you did
>+specify a package (with -p), the package build dir will be removed first.
>+
>+The list of toolchains is retrieved from the Buildroot autobuilders, available
>+at ${TOOLCHAINS_URL}.
>+
>+Options:
>+
>+    -h, --help
>+        Print this help.
>+
>+    -c CFG, --config-snippet CFG
>+        Use the CFG file as the source for the config snippet. This file
>+        should contain all the config options required to build a package.
>+
>+    -d DIR, --build-dir DIR
>+        Do the builds in directory DIR, one sub-dir per toolchain.
>+
>+    -p PKG, --package PKG
>+        Test-build the package PKG, by running 'make PKG'; if not specified,
>+        just runs 'make'.
>+
>+Example:
>+
>+    Testing libcec would require a config snippet that contains:
>+        BR2_PACKAGE_LIBCEC=y
>+
>+    Testing libcurl with openSSL support would require a snippet such as:
>+        BR2_PACKAGE_OPENSSL=y
>+        BR2_PACKAGE_LIBCURL=y
>+
>+_EOF_
>+}
>+
>+my_name="${0##*/}"
>+main "${@}"
>-- 
>2.7.4

>_______________________________________________
>buildroot mailing list
>buildroot at busybox.net
>http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 22:00   ` Cam Hutchison
@ 2017-02-08 22:39     ` Cam Hutchison
  2017-02-11 16:08     ` Yann E. MORIN
  1 sibling, 0 replies; 29+ messages in thread
From: Cam Hutchison @ 2017-02-08 22:39 UTC (permalink / raw)
  To: buildroot

On 9 February 2017 at 09:00, Cam Hutchison <camh@xdna.net> wrote:

> "Yann E. MORIN" <yann.morin.1998@free.fr> writes:
>
> >This script helps in testing that a package builds fine on a wide range
> >of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
>
> >Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> >[yann.morin.1998 at free.fr:
> > - completely rewrite the script from Thomas, with help from Luca
> >]
> >Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >Cc: Luca Ceresoli <luca@lucaceresoli.net>
> >Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> >Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
> >Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> >---
> >Changes v2 -> v3:
> >  - grammar  (Luca)
> >---
> > support/scripts/test-pkg | 168 ++++++++++++++++++++++++++++++
> +++++++++++++++++
> > 1 file changed, 168 insertions(+)
> > create mode 100755 support/scripts/test-pkg
>
> >diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
> >new file mode 100755
> >index 0000000..008b32c
> >--- /dev/null
> >+++ b/support/scripts/test-pkg
> >@@ -0,0 +1,168 @@
> >+#!/bin/bash
> >+set -e
> >+
> >+TOOLCHAINS_URL='http://autobuild.buildroot.org/
> toolchains/configs/toolchain-configs.csv'
> >+
> >+main() {
> >+    local o O opts
> >+    local cfg dir pkg toolchain
> >+    local -a toolchains
> >+
> >+    o='hc:d:p:'
> >+    O='help,config-snippet:build-dir:package:'
> >+    opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
> >+    eval set -- "${opts}"
> >+
> >+    while [ ${#} -gt 0 ]; do
> >+        case "${1}" in
> >+        (-h|--help)
> >+            help; exit 0
> >+            ;;
> >+        (-c|--config-snippet)
> >+            cfg="${2}"; shift 2
> >+            ;;
> >+        (-d|--build-dir)
> >+            dir="${2}"; shift 2
> >+            ;;
> >+        (-p|--package)
> >+            pkg="${2}"; shift 2
> >+            ;;
> >+        (--)
> >+            shift; break
> >+            ;;
> >+        esac
> >+    done
> >+    if [ -z "${cfg}" ]; then
> >+        printf "error: no config snippet specified\n" >&2; exit 1
> >+    fi
> >+    if [ -z "${dir}" ]; then
> >+        dir="${HOME}/br-test-pkg"
> >+    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=( $( curl -s "${TOOLCHAINS_URL}" \
> >+                    |sed -r -e 's/,.*//; /internal/d;'
> >+                  )
> >+               )
> >+
> >+    if [ ${#toolchains[@]} -eq 0 ]; then
> >+        printf "error: no toolchain found (networking issue?)\n" >&2;
> exit 1
>
> The format string should be in single quotes as it contains a glob char.
>

I'm wrong here. Globs don't expand in double-quotes.


> I usually put all printf format strings in single quotes since printf is
> doing the substitutions, not the shell.
>
> >+    fi
> >+
> >+    for toolchain in "${toolchains[@]}"; do
> >+        build_one "${dir}" "${toolchain}" "${cfg}" "${pkg}"
> >+    done
> >+}
> >+
> >+build_one() {
> >+    local dir="${1}"
> >+    local url="${2}"
> >+    local cfg="${3}"
> >+    local pkg="${4}"
> >+    local toolchain line
> >+
> >+    # Using basename(1) on a URL works nicely
> >+    toolchain="$( basename "${url}" .config )"
> >+
> >+    printf "%40s: " "${toolchain}"
> >+
> >+    dir="${dir}/${toolchain}"
> >+    mkdir -p "${dir}"
> >+
> >+    printf "download config"
> >+    if ! curl -s "${url}" >"${dir}/.config"; then
> >+        printf ": FAILED\n"
> >+        return
> >+    fi
> >+
> >+    cat >>"${dir}/.config" <<-_EOF_
> >+      BR2_INIT_NONE=y
> >+      BR2_SYSTEM_BIN_SH_NONE=y
> >+      # BR2_PACKAGE_BUSYBOX is not set
> >+      # BR2_TARGET_ROOTFS_TAR is not set
> >+      _EOF_
> >+    cat "${cfg}" >>"${dir}/.config"
> >+
> >+    printf ", olddefconfig"
> >+    if ! make O="${dir}" olddefconfig >/dev/null 2>&1; then
> >+        printf ": FAILED\n"
> >+        return
> >+    fi
> >+    # We want all the options from the snippet to be present as-is (set
> >+    # or not set) in the actual .config; if one of them is not, it means
> >+    # some dependency from the toolchain or arch is not available, in
> >+    # which case this config is untestable and we skip it.
> >+    while read line; do
> >+        if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then
>
> You should use grep -Fx here since ${line} might contains regex chars:
>
>         if ! grep -Fx "${line}" "${dir}/.config" >/dev/null 2>&1; then
>
> ....
>
> >+            printf ", SKIPPED\n"
> >+            return
> >+        fi
> >+    done <"${cfg}"
>
> .... but I'd get rid of the loop altogether and use comm(1); something
> like:
>
>     if [ -n "$( comm -23 <(sort "${cfg}") <(sort "${dir/.config}") )" ];
> then
>         printf ", SKIPPED\n"
>         return
>     fi
>
> >+
> >+    if [ -n "${pkg}" ]; then
> >+        printf ", dirclean"
> >+        if ! make O="${dir}" "${pkg}-dirclean" >> "${dir}/logfile" 2>&1;
> then
> >+            printf ": FAILED\n"
> >+            return
> >+        fi
> >+    fi
> >+
> >+    printf ", build"
> >+    # shellcheck disable=SC2086
> >+    if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
> >+        printf ": FAILED\n"
> >+        return
> >+    fi
> >+
> >+    printf ": OK\n"
> >+}
> >+
> >+help() {
> >+    cat <<_EOF_
> >+test-pkg: test-build a package against various toolchains and
> architectures
> >+
> >+The supplied config snippet is appended to each toolchain config, the
> >+resulting configuration is checked to ensure it still contains all
> options
> >+specified in the snippet; if any is missing, the build is skipped, on the
> >+assumption that the package under test requires a toolchain or
> architecture
> >+feature that is missing.
> >+
> >+In case failures are noticed, you can fix the package and just re-run the
> >+same command again; it will re-run the test where it failed. If you did
> >+specify a package (with -p), the package build dir will be removed first.
> >+
> >+The list of toolchains is retrieved from the Buildroot autobuilders,
> available
> >+at ${TOOLCHAINS_URL}.
> >+
> >+Options:
> >+
> >+    -h, --help
> >+        Print this help.
> >+
> >+    -c CFG, --config-snippet CFG
> >+        Use the CFG file as the source for the config snippet. This file
> >+        should contain all the config options required to build a
> package.
> >+
> >+    -d DIR, --build-dir DIR
> >+        Do the builds in directory DIR, one sub-dir per toolchain.
> >+
> >+    -p PKG, --package PKG
> >+        Test-build the package PKG, by running 'make PKG'; if not
> specified,
> >+        just runs 'make'.
> >+
> >+Example:
> >+
> >+    Testing libcec would require a config snippet that contains:
> >+        BR2_PACKAGE_LIBCEC=y
> >+
> >+    Testing libcurl with openSSL support would require a snippet such as:
> >+        BR2_PACKAGE_OPENSSL=y
> >+        BR2_PACKAGE_LIBCURL=y
> >+
> >+_EOF_
> >+}
> >+
> >+my_name="${0##*/}"
> >+main "${@}"
> >--
> >2.7.4
>
> >_______________________________________________
> >buildroot mailing list
> >buildroot at busybox.net
> >http://lists.busybox.net/mailman/listinfo/buildroot
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170209/77a164dd/attachment.html>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
  2017-02-08 22:00   ` Cam Hutchison
@ 2017-02-09 13:41   ` Luca Ceresoli
  2017-02-09 21:50   ` Thomas Petazzoni
  2017-02-09 21:51   ` Thomas Petazzoni
  3 siblings, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2017-02-09 13:41 UTC (permalink / raw)
  To: buildroot

Hi,

On 08/02/2017 21:15, Yann E. MORIN wrote:
> This script helps in testing that a package builds fine on a wide range
> of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> [yann.morin.1998 at free.fr:
>  - completely rewrite the script from Thomas, with help from Luca
> ]
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
> Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> ---
> Changes v2 -> v3:
>   - grammar  (Luca)

There are more changes in reality, not only grammar fixes. So the Acked
and Reviewed-by tags should be removed IMO.

But I'm OK with the new version as well, so:

[tested the exim package with all toolchains, with and without -p,
introducing build, URL and defconfig errors]
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>

-- 
Luca

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton
  2017-02-08 20:15 ` [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton Yann E. MORIN
@ 2017-02-09 17:07   ` Luca Ceresoli
  2017-02-09 21:58   ` Thomas Petazzoni
  1 sibling, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2017-02-09 17:07 UTC (permalink / raw)
  To: buildroot

Hi,

On 08/02/2017 21:15, Yann E. MORIN wrote:
> When a build is skipped, store the lines from the config snippet, that
> are missing in the resulting configuration, in a file in the build
> directory, for the user to inspect.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>

Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>


-- 
Luca

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures
  2017-02-08 20:15 ` [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures Yann E. MORIN
@ 2017-02-09 17:09   ` Luca Ceresoli
  2017-02-09 21:59   ` Thomas Petazzoni
  1 sibling, 0 replies; 29+ messages in thread
From: Luca Ceresoli @ 2017-02-09 17:09 UTC (permalink / raw)
  To: buildroot

Hi,

On 08/02/2017 21:15, Yann E. MORIN wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>

Review confirmed since the patch has not changed since v2.

Additionally:
Tested-by: Luca Ceresoli <luca@lucaceresoli.net>

-- 
Luca

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
  2017-02-08 22:00   ` Cam Hutchison
  2017-02-09 13:41   ` Luca Ceresoli
@ 2017-02-09 21:50   ` Thomas Petazzoni
  2017-02-09 22:00     ` Yann E. MORIN
  2017-02-09 21:51   ` Thomas Petazzoni
  3 siblings, 1 reply; 29+ messages in thread
From: Thomas Petazzoni @ 2017-02-09 21:50 UTC (permalink / raw)
  To: buildroot

Hello,

For some reason only your cover letter had PATCHv3, not the patches
themselves. Could you check what happened?

On Wed,  8 Feb 2017 21:15:24 +0100, Yann E. MORIN wrote:
> This script helps in testing that a package builds fine on a wide range
> of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> [yann.morin.1998 at free.fr:
>  - completely rewrite the script from Thomas, with help from Luca
> ]
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
> Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

First of all, thanks for taking over my initial crappy submission and
making it something production ready. I've applied your patch, but I
nonetheless have a few comments about it. See below.

> +    opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"

I continue to terribly dislike this whole concept of putting a space
after an opening parenthesis and before a closing parenthesis.

I know this is your coding style, but it is *not* the Buildroot coding
style. So I'd appreciate if the shell scripts could also comply with
the Buildroot coding style on this.

> +    printf "download config"

I find all these prints to be really useless, and they clutter the
output for nothing. My original script had a very lean and readable
output:

	<toolchain>:	<status>

and now it's the much more verbose (and useless):

                armv5-ctng-linux-gnueabi: download config, olddefconfig, build: OK
              armv7-ctng-linux-gnueabihf: download config, olddefconfig, build: OK

(which would get even more verbose if I had passed a -p option, since
dirclean would have been added).

I'd really prefer if we got rid of those additional prints, they are
not useful, and make the whole thing less readable.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
                     ` (2 preceding siblings ...)
  2017-02-09 21:50   ` Thomas Petazzoni
@ 2017-02-09 21:51   ` Thomas Petazzoni
  3 siblings, 0 replies; 29+ messages in thread
From: Thomas Petazzoni @ 2017-02-09 21:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  8 Feb 2017 21:15:24 +0100, Yann E. MORIN wrote:
> This script helps in testing that a package builds fine on a wide range
> of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> [yann.morin.1998 at free.fr:
>  - completely rewrite the script from Thomas, with help from Luca
> ]
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
> Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Another comment: now that the script itself has been merged, adding a
quick note in the manual about it would be nice, so that developers
adding new packages (or bumping versions) can quickly test by using
this script.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton
  2017-02-08 20:15 ` [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton Yann E. MORIN
  2017-02-09 17:07   ` Luca Ceresoli
@ 2017-02-09 21:58   ` Thomas Petazzoni
  1 sibling, 0 replies; 29+ messages in thread
From: Thomas Petazzoni @ 2017-02-09 21:58 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  8 Feb 2017 21:15:25 +0100, Yann E. MORIN wrote:
> When a build is skipped, store the lines from the config snippet, that
> are missing in the resulting configuration, in a file in the build
> directory, for the user to inspect.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> 
> ---
> Changes v2 -> v3:
>   - simplify the code a bit  (Luca)
> ---
>  support/scripts/test-pkg | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures
  2017-02-08 20:15 ` [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures Yann E. MORIN
  2017-02-09 17:09   ` Luca Ceresoli
@ 2017-02-09 21:59   ` Thomas Petazzoni
  2017-02-11 19:48     ` Thomas De Schampheleire
  1 sibling, 1 reply; 29+ messages in thread
From: Thomas Petazzoni @ 2017-02-09 21:59 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  8 Feb 2017 21:15:26 +0100, Yann E. MORIN wrote:

> +    if [ ${nb_dl} -ne 0 ]; then
> +        printf "%d configurations could not be downloaded\n" ${nb_dl}
> +    fi
> +    if [ ${nb_cfg} -ne 0 ]; then
> +        printf "%d configurations could not be applied\n" ${nb_cfg}
> +    fi
> +    if [ ${nb_skip} -ne 0 ]; then
> +        printf "%d configurations were skipped\n" ${nb_skip}
> +    fi
> +    if [ ${nb_clean} -ne 0 ]; then
> +        printf "%d configurations could not be dircleaned\n" ${nb_clean}
> +    fi
> +    if [ ${nb_build} -ne 0 ]; then
> +        printf "%d configurations would not build\n" ${nb_build}
> +    fi

This is really verbose and not very useful. Instead what would be much
more useful is just:

	successes = %d, failures = %d, skipped = %d

(possibly presented in a different way, my point is really that number
of successes, number of failures and numbers of skipped configurations
is really all what matters)

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-09 21:50   ` Thomas Petazzoni
@ 2017-02-09 22:00     ` Yann E. MORIN
  0 siblings, 0 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-09 22:00 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2017-02-09 22:50 +0100, Thomas Petazzoni spake thusly:
> For some reason only your cover letter had PATCHv3, not the patches
> themselves. Could you check what happened?

Yup, I'll check...

> On Wed,  8 Feb 2017 21:15:24 +0100, Yann E. MORIN wrote:
> > This script helps in testing that a package builds fine on a wide range
> > of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
> > 
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > [yann.morin.1998 at free.fr:
> >  - completely rewrite the script from Thomas, with help from Luca
> > ]
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Luca Ceresoli <luca@lucaceresoli.net>
> > Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> > Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
> > Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> 
> First of all, thanks for taking over my initial crappy submission and
> making it something production ready. I've applied your patch, but I
> nonetheless have a few comments about it. See below.
> 
> > +    opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
> 
> I continue to terribly dislike this whole concept of putting a space
> after an opening parenthesis and before a closing parenthesis.
> 
> I know this is your coding style, but it is *not* the Buildroot coding
> style. So I'd appreciate if the shell scripts could also comply with
> the Buildroot coding style on this.

Fair enough. I'll post a patch fixing this.

> > +    printf "download config"
> 
> I find all these prints to be really useless, and they clutter the
> output for nothing. My original script had a very lean and readable
> output:
> 
> 	<toolchain>:	<status>
> 
> and now it's the much more verbose (and useless):
> 
>                 armv5-ctng-linux-gnueabi: download config, olddefconfig, build: OK
>               armv7-ctng-linux-gnueabihf: download config, olddefconfig, build: OK
> 
> (which would get even more verbose if I had passed a -p option, since
> dirclean would have been added).
> 
> I'd really prefer if we got rid of those additional prints, they are
> not useful, and make the whole thing less readable.

Well, I like that there is so feedback of what's going on under the
hood...

But I'll send updates to 'fix' that.

Thanks! :-)

Regards,
Yann E. MORIN.

> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests
  2017-02-08 20:15 ` [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests Yann E. MORIN
@ 2017-02-09 22:13   ` Thomas Petazzoni
  0 siblings, 0 replies; 29+ messages in thread
From: Thomas Petazzoni @ 2017-02-09 22:13 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  8 Feb 2017 21:15:27 +0100, Yann E. MORIN wrote:
> Sometimes, it interesting to have a global overview of whether the
> package builds at all or not, rather than test on all toolchains.
> 
> Add an option that allows testing on a limited set of randomly choosen
> toolchains.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> 
> ---
> Changes v1 -> v2;
>   - fix when option is not provided
> ---
>  support/scripts/test-pkg | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-08 22:00   ` Cam Hutchison
  2017-02-08 22:39     ` Cam Hutchison
@ 2017-02-11 16:08     ` Yann E. MORIN
  2017-02-11 21:19       ` Thomas De Schampheleire
  1 sibling, 1 reply; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-11 16:08 UTC (permalink / raw)
  To: buildroot

Cam, All,

Since you did not Cc me on that mail, I only noticed it now...

On 2017-02-08 22:00 -0000, Cam Hutchison spake thusly:
> "Yann E. MORIN" <yann.morin.1998@free.fr> writes:
> >This script helps in testing that a package builds fine on a wide range
> >of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
[--SNIP--]
> >+    if [ ${#toolchains[@]} -eq 0 ]; then
> >+        printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
> 
> The format string should be in single quotes as it contains a glob char.

Nope, wildcards are not expanded in double quotes (as you then noticed).

> I usually put all printf format strings in single quotes since printf is
> doing the substitutions, not the shell.

I tend to agree on the principle: format strings should be
single-quoted. But then we have disparate quoting styles, and I don;t
like it. I prefer a single quoting style...

But your point is valid as well.

[--SNIP--]
> >+    while read line; do
> >+        if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then
> 
> You should use grep -Fx here since ${line} might contains regex chars:
> 
>         if ! grep -Fx "${line}" "${dir}/.config" >/dev/null 2>&1; then
> 
> ....
> 
> >+            printf ", SKIPPED\n"
> >+            return
> >+        fi
> >+    done <"${cfg}"
> 
> .... but I'd get rid of the loop altogether and use comm(1); something like:
> 
>     if [ -n "$( comm -23 <(sort "${cfg}") <(sort "${dir/.config}") )" ]; then
>         printf ", SKIPPED\n"
> 	return
>     fi

Yup, I'll take a look at using comm instead. Thanks for the tip! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures
  2017-02-09 21:59   ` Thomas Petazzoni
@ 2017-02-11 19:48     ` Thomas De Schampheleire
  2017-02-11 22:21       ` Yann E. MORIN
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas De Schampheleire @ 2017-02-11 19:48 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 9, 2017 at 10:59 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Wed,  8 Feb 2017 21:15:26 +0100, Yann E. MORIN wrote:
>
>> +    if [ ${nb_dl} -ne 0 ]; then
>> +        printf "%d configurations could not be downloaded\n" ${nb_dl}
>> +    fi
>> +    if [ ${nb_cfg} -ne 0 ]; then
>> +        printf "%d configurations could not be applied\n" ${nb_cfg}
>> +    fi
>> +    if [ ${nb_skip} -ne 0 ]; then
>> +        printf "%d configurations were skipped\n" ${nb_skip}
>> +    fi
>> +    if [ ${nb_clean} -ne 0 ]; then
>> +        printf "%d configurations could not be dircleaned\n" ${nb_clean}
>> +    fi
>> +    if [ ${nb_build} -ne 0 ]; then
>> +        printf "%d configurations would not build\n" ${nb_build}
>> +    fi
>
> This is really verbose and not very useful. Instead what would be much
> more useful is just:
>
>         successes = %d, failures = %d, skipped = %d
>
> (possibly presented in a different way, my point is really that number
> of successes, number of failures and numbers of skipped configurations
> is really all what matters)
>

I agree with Thomas here. Especially because a failure in download,
olddefconfig and dirclean steps is exceptional. Most failures will be
due to build problems or to a lesser extent invalid cofigurations
(either completely invalid == developer error in providing the
snippet, or invalid in some toolchains only).
Since the amount of toolchains that will be checked is limited, it is
not a lot of work to scroll up to view the actual problems.

/Thomas

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains
  2017-02-08 20:15 ` [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains Yann E. MORIN
@ 2017-02-11 19:53   ` Thomas De Schampheleire
  2017-02-11 22:24     ` Yann E. MORIN
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas De Schampheleire @ 2017-02-11 19:53 UTC (permalink / raw)
  To: buildroot

On Wed, Feb 8, 2017 at 9:15 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> For now, testing a package requires network access. However, there are
> situations where everything is already cached locally (especially the
> toolchains tarballs) and network is not available (e.g. in the train,
> travelling back from FOSDEM...)
>
> Alternatively, one may also want to test against a subset of the default
> toolchains (e.g. the ones known to have a specific issue).
>
> Add an option to use an alternate URL, which can be remote or a path to
> a local file.
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  support/scripts/test-pkg | 47 +++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 41 insertions(+), 6 deletions(-)
>
> diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
> index 59c9f23..e77c804 100755
> --- a/support/scripts/test-pkg
> +++ b/support/scripts/test-pkg
> @@ -5,16 +5,17 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
>
>  main() {
>      local o O opts
> -    local cfg dir pkg random toolchain
> +    local cfg dir pkg random url toolchain
>      local ret nb_dl nb_cfg nb_skip nb_clean nb_build
>      local -a toolchains
>
> -    o='hc:d:p:r:'
> -    O='help,config-snippet:build-dir:package:,random:'
> +    o='hc:d:p:r:t:'
> +    O='help,config-snippet:build-dir:package:,random:,toolchains:'
>      opts="$( getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}"  )"
>      eval set -- "${opts}"
>
>      random=0
> +    url="${TOOLCHAINS_URL}"
>      while [ ${#} -gt 0 ]; do
>          case "${1}" in
>          (-h|--help)
> @@ -32,6 +33,9 @@ main() {
>          (-r|--random)
>              random="${2}"; shift 2
>              ;;
> +        (-t|--toolchains)
> +            url="${2}"; shift 2
> +            ;;
>          (--)
>              shift; break
>              ;;
> @@ -44,10 +48,16 @@ main() {
>          dir="${HOME}/br-test-pkg"
>      fi
>
> +    # Transform local paths to URI to make curl happy and simplify
> +    # our code path
> +    case "${url}" in
> +    (/*)    url="file://${url}";;
> +    esac
> +
>      # 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=( $( curl -s "${TOOLCHAINS_URL}" \
> +    toolchains=( $( curl -s "${url}" \
>                      |sed -r -e 's/,.*//; /internal/d;' \
>                      |if [ ${random} -gt 0 ]; then \
>                          sort -R |head -n ${random}
> @@ -102,6 +112,12 @@ build_one() {
>      local pkg="${4}"
>      local toolchain line skip
>
> +    # Transform local paths to URI to make curl happy and simplify
> +    # our code path
> +    case "${url}" in
> +    (/*)    url="file://${url}";;
> +    esac

Some duplication that could be extracted to a function?

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress
  2017-02-08 20:15 ` [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress Yann E. MORIN
@ 2017-02-11 20:09   ` Thomas De Schampheleire
  2017-02-11 22:25     ` Yann E. MORIN
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas De Schampheleire @ 2017-02-11 20:09 UTC (permalink / raw)
  To: buildroot

On Wed, Feb 8, 2017 at 9:15 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> ---
>  support/scripts/test-pkg | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
> index e77c804..919200d 100755
> --- a/support/scripts/test-pkg
> +++ b/support/scripts/test-pkg
> @@ -6,7 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
>  main() {
>      local o O opts
>      local cfg dir pkg random url toolchain
> -    local ret nb_dl nb_cfg nb_skip nb_clean nb_build
> +    local ret nb nb_dl nb_cfg nb_skip nb_clean nb_build
>      local -a toolchains
>
>      o='hc:d:p:r:t:'
> @@ -71,13 +71,18 @@ main() {
>          printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
>      fi
>
> +    printf "Found %d toolchains\n" ${#toolchains[@]}
> +
> +    nb=1
>      nb_dl=0
>      nb_cfg=0
>      nb_skip=0
>      nb_clean=0
>      nb_build=0
>      for toolchain in "${toolchains[@]}"; do
> +        printf "%40s [%3d/%3d]: " "$( basename "${toolchain}" .config)" ${nb} ${#toolchains[@]}

Do you expect more than 99 toolchains very soon?
I know it's a nit, but the following does not look very nice IMHO: [  2/ 48]
I would either use %2d for the counters, or alternatively:

nbfmt="%d"
if [ ${#toolchains[@]} -gt 9 ]; then
    nbfmt="%2d"
elif [ ${#toolchains[@]} -gt 99 ]; then
    nbfmt="%3d"
fi

Regardless:

Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Tested-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-11 16:08     ` Yann E. MORIN
@ 2017-02-11 21:19       ` Thomas De Schampheleire
  2017-02-11 22:28         ` Yann E. MORIN
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas De Schampheleire @ 2017-02-11 21:19 UTC (permalink / raw)
  To: buildroot

On Sat, Feb 11, 2017 at 5:08 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Cam, All,
>
> Since you did not Cc me on that mail, I only noticed it now...
>
> On 2017-02-08 22:00 -0000, Cam Hutchison spake thusly:
>> "Yann E. MORIN" <yann.morin.1998@free.fr> writes:
>> >This script helps in testing that a package builds fine on a wide range
>> >of architectures and toolchains: BE/LE, 32/64-bit, musl/glibc/uclibc...
> [--SNIP--]
>> >+    if [ ${#toolchains[@]} -eq 0 ]; then
>> >+        printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
>>
>> The format string should be in single quotes as it contains a glob char.
>
> Nope, wildcards are not expanded in double quotes (as you then noticed).
>
>> I usually put all printf format strings in single quotes since printf is
>> doing the substitutions, not the shell.
>
> I tend to agree on the principle: format strings should be
> single-quoted. But then we have disparate quoting styles, and I don;t
> like it. I prefer a single quoting style...
>
> But your point is valid as well.
>
> [--SNIP--]
>> >+    while read line; do
>> >+        if ! grep "^${line}\$" "${dir}/.config" >/dev/null 2>&1; then
>>
>> You should use grep -Fx here since ${line} might contains regex chars:
>>
>>         if ! grep -Fx "${line}" "${dir}/.config" >/dev/null 2>&1; then
>>
>> ....
>>
>> >+            printf ", SKIPPED\n"
>> >+            return
>> >+        fi
>> >+    done <"${cfg}"
>>
>> .... but I'd get rid of the loop altogether and use comm(1); something like:
>>
>>     if [ -n "$( comm -23 <(sort "${cfg}") <(sort "${dir/.config}") )" ]; then
>>         printf ", SKIPPED\n"
>>       return
>>     fi
>
> Yup, I'll take a look at using comm instead. Thanks for the tip! :-)
>

Here is a feature request, but only if it does not add much
complexity: I was expecting the script to accept this:

echo "BR2_PACKAGE_BUSYBOX=y" | support/scripts/test-pkg -p busybox -c -

i.e. let '-' indicate that the config snippet is to be taken from
standard input, a principle supported by many unix tools already.
The 'echo' could be more complex in someone else's use case, for
example a concatenation of several pre-existing snippets.

Best regards,
Thomas

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures
  2017-02-11 19:48     ` Thomas De Schampheleire
@ 2017-02-11 22:21       ` Yann E. MORIN
  0 siblings, 0 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-11 22:21 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2017-02-11 20:48 +0100, Thomas De Schampheleire spake thusly:
> On Thu, Feb 9, 2017 at 10:59 PM, Thomas Petazzoni
> <thomas.petazzoni@free-electrons.com> wrote:
> > Hello,
> >
> > On Wed,  8 Feb 2017 21:15:26 +0100, Yann E. MORIN wrote:
> >
> >> +    if [ ${nb_dl} -ne 0 ]; then
> >> +        printf "%d configurations could not be downloaded\n" ${nb_dl}
> >> +    fi
> >> +    if [ ${nb_cfg} -ne 0 ]; then
> >> +        printf "%d configurations could not be applied\n" ${nb_cfg}
> >> +    fi
> >> +    if [ ${nb_skip} -ne 0 ]; then
> >> +        printf "%d configurations were skipped\n" ${nb_skip}
> >> +    fi
> >> +    if [ ${nb_clean} -ne 0 ]; then
> >> +        printf "%d configurations could not be dircleaned\n" ${nb_clean}
> >> +    fi
> >> +    if [ ${nb_build} -ne 0 ]; then
> >> +        printf "%d configurations would not build\n" ${nb_build}
> >> +    fi
> >
> > This is really verbose and not very useful. Instead what would be much
> > more useful is just:
> >
> >         successes = %d, failures = %d, skipped = %d
> >
> > (possibly presented in a different way, my point is really that number
> > of successes, number of failures and numbers of skipped configurations
> > is really all what matters)
> >
> 
> I agree with Thomas here. Especially because a failure in download,
> olddefconfig and dirclean steps is exceptional. Most failures will be
> due to build problems or to a lesser extent invalid cofigurations
> (either completely invalid == developer error in providing the
> snippet, or invalid in some toolchains only).
> Since the amount of toolchains that will be checked is limited, it is
> not a lot of work to scroll up to view the actual problems.

I already fixed it as per Thomas P. suggestion. It will be in the next
re-spin (tomorrow).

Regards,
Yann E. MORIN.


-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains
  2017-02-11 19:53   ` Thomas De Schampheleire
@ 2017-02-11 22:24     ` Yann E. MORIN
  0 siblings, 0 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-11 22:24 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2017-02-11 20:53 +0100, Thomas De Schampheleire spake thusly:
> On Wed, Feb 8, 2017 at 9:15 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > For now, testing a package requires network access. However, there are
> > situations where everything is already cached locally (especially the
> > toolchains tarballs) and network is not available (e.g. in the train,
> > travelling back from FOSDEM...)
> >
> > Alternatively, one may also want to test against a subset of the default
> > toolchains (e.g. the ones known to have a specific issue).
> >
> > Add an option to use an alternate URL, which can be remote or a path to
> > a local file.
[--SNIP--]
> > +    # Transform local paths to URI to make curl happy and simplify
> > +    # our code path
> > +    case "${url}" in
> > +    (/*)    url="file://${url}";;
> > +    esac
> > +
> >      # 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=( $( curl -s "${TOOLCHAINS_URL}" \
> > +    toolchains=( $( curl -s "${url}" \
> >                      |sed -r -e 's/,.*//; /internal/d;' \
> >                      |if [ ${random} -gt 0 ]; then \
> >                          sort -R |head -n ${random}
> > @@ -102,6 +112,12 @@ build_one() {
> >      local pkg="${4}"
> >      local toolchain line skip
> >
> > +    # Transform local paths to URI to make curl happy and simplify
> > +    # our code path
> > +    case "${url}" in
> > +    (/*)    url="file://${url}";;
> > +    esac
> 
> Some duplication that could be extracted to a function?

I wondered as much, too, but this is really trivial code. Also, if this
gets to be a function, then that would have to be used using shell
expansion, like:

    url="$(canonical_url "${url}")"

which does not look very nice either.

So I believe duplication is acceptable in this case.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress
  2017-02-11 20:09   ` Thomas De Schampheleire
@ 2017-02-11 22:25     ` Yann E. MORIN
  2017-02-12  6:40       ` Thomas De Schampheleire
  0 siblings, 1 reply; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-11 22:25 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2017-02-11 21:09 +0100, Thomas De Schampheleire spake thusly:
> On Wed, Feb 8, 2017 at 9:15 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  support/scripts/test-pkg | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
> > index e77c804..919200d 100755
> > --- a/support/scripts/test-pkg
> > +++ b/support/scripts/test-pkg
> > @@ -6,7 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-conf
> >  main() {
> >      local o O opts
> >      local cfg dir pkg random url toolchain
> > -    local ret nb_dl nb_cfg nb_skip nb_clean nb_build
> > +    local ret nb nb_dl nb_cfg nb_skip nb_clean nb_build
> >      local -a toolchains
> >
> >      o='hc:d:p:r:t:'
> > @@ -71,13 +71,18 @@ main() {
> >          printf "error: no toolchain found (networking issue?)\n" >&2; exit 1
> >      fi
> >
> > +    printf "Found %d toolchains\n" ${#toolchains[@]}
> > +
> > +    nb=1
> >      nb_dl=0
> >      nb_cfg=0
> >      nb_skip=0
> >      nb_clean=0
> >      nb_build=0
> >      for toolchain in "${toolchains[@]}"; do
> > +        printf "%40s [%3d/%3d]: " "$( basename "${toolchain}" .config)" ${nb} ${#toolchains[@]}
> 
> Do you expect more than 99 toolchains very soon?
> I know it's a nit, but the following does not look very nice IMHO: [  2/ 48]
> I would either use %2d for the counters, or alternatively:
> 
> nbfmt="%d"
> if [ ${#toolchains[@]} -gt 9 ]; then
>     nbfmt="%2d"
> elif [ ${#toolchains[@]} -gt 99 ]; then
>     nbfmt="%3d"
> fi
> 
> Regardless:
> 
> Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Tested-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Thanks, but I eventually dropped that patch from the series. It does not
bring much in the end.

If people argue that it is better to keep it, I can re-instate it.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 1/6] support/scripts: add script to test a package
  2017-02-11 21:19       ` Thomas De Schampheleire
@ 2017-02-11 22:28         ` Yann E. MORIN
  0 siblings, 0 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-11 22:28 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2017-02-11 22:19 +0100, Thomas De Schampheleire spake thusly:
> On Sat, Feb 11, 2017 at 5:08 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
[--SNIP--]
> Here is a feature request, but only if it does not add much
> complexity: I was expecting the script to accept this:
> 
> echo "BR2_PACKAGE_BUSYBOX=y" | support/scripts/test-pkg -p busybox -c -
> 
> i.e. let '-' indicate that the config snippet is to be taken from
> standard input, a principle supported by many unix tools already.
> The 'echo' could be more complex in someone else's use case, for
> example a concatenation of several pre-existing snippets.

Which means that we'd have to manage a temporary file internally. Well,
we can do without it, at the cost of some complexity in the script.

What would be the use-case that would prevent on to do:

    $ printf "Bla\nBle\n" >foo.cfg
    $ ./support/scripts/test-pkg -p busybox -c foo.cfg
    $ rm foo.cfg

instead?

But yes, that's doable. Lt's just post-pone that "enhancement" for
later...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress
  2017-02-11 22:25     ` Yann E. MORIN
@ 2017-02-12  6:40       ` Thomas De Schampheleire
  2017-02-12  9:33         ` Yann E. MORIN
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas De Schampheleire @ 2017-02-12  6:40 UTC (permalink / raw)
  To: buildroot

On Feb 11, 2017 23:25, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

Thomas DS, All,

On 2017-02-11 21:09 +0100, Thomas De Schampheleire spake thusly:
> On Wed, Feb 8, 2017 at 9:15 PM, Yann E. MORIN <yann.morin.1998@free.fr>
wrote:
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > ---
> >  support/scripts/test-pkg | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg
> > index e77c804..919200d 100755
> > --- a/support/scripts/test-pkg
> > +++ b/support/scripts/test-pkg
> > @@ -6,7 +6,7 @@ TOOLCHAINS_URL='http://autobuild.buildroot.org/
toolchains/configs/toolchain-conf
> >  main() {
> >      local o O opts
> >      local cfg dir pkg random url toolchain
> > -    local ret nb_dl nb_cfg nb_skip nb_clean nb_build
> > +    local ret nb nb_dl nb_cfg nb_skip nb_clean nb_build
> >      local -a toolchains
> >
> >      o='hc:d:p:r:t:'
> > @@ -71,13 +71,18 @@ main() {
> >          printf "error: no toolchain found (networking issue?)\n" >&2;
exit 1
> >      fi
> >
> > +    printf "Found %d toolchains\n" ${#toolchains[@]}
> > +
> > +    nb=1
> >      nb_dl=0
> >      nb_cfg=0
> >      nb_skip=0
> >      nb_clean=0
> >      nb_build=0
> >      for toolchain in "${toolchains[@]}"; do
> > +        printf "%40s [%3d/%3d]: " "$( basename "${toolchain}"
.config)" ${nb} ${#toolchains[@]}
>
> Do you expect more than 99 toolchains very soon?
> I know it's a nit, but the following does not look very nice IMHO: [  2/
48]
> I would either use %2d for the counters, or alternatively:
>
> nbfmt="%d"
> if [ ${#toolchains[@]} -gt 9 ]; then
>     nbfmt="%2d"
> elif [ ${#toolchains[@]} -gt 99 ]; then
>     nbfmt="%3d"
> fi
>
> Regardless:
>
> Reviewed-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Tested-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Thanks, but I eventually dropped that patch from the series. It does not
bring much in the end.

If people argue that it is better to keep it, I can re-instate it.


For my part, I think there is value in such progress indication...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170212/9daefa86/attachment.html>

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress
  2017-02-12  6:40       ` Thomas De Schampheleire
@ 2017-02-12  9:33         ` Yann E. MORIN
  0 siblings, 0 replies; 29+ messages in thread
From: Yann E. MORIN @ 2017-02-12  9:33 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2017-02-12 07:40 +0100, Thomas De Schampheleire spake thusly:
> On Feb 11, 2017 23:25, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
[--SNIP--]
> > Thanks, but I eventually dropped that patch from the series. It does not
> > bring much in the end.
> > 
> > If people argue that it is better to keep it, I can re-instate it.
> 
> For my part, I think there is value in such progress indication...

I heard thy complain; I shall then reinstate the progress. ;-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2017-02-12  9:33 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 20:15 [Buildroot] [PATCH 0/6 v3] support: script to build-test packages Yann E. MORIN
2017-02-08 20:15 ` [Buildroot] [PATCH 1/6] support/scripts: add script to test a package Yann E. MORIN
2017-02-08 22:00   ` Cam Hutchison
2017-02-08 22:39     ` Cam Hutchison
2017-02-11 16:08     ` Yann E. MORIN
2017-02-11 21:19       ` Thomas De Schampheleire
2017-02-11 22:28         ` Yann E. MORIN
2017-02-09 13:41   ` Luca Ceresoli
2017-02-09 21:50   ` Thomas Petazzoni
2017-02-09 22:00     ` Yann E. MORIN
2017-02-09 21:51   ` Thomas Petazzoni
2017-02-08 20:15 ` [Buildroot] [PATCH 2/6] support/test-pkg: store lines missing from resulting configuraiton Yann E. MORIN
2017-02-09 17:07   ` Luca Ceresoli
2017-02-09 21:58   ` Thomas Petazzoni
2017-02-08 20:15 ` [Buildroot] [PATCH 3/6] support/test-pkg: report number and types of failures Yann E. MORIN
2017-02-09 17:09   ` Luca Ceresoli
2017-02-09 21:59   ` Thomas Petazzoni
2017-02-11 19:48     ` Thomas De Schampheleire
2017-02-11 22:21       ` Yann E. MORIN
2017-02-08 20:15 ` [Buildroot] [PATCH 4/6] supprt/test-pkg: add option to limit the number of tests Yann E. MORIN
2017-02-09 22:13   ` Thomas Petazzoni
2017-02-08 20:15 ` [Buildroot] [PATCH 5/6] support/test-pkg: add option to use an alternate list of toolchains Yann E. MORIN
2017-02-11 19:53   ` Thomas De Schampheleire
2017-02-11 22:24     ` Yann E. MORIN
2017-02-08 20:15 ` [Buildroot] [PATCH 6/6] support/test-pkg: print number of toolchain and progress Yann E. MORIN
2017-02-11 20:09   ` Thomas De Schampheleire
2017-02-11 22:25     ` Yann E. MORIN
2017-02-12  6:40       ` Thomas De Schampheleire
2017-02-12  9:33         ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.