All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv2 1/2] utils/test-pkg: fix long option parsing
@ 2019-02-05 20:09 Thomas De Schampheleire
  2019-02-05 20:09 ` [Buildroot] [PATCHv2 2/2] utils/test-pkg: clean output dir for successful builds Thomas De Schampheleire
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas De Schampheleire @ 2019-02-05 20:09 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

The long option parsing of test-pkg is broken because:
- some long options are not declared
- there should be a comma between long options, the colon does not replace
it.

This change also revealed that the declaration of 'toolchains-dir' should
have been 'toolchains-csv', originally introduced in commit ed59f81a3cb4ddb.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 utils/test-pkg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v2: new patch

diff --git a/utils/test-pkg b/utils/test-pkg
index 1995fa8578..087f9ddca9 100755
--- a/utils/test-pkg
+++ b/utils/test-pkg
@@ -5,12 +5,12 @@ TOOLCHAINS_CSV='support/config-fragments/autobuild/toolchain-configs.csv'
 
 main() {
     local o O opts
-    local cfg dir pkg random toolchains_dir toolchain all number mode
+    local cfg dir pkg random toolchains_csv toolchain all number mode
     local ret nb nb_skip nb_fail nb_legal nb_tc build_dir
     local -a toolchains
 
     o='hac:d:n:p:r:t:'
-    O='help,config-snippet:build-dir:package:,random:,toolchains-dir:'
+    O='help,all,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
     opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")"
     eval set -- "${opts}"
 
-- 
2.19.2

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

* [Buildroot] [PATCHv2 2/2] utils/test-pkg: clean output dir for successful builds
  2019-02-05 20:09 [Buildroot] [PATCHv2 1/2] utils/test-pkg: fix long option parsing Thomas De Schampheleire
@ 2019-02-05 20:09 ` Thomas De Schampheleire
  2019-02-05 21:12   ` Thomas De Schampheleire
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas De Schampheleire @ 2019-02-05 20:09 UTC (permalink / raw)
  To: buildroot

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

test-pkg will use gigabytes of space when testing all toolchains.
Nevertheless, you are normally only interested in the actual build / host
tree when there is a build failure.

Do a 'make clean' for successful builds to save disk space, unless the new
option '-k/--keep' is set.
Note that the logfile and configuration is always retained for inspection.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 utils/test-pkg | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

v2: make the feature optional via '--keep' (feedback Arnout and Peter)


diff --git a/utils/test-pkg b/utils/test-pkg
index 087f9ddca9..ef865c80fe 100755
--- a/utils/test-pkg
+++ b/utils/test-pkg
@@ -6,16 +6,17 @@ TOOLCHAINS_CSV='support/config-fragments/autobuild/toolchain-configs.csv'
 main() {
     local o O opts
     local cfg dir pkg random toolchains_csv toolchain all number mode
-    local ret nb nb_skip nb_fail nb_legal nb_tc build_dir
+    local ret nb nb_skip nb_fail nb_legal nb_tc build_dir keep
     local -a toolchains
 
-    o='hac:d:n:p:r:t:'
-    O='help,all,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
+    o='hakc:d:n:p:r:t:'
+    O='help,all,keep,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
     opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")"
     eval set -- "${opts}"
 
     random=0
     all=0
+    keep=0
     number=0
     mode=0
     toolchains_csv="${TOOLCHAINS_CSV}"
@@ -27,6 +28,9 @@ main() {
         (-a|--all)
             all=1; shift 1
             ;;
+        (-k|--keep)
+            keep=1; shift 1
+            ;;
         (-c|--config-snippet)
             cfg="${2}"; shift 2
             ;;
@@ -161,6 +165,12 @@ build_one() {
     if ! make O="${dir}" legal-info >> "${dir}/logfile" 2>&1; then
         return 3
     fi
+
+    # If we get here, the build was successful. Clean up the build/host
+    # directories to save disk space, unless 'keep' was set.
+    if [ ${keep} -ne 1 ]; then
+        make O="${dir}" clean >> "${dir}/logfile" 2>&1
+    fi
 }
 
 help() {
-- 
2.19.2

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

* [Buildroot] [PATCHv2 2/2] utils/test-pkg: clean output dir for successful builds
  2019-02-05 20:09 ` [Buildroot] [PATCHv2 2/2] utils/test-pkg: clean output dir for successful builds Thomas De Schampheleire
@ 2019-02-05 21:12   ` Thomas De Schampheleire
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas De Schampheleire @ 2019-02-05 21:12 UTC (permalink / raw)
  To: buildroot

El mar., 5 feb. 2019 a las 21:10, Thomas De Schampheleire
(<patrickdepinguin@gmail.com>) escribi?:
>
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> test-pkg will use gigabytes of space when testing all toolchains.
> Nevertheless, you are normally only interested in the actual build / host
> tree when there is a build failure.
>
> Do a 'make clean' for successful builds to save disk space, unless the new
> option '-k/--keep' is set.
> Note that the logfile and configuration is always retained for inspection.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>  utils/test-pkg | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
>
> v2: make the feature optional via '--keep' (feedback Arnout and Peter)
>
>
> diff --git a/utils/test-pkg b/utils/test-pkg
> index 087f9ddca9..ef865c80fe 100755
> --- a/utils/test-pkg
> +++ b/utils/test-pkg
> @@ -6,16 +6,17 @@ TOOLCHAINS_CSV='support/config-fragments/autobuild/toolchain-configs.csv'
>  main() {
>      local o O opts
>      local cfg dir pkg random toolchains_csv toolchain all number mode
> -    local ret nb nb_skip nb_fail nb_legal nb_tc build_dir
> +    local ret nb nb_skip nb_fail nb_legal nb_tc build_dir keep
>      local -a toolchains
>
> -    o='hac:d:n:p:r:t:'
> -    O='help,all,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
> +    o='hakc:d:n:p:r:t:'
> +    O='help,all,keep,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
>      opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")"
>      eval set -- "${opts}"
>
>      random=0
>      all=0
> +    keep=0
>      number=0
>      mode=0
>      toolchains_csv="${TOOLCHAINS_CSV}"
> @@ -27,6 +28,9 @@ main() {
>          (-a|--all)
>              all=1; shift 1
>              ;;
> +        (-k|--keep)
> +            keep=1; shift 1
> +            ;;
>          (-c|--config-snippet)
>              cfg="${2}"; shift 2
>              ;;
> @@ -161,6 +165,12 @@ build_one() {
>      if ! make O="${dir}" legal-info >> "${dir}/logfile" 2>&1; then
>          return 3
>      fi
> +
> +    # If we get here, the build was successful. Clean up the build/host
> +    # directories to save disk space, unless 'keep' was set.
> +    if [ ${keep} -ne 1 ]; then
> +        make O="${dir}" clean >> "${dir}/logfile" 2>&1
> +    fi

Grmbl, I forgot to update the help text...

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

end of thread, other threads:[~2019-02-05 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 20:09 [Buildroot] [PATCHv2 1/2] utils/test-pkg: fix long option parsing Thomas De Schampheleire
2019-02-05 20:09 ` [Buildroot] [PATCHv2 2/2] utils/test-pkg: clean output dir for successful builds Thomas De Schampheleire
2019-02-05 21:12   ` Thomas De Schampheleire

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.