From patchwork Thu Oct 10 06:39:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 1174335 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Wwjq2JGQ"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46phKJ6h70z9sCJ for ; Thu, 10 Oct 2019 17:40:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B3CA124A5C; Thu, 10 Oct 2019 06:40:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gTRo--YltyL8; Thu, 10 Oct 2019 06:39:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 5BE0A24214; Thu, 10 Oct 2019 06:39:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 7C4B21BF41D for ; Thu, 10 Oct 2019 06:39:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 78E6724400 for ; Thu, 10 Oct 2019 06:39:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k9gQVhAY3fdM for ; Thu, 10 Oct 2019 06:39:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by silver.osuosl.org (Postfix) with ESMTPS id 11BA024214 for ; Thu, 10 Oct 2019 06:39:55 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id r5so6236201wrm.12 for ; Wed, 09 Oct 2019 23:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QfJPx8UFuP35SAb+p6VBlKgJRYw/e31o0hH7shzTZb0=; b=Wwjq2JGQDT4QOPXSkhRcvNDjd5SeIZT6IDW0a0UGAzqXMOuazjcg0SjZrQFyBtSgyV I5an2ufIDGhMEbkYgwPZ1kgX3zcX9eCKHYI1kEMIs0Ag/lW/C7yFleo8HxcXCHulH6kd 5VumBxI5l8cKLF4BVsxXZaESTviw74DmnRjIZ7MZqjzd2Zcmd9TvaLH7KXMcVq0MIZTh YC19uh48KGHUE2aOxvWq4ncHDjvxKr4PsIWqeWDf85fj8YPtimBlxQ3sbJ1PixAoGtgr edkQ35zLBViZy4S3+XwAzt2lEIJrrMAWVNTZ5hnV1TIMNvKQa4xtUv0eug4ts3ebTy1O lb8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QfJPx8UFuP35SAb+p6VBlKgJRYw/e31o0hH7shzTZb0=; b=J2GD48XUJ85zkfmei9tWhd2hsWisIq7kFwG5YiWj1MwvmalByHZtrzOuXm06B1OU4A iC1kNlbn1YWeSL4MGk3gOCwZCOGhYxGZPOUUgFrsloiuSJePUYqmqFRxLDW1ZiSkif2Q O7CgvJgzWuytbIHv/6aE4Kpv3Bu+blRJCQ6XQ4A8SVsFrZRApGgvFg17yGNOMll3h6fn zl6c45caXGxcQnMueJT4VdMddUf8UisEfup56Gf6lUBno2yF+Zbmam4qrz3/Sz4DVcFZ gwt6vm+wXqWhGNG6PyDTZS364CXDchtpo/iTI5j55e4HVeICZ00jVu4Oxkazyt2Qh4k8 w05A== X-Gm-Message-State: APjAAAXf1vJNpW4k7CtyhkEhKeqmwy8w46qBVMFKN5Rr8CfGH4HumuCD YmCoGJp+rM6pQe8ETBx0KVbxAmU3 X-Google-Smtp-Source: APXvYqxIg9sEeqIBzlYevZRrj0v178+VFvQaQ5AqWw0UAob3SNHjz8d1vMf3txfY9rAbS3amAMNjtQ== X-Received: by 2002:adf:a516:: with SMTP id i22mr7313378wrb.273.1570689593124; Wed, 09 Oct 2019 23:39:53 -0700 (PDT) Received: from hthiery01.sab.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id m7sm5051585wrv.40.2019.10.09.23.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 23:39:52 -0700 (PDT) From: heiko.thiery@gmail.com To: buildroot@buildroot.org Date: Thu, 10 Oct 2019 08:39:33 +0200 Message-Id: <20191010063933.30858-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] utils/test-pkg: set the return code for fail X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Thiery Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Heiko Thiery 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 --- utils/test-pkg | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/utils/test-pkg b/utils/test-pkg index f3b34d5d0d..e54c9f0cd8 100755 --- a/utils/test-pkg +++ b/utils/test-pkg @@ -17,8 +17,8 @@ main() { local -a toolchains local pkg_br_name - o='hakc:d:n:p:r:t:' - O='help,all,keep,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:' + o='hakec:d:n:p:r:t:' + O='help,all,keep,error,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:' opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")" eval set -- "${opts}" @@ -28,6 +28,7 @@ main() { number=0 mode=0 toolchains_csv="${TOOLCHAINS_CSV}" + exitcode=0 while [ ${#} -gt 0 ]; do case "${1}" in (-h|--help) @@ -57,6 +58,9 @@ main() { (-t|--toolchains-csv) toolchains_csv="${2}"; shift 2 ;; + (-e|--error) + exitcode=1;shift 1 + ;; (--) shift; break ;; @@ -138,6 +142,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() { @@ -251,6 +259,9 @@ Options: Note: the logfile and configuration is always retained, even without this option. + -e, --error + Set return code in case of build fail or legal-info error. + Example: Testing libcec would require a config snippet that contains: @@ -264,4 +275,7 @@ _EOF_ } my_name="${0##*/}" -main "${@}" +main "${@}" && ret=0 || ret=${?} +if [ ${exitcode} -ne 0 -a ${ret} -ne 0 ]; then + exit 1 +fi