blob: b31d6d8593daaaacb29caeed66c1f9d70dab09b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/bash
[ -f testing.sh ] && . testing.sh
#testing "name" "command" "result" "infile" "stdin"
mkdir dir && cd dir && touch file
chattr +A file &>/dev/null
_A='-------A------------'
_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.
# 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'
}
testing "file" "lsattr file | clean" "$_A file\n" "" ""
testing "-R file" "lsattr -R file | clean" "$_A file\n" "" ""
testing "-a file" "lsattr -a file | clean" "$_A file\n" "" ""
testing "-d ." "lsattr -d . | clean" "$_d .\n" "" ""
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" "" ""
NOSPACE=1 testing "-p file" "lsattr -p file | clean" "_ $_A file\n" "" ""
NOSPACE=1 testing "-lp file" "lsattr -lp file | clean" "_ file No_Atime\n" "" ""
NOSPACE=1 testing "-vp file" "lsattr -vp file | clean" "_ _ $_A file\n" "" ""
chattr -AacDdijsStTu file && cd ..
rm -rf dir
|