summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/efivarfs/efivarfs.sh
diff options
context:
space:
mode:
authorZhangXiaoxu <zhangxiaoxu5@huawei.com>2019-03-19 06:24:31 +0300
committerShuah Khan <shuah@kernel.org>2019-04-09 01:44:21 +0300
commitf8a0590f0e01402873ec28a0da46f979f6bc56f1 (patch)
treed4346be7aeb80812f504c84e85d2b16eb89aad10 /tools/testing/selftests/efivarfs/efivarfs.sh
parent0a7dc82ef2ed7f4c244fe55b59ea05909a408108 (diff)
downloadlinux-f8a0590f0e01402873ec28a0da46f979f6bc56f1.tar.xz
selftests: efivarfs: remove the test_create_read file if it was exist
After the first run, the test case 'test_create_read' will always fail because the file is exist and file's attr is 'S_IMMUTABLE', open with 'O_RDWR' will always return -EPERM. Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com> Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests/efivarfs/efivarfs.sh')
-rwxr-xr-xtools/testing/selftests/efivarfs/efivarfs.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh
index a47029a799d2..d3866100e884 100755
--- a/tools/testing/selftests/efivarfs/efivarfs.sh
+++ b/tools/testing/selftests/efivarfs/efivarfs.sh
@@ -77,6 +77,10 @@ test_create_empty()
test_create_read()
{
local file=$efivarfs_mount/$FUNCNAME-$test_guid
+ if [ -f $file]; then
+ chattr -i $file
+ rm -rf $file
+ fi
./create-read $file
}