All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: shuah@kernel.org, "Cristian Marussi" <cristian.marussi@arm.com>,
	"Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
Subject: [PATCH 1/5] selftests: skip mincore.check_file_mmap when fs lacks needed support
Date: Wed, 26 Jan 2022 10:27:19 +0000	[thread overview]
Message-ID: <20220126102723.23300-2-cristian.marussi@arm.com> (raw)
In-Reply-To: <20220126102723.23300-1-cristian.marussi@arm.com>

Report mincore.check_file_mmap as SKIP instead of FAIL if the underlying
filesystem lacks support of O_TMPFILE or fallocate since such failures
are not really related to mincore functionality.

Cc: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
This can happen especially on test-automation systems where rootfs can
be configured as being on NFS or virtual disks.
---
 .../selftests/mincore/mincore_selftest.c      | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/mincore/mincore_selftest.c b/tools/testing/selftests/mincore/mincore_selftest.c
index e54106643337..4c88238fc8f0 100644
--- a/tools/testing/selftests/mincore/mincore_selftest.c
+++ b/tools/testing/selftests/mincore/mincore_selftest.c
@@ -207,15 +207,21 @@ TEST(check_file_mmap)
 
 	errno = 0;
 	fd = open(".", O_TMPFILE | O_RDWR, 0600);
-	ASSERT_NE(-1, fd) {
-		TH_LOG("Can't create temporary file: %s",
-			strerror(errno));
+	if (fd < 0) {
+		ASSERT_EQ(errno, EOPNOTSUPP) {
+			TH_LOG("Can't create temporary file: %s",
+			       strerror(errno));
+		}
+		SKIP(goto out_free, "O_TMPFILE not supported by filesystem.");
 	}
 	errno = 0;
 	retval = fallocate(fd, 0, 0, FILE_SIZE);
-	ASSERT_EQ(0, retval) {
-		TH_LOG("Error allocating space for the temporary file: %s",
-			strerror(errno));
+	if (retval) {
+		ASSERT_EQ(errno, EOPNOTSUPP) {
+			TH_LOG("Error allocating space for the temporary file: %s",
+			       strerror(errno));
+		}
+		SKIP(goto out_close, "fallocate not supported by filesystem.");
 	}
 
 	/*
@@ -271,7 +277,9 @@ TEST(check_file_mmap)
 	}
 
 	munmap(addr, FILE_SIZE);
+out_close:
 	close(fd);
+out_free:
 	free(vec);
 }
 
-- 
2.17.1


  reply	other threads:[~2022-01-26 10:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 10:27 [PATCH 0/5] Miscellaneous trivial fixes Cristian Marussi
2022-01-26 10:27 ` Cristian Marussi [this message]
2022-01-27 23:23   ` [PATCH 1/5] selftests: skip mincore.check_file_mmap when fs lacks needed support Shuah Khan
2022-01-26 10:27 ` [PATCH 2/5] kselftest: Fix vdso_test_time to pass on skips Cristian Marussi
2022-01-26 12:22   ` Vincenzo Frascino
2022-01-26 12:34     ` Cristian Marussi
2022-01-26 15:26       ` Vincenzo Frascino
2022-01-26 12:26   ` [PATCH] kselftest: Fix vdso_test_abi return status Vincenzo Frascino
2022-01-27 23:18     ` Shuah Khan
2022-01-28 11:09       ` Vincenzo Frascino
2022-01-27 23:02   ` [PATCH 2/5] kselftest: Fix vdso_test_time to pass on skips Shuah Khan
2022-01-26 10:27 ` [PATCH 3/5] selftests: openat2: Print also errno in failure messages Cristian Marussi
2022-01-27 23:11   ` Shuah Khan
2022-01-26 10:27 ` [PATCH 4/5] selftests: openat2: Add missing dependency in Makefile Cristian Marussi
2022-01-27 23:12   ` Shuah Khan
2022-01-26 10:27 ` [PATCH 5/5] selftests: openat2: Skip testcases that fail with EOPNOTSUPP Cristian Marussi
2022-01-27 23:13   ` Shuah Khan
2022-01-27 23:05 ` [PATCH 0/5] Miscellaneous trivial fixes Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220126102723.23300-2-cristian.marussi@arm.com \
    --to=cristian.marussi@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=ricardo.canuelo@collabora.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.