From patchwork Fri Feb 22 20:52:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 10826979 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 E8A051575 for ; Fri, 22 Feb 2019 20:53:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC5E732C4C for ; Fri, 22 Feb 2019 20:53:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCA2632C59; Fri, 22 Feb 2019 20:53: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 C599A32C4C for ; Fri, 22 Feb 2019 20:52:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727053AbfBVUw6 (ORCPT ); Fri, 22 Feb 2019 15:52:58 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:35298 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726056AbfBVUwy (ORCPT ); Fri, 22 Feb 2019 15:52:54 -0500 Received: from mail-wr1-f70.google.com ([209.85.221.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gxHoS-0000Cu-6G for linux-kselftest@vger.kernel.org; Fri, 22 Feb 2019 20:52:52 +0000 Received: by mail-wr1-f70.google.com with SMTP id z16so1545011wrt.0 for ; Fri, 22 Feb 2019 12:52:52 -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=NRPeMIi4WkzlI/wi4uTphGWN+IH4+mQk5AY4oH1wsVE=; b=drz5maeQiW2PCbGw3y6nNn2AQYW5HSEzdHJ58GWgTq/nzpDa5XEo77appqPy64URvL AMmic9dvhjuFMquqp+GfpyopTLp6zx4GtnaB18FhI+L8FRxPPbOq4BKiaaCX0q99u51m GDA2mzlklPMvKpqpOhG7hDrjE2Zp61EXQ/cp4JhVFXd0rw7qHCwnI6145qC480ADt8I6 bdQcP7zc8moZ25+2pqkcHTCqArtSpdaJJdqDpwXw+dkTpYsR22J6tW2qTn5PnkMgLg3C YBmto/gKqQpMhDY/Jd3kb0+ahNQFEEJfVgDLFYVqwXTJC3SWyrOU28ewkqkeXRkcVf7Q MMhQ== X-Gm-Message-State: AHQUAuZ0jGzlpWvkPz/krplAJuvQ4TE22St7pIr1PYafi0pG2Pkza7Ng yFfwi8V5BxEXKYo8YkXbvrsPKvkvZEB5oLaWWzfteR20uiytX71+1jyLkqbJfjWTPCflqwSfE4q mMW8+pW+FLndYpX7aWw1s+QBdhmAMo3mUmmqx6wwenmt7Dg== X-Received: by 2002:adf:b784:: with SMTP id s4mr4211387wre.155.1550868771083; Fri, 22 Feb 2019 12:52:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZKVQO7O6v9cZu7nhampuKrCQjuiHxVea5LaqBvtfHabeEiaiDBC8lla/WHHa37nb2BOlK0Jg== X-Received: by 2002:adf:b784:: with SMTP id s4mr4211379wre.155.1550868770882; Fri, 22 Feb 2019 12:52:50 -0800 (PST) Received: from smeagol.c.hoisthospitality.com ([194.158.46.138]) by smtp.gmail.com with ESMTPSA id a8sm1728962wrt.79.2019.02.22.12.52.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 12:52:50 -0800 (PST) From: Juerg Haefliger X-Google-Original-From: Juerg Haefliger To: linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, mhiramat@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org Cc: Juerg Haefliger Subject: [RESEND PATCH v2 1/2] selftests/ftrace: Replace echo -e with printf Date: Fri, 22 Feb 2019 21:52:36 +0100 Message-Id: <20190222205237.606-2-juergh@canonical.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190222205237.606-1-juergh@canonical.com> References: <20190222091021.10178-1-juergh@canonical.com> <20190222205237.606-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 echo -e is not POSIX. Depending on what /bin/sh is, we can get incorrect output like: $ -e -n [1] Basic trace file check $ -e [PASS] Fix that by using printf instead. Acked-by: Steven Rostedt (VMware) Acked-by: Masami Hiramatsu Signed-off-by: Juerg Haefliger --- tools/testing/selftests/ftrace/ftracetest | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index fc755e1b50f1..20c9c0ad8682 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest @@ -173,8 +173,13 @@ strip_esc() { } prlog() { # messages - echo -e "$@" - [ "$LOG_FILE" ] && echo -e "$@" | strip_esc >> $LOG_FILE + newline="\n" + if [ "$1" = "-n" ] ; then + newline= + shift + fi + printf "$*$newline" + [ "$LOG_FILE" ] && printf "$*$newline" | strip_esc >> $LOG_FILE } catlog() { #file cat $1