annotate tests/lsattr.test @ 1499:319e79bab052 draft

Separate more commands so single.sh can build them standalone.
author Rob Landley <rob@landley.net>
date Fri, 26 Sep 2014 18:42:23 -0500
parents 8700cbe1cb29
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1377
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
1 #!/bin/bash
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
2
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
3 [ -f testing.sh ] && . testing.sh
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
4
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
5 #testing "name" "command" "result" "infile" "stdin"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
6
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
7 # chattr - Testcases
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
8
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
9 mkdir testattr
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
10 IN="cd testattr"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
11 OUT="cd .."
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
12 _t="abcdefghijklmnopqrstuvwxyz"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
13
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
14 testing "chattr [-/+]i FILE[write]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
15 chattr +i testFile && lsattr testFile && echo "$_t" > testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
16 chattr -i testFile; rm -rf testFile; $OUT " "----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
17 testing "chattr [-/+]i FILE[re-write]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
18 chattr +i testFile && echo \"$_t\" > testFile || chattr -i testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
19 echo \"$_t\" > testFile && lsattr testFile; rm -rf testFile; $OUT" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
20 "------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
21 testing "chattr [-/+]i FILE[append]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
22 chattr +i testFile && echo \"$_t\" >> testFile || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
23 chattr -i testFile; rm -rf testFile; $OUT" "----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
24 testing "chattr [-/+]i FILE[move]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
25 chattr +i testFile && mv testFile testFile1 || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
26 chattr -i testFile; rm -rf testFile; $OUT" "----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
27 testing "chattr [-/+]i FILE[delete]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
28 chattr +i testFile && rm -f testFile || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
29 chattr -i testFile; rm -rf testFile; $OUT" "----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
30 testing "chattr [-/+]i FILE[read]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
31 chattr +i testFile && cat testFile && lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
32 chattr -i testFile; rm -rf testFile; $OUT" "$_t\n----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
33 testing "chattr [-/+]a FILE[write]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
34 chattr +a testFile && echo $_t > testFile || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
35 chattr -a testFile; rm -rf testFile; $OUT" "-----a------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
36 testing "chattr [-/+]a FILE[re-write]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
37 chattr +a testFile && echo $_t > testFile || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
38 chattr -a testFile && echo $_t > testFile && cat testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
39 lsattr testFile; rm -rf testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
40 $OUT" "-----a------- testFile\n$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
41 testing "chattr [-/+]a FILE[append]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
42 chattr +a testFile && echo $_t >> testFile && cat testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
43 lsattr testFile && chattr -a testFile; rm -rf testFile; $OUT" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
44 "$_t\n$_t\n-----a------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
45 testing "chattr [-/+]a FILE[move]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
46 chattr +a testFile && mv testFile testFile1 || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
47 chattr -a testFile; rm -rf testFile; $OUT" "-----a------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
48 testing "chattr [-/+]a FILE[delete]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
49 chattr +a testFile && rm -f testFile || lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
50 chattr -a testFile; rm -rf testFile; $OUT" "-----a------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
51 testing "chattr [-/+]a FILE[read]" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
52 chattr +a testFile && cat testFile && lsattr testFile && chattr -a testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
53 rm -rf testFile; $OUT" "$_t\n-----a------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
54
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
55 for attr in "A" "a" "c" "D" "d" "i" "j" "s" "S" "t" "T" "u"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
56 do
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
57 testing "chattr [-/+]$attr FILE" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
58 chattr +$attr testFile && cat testFile && chattr -$attr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
59 lsattr testFile; rm -rf testFile; $OUT" "$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
60 done
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
61
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
62 for attr in "A" "a" "c" "D" "d" "i" "j" "s" "S" "t" "T" "u"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
63 do
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
64 testing "chattr -$attr FILE" "$IN && echo "$_t" > testFile && chattr -$attr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
65 cat testFile && lsattr testFile; rm -rf testFile; $OUT" "$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
66 done
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
67
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
68 testing "chattr [-/+]AacDdijsStTu FILE" "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
69 chattr +AacDdijsStTu testFile && cat testFile && chattr -AacDdijsStTu testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
70 lsattr testFile; rm -rf testFile; $OUT" "$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
71 testing "chattr [-/+]AacDdijsStTu(random) FILE" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
72 "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
73 chattr +AacDdijsStTu testFile && cat testFile && chattr -A testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
74 chattr -a testFile && chattr -c testFile && chattr -D testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
75 chattr -d testFile && chattr -i testFile && chattr -j testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
76 chattr -s testFile && chattr -S testFile && chattr -t testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
77 chattr -T testFile && chattr -u testFile && lsattr testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
78 chattr -AacDdijsStTu testFile; rm -rf testFile; $OUT" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
79 "$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
80 testing "chattr [-/+]AacDdijsStTu FILE*" "$IN &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
81 echo "$_t" > testFile && echo "$_t" > testFile1 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
82 echo "$_t" > testFile2 && echo "$_t" > testFile3 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
83 echo "$_t" > testFile4 && echo "$_t" > testFile5 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
84 echo "$_t" > testFile6 && echo "$_t" > testFile7 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
85 echo "$_t" > testFile8 && echo "$_t" > testFile9 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
86 echo "$_t" > testFile10 && echo "$_t" > testFile11 &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
87 chattr +AacDdijsStTu testFile* &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
88 cat testFile9 && chattr -AacDdijsStTu testFile* && lsattr testFile*; rm -rf testFile*; $OUT" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
89 "$_t\n------------- testFile\n------------- testFile1\n------------- testFile10\n------------- testFile11\n------------- testFile2\n------------- testFile3\n------------- testFile4\n------------- testFile5\n------------- testFile6\n------------- testFile7\n------------- testFile8\n------------- testFile9\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
90 testing "chattr [-/+]AacDdijsStTu(random) FILE*" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
91 "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
92 chattr +AacDdijsStTu testFile* && cat testFile && chattr -A testFile* &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
93 chattr -a testFile* && chattr -c testFile* && chattr -D testFile* &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
94 chattr -d testFile* && chattr -i testFile* && chattr -j testFile* &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
95 chattr -s testFile* && chattr -S testFile* && chattr -t testFile* &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
96 chattr -T testFile* && chattr -u testFile* && lsattr testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
97 rm -rf testFile; $OUT" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
98 "$_t\n------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
99 testing "chattr [-/+]i FILE[write]" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
100 "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
101 chattr +i testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
102 echo \"$_t\" > testFile || lsattr testFile && chattr -i testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
103 rm -rf testFile; $OUT" "----i-------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
104 testing "chattr [-/+]A FILE[write]" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
105 "$IN && echo "$_t" > testFile && chattr +A testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
106 echo \"$_t\" > testFile && lsattr testFile && chattr -A testFile;
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
107 rm -rf testFile; $OUT" "-------A----- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
108 testing "chattr [-/+]s FILE[write]" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
109 "$IN && echo "$_t" > testFile && chattr +s testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
110 echo \"$_t\" > testFile && lsattr testFile && chattr -s testFile
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
111 rm -rf testFile; $OUT" "s------------ testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
112 testing "chattr -v version FILE[write]" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
113 "$IN && echo "$_t" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
114 chattr -v 1234 testFile && echo \"$_t\" > testFile &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
115 lsattr -v testFile; rm -rf testFile" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
116 " 1234 ------------- testFile\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
117
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
118 _a="-------A-----"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
119 testing "chattr -R [-/+]a FILE" "$IN && touch aa && chattr -R +A aa && lsattr aa &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
120 chattr -R -A aa; rm -rf aa; $OUT" "$_a aa\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
121 testing "chattr -R [-/+]a FILE.." "$IN && touch aa bb &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
122 chattr -R +A aa bb && lsattr aa bb &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
123 chattr -R -A aa bb; rm -rf aa bb; $OUT" "$_a aa\n$_a bb\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
124
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
125 # Clean up
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
126 rm -rf testattr
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
127
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
128 # lsattr - Testcases
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
129 mkdir dir && cd dir && touch file
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
130 chattr +A file &>/dev/null
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
131
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
132 _p=$PWD
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
133 _b="-------------"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
134 _A="-------A-----"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
135
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
136 testing "lsattr file" "lsattr file" "$_A file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
137 testing "lsattr file_path" "lsattr $_p/file" "$_A $_p/file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
138 testing "lsattr -R file" "lsattr -R file" "$_A file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
139 testing "lsattr -R file_path" "lsattr -R $_p/file" "$_A $_p/file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
140 testing "lsattr -a file" "lsattr -a file" "$_A file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
141 testing "lsattr -a file_path" "lsattr -a $_p/file" "$_A $_p/file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
142 testing "lsattr -d ." "lsattr -d ." "$_b .\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
143 testing "lsattr -d dir_path" "lsattr -d $_p" "$_b $_p\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
144 testing "lsattr -d file" "lsattr -d file" "$_A file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
145 testing "lsattr -d file_path" "lsattr -d $_p/file" "$_A $_p/file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
146 sp_44=" "
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
147 testing "lsattr -l file" "lsattr -l file" "file $sp_44 No_Atime\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
148 _v="12345"
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
149 testing "lsattr -v file" "chattr -v $_v * && lsattr -v file" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
150 "$_v $_A file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
151 testing "lsattr -v file_path" "chattr -v $_v * && lsattr -v $_p/file" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
152 "$_v $_A $_p/file\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
153 testing "lsattr -Radlv file1 file2" "chattr -v $_v * &&
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
154 lsattr -Radlv file input" \
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
155 "$_v file $sp_44 No_Atime\n$_v input $sp_44 ---\n" "" ""
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
156
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
157 # Cleanup
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
158 chattr -AacDdijsStTu file && cd ..
7a2aec0876fe I have developed few testsuites for toybox commands -
Divya Kothari <divya.s.kothari@gmail.com>
parents:
diff changeset
159 rm -rf dir