Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Feb 2021 17:06:44 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 39a1f858ad73 - main - du_test: Skip three tests if sparse files are not supported
Message-ID:  <202102031706.113H6i4A097359@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=39a1f858ad735ef816a9b1fb7eeade2c6802eb98

commit 39a1f858ad735ef816a9b1fb7eeade2c6802eb98
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-02-03 16:07:05 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-02-03 17:06:07 +0000

    du_test: Skip three tests if sparse files are not supported
    
    This fixes running the du tests with /tmp as tmpfs (which is what we do in the
    CheriBSD CI).
    
    Obtained from:  CheriBSD
    Reviewed By:    ngie
    Differential Revision: https://reviews.freebsd.org/D28398
---
 usr.bin/du/tests/du_test.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh
index 1c283b58fef4..5106307ad66a 100755
--- a/usr.bin/du/tests/du_test.sh
+++ b/usr.bin/du/tests/du_test.sh
@@ -24,6 +24,17 @@
 #
 # $FreeBSD$
 
+require_sparse_file_support()
+{
+	if ! getconf MIN_HOLE_SIZE "$(pwd)"; then
+		echo "getconf MIN_HOLE_SIZE $(pwd) failed; sparse files " \
+		    "probably not supported by file system"
+		mount
+		atf_skip "Test's work directory does not support sparse files;" \
+		    "try with a different TMPDIR?"
+	fi
+}
+
 atf_test_case A_flag
 A_flag_head()
 {
@@ -31,6 +42,7 @@ A_flag_head()
 }
 A_flag_body()
 {
+	require_sparse_file_support
 	# XXX: compressed volumes?
 	atf_check truncate -s 10g sparse.file
 	atf_check -o inline:'1\tsparse.file\n' du -g sparse.file
@@ -103,6 +115,7 @@ g_flag_head()
 }
 g_flag_body()
 {
+	require_sparse_file_support
 	atf_check truncate -s 1k A
 	atf_check truncate -s 1m B
 	atf_check truncate -s 1g C
@@ -117,6 +130,7 @@ h_flag_head()
 }
 h_flag_body()
 {
+	require_sparse_file_support
 	atf_check truncate -s 1k A
 	atf_check truncate -s 1m B
 	atf_check truncate -s 1g C



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102031706.113H6i4A097359>