aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-02-01 17:17:28 -0800
committerRob Landley <rob@landley.net>2020-02-01 22:37:36 -0600
commit49912d6f47311d087ce007129a945e48199bfbac (patch)
treef4539c3e31240e6788de52af2c93aacc8410dda5
parentae626295bad3e20a9c457f5f616cd92299f5258c (diff)
downloadtoybox-49912d6f47311d087ce007129a945e48199bfbac.tar.gz
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).
-rwxr-xr-xtests/chattr.test8
-rw-r--r--tests/lsattr.test13
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 ..