* [Buildroot] [PATCH 1/1] utils/test-pkg: set the return code for fail
2019-10-10 8:51 [Buildroot] [PATCH 1/1] utils/test-pkg: set the return code for fail heiko.thiery at gmail.com
@ 2019-10-10 8:53 ` Heiko Thiery
2019-10-10 8:58 ` yann.morin at orange.com
1 sibling, 0 replies; 3+ messages in thread
From: Heiko Thiery @ 2019-10-10 8:53 UTC (permalink / raw)
To: buildroot
> Add an option (-e) to exit the script with an error if a build
> or the legal-info check fails.
>
> Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
> ---
> utils/test-pkg | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/utils/test-pkg b/utils/test-pkg
> index f3b34d5d0d..5e440b12f6 100755
> --- a/utils/test-pkg
> +++ b/utils/test-pkg
> @@ -138,6 +138,10 @@ main() {
>
> printf "%d builds, %d skipped, %d build failed, %d legal-info failed\n" \
> ${nb} ${nb_skip} ${nb_fail} ${nb_legal}
> +
> + if [ ${nb_fail} -ne 0 -o ${nb_legal} -ne 0 ]; then
> + return 1
> + fi
> }
>
> build_one() {
> @@ -264,4 +268,7 @@ _EOF_
> }
>
> my_name="${0##*/}"
> -main "${@}"
> +main "${@}" && ret=0 || ret=${?}
> +if [ ${ret} -ne 0 ]; then
> + exit 1
> +fi
> --
> 2.20.1
>
forgot the v2 prefix
^ permalink raw reply [flat|nested] 3+ messages in thread* [Buildroot] [PATCH 1/1] utils/test-pkg: set the return code for fail
2019-10-10 8:51 [Buildroot] [PATCH 1/1] utils/test-pkg: set the return code for fail heiko.thiery at gmail.com
2019-10-10 8:53 ` Heiko Thiery
@ 2019-10-10 8:58 ` yann.morin at orange.com
1 sibling, 0 replies; 3+ messages in thread
From: yann.morin at orange.com @ 2019-10-10 8:58 UTC (permalink / raw)
To: buildroot
Heiko, All,
On 2019-10-10 10:51 +0200, heiko.thiery at gmail.com spake thusly:
> From: Heiko Thiery <heiko.thiery@kontron.com>
>
> Add an option (-e) to exit the script with an error if a build
> or the legal-info check fails.
This commit log should be updated now that the option has been removed.
> Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
> ---
> utils/test-pkg | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/utils/test-pkg b/utils/test-pkg
> index f3b34d5d0d..5e440b12f6 100755
> --- a/utils/test-pkg
> +++ b/utils/test-pkg
> @@ -138,6 +138,10 @@ main() {
>
> printf "%d builds, %d skipped, %d build failed, %d legal-info failed\n" \
> ${nb} ${nb_skip} ${nb_fail} ${nb_legal}
> +
> + if [ ${nb_fail} -ne 0 -o ${nb_legal} -ne 0 ]; then
> + return 1
> + fi
It might be simpler to just return the number of failures:
return $((nb_fail+nb_legal))
> }
>
> build_one() {
> @@ -264,4 +268,7 @@ _EOF_
> }
>
> my_name="${0##*/}"
> -main "${@}"
> +main "${@}" && ret=0 || ret=${?}
> +if [ ${ret} -ne 0 ]; then
> + exit 1
> +fi
No need for this gymnastics: the script will return with the same return
code as the last command in the script, which in this case happen to be
the return code of main(), which will be 1 in case of error.
So, you really only need to change the return code of main().
Regards,
Yann E. MORIN.
> --
> 2.20.1
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
____________
.-----------------.--------------------: _ :------------------.
| Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON |
| +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN |
| +33 638.411.245 '--------------------: (_ `--, | X AGAINST |
| yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL |
'--------------------------------------:______/_____:------------------'
_________________________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.
This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread