From patchwork Tue Nov 27 03:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rue X-Patchwork-Id: 10699619 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 C623313BB for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1C4A2A896 for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A29DA2A8A4; Tue, 27 Nov 2018 03:12:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 44FD52A896 for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbeK0OJU (ORCPT ); Tue, 27 Nov 2018 09:09:20 -0500 Received: from mail-io1-f51.google.com ([209.85.166.51]:45332 "EHLO mail-io1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728381AbeK0OJU (ORCPT ); Tue, 27 Nov 2018 09:09:20 -0500 Received: by mail-io1-f51.google.com with SMTP id w7so15779717iom.12 for ; Mon, 26 Nov 2018 19:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=QCWWrozDLm9AGnpjiOXGa4PFMJN2Pf/cim+RMMzNvMJ6syz7bMXCxXmB1XpvnddaUo 1lqSL6yjBjp4deDVpxQ1qlTg7UY+QRMefZozjSETvA/H41P2GdddstjILPBPbkYrabJn IICVT3FKOS8AGAsa8nCYLIovyU2tcPKNOJmlw= 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=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=Z5d0xyVjHlwXnatcEPnmERx9yv5OhJnNCAcab1eXXnXbDc6LHGJXGrTtnqkGRKjU5N 9IKRY6LbWa2OWctQw4+byVqWS23s9tLbC3nhwZgxwfndMu6veUDkK/TN4uz23GCYKqrM wU3hmtGy2m6jm+rqbCOl21RxFTQS6y2korSFOvL6Px8rK77VhhRd80lJK+GIqyVpo5XA vfkxiCX/z9FgUGPvhlZuiDSkgySCDPhe4nISyIPTOTTvROyos4wKwhAx11wyckMjqcb5 w7J6ir6aWM0t18cjWLz16y+2jcejqQDA+5MRKEULXy9cgEFSNn2fIKvk5Dacng1EiAqb xEAQ== X-Gm-Message-State: AA+aEWaRVxZrxVrih9e6zQ93pAhzfCu3sPdsmgCF23nG/GeyTK5UiDgR fH6qaDPeWxr+TykRoW7ih22mAQ== X-Google-Smtp-Source: AFSGD/UMJ8pPtIU5vLa2r3TkJVC5NfColD3DTzPvA5gdtMWD8pCL2/4rj9UkRxmGlR6JW8C+PJc8tw== X-Received: by 2002:a5d:8b8d:: with SMTP id p13mr16027638iol.223.1543288376162; Mon, 26 Nov 2018 19:12:56 -0800 (PST) Received: from localhost (c-107-2-67-121.hsd1.mn.comcast.net. [107.2.67.121]) by smtp.gmail.com with ESMTPSA id w186sm1149449itb.15.2018.11.26.19.12.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 19:12:55 -0800 (PST) From: Dan Rue To: linux-kernel@vger.kernel.org Cc: Dan Rue , Shuah Khan , Greg Kroah-Hartman , Kees Cook , "Luis R. Rodriguez" , linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option Date: Mon, 26 Nov 2018 21:12:15 -0600 Message-Id: <20181127031218.24419-2-dan.rue@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org> References: <20181127031218.24419-1-dan.rue@linaro.org> 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 Acked-by: Kees Cook diff -Z is used to trim the trailing whitespace when comparing the loaded firmware file with the source firmware file. However, per the comment in the source code, -Z should not be necessary. In testing, the input and output files are identical. Additionally, -Z is not a standard option and is not available in environments such as busybox. When -Z is not supported, diff fails with a usage error, which is suppressed, but then causes read_firmwares() to exit with a false failure message. Signed-off-by: Dan Rue --- tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh index a4320c4b44dc..466cf2f91ba0 100755 --- a/tools/testing/selftests/firmware/fw_filesystem.sh +++ b/tools/testing/selftests/firmware/fw_filesystem.sh @@ -155,11 +155,8 @@ read_firmwares() { for i in $(seq 0 3); do config_set_read_fw_idx $i - # Verify the contents are what we expect. - # -Z required for now -- check for yourself, md5sum - # on $FW and DIR/read_firmware will yield the same. Even - # cmp agrees, so something is off. - if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then + # Verify the contents match + if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then echo "request #$i: firmware was not loaded" >&2 exit 1 fi @@ -171,7 +168,7 @@ read_firmwares_expect_nofile() for i in $(seq 0 3); do config_set_read_fw_idx $i # Ensures contents differ - if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then + if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then echo "request $i: file was not expected to match" >&2 exit 1 fi