[5/5] zdtm: now tempfs_overmounted will pass so remove crfail

Submitted by Pavel Tikhomirov on Dec. 6, 2017, 1:51 p.m.

Details

Message ID 20171206135121.31835-1-ptikhomirov@virtuozzo.com
State New
Series "mount: make it possible to dump overmounted mount"
Headers show

Commit Message

Pavel Tikhomirov Dec. 6, 2017, 1:51 p.m.
changes in v2:
make test check that file on overmounted tmpfs mount is dumped

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 test/zdtm/static/tempfs_overmounted.c    | 22 ++++++++++++++++++++++
 test/zdtm/static/tempfs_overmounted.desc |  2 +-
 2 files changed, 23 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/tempfs_overmounted.c b/test/zdtm/static/tempfs_overmounted.c
index 56c3d2ed8..c9c1e2dae 100644
--- a/test/zdtm/static/tempfs_overmounted.c
+++ b/test/zdtm/static/tempfs_overmounted.c
@@ -16,6 +16,9 @@  TEST_OPTION(dirname, string, "directory name", 1);
 
 int main(int argc, char **argv)
 {
+	char testfile[PATH_MAX];
+	int fd;
+
 	test_init(argc, argv);
 
 	mkdir(dirname, 0700);
@@ -23,6 +26,15 @@  int main(int argc, char **argv)
 		fail("Can't mount tmpfs");
 		return 1;
 	}
+
+	snprintf(testfile, PATH_MAX, "%s/testfile", dirname);
+	fd = open(testfile, O_CREAT | O_EXCL, 0600);
+	if (fd < 0) {
+		fail("Can't create file");
+		return 1;
+	}
+	close(fd);
+
 	if (mount("none", dirname, "tmpfs", 0, "") < 0) {
 		fail("Can't mount tmpfs");
 		return 1;
@@ -31,6 +43,16 @@  int main(int argc, char **argv)
 	test_daemon();
 	test_waitsig();
 
+	if (umount(dirname)) {
+		fail("Can't umount");
+		return 1;
+	}
+
+	if (access(testfile, F_OK) < 0) {
+		fail("Can't access testfile");
+		return 1;
+	}
+
 	pass();
 	return 0;
 }
diff --git a/test/zdtm/static/tempfs_overmounted.desc b/test/zdtm/static/tempfs_overmounted.desc
index 0d8b7f2b4..7657ba45c 100644
--- a/test/zdtm/static/tempfs_overmounted.desc
+++ b/test/zdtm/static/tempfs_overmounted.desc
@@ -1 +1 @@ 
-{'flavor': 'ns uns', 'flags': 'suid crfail'}
+{'flavor': 'ns uns', 'flags': 'suid'}

Comments

Andrei Vagin Dec. 7, 2017, 5:41 a.m.
Did you check my patch from a previous comment? Does it work now?

On Wed, Dec 06, 2017 at 04:51:21PM +0300, Pavel Tikhomirov wrote:
> changes in v2:
> make test check that file on overmounted tmpfs mount is dumped
> 
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> ---
>  test/zdtm/static/tempfs_overmounted.c    | 22 ++++++++++++++++++++++
>  test/zdtm/static/tempfs_overmounted.desc |  2 +-
>  2 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm/static/tempfs_overmounted.c b/test/zdtm/static/tempfs_overmounted.c
> index 56c3d2ed8..c9c1e2dae 100644
> --- a/test/zdtm/static/tempfs_overmounted.c
> +++ b/test/zdtm/static/tempfs_overmounted.c
> @@ -16,6 +16,9 @@ TEST_OPTION(dirname, string, "directory name", 1);
>  
>  int main(int argc, char **argv)
>  {
> +	char testfile[PATH_MAX];
> +	int fd;
> +
>  	test_init(argc, argv);
>  
>  	mkdir(dirname, 0700);
> @@ -23,6 +26,15 @@ int main(int argc, char **argv)
>  		fail("Can't mount tmpfs");
>  		return 1;
>  	}
> +
> +	snprintf(testfile, PATH_MAX, "%s/testfile", dirname);
> +	fd = open(testfile, O_CREAT | O_EXCL, 0600);
> +	if (fd < 0) {
> +		fail("Can't create file");
> +		return 1;
> +	}
> +	close(fd);
> +
>  	if (mount("none", dirname, "tmpfs", 0, "") < 0) {
>  		fail("Can't mount tmpfs");
>  		return 1;
> @@ -31,6 +43,16 @@ int main(int argc, char **argv)
>  	test_daemon();
>  	test_waitsig();
>  
> +	if (umount(dirname)) {
> +		fail("Can't umount");
> +		return 1;
> +	}
> +
> +	if (access(testfile, F_OK) < 0) {
> +		fail("Can't access testfile");
> +		return 1;
> +	}
> +
>  	pass();
>  	return 0;
>  }
> diff --git a/test/zdtm/static/tempfs_overmounted.desc b/test/zdtm/static/tempfs_overmounted.desc
> index 0d8b7f2b4..7657ba45c 100644
> --- a/test/zdtm/static/tempfs_overmounted.desc
> +++ b/test/zdtm/static/tempfs_overmounted.desc
> @@ -1 +1 @@
> -{'flavor': 'ns uns', 'flags': 'suid crfail'}
> +{'flavor': 'ns uns', 'flags': 'suid'}
> -- 
> 2.13.6
>
Pavel Tikhomirov Dec. 7, 2017, 6:28 a.m.