diff mbox series

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

Message ID 1552965871-77209-1-git-send-email-zhangxiaoxu5@huawei.com (mailing list archive)
State Mainlined
Commit f8a0590f0e01402873ec28a0da46f979f6bc56f1
Headers show
Series selftests: efivarfs: remove the test_create_read file if it was exist | expand

Commit Message

Zhang Xiaoxu March 19, 2019, 3:24 a.m. UTC
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>
---
 tools/testing/selftests/efivarfs/efivarfs.sh | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Shuah March 25, 2019, 2:34 p.m. UTC | #1
On 3/18/19 9:24 PM, ZhangXiaoxu wrote:
> 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>
> ---
>   tools/testing/selftests/efivarfs/efivarfs.sh | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh
> index a47029a..d386610 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
>   }
>   
> 

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

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh
index a47029a..d386610 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
 }