From aa42b3dbcb0326badf377fec2c7fb2f34fdabecd Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 21 Aug 2018 12:56:53 +0200 Subject: Avoid running some tests if the file system does not support holes Otherwise, these tests fills up the entire disk (or just run very slowly and eventually time out). --- io/test-lfs.c | 3 +++ io/tst-copy_file_range.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'io') diff --git a/io/test-lfs.c b/io/test-lfs.c index f7721a5..52120e9 100644 --- a/io/test-lfs.c +++ b/io/test-lfs.c @@ -25,6 +25,7 @@ #include #include #include +#include /* Prototype for our test function. */ extern void do_prepare (int argc, char *argv[]); @@ -70,6 +71,8 @@ do_prepare (int argc, char *argv[]) else error (EXIT_FAILURE, errno, "cannot create temporary file"); } + if (!support_descriptor_supports_holes (fd)) + FAIL_UNSUPPORTED ("File %s does not support holes", name); add_temp_file (name); if (getrlimit64 (RLIMIT_FSIZE, &rlim) != 0) diff --git a/io/tst-copy_file_range.c b/io/tst-copy_file_range.c index 3d531a1..e5b46f9 100644 --- a/io/tst-copy_file_range.c +++ b/io/tst-copy_file_range.c @@ -739,7 +739,12 @@ do_test (void) *p = rand () >> 24; infd = create_temp_file ("tst-copy_file_range-in-", &infile); - xclose (create_temp_file ("tst-copy_file_range-out-", &outfile)); + { + int outfd = create_temp_file ("tst-copy_file_range-out-", &outfile); + if (!support_descriptor_supports_holes (outfd)) + FAIL_UNSUPPORTED ("File %s does not support holes", outfile); + xclose (outfd); + } /* Try to find a different directory from the default input/output file. */ -- cgit v1.1