From patchwork Fri Feb 22 20:53: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: 10826983 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 4B004139A for ; Fri, 22 Feb 2019 20:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C15928505 for ; Fri, 22 Feb 2019 20:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3060828706; Fri, 22 Feb 2019 20:54:15 +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 D51F528505 for ; Fri, 22 Feb 2019 20:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726278AbfBVUyO (ORCPT ); Fri, 22 Feb 2019 15:54:14 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:35339 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfBVUyO (ORCPT ); Fri, 22 Feb 2019 15:54:14 -0500 Received: from mail-wm1-f70.google.com ([209.85.128.70]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gxHpk-0000Lu-DY for linux-kselftest@vger.kernel.org; Fri, 22 Feb 2019 20:54:12 +0000 Received: by mail-wm1-f70.google.com with SMTP id f202so488304wme.2 for ; Fri, 22 Feb 2019 12:54:12 -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=LPydPkX4yBnap6TBoc8v0sBuIwavEI3GCaGUnYgEJakl20TB4spLT/+CaGQ6ebXXd/ H3ylyyv46GH1SHr7euN/+ZqffkZv7Nt8/S1veah3R9fv0Tf+ds9uHSa+5K8MNvyXHT/J OzfCrje8QmEmBg6DgHAZODkdaVX6/RUrm/Pdc+I14xzPhwom9o8yMcJ7CuABfbf/dHTQ qScI92VoQG8syi7H5DaMMKdyZvE55DNviLXmbEmORC5BQfb8UFTGmvsktmnjLn+fr8tQ NFAQMJpNeVRo/ae5GMoHzjaBlXInE7BjdxTSNAlTMyhiCiaSArk4emQcX6yWvLxWJyDr 19oA== X-Gm-Message-State: AHQUAuYYi6wNJdIIOMKQlV5jAt5eUqt2KZIh5JCgl4dO8mnCc5sXIRXZ gTKVTN1qN76GGIdsvE0fpG/qLsfOE4PGWAsZsdfFo3Q3EG/qUrPcQ14USMDN+B+E2sijomdXWW3 P0Z0QioZxIywbCGMTiBFVtnRU9Ghv0Nlf9yOX8UCy6F2Hxg== X-Received: by 2002:a7b:c14f:: with SMTP id z15mr3731357wmi.3.1550868851578; Fri, 22 Feb 2019 12:54:11 -0800 (PST) X-Google-Smtp-Source: AHgI3Ialsemdfap9Uq6CkVhuIqk/R+3D8RwXnBkjzKnz4OIkFedPm1/Tr/PIJkJuQiFWK7EGw45u7w== X-Received: by 2002:a7b:c14f:: with SMTP id z15mr3731351wmi.3.1550868851431; Fri, 22 Feb 2019 12:54:11 -0800 (PST) Received: from smeagol.c.hoisthospitality.com ([194.158.46.138]) by smtp.gmail.com with ESMTPSA id r14sm1432990wrv.77.2019.02.22.12.54.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 12:54:10 -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:53:50 +0100 Message-Id: <20190222205351.743-2-juergh@canonical.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190222205351.743-1-juergh@canonical.com> References: <20190222091021.10178-1-juergh@canonical.com> <20190222205351.743-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