From patchwork Tue Dec 25 08:59:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Po-Hsu Lin X-Patchwork-Id: 10742557 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 087BD14E2 for ; Tue, 25 Dec 2018 09:01:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3574289E5 for ; Tue, 25 Dec 2018 09:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D613728A73; Tue, 25 Dec 2018 09:01:33 +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 4F13A289E5 for ; Tue, 25 Dec 2018 09:01:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725878AbeLYJBc (ORCPT ); Tue, 25 Dec 2018 04:01:32 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:55773 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbeLYJBc (ORCPT ); Tue, 25 Dec 2018 04:01:32 -0500 Received: from mail-pf1-f198.google.com ([209.85.210.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gbiag-0003XC-F6 for linux-kselftest@vger.kernel.org; Tue, 25 Dec 2018 09:01:30 +0000 Received: by mail-pf1-f198.google.com with SMTP id p15so14651552pfk.7 for ; Tue, 25 Dec 2018 01:01:30 -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:subject:date:message-id; bh=Xo049x0xiIqeDYPyD0QhBX1kSGrXxCvtHAOi6WBWmm0=; b=aY+O0P03TV1rPpdRlp4q581bj0LmOlOwQsLLlrt7Rr3ASQfTTEKmpHnWBjav9/Awha ZgyXwHoIfRuPeTe16SWCm+ZX+Jjuw/R5WfE8NSi41m+BNBIPLnlJWglwjTuc4ZVpojng aylutMqTkbAmYYKUBy8dB0r/Zp1f7rj1MJNm88cT6P06ciOswQUTT6/N5IW0OvBAMwO2 Sx0c7BQEkVfkrXUBWSagnt9J4Y4ItelwohGMK2u+sHW6pqDU5J0igpQuH/V26WlXNMHS NigTTJpQSAceqkdWy7YTAvMtU4HsHQw5xqrOLcQnGdY/+jEyRUfVyGtGZ/ZoaclEiZoV vBpA== X-Gm-Message-State: AJcUukdLt0OQ9j9+9PhIIn3saVzC72YhVNOVdaGuaI2iV7uuF9aXfPbj gfRNoc/AdF3THuX3jlpx1UJ5tyMxwJr8ciF3v6AOQpsrFqr0pFRQQZUU/xxhyABHvy8MuX8KZHE Ro3m5WVmQH7TlCNwxCwAyqgCiFmVoBjW8C5tvrv917chz X-Received: by 2002:a17:902:e20b:: with SMTP id ce11mr15249413plb.251.1545728489094; Tue, 25 Dec 2018 01:01:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN5VVBgJ1D4NFF+WwtYwp6FGXHvu1j8sAJdo6ZELsV7nFTqvt9bTwdr6QjzPw758p+/fCqwSDw== X-Received: by 2002:a17:902:e20b:: with SMTP id ce11mr15249393plb.251.1545728488750; Tue, 25 Dec 2018 01:01:28 -0800 (PST) Received: from Leggiero.taipei.internal (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id s130sm70460103pgc.60.2018.12.25.01.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Dec 2018 01:01:27 -0800 (PST) From: Po-Hsu Lin To: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests/efivarfs: clean up test files from test_create*() Date: Tue, 25 Dec 2018 16:59:45 +0800 Message-Id: <20181225085945.13686-1-po-hsu.lin@canonical.com> X-Mailer: git-send-email 2.17.1 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 Test files created by test_create*() tests will stay in the $efivarfs_mount directory until next reboot. When the tester tries to run this efivarfs test again on the same system, the immutable characteristics in that directory with those previously generated files will cause some "Permission denied" noises and a false-positive test result to the test_create_read() test. Remove those test files in the end of each test to solve this issue. Link: https://bugs.launchpad.net/bugs/1809704 Signed-off-by: Po-Hsu Lin --- tools/testing/selftests/efivarfs/efivarfs.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh index a47029a..ea2e2a0 100755 --- a/tools/testing/selftests/efivarfs/efivarfs.sh +++ b/tools/testing/selftests/efivarfs/efivarfs.sh @@ -60,6 +60,12 @@ test_create() echo "$file has invalid size" >&2 exit 1 fi + + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi } test_create_empty() @@ -72,12 +78,24 @@ test_create_empty() echo "$file can not be created without writing" >&2 exit 1 fi + + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi } test_create_read() { local file=$efivarfs_mount/$FUNCNAME-$test_guid ./create-read $file + + rm $file 2>/dev/null + if [ $? -ne 0 ]; then + chattr -i $file + rm $file + fi } test_delete()