From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv3 2/2] utils/test-pkg: clean output dir for successful builds
Date: Tue, 5 Feb 2019 22:21:42 +0100 [thread overview]
Message-ID: <20190205212142.2244-2-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20190205212142.2244-1-patrickdepinguin@gmail.com>
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 | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
v3: add missing help entry for --keep
v2: make the feature optional via '--keep' (feedback Arnout and Peter)
diff --git a/utils/test-pkg b/utils/test-pkg
index 087f9ddca9..c2aec0784d 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() {
@@ -221,6 +231,11 @@ Options:
try. If not specified, the toolchains in ${TOOLCHAINS_CSV} will be
used.
+ -k, --keep
+ Keep the build directories even if the build succeeds.
+ Note: the logfile and configuration is always retained, even without
+ this option.
+
Example:
Testing libcec would require a config snippet that contains:
--
2.19.2
next prev parent reply other threads:[~2019-02-05 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-05 21:21 [Buildroot] [PATCHv3 1/2] utils/test-pkg: fix long option parsing Thomas De Schampheleire
2019-02-05 21:21 ` Thomas De Schampheleire [this message]
2019-06-23 16:59 ` [Buildroot] [PATCHv3 2/2] utils/test-pkg: clean output dir for successful builds Yann E. MORIN
2019-06-25 9:04 ` Peter Korsgaard
2019-06-23 16:50 ` [Buildroot] [PATCHv3 1/2] utils/test-pkg: fix long option parsing Yann E. MORIN
2019-06-25 9:03 ` Peter Korsgaard
2019-06-23 19:40 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190205212142.2244-2-patrickdepinguin@gmail.com \
--to=patrickdepinguin@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox