Skip to contentSkip to conversation

selftests: efivarfs: remove the test_create_read file if it was exist

PATCH New zhangxiaoxu5 at huawei.com (ZhangXiaoxu) 1 participant 2 messages Mar 19, 2019 – Mar 25, 2019 Kselftest

lore
Share & tools
lore

zhangxiaoxu5 at huawei.com (ZhangXiaoxu)

#0 lore raw

PATCH 1/1 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 at huawei.com>
---
 tools/testing/selftests/efivarfs/efivarfs.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/efivarfs/efivarfs.sh +4 -0
index a47029a..d386610 100755
@@ -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
 }
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 selftests: efivarfs: remove the test_create_read file if it was exist

Quoted 15 lines · ZhangXiaoxu

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 at huawei.com>
---
  tools/testing/selftests/efivarfs/efivarfs.sh | 4 ++++
  1 file changed, 4 insertions(+)
tools/testing/selftests/efivarfs/efivarfs.sh +0 -0
index a47029a..d386610 100755

tools/testing/selftests/efivarfs/efivarfs.sh test_create_empty() · line 86

Quoted 10 lines
tools/testing/selftests/efivarfs/efivarfs.sh +4 -0
@@ -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
  }
 

Thanks for the patch. I will apply it for the next rc

thanks,
-- Shuah