Changeset 68 for trunk/test/testrun_1.sh
- Timestamp:
- Oct 30, 2006, 12:03:44 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/testrun_1.sh
r51 r68 41 41 testrun1_setup=0 42 42 43 MAXTEST=1 1; export MAXTEST43 MAXTEST=13; export MAXTEST 44 44 45 45 test_dirs () { … … 70 70 # combine file check schedule with one-shot mode 71 71 # 72 TESTPOLICY_1 1="72 TESTPOLICY_13=" 73 73 [ReadOnly] 74 74 dir=99${BASE} 75 75 " 76 76 77 mod_testdata_1 1() {77 mod_testdata_13 () { 78 78 one_sec_sleep 79 79 echo "foobar" >"${BASE}/c/x"; # bad … … 87 87 } 88 88 89 chk_testdata_1 1() {89 chk_testdata_13 () { 90 90 # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 91 91 tmp=`grep CRIT $LOGFILE | wc -l` … … 110 110 } 111 111 112 TESTPOLICY_1 0="112 TESTPOLICY_12=" 113 113 [ReadOnly] 114 114 dir=99${BASE} … … 119 119 " 120 120 121 mod_testdata_1 0() {121 mod_testdata_12 () { 122 122 one_sec_sleep 123 123 echo "foobar" >"${BASE}/b/x"; # ok … … 129 129 } 130 130 131 chk_testdata_12 () { 132 # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 133 tmp=`grep CRIT $LOGFILE | wc -l` 134 if [ $tmp -ne 3 ]; then 135 [ -z "$verbose" ] || log_msg_fail "policy count"; 136 return 1 137 fi 138 egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1 139 if [ $? -ne 0 ]; then 140 [ -z "$verbose" ] || log_msg_fail "${BASE}/c/x"; 141 return 1 142 fi 143 egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/a/x" $LOGFILE >/dev/null 2>&1 144 if [ $? -ne 0 ]; then 145 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/a/x"; 146 return 1 147 fi 148 egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/y" $LOGFILE >/dev/null 2>&1 149 if [ $? -ne 0 ]; then 150 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/y"; 151 return 1 152 fi 153 CDIRS="a a/a a/b a/c c"; 154 NDIRS="b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 155 test_dirs; 156 return $? 157 } 158 159 # 160 # --- ACL/SELinux test case 161 # 162 TESTPOLICY_11=" 163 [ReadOnly] 164 dir=99${BASE} 165 [IgnoreAll] 166 dir=-1${BASE}/b 167 [Attributes] 168 dir=1${BASE}/a 169 [Misc] 170 UseSelinuxCheck = no 171 UseAclCheck = no 172 " 173 174 mod_testdata_11 () { 175 one_sec_sleep 176 setfacl -m 'user:nobody:r--' "${BASE}/b/x"; # ok (ign) 177 setfacl -m 'user:nobody:r--' "${BASE}/c/x"; # bad 178 setfacl -m 'user:nobody:r--' "${BASE}/a/x"; # bad 179 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/b/y"; # ok (ign) 180 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/a/a/x";# ok (depth) 181 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/x"; # bad 182 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/y"; # bad 183 } 184 185 chk_testdata_11 () { 186 # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 187 tmp=`grep CRIT $LOGFILE | wc -l` 188 if [ $tmp -ne 1 ]; then 189 [ -z "$verbose" ] || log_msg_fail "policy count"; 190 return 1 191 fi 192 egrep "CRIT.*POLICY \[ReadOnly\] --------T-.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1 193 if [ $? -ne 0 ]; then 194 [ -z "$verbose" ] || log_msg_fail "${BASE}/c/x"; 195 return 1 196 fi 197 CDIRS="a a/a a/b a/c c"; 198 NDIRS="b a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; 199 test_dirs; 200 return $? 201 } 202 203 TESTPOLICY_10=" 204 [ReadOnly] 205 dir=99${BASE} 206 [IgnoreAll] 207 dir=-1${BASE}/b 208 [Attributes] 209 dir=1${BASE}/a 210 " 211 212 mod_testdata_10 () { 213 one_sec_sleep 214 setfacl -m 'user:nobody:r--' "${BASE}/b/x"; # ok (ign) 215 setfacl -m 'user:nobody:r--' "${BASE}/c/x"; # bad 216 setfacl -m 'user:nobody:r--' "${BASE}/a/x"; # bad 217 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/b/y"; # ok (ign) 218 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/a/a/x";# ok (depth) 219 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/x"; # bad 220 setfattr -n 'security.selinux' -v "system_u:object_r:etc_t\000" "${BASE}/a/y"; # bad 221 } 222 131 223 chk_testdata_10 () { 132 224 # CDIRS="a b c a/a a/b a/c a/a/a a/a/b a/a/c a/a/a/a a/a/a/b a/a/a/c"; … … 136 228 return 1 137 229 fi 138 egrep "CRIT.*POLICY \[ReadOnly\] C-------TS.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1230 egrep "CRIT.*POLICY \[ReadOnly\] -----M--T-.*${BASE}/c/x" $LOGFILE >/dev/null 2>&1 139 231 if [ $? -ne 0 ]; then 140 232 [ -z "$verbose" ] || log_msg_fail "${BASE}/c/x"; 141 233 return 1 142 234 fi 143 egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/ a/x" $LOGFILE >/dev/null 2>&1144 if [ $? -ne 0 ]; then 145 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/ a/x";235 egrep "CRIT.*POLICY \[Attributes\] -----M----.*${BASE}/a/x" $LOGFILE >/dev/null 2>&1 236 if [ $? -ne 0 ]; then 237 [ -z "$verbose" ] || log_msg_fail "${BASE}/a/x"; 146 238 return 1 147 239 fi … … 825 917 run_check () 826 918 { 827 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind828 919 ${VALGRIND} ./samhain -t check -p none -l debug 2>>test_log_valgrind 920 829 921 if test x$? = x0; then 922 830 923 ./samhain -j -L $LOGFILE >"${LOGFILE}.tmp" && mv "${LOGFILE}.tmp" "${LOGFILE}" 924 831 925 if [ $? -ne 0 ]; then 832 926 [ -z "$quiet" ] && log_msg_fail "mv logfile..."; … … 927 1021 { 928 1022 if [ $1 -ne 0 ]; then 929 [ -z "$quiet" ] &&log_fail ${2} ${MAXTEST};1023 log_fail ${2} ${MAXTEST}; 930 1024 return 1 931 1025 fi … … 1012 1106 [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST}; 1013 1107 fi 1108 # 1014 1109 let "tcount = tcount + 1" >/dev/null 1110 # 1111 if [ -z "$doall" -a $tcount -eq 10 ]; then 1112 log_skip 10 $MAXTEST 'ACL/SELinux test (or use --really-all)' 1113 let "tcount = tcount + 1" >/dev/null 1114 fi 1115 # 1116 if [ -z "$doall" -a $tcount -eq 11 ]; then 1117 log_skip 11 $MAXTEST 'ACL/SELinux test (or use --really-all)' 1118 let "tcount = tcount + 1" >/dev/null 1119 fi 1120 # 1015 1121 POLICY=`eval echo '"$'"TESTPOLICY_$tcount"'"'` 1016 1122 done
Note:
See TracChangeset
for help on using the changeset viewer.