From patchwork Mon Feb 25 13:14:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 10828541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB25C922 for ; Mon, 25 Feb 2019 13:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9D242B682 for ; Mon, 25 Feb 2019 13:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE67F2B687; Mon, 25 Feb 2019 13:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1102E2B66C for ; Mon, 25 Feb 2019 13:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727036AbfBYNPA (ORCPT ); Mon, 25 Feb 2019 08:15:00 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:52893 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727011AbfBYNPA (ORCPT ); Mon, 25 Feb 2019 08:15:00 -0500 Received: from mail-ed1-f71.google.com ([209.85.208.71]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gyG5y-0006wu-Qt for linux-kselftest@vger.kernel.org; Mon, 25 Feb 2019 13:14:58 +0000 Received: by mail-ed1-f71.google.com with SMTP id o9so3896007edh.10 for ; Mon, 25 Feb 2019 05:14:58 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=05Pfz0VU4oe6f93buxQY9QkgqsOv1os77MxM6+gPtFA=; b=FFy+TIMZjzxaTi/Wup4dgrJC5zceLdO+f+wxaHolT/HVVXFQcS73jzbTnTqHaveP4k a76AGRwXxff7hMp/BlQXz4X4AFwDAhtr8Y1LVQeZguXFtSYZQif/C25my7Q3pifx4ELy XdR1NjzMy4DOrUol5Nt4wgd8Q2deDyM+ez1IaBMioqCAobTEad6JM/q5TMJIAeRhNCAo N7/1ZOOjWo0CbOrHqc/R04cjx+9s6uEvfwc/G0h5paPEx9fejp/OpdegNk2KjWN9aZ+z QWcPPlFEqOTYubOiCEOKCpmid73p4MP6+shxq5Pg3zUmYdCsGH7H+6XBd5dNtKvR9LRX bIsA== X-Gm-Message-State: AHQUAuZkmWQ1XBttKosJRTbkBqM6JSqeVl4vhwQZHWCx2BM7TaF5s68X qmxwse+j5ypI66odWKtmbIbvhJTw5/GmBGhmDWnFR8Uj6JLGok29LePh4XGiPNLjDAxFwl+9Fsz RxTI1ewdIbyeUqjq3jEhP4z/BPMJ0tfKK4geLWgam0rcGww== X-Received: by 2002:a50:b786:: with SMTP id h6mr14526770ede.85.1551100498505; Mon, 25 Feb 2019 05:14:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IYkwy4pc0UTozk0rR2MjKf+t0Kb8Rj3JU9jOfxwpYicPej1v4ouavNIrrwqZsldMuzX+zcJgA== X-Received: by 2002:a50:b786:: with SMTP id h6mr14526757ede.85.1551100498288; Mon, 25 Feb 2019 05:14:58 -0800 (PST) Received: from gollum.fritz.box ([81.221.192.120]) by smtp.gmail.com with ESMTPSA id b46sm2719464edd.18.2019.02.25.05.14.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 05:14:57 -0800 (PST) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: rostedt@goodmis.org, mingo@redhat.com, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Juerg Haefliger Subject: [RESEND PATCH] selftests/ftrace: Handle the absence of tput Date: Mon, 25 Feb 2019 14:14:50 +0100 Message-Id: <20190225131450.4775-1-juergh@canonical.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190220153706.24686-1-juergh@canonical.com> References: <20190220153706.24686-1-juergh@canonical.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In environments where tput is not available, we get the following error $ ./ftracetest: 163: [: Illegal number: because ncolors is an empty string. Fix that by setting it to 0 if the tput command fails. Acked-by: Steven Rostedt (VMware) Acked-by: Masami Hiramatsu Signed-off-by: Juerg Haefliger --- tools/testing/selftests/ftrace/ftracetest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index 75244db70331..fc755e1b50f1 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -154,13 +154,13 @@ fi # Define text colors # Check available colors on the terminal, if any -ncolors=`tput colors 2>/dev/null` +ncolors=`tput colors 2>/dev/null || echo 0` color_reset= color_red= color_green= color_blue= # If stdout exists and number of colors is eight or more, use them -if [ -t 1 -a "$ncolors" -a "$ncolors" -ge 8 ]; then +if [ -t 1 -a "$ncolors" -ge 8 ]; then color_reset="\e[0m" color_red="\e[31m" color_green="\e[32m"