The tests now pass on all the systems available to me (cloud Android
with encrypted f2fs, current AOSP with regular f2fs, and current Debian
testing with ext4).
---
 tests/chattr.test |  8 ++++----
 tests/lsattr.test | 13 +++++++++----
 2 files changed, 13 insertions(+), 8 deletions(-)
From 407a362a359b9bb0b1d02cd8b43fc0614c6cea92 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Sat, 1 Feb 2020 17:17:28 -0800
Subject: [PATCH] chattr.test/lsattr.test: fix on more kernels/fses.

The tests now pass on all the systems available to me (cloud Android
with encrypted f2fs, current AOSP with regular f2fs, and current Debian
testing with ext4).
---
 tests/chattr.test |  8 ++++----
 tests/lsattr.test | 13 +++++++++----
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/tests/chattr.test b/tests/chattr.test
index e3d8d547..2e580cfb 100755
--- a/tests/chattr.test
+++ b/tests/chattr.test
@@ -13,12 +13,12 @@ fi
 function clean()
 {
   # We don't know whether the fs will have extents (e, typically true on the
-  # desktop) or be encrypted (E, typically true on Android), so strip out both
-  # the long and short forms of those.
+  # desktop) or be encrypted (E, typically true on Android), or have data
+  # inlined in the inode (N), or use indexed directories, so strip those out.
   # We also don't want to rely on chattr(1) to set a known version number or
   # project number, so blank out any numbers.
-  sed 's/, Encrypted//; s/-E-/---/; s/, Extents//; s/-e-/---/' | \
-  sed -E 's/[0-9]+/_/g'
+  sed -E 's/, (Encrypted|Extents|Indexed_directory|Inline_Data)//g;' |
+    sed -E 's/[EeIN]-/--/g; s/[0-9]+/_/g'
 }
 
 mkdir testattr
diff --git a/tests/lsattr.test b/tests/lsattr.test
index b31d6d85..cadbe920 100644
--- a/tests/lsattr.test
+++ b/tests/lsattr.test
@@ -13,12 +13,12 @@ _d='--------------------'
 function clean()
 {
   # We don't know whether the fs will have extents (e, typically true on the
-  # desktop) or be encrypted (E, typically true on Android), so strip out both
-  # the long and short forms of those.
+  # desktop) or be encrypted (E, typically true on Android), or have data
+  # inlined in the inode (N), or use indexed directories, so strip those out.
   # We also don't want to rely on chattr(1) to set a known version number or
   # project number, so blank out any numbers.
-  sed 's/, Encrypted//; s/-E-/---/; s/, Extents//; s/-e-/---/' | \
-  sed -E 's/[0-9]+/_/g'
+  sed -E 's/, (Encrypted|Extents|Indexed_directory|Inline_Data)//g;' |
+    sed -E 's/[EeIN]-/--/g; s/[0-9]+/_/g'
 }
 
 testing "file" "lsattr file | clean" "$_A file\n" "" ""
@@ -29,8 +29,13 @@ testing "-d file" "lsattr -d file | clean" "$_A file\n" "" ""
 NOSPACE=1 testing "-l file" "lsattr -l file | clean" "file No_Atime\n" "" ""
 NOSPACE=1 testing "-v file" "lsattr -v file | clean" "_ $_A file\n" "" ""
 NOSPACE=1 testing "-lv file" "lsattr -lv file | clean" "_ file No_Atime\n" "" ""
+
+# You need at least Linux 4.5 plus file system support for project ids.
+lsattr -p file >/dev/null 2>&1 || SKIPNEXT=1
 NOSPACE=1 testing "-p file" "lsattr -p file | clean" "_ $_A file\n" "" ""
+lsattr -p file >/dev/null 2>&1 || SKIPNEXT=1
 NOSPACE=1 testing "-lp file" "lsattr -lp file | clean" "_ file No_Atime\n" "" ""
+lsattr -p file >/dev/null 2>&1 || SKIPNEXT=1
 NOSPACE=1 testing "-vp file" "lsattr -vp file | clean" "_ _ $_A file\n" "" ""
 
 chattr -AacDdijsStTu file && cd ..
-- 
2.25.0.341.g760bfbb309-goog

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

Reply via email to