diff mbox series

[mtd-utils] fs-tests: integck: Allow checking root

Message ID 20240808123149.2667334-1-csokas.bence@prolan.hu
State New
Headers show
Series [mtd-utils] fs-tests: integck: Allow checking root | expand

Commit Message

Csókás Bence Aug. 8, 2024, 12:31 p.m. UTC
Trailing slash removal creates an empty string
from '/', making it impossible to check the
root filesystem.

Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
---
 tests/fs-tests/integrity/integck.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Zhihao Cheng Aug. 8, 2024, 1:32 p.m. UTC | #1
在 2024/8/8 20:31, Csókás, Bence 写道:
> Trailing slash removal creates an empty string
> from '/', making it impossible to check the
> root filesystem.
> 

It will bring a new failed assertion 'CHECK(umount(fsinfo.mount_point) 
!= -1)' in recover_tested_fs(), following is the log:

integck: pid 3387, testing "ext4" at "/"
integck: error!: condition 'umount(fsinfo.mount_point) != -1' failed in 
recover_tested_fs() at tests/fs-tests/integrity/integck.c:3212
integck: error 16 (Device or resource busy)

> Signed-off-by: Csókás, Bence <csokas.bence@prolan.hu>
> ---
>   tests/fs-tests/integrity/integck.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
> index 0a7f142..b7cedc2 100644
> --- a/tests/fs-tests/integrity/integck.c
> +++ b/tests/fs-tests/integrity/integck.c
> @@ -2946,9 +2946,11 @@ static void get_tested_fs_info(void)
>   	/* Remove trailing '/' symbols from the mount point */
>   	p = dup_string(args.mount_point);
>   	fsinfo.mount_point = p;
> -	p += strlen(p);
> -	while (*--p == '/');
> -	*(p + 1) = '\0';
> +	if (strlen(p) > 1) {
> +		p += strlen(p);
> +		while (*--p == '/');
> +		*(p + 1) = '\0';
> +	}
>   
>   	CHECK(statfs(fsinfo.mount_point, &fs_info) == 0);
>   	fsinfo.max_name_len = fs_info.f_namelen;
>
diff mbox series

Patch

diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 0a7f142..b7cedc2 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -2946,9 +2946,11 @@  static void get_tested_fs_info(void)
 	/* Remove trailing '/' symbols from the mount point */
 	p = dup_string(args.mount_point);
 	fsinfo.mount_point = p;
-	p += strlen(p);
-	while (*--p == '/');
-	*(p + 1) = '\0';
+	if (strlen(p) > 1) {
+		p += strlen(p);
+		while (*--p == '/');
+		*(p + 1) = '\0';
+	}
 
 	CHECK(statfs(fsinfo.mount_point, &fs_info) == 0);
 	fsinfo.max_name_len = fs_info.f_namelen;