xref: /openbsd-src/regress/bin/chmod/Makefile (revision ddce81d18ead1cead306cecb446175faf94d13e9)
1# $OpenBSD: Makefile,v 1.3 2017/02/18 18:27:12 tb 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_h_abs_0000 chmod_h_abs_0644
7REGRESS_TARGETS+=	chmod_h_sym_0000 chmod_h_sym_0644
8REGRESS_TARGETS+=	chmod_h_go_minus_r chmod_h_go_minus_rx
9REGRESS_TARGETS+=	chmod_h_go_plus_r chmod_h_go_plus_rx
10REGRESS_TARGETS+=	chmod_via_link_abs_0000 chmod_via_link_abs_0644
11REGRESS_TARGETS+=	chmod_via_link_sym_0000 chmod_via_link_sym_0644
12REGRESS_TARGETS+=	chmod_via_link_go_minus_r chmod_via_link_go_minus_rx
13REGRESS_TARGETS+=	chmod_via_link_go_plus_r chmod_via_link_go_plus_rx
14REGRESS_TARGETS+=	chmod_error
15
16REGRESS_TARGETS+=	chgrp_id chgrp_name
17REGRESS_TARGETS+=	chgrp_symlink chgrp_h_symlink
18REGRESS_TARGETS+=	chgrp_R chgrp_RP chgrp_RH chgrp_RL
19REGRESS_TARGETS+=	chgrp_error
20
21REGRESS_TARGETS+=	chown_id chown_name
22REGRESS_TARGETS+=	chown_symlink chown_h_symlink
23REGRESS_TARGETS+=	chown_R chown_RP chown_RH chown_RL
24REGRESS_TARGETS+=	chown_error
25
26REGRESS_TARGETS+=	chflags chflags_no
27REGRESS_TARGETS+=	chflags_R chflags_RP chflags_RH chflags_RL
28REGRESS_TARGETS+=	chflags_via_link
29REGRESS_TARGETS+=	chflags_error
30
31prepfile: clean
32	@/bin/mkdir -p regress
33	@/usr/bin/touch regress/file
34	@/bin/chmod 000 regress/file
35	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
36
37chmod_prepsymlink: prepfile
38	@/bin/ln -s ${.OBJDIR}/regress/file ${.OBJDIR}/regress/link
39	@/bin/chmod -h 755 regress/link
40	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
41
42prepdir: clean
43	@/bin/mkdir -p regress/dir
44	@/usr/bin/touch regress/dir/file1
45	@/usr/bin/touch regress/dir/file2
46	@/bin/chmod 000 regress/dir/file1
47	@/bin/chmod 000 regress/dir/file2
48	@/usr/bin/touch regress/link_target_file
49	@/bin/chmod 0600 regress/link_target_file
50	@[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100000' ]
51	@[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100000' ]
52	@ln -s ${.OBJDIR}/regress/link_target_file \
53	    ${.OBJDIR}/regress/dir/linked_file
54	@ln -s ${.OBJDIR}/regress/dir ${.OBJDIR}/regress/linked_dir
55	@/bin/chmod 000 regress/dir
56	@[ `/usr/bin/stat -f '%p' regress/dir` == '40000' ]
57	@[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ]
58
59chown_prepfile: prepfile
60	@[ `id -u` != 0 ] || /sbin/chown root:wheel regress/file
61	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == 'root' ]
62	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \
63	    'wheel' ]
64
65chown_prepsymlink: chown_prepfile
66	@[ `id -u` != 0 ] || ln -s ${.OBJDIR}/regress/file \
67	    ${.OBJDIR}/regress/symlink
68	@[ `id -u` != 0 ] || /sbin/chown -h root:wheel regress/symlink
69	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \
70	    'root' ]
71	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \
72	    'wheel' ]
73
74chown_prepdir: prepdir
75	@[ `id -u` != 0 ] || /bin/chmod -R 0755 regress
76	@[ `id -u` != 0 ] || /sbin/chown -RL root:wheel regress
77
78chflags_prepfile: prepfile
79	@/usr/bin/chflags dump regress/file
80	@[ `/usr/bin/stat -f '%f' regress/file` == '0' ]
81
82chflags_prepdir: prepdir
83	@/bin/chmod -R 0755 regress
84	@/usr/bin/chflags -RL dump regress
85
86chmod_abs_0000: prepfile
87	@echo chmod abs 0000
88	@/bin/chmod 0644 regress/file
89	@/bin/chmod 0000 regress/file
90	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
91
92chmod_abs_0644: prepfile
93	@echo chmod abs 0644
94	@/bin/chmod 0644 regress/file
95	@[ `/usr/bin/stat -f '%p' regress/file` == '100644' ]
96
97chmod_sym_0644: prepfile
98	@echo chmod sym 0644
99	@/bin/chmod u=rw,go=r regress/file
100	@[ `/usr/bin/stat -f '%p' regress/file` == '100644' ]
101
102chmod_sym_0000: prepfile
103	@echo chmod sym 0000
104	@/bin/chmod 0644 regress/file
105	@/bin/chmod a-rwx regress/file
106	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
107
108chmod_R_0755: prepdir
109	@echo chmod -R 0755
110	@/bin/chmod -R 0755 regress/dir
111	@[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ]
112	@[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ]
113	@[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ]
114	@[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ]
115
116chmod_RP_0755: prepdir
117	@echo chmod -RP 0755
118	@/bin/chmod -RP 0755 regress/dir
119	@[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ]
120	@[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ]
121	@[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ]
122	@[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ]
123
124chmod_RH_0755: prepdir
125	@echo chmod -RH 0755
126	@/bin/chmod -RH 0755 regress/linked_dir
127	@[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ]
128	@[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ]
129	@[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ]
130	@[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100600' ]
131
132chmod_RL_0755: prepdir
133	@echo chmod -RL 0755
134	@/bin/chmod -RL 0755 regress/linked_dir
135	@[ `/usr/bin/stat -f '%p' regress/dir/file1` == '100755' ]
136	@[ `/usr/bin/stat -f '%p' regress/dir/file2` == '100755' ]
137	@[ `/usr/bin/stat -f '%p' regress/dir` == '40755' ]
138	@[ `/usr/bin/stat -f '%p' regress/link_target_file` == '100755' ]
139
140chmod_h_abs_0000: chmod_prepsymlink
141	@echo chmod -h 0000
142	@/bin/chmod -h 0000 regress/link
143	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
144	@[ `/usr/bin/stat -f '%p' regress/link` == '120000' ]
145
146chmod_h_abs_0644: chmod_prepsymlink
147	@echo chmod -h 0644
148	@/bin/chmod -h 0644 regress/link
149	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
150	@[ `/usr/bin/stat -f '%p' regress/link` == '120644' ]
151
152chmod_h_sym_0000: chmod_prepsymlink
153	@echo chmod -h sym 0000
154	@/bin/chmod -h a-rwx regress/link
155	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
156	@[ `/usr/bin/stat -f '%p' regress/link` == '120000' ]
157
158chmod_h_sym_0644: chmod_prepsymlink
159	@echo chmod -h sym 0644
160	@/bin/chmod -h u=rw,go=r regress/link
161	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
162	@[ `/usr/bin/stat -f '%p' regress/link` == '120644' ]
163
164chmod_h_go_minus_r: chmod_prepsymlink
165	@echo chmod -h go-r
166	@/bin/chmod -h go-r regress/link
167	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
168	@[ `/usr/bin/stat -f '%p' regress/link` == '120711' ]
169
170chmod_h_go_minus_rx: chmod_prepsymlink
171	@echo chmod -h go-rx
172	@/bin/chmod -h go-rx regress/link
173	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
174	@[ `/usr/bin/stat -f '%p' regress/link` == '120700' ]
175
176chmod_h_go_plus_r: chmod_prepsymlink
177	@echo chmod -h go+r
178	@/bin/chmod -h go+r regress/link
179	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
180	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
181
182chmod_h_go_plus_rx: chmod_prepsymlink
183	@echo chmod -h go+rx
184	@/bin/chmod -h go+rx regress/link
185	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
186	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
187
188chmod_via_link_abs_0000: chmod_prepsymlink
189	@echo chmod via symlink 0000
190	@/bin/chmod 0000 regress/link
191	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
192	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
193
194chmod_via_link_abs_0644: chmod_prepsymlink
195	@echo chmod via symlink 0644
196	@/bin/chmod 0644 regress/link
197	@[ `/usr/bin/stat -f '%p' regress/file` == '100644' ]
198	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
199
200chmod_via_link_sym_0000: chmod_prepsymlink
201	@echo chmod via symlink sym 0000
202	@/bin/chmod a-rwx regress/link
203	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
204	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
205
206chmod_via_link_sym_0644: chmod_prepsymlink
207	@echo chmod via symlink sym 0644
208	@/bin/chmod u=rw,go=r regress/link
209	@[ `/usr/bin/stat -f '%p' regress/file` == '100644' ]
210	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
211
212chmod_via_link_go_minus_r: chmod_prepsymlink
213	@echo chmod via symlink go-r
214	@/bin/chmod go-r regress/link
215	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
216	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
217
218chmod_via_link_go_minus_rx: chmod_prepsymlink
219	@echo chmod via symlink go-rx
220	@/bin/chmod go-rx regress/link
221	@[ `/usr/bin/stat -f '%p' regress/file` == '100000' ]
222	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
223
224chmod_via_link_go_plus_r: chmod_prepsymlink
225	@echo chmod via symlink go+r
226	@/bin/chmod go+r regress/link
227	@[ `/usr/bin/stat -f '%p' regress/file` == '100044' ]
228	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
229
230chmod_via_link_go_plus_rx: chmod_prepsymlink
231	@echo chmod via symlink go+rx
232	@/bin/chmod go+rx regress/link
233	@[ `/usr/bin/stat -f '%p' regress/file` == '100055' ]
234	@[ `/usr/bin/stat -f '%p' regress/link` == '120755' ]
235
236chmod_error:
237	@echo chmod error
238	@/bin/chmod foo bar 2> ${.OBJDIR}/chmod.error || /usr/bin/true
239	@cmp -s ${.CURDIR}/chmod.error ${.OBJDIR}/chmod.error
240
241chgrp_id: chown_prepfile
242	@echo chgrp 32767
243	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
244	@[ `id -u` != 0 ] || /bin/chgrp 32767 regress/file
245	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%g' regress/file` == 32767 ]
246
247chgrp_name: chown_prepfile
248	@echo chgrp nobody
249	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
250	@[ `id -u` != 0 ] || /bin/chgrp nobody regress/file
251	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \
252	    'nobody' ]
253
254chgrp_symlink: chown_prepsymlink
255	@echo chgrp symlink
256	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
257	@[ `id -u` != 0 ] || /bin/chgrp nobody regress/symlink
258	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \
259	    'nobody' ]
260	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \
261	    'wheel' ]
262
263chgrp_h_symlink: chown_prepsymlink
264	@echo chgrp -h symlink
265	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
266	@[ `id -u` != 0 ] || /bin/chgrp -h nobody regress/symlink
267	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/file` == \
268	    'wheel' ]
269	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/symlink` == \
270	    'nobody' ]
271
272chgrp_R: chown_prepdir
273	@echo chown -R nobody
274	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
275	@[ `id -u` != 0 ] || /bin/chgrp -R nobody regress/dir
276	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \
277	    'nobody' ]
278	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \
279	    'nobody' ]
280	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \
281	    'nobody' ]
282	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \
283	    regress/link_target_file` == 'wheel' ]
284
285chgrp_RP: chown_prepdir
286	@echo chgrp -RP nobody
287	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
288	@[ `id -u` != 0 ] || /bin/chgrp -RP nobody regress/dir
289	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \
290	    'nobody' ]
291	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \
292	    'nobody' ]
293	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \
294	    'nobody' ]
295	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \
296	    regress/link_target_file` == 'wheel' ]
297
298chgrp_RH: chown_prepdir
299	@echo chgrp -RH nobody
300	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
301	@[ `id -u` != 0 ] || /bin/chgrp -RH nobody regress/linked_dir
302	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \
303	    'nobody' ]
304	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \
305	    'nobody' ]
306	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \
307	    'nobody' ]
308	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \
309	    regress/link_target_file` == 'wheel' ]
310
311chgrp_RL: chown_prepdir
312	@echo chgrp -RL nobody
313	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
314	@[ `id -u` != 0 ] || /bin/chgrp -RL nobody regress/linked_dir
315	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file1` == \
316	    'nobody' ]
317	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir/file2` == \
318	    'nobody' ]
319	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' regress/dir` == \
320	    'nobody' ]
321	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Sg' \
322	    regress/link_target_file` == 'nobody' ]
323
324chgrp_error:
325	@echo chgrp error
326	@/bin/chgrp __hopefully_not_existing_group bar 2> \
327	    ${.OBJDIR}/chgrp.error || /usr/bin/true
328	@cmp -s ${.CURDIR}/chgrp.error ${.OBJDIR}/chgrp.error
329
330chown_id: chown_prepfile
331	@echo chown 32767
332	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
333	@[ `id -u` != 0 ] || /sbin/chown 32767 regress/file
334	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%u' regress/file` == 32767 ]
335
336chown_name: chown_prepfile
337	@echo chown nobody
338	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
339	@[ `id -u` != 0 ] || /sbin/chown nobody regress/file
340	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \
341	    'nobody' ]
342
343chown_symlink: chown_prepsymlink
344	@echo chown symlink
345	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
346	@[ `id -u` != 0 ] || /sbin/chown nobody regress/symlink
347	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \
348	    'nobody' ]
349	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \
350	    'root' ]
351
352chown_h_symlink: chown_prepsymlink
353	@echo chown -h symlink
354	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
355	@[ `id -u` != 0 ] || /sbin/chown -h nobody regress/symlink
356	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/file` == \
357	    'root' ]
358	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/symlink` == \
359	    'nobody' ]
360
361chown_R: chown_prepdir
362	@echo chown -R nobody
363	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
364	@[ `id -u` != 0 ] || /sbin/chown -R nobody regress/dir
365	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \
366	    'nobody' ]
367	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \
368	    'nobody' ]
369	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \
370	    'nobody' ]
371	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \
372	    regress/link_target_file` == 'root' ]
373
374chown_RP: chown_prepdir
375	@echo chown -RP nobody
376	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
377	@[ `id -u` != 0 ] || /sbin/chown -RP nobody regress/dir
378	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \
379	    'nobody' ]
380	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \
381	    'nobody' ]
382	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \
383	    'nobody' ]
384	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \
385	    regress/link_target_file` == 'root' ]
386
387chown_RH: chown_prepdir
388	@echo chown -RH nobody
389	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
390	@[ `id -u` != 0 ] || /sbin/chown -RH nobody regress/linked_dir
391	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \
392	    'nobody' ]
393	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \
394	    'nobody' ]
395	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \
396	    'nobody' ]
397	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \
398	    regress/link_target_file` == 'root' ]
399
400chown_RL: chown_prepdir
401	@echo chown -RL nobody
402	@[ `id -u` != 0 ] && echo skipped, not root || /usr/bin/true
403	@[ `id -u` != 0 ] || /sbin/chown -RL nobody regress/linked_dir
404	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file1` == \
405	    'nobody' ]
406	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir/file2` == \
407	    'nobody' ]
408	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' regress/dir` == \
409	    'nobody' ]
410	@[ `id -u` != 0 ] || [ `/usr/bin/stat -f '%Su' \
411	    regress/link_target_file` == 'nobody' ]
412
413chown_error:
414	@echo chown error
415	@/sbin/chown __hopefully_not_existing_user bar 2> \
416	    ${.OBJDIR}/chown.error || /usr/bin/true
417	@cmp -s ${.CURDIR}/chown.error ${.OBJDIR}/chown.error
418
419chflags: chflags_prepfile
420	@echo chflags nodump
421	@/usr/bin/chflags nodump regress/file
422	@[ `/usr/bin/stat -f '%f' regress/file` == '1' ]
423
424chflags_no: chflags_prepfile
425	@echo chflags dump
426	@/usr/bin/chflags nodump regress/file
427	@[ `/usr/bin/stat -f '%f' regress/file` == '1' ]
428	@/usr/bin/chflags dump regress/file
429	@[ `/usr/bin/stat -f '%f' regress/file` == '0' ]
430
431chflags_R: chflags_prepdir
432	@echo chflags -R nodump
433	@/usr/bin/chflags -R nodump regress/dir
434	@[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ]
435	@[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ]
436	@[ `/usr/bin/stat -f '%f' regress/dir` == '1' ]
437	@[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ]
438
439chflags_RP: chflags_prepdir
440	@echo chflags -RP nodump
441	@/usr/bin/chflags -RP nodump regress/dir
442	@[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ]
443	@[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ]
444	@[ `/usr/bin/stat -f '%f' regress/dir` == '1' ]
445	@[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ]
446
447chflags_RH: chflags_prepdir
448	@echo chflags -RH nodump
449	@/usr/bin/chflags -RH nodump regress/linked_dir
450	@[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ]
451	@[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ]
452	@[ `/usr/bin/stat -f '%f' regress/dir` == '1' ]
453	@[ `/usr/bin/stat -f '%f' regress/link_target_file` == '0' ]
454
455chflags_RL: chflags_prepdir
456	@echo chflags -RL nodump
457	@/usr/bin/chflags -RL nodump regress/linked_dir
458	@[ `/usr/bin/stat -f '%f' regress/dir/file1` == '1' ]
459	@[ `/usr/bin/stat -f '%f' regress/dir/file2` == '1' ]
460	@[ `/usr/bin/stat -f '%f' regress/dir` == '1' ]
461	@[ `/usr/bin/stat -f '%f' regress/link_target_file` == '1' ]
462
463chflags_via_link: chflags_prepfile
464	@echo chflags via link
465	@/bin/ln -s ${.OBJDIR}/regress/file ${.OBJDIR}/regress/link
466	@chflags -h uchg regress/link
467	@chflags nodump regress/link
468	@[ `stat -f '%f' regress/link` == '2' ]
469	@[ `stat -f '%f' regress/file` == '1' ]
470	@chflags -h nouchg regress/link
471	@chflags dump regress/link
472	@[ `stat -f '%f' regress/link` == '0' ]
473	@[ `stat -f '%f' regress/file` == '0' ]
474
475chflags_error:
476	@echo chflags error
477	@/usr/bin/chflags foo bar 2> ${.OBJDIR}/chflags.error || /usr/bin/true
478	@cmp -s ${.CURDIR}/chflags.error ${.OBJDIR}/chflags.error
479
480clean:
481	@chmod -R 0700 regress 2>/dev/null || /usr/bin/true
482	@/bin/rm -rf regress
483
484.PHONY: ${REGRESS_TARGETS} prepfile prepdir chown_prepfile chown_prepsymlink \
485	    chown_prepdir chflags_prepfile chflags_prepdir
486
487.include <bsd.regress.mk>
488