diff mbox series

[08/11] vfs: Export test_setup() and test_cleanup()

Message ID 20230307114507.332309-9-rodrigo@sdfg.com.ar (mailing list archive)
State New, archived
Headers show
Series Tests for idmapped tmpfs | expand

Commit Message

Rodrigo Campos March 7, 2023, 11:45 a.m. UTC
Future patches will call existing test inside another test, so we need
to properly setup the test environment.

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
---
 src/vfs/vfstest.c |  4 ++--
 src/vfs/vfstest.h | 10 ++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)
 create mode 100644 src/vfs/vfstest.h

Comments

Christian Brauner March 7, 2023, 4:51 p.m. UTC | #1
On Tue, Mar 07, 2023 at 12:45:04PM +0100, Rodrigo Campos wrote:
> Future patches will call existing test inside another test, so we need
> to properly setup the test environment.
> 
> Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
> ---
>  src/vfs/vfstest.c |  4 ++--
>  src/vfs/vfstest.h | 10 ++++++++++
>  2 files changed, 12 insertions(+), 2 deletions(-)
>  create mode 100644 src/vfs/vfstest.h
> 
> diff --git src/vfs/vfstest.c src/vfs/vfstest.c
> index 3ec65dff..9e15ad9a 100644
> --- src/vfs/vfstest.c
> +++ src/vfs/vfstest.c
> @@ -81,7 +81,7 @@ static void stash_overflowgid(struct vfstest_info *info)
>  	info->t_overflowgid = atoi(buf);
>  }
>  
> -static void test_setup(struct vfstest_info *info)
> +void test_setup(struct vfstest_info *info)
>  {
>  	if (mkdirat(info->t_mnt_fd, T_DIR1, 0777))
>  		die("failure: mkdirat");
> @@ -94,7 +94,7 @@ static void test_setup(struct vfstest_info *info)
>  		die("failure: fchmod");
>  }
>  
> -static void test_cleanup(struct vfstest_info *info)
> +void test_cleanup(struct vfstest_info *info)
>  {
>  	safe_close(info->t_dir1_fd);
>  	if (rm_r(info->t_mnt_fd, T_DIR1))
> diff --git src/vfs/vfstest.h src/vfs/vfstest.h
> new file mode 100644
> index 00000000..352b57d5
> --- /dev/null
> +++ src/vfs/vfstest.h
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef __VFSTEST_H
> +#define __VFSTEST_H
> +
> +void test_setup(struct vfstest_info *info);
> +void test_cleanup(struct vfstest_info *info);
> +
> +
> +#endif /* __IDMAPPED_MOUNTS_H */


s/__IDMAPPED_MOUNTS_H/__VFSTEST_H/ ?
Rodrigo Campos March 7, 2023, 5:11 p.m. UTC | #2
On 3/7/23 17:51, Christian Brauner wrote:
> On Tue, Mar 07, 2023 at 12:45:04PM +0100, Rodrigo Campos wrote:
>> +#endif /* __IDMAPPED_MOUNTS_H */
> 
> 
> s/__IDMAPPED_MOUNTS_H/__VFSTEST_H/ ?

Ouch, yes, thanks!
diff mbox series

Patch

diff --git src/vfs/vfstest.c src/vfs/vfstest.c
index 3ec65dff..9e15ad9a 100644
--- src/vfs/vfstest.c
+++ src/vfs/vfstest.c
@@ -81,7 +81,7 @@  static void stash_overflowgid(struct vfstest_info *info)
 	info->t_overflowgid = atoi(buf);
 }
 
-static void test_setup(struct vfstest_info *info)
+void test_setup(struct vfstest_info *info)
 {
 	if (mkdirat(info->t_mnt_fd, T_DIR1, 0777))
 		die("failure: mkdirat");
@@ -94,7 +94,7 @@  static void test_setup(struct vfstest_info *info)
 		die("failure: fchmod");
 }
 
-static void test_cleanup(struct vfstest_info *info)
+void test_cleanup(struct vfstest_info *info)
 {
 	safe_close(info->t_dir1_fd);
 	if (rm_r(info->t_mnt_fd, T_DIR1))
diff --git src/vfs/vfstest.h src/vfs/vfstest.h
new file mode 100644
index 00000000..352b57d5
--- /dev/null
+++ src/vfs/vfstest.h
@@ -0,0 +1,10 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __VFSTEST_H
+#define __VFSTEST_H
+
+void test_setup(struct vfstest_info *info);
+void test_cleanup(struct vfstest_info *info);
+
+
+#endif /* __IDMAPPED_MOUNTS_H */