1# $OpenBSD: Makefile,v 1.1 2015/06/15 09:23:12 florian Exp $ 2 3REGRESS_TARGETS= chmod_abs_0000 chmod_abs_0644 4REGRESS_TARGETS+= chmod_sym_0644 chmod_sym_0000 5REGRESS_TARGETS+= chmod_R_0755 chmod_RP_0755 chmod_RH_0755 chmod_RL_0755 6REGRESS_TARGETS+= chmod_error 7 8REGRESS_TARGETS+= chgrp_id chgrp_name 9REGRESS_TARGETS+= chgrp_symlink chgrp_h_symlink 10REGRESS_TARGETS+= chgrp_R chgrp_RP chgrp_RH chgrp_RL 11REGRESS_TARGETS+= chgrp_error 12 13REGRESS_TARGETS+= chown_id chown_name 14REGRESS_TARGETS+= chown_symlink chown_h_symlink 15REGRESS_TARGETS+= chown_R chown_RP chown_RH chown_RL 16REGRESS_TARGETS+= chown_error 17 18REGRESS_TARGETS+= chflags chflags_no 19REGRESS_TARGETS+= chflags_R chflags_RP chflags_RH chflags_RL 20REGRESS_TARGETS+= chflags_error 21 22prepfile: clean 23 @/bin/mkdir -p regress 24 @/usr/bin/touch regress/file 25 @/bin/chmod 000 regress/file 26 @[ `/usr/bin/stat -f '%p' regress/file` == '100000' ] 27 28prepdir: clean 29 @/bin/mkdir -p regress/dir 30 @/usr/bin/touch regress/dir/file1 31 @/usr/bin/touch regress/dir/file2 32 @/bin/chmod 000 regress/dir/file1 33 @/bin/chmod 000 regress/dir/file2 34 @/usr/bin/touch regress/link_target_file 35 @/bin/chmod 0600 regress/link_target_file 36 @[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100000' ] 37 @[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100000' ] 38 @ln -s ${.OBJDIR}/regress/link_target_file \ 39 ${.OBJDIR}/regress/dir/linked_file 40 @ln -s ${.OBJDIR}/regress/dir ${.OBJDIR}/regress/linked_dir 41 @/bin/chmod 000 regress/dir 42 @[ `/usr/bin/stat -f '%p' regress/dir` == '40000' ] 43 @[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ] 44 45chown_prepfile: prepfile 46 @[ `id -u` != 0 ] || /sbin/chown root:wheel regress/file 47 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == 'root' ] 48 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \ 49 'wheel' ] 50 51chown_prepsymlink: chown_prepfile 52 @[ `id -u` != 0 ] || ln -s ${.OBJDIR}/regress/file \ 53 ${.OBJDIR}/regress/symlink 54 @[ `id -u` != 0 ] || /sbin/chown -h root:wheel regress/symlink 55 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \ 56 'root' ] 57 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \ 58 'wheel' ] 59 60chown_prepdir: prepdir 61 @[ `id -u` != 0 ] || /bin/chmod -R 0755 regress 62 @[ `id -u` != 0 ] || /sbin/chown -RL root:wheel regress 63 64chflags_prepfile: prepfile 65 @/usr/bin/chflags dump regress/file 66 @[ `/usr/bin/stat -f '%f' regress/file` == '0' ] 67 68chflags_prepdir: prepdir 69 @/bin/chmod -R 0755 regress 70 @/usr/bin/chflags -RL dump regress 71 72chmod_abs_0000: prepfile 73 @echo chmod abs 0000 74 @/bin/chmod 0644 regress/file 75 @/bin/chmod 0000 regress/file 76 @[ `/usr/bin/stat -f '%p' regress/file` == '100000' ] 77 78chmod_abs_0644: prepfile 79 @echo chmod abs 0644 80 @/bin/chmod 0644 regress/file 81 @[ `/usr/bin/stat -f '%p' regress/file` == '100644' ] 82 83chmod_sym_0644: prepfile 84 @echo chmod sym 0644 85 @/bin/chmod u=rw,go=r regress/file 86 @[ `/usr/bin/stat -f '%p' regress/file` == '100644' ] 87 88chmod_sym_0000: prepfile 89 @echo chmod sym 0000 90 @/bin/chmod 0644 regress/file 91 @/bin/chmod a-rwx regress/file 92 @[ `/usr/bin/stat -f '%p' regress/file` == '100000' ] 93 94chmod_R_0755: prepdir 95 @echo chmod -R 0755 96 @/bin/chmod -R 0755 regress/dir 97 @[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ] 98 @[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ] 99 @[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ] 100 @[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ] 101 102chmod_RP_0755: prepdir 103 @echo chmod -RP 0755 104 @/bin/chmod -RP 0755 regress/dir 105 @[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ] 106 @[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ] 107 @[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ] 108 @[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ] 109 110chmod_RH_0755: prepdir 111 @echo chmod -RH 0755 112 @/bin/chmod -RH 0755 regress/linked_dir 113 @[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ] 114 @[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ] 115 @[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ] 116 @[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ] 117 118chmod_RL_0755: prepdir 119 @echo chmod -RL 0755 120 @/bin/chmod -RL 0755 regress/linked_dir 121 @[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ] 122 @[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ] 123 @[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ] 124 @[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100755' ] 125 126chmod_error: 127 @echo chmod error 128 @/bin/chmod foo bar 2> ${.OBJDIR}/chmod.error || /usr/bin/true 129 @cmp -s ${.CURDIR}/chmod.error ${.OBJDIR}/chmod.error 130 131chgrp_id: chown_prepfile 132 @echo chgrp 32767 133 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 134 @[ `id -u` != 0 ] || /bin/chgrp 32767 regress/file 135 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%g' regress/file` == 32767 ] 136 137chgrp_name: chown_prepfile 138 @echo chgrp nobody 139 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 140 @[ `id -u` != 0 ] || /bin/chgrp nobody regress/file 141 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \ 142 'nobody' ] 143 144chgrp_symlink: chown_prepsymlink 145 @echo chgrp symlink 146 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 147 @[ `id -u` != 0 ] || /bin/chgrp nobody regress/symlink 148 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \ 149 'nobody' ] 150 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \ 151 'wheel' ] 152 153chgrp_h_symlink: chown_prepsymlink 154 @echo chgrp -h symlink 155 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 156 @[ `id -u` != 0 ] || /bin/chgrp -h nobody regress/symlink 157 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \ 158 'wheel' ] 159 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \ 160 'nobody' ] 161 162chgrp_R: chown_prepdir 163 @echo chown -R nobody 164 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 165 @[ `id -u` != 0 ] || /bin/chgrp -R nobody regress/dir 166 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \ 167 'nobody' ] 168 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \ 169 'nobody' ] 170 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \ 171 'nobody' ] 172 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \ 173 regress/link_target_file` == 'wheel' ] 174 175chgrp_RP: chown_prepdir 176 @echo chgrp -RP nobody 177 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 178 @[ `id -u` != 0 ] || /bin/chgrp -RP nobody regress/dir 179 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \ 180 'nobody' ] 181 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \ 182 'nobody' ] 183 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \ 184 'nobody' ] 185 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \ 186 regress/link_target_file` == 'wheel' ] 187 188chgrp_RH: chown_prepdir 189 @echo chgrp -RH nobody 190 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 191 @[ `id -u` != 0 ] || /bin/chgrp -RH nobody regress/linked_dir 192 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \ 193 'nobody' ] 194 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \ 195 'nobody' ] 196 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \ 197 'nobody' ] 198 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \ 199 regress/link_target_file` == 'wheel' ] 200 201chgrp_RL: chown_prepdir 202 @echo chgrp -RL nobody 203 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 204 @[ `id -u` != 0 ] || /bin/chgrp -RL nobody regress/linked_dir 205 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \ 206 'nobody' ] 207 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \ 208 'nobody' ] 209 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \ 210 'nobody' ] 211 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \ 212 regress/link_target_file` == 'nobody' ] 213 214chgrp_error: 215 @echo chgrp error 216 @/bin/chgrp __hopefully_not_existing_group bar 2> \ 217 ${.OBJDIR}/chgrp.error || /usr/bin/true 218 @cmp -s ${.CURDIR}/chgrp.error ${.OBJDIR}/chgrp.error 219 220chown_id: chown_prepfile 221 @echo chown 32767 222 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 223 @[ `id -u` != 0 ] || /sbin/chown 32767 regress/file 224 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%u' regress/file` == 32767 ] 225 226chown_name: chown_prepfile 227 @echo chown nobody 228 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 229 @[ `id -u` != 0 ] || /sbin/chown nobody regress/file 230 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \ 231 'nobody' ] 232 233chown_symlink: chown_prepsymlink 234 @echo chown symlink 235 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 236 @[ `id -u` != 0 ] || /sbin/chown nobody regress/symlink 237 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \ 238 'nobody' ] 239 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \ 240 'root' ] 241 242chown_h_symlink: chown_prepsymlink 243 @echo chown -h symlink 244 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 245 @[ `id -u` != 0 ] || /sbin/chown -h nobody regress/symlink 246 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \ 247 'root' ] 248 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \ 249 'nobody' ] 250 251chown_R: chown_prepdir 252 @echo chown -R nobody 253 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 254 @[ `id -u` != 0 ] || /sbin/chown -R nobody regress/dir 255 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \ 256 'nobody' ] 257 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \ 258 'nobody' ] 259 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \ 260 'nobody' ] 261 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \ 262 regress/link_target_file` == 'root' ] 263 264chown_RP: chown_prepdir 265 @echo chown -RP nobody 266 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 267 @[ `id -u` != 0 ] || /sbin/chown -RP nobody regress/dir 268 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \ 269 'nobody' ] 270 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \ 271 'nobody' ] 272 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \ 273 'nobody' ] 274 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \ 275 regress/link_target_file` == 'root' ] 276 277chown_RH: chown_prepdir 278 @echo chown -RH nobody 279 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 280 @[ `id -u` != 0 ] || /sbin/chown -RH nobody regress/linked_dir 281 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \ 282 'nobody' ] 283 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \ 284 'nobody' ] 285 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \ 286 'nobody' ] 287 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \ 288 regress/link_target_file` == 'root' ] 289 290chown_RL: chown_prepdir 291 @echo chown -RL nobody 292 @[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true 293 @[ `id -u` != 0 ] || /sbin/chown -RL nobody regress/linked_dir 294 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \ 295 'nobody' ] 296 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \ 297 'nobody' ] 298 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \ 299 'nobody' ] 300 @[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \ 301 regress/link_target_file` == 'nobody' ] 302 303chown_error: 304 @echo chown error 305 @/sbin/chown __hopefully_not_existing_user bar 2> \ 306 ${.OBJDIR}/chown.error || /usr/bin/true 307 @cmp -s ${.CURDIR}/chown.error ${.OBJDIR}/chown.error 308 309chflags: chflags_prepfile 310 @echo chflags nodump 311 @/usr/bin/chflags nodump regress/file 312 @[ `/usr/bin/stat -f '%f' regress/file` == '1' ] 313 314chflags_no: chflags_prepfile 315 @echo chflags dump 316 @/usr/bin/chflags nodump regress/file 317 @[ `/usr/bin/stat -f '%f' regress/file` == '1' ] 318 @/usr/bin/chflags dump regress/file 319 @[ `/usr/bin/stat -f '%f' regress/file` == '0' ] 320 321chflags_R: chflags_prepdir 322 @echo chflags -R nodump 323 @/usr/bin/chflags -R nodump regress/dir 324 @[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ] 325 @[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ] 326 @[ `/usr/bin/stat -f '%f' regress/dir` == '1' ] 327 @[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ] 328 329chflags_RP: chflags_prepdir 330 @echo chflags -RP nodump 331 @/usr/bin/chflags -RP nodump regress/dir 332 @[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ] 333 @[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ] 334 @[ `/usr/bin/stat -f '%f' regress/dir` == '1' ] 335 @[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ] 336 337chflags_RH: chflags_prepdir 338 @echo chflags -RH nodump 339 @/usr/bin/chflags -RH nodump regress/linked_dir 340 @[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ] 341 @[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ] 342 @[ `/usr/bin/stat -f '%f' regress/dir` == '1' ] 343 @[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ] 344 345chflags_RL: chflags_prepdir 346 @echo chflags -RL nodump 347 @/usr/bin/chflags -RL nodump regress/linked_dir 348 @[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ] 349 @[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ] 350 @[ `/usr/bin/stat -f '%f' regress/dir` == '1' ] 351 @[ `/usr/bin/stat -f '%f' regress/link_target_file` == '1' ] 352 353chflags_error: 354 @echo chflags error 355 @/usr/bin/chflags foo bar 2> ${.OBJDIR}/chflags.error || /usr/bin/true 356 @cmp -s ${.CURDIR}/chflags.error ${.OBJDIR}/chflags.error 357 358clean: 359 @chmod -R 0700 regress 2>/dev/null || /usr/bin/true 360 @/bin/rm -rf regress 361 362.PHONY: ${REGRESS_TARGETS} prepfile prepdir chown_prepfile chown_prepsymlink \ 363 chown_prepdir chflags_prepfile chflags_prepdir 364 365.include <bsd.regress.mk> 366