Weaken the test slightly so that the extra 4KiB used for SELinux is
ignored.

Unfortunately all the du tests suffer the same problem, and I'm less
sure what to do there. Mounting a read-only file system without the
extended attributes might be the best idea? But since this test modifies
the file system...
---
 tests/truncate.test | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
From 9e3fb7d0dc82c77f5a49b1380382b87109a74c39 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Fri, 26 Jul 2019 11:05:25 -0700
Subject: [PATCH] truncate.test: work around ext extended attributes space
 usage.

Weaken the test slightly so that the extra 4KiB used for SELinux is
ignored.

Unfortunately all the du tests suffer the same problem, and I'm less
sure what to do there. Mounting a read-only file system without the
extended attributes might be the best idea? But since this test modifies
the file system...
---
 tests/truncate.test | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/truncate.test b/tests/truncate.test
index 1d19aa1b..253af626 100755
--- a/tests/truncate.test
+++ b/tests/truncate.test
@@ -8,8 +8,11 @@ SIZE='&& stat -c %s freep'
 testing "0" "truncate -s 0 freep $SIZE" "0\n" "" ""
 testing "12345" "truncate -s 12345 freep $SIZE" "12345\n" "" ""
 testing "1m" "truncate -s 1m freep $SIZE" "1048576\n" "" ""
-testing "is sparse" "truncate -s 1g freep && stat -c %b freep" \
-	"0\n" "" ""
+# We can't test against 0 because Android filesystems use an extra 4KiB for
+# extended attributes (SELinux).
+testing "is sparse" "truncate -s 1g freep && [ $(stat -c %b freep) -le 8 ] &&
+  echo okay" \
+	"okay\n" "" ""
 testing "+" "truncate -s 1k freep && truncate -s +1k freep $SIZE" \
 	"2048\n" "" ""
 testing "-" "truncate -s 4k freep && truncate -s -1k freep $SIZE" \
-- 
2.22.0.709.g102302147b-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to