gnutls_srtp_get_profile_by_name -> gnutls_srtp_get_profile_id
[gnutls.git] / gl / tests / test-sys_stat.c
blob0702e04f6edf50d4988489ebc715fa19d978ed28
1 /* Test of <sys/stat.h> substitute.
2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
19 #include <config.h>
21 #include <sys/stat.h>
23 #include "verify.h"
25 /* Check the existence of some macros. */
26 int a[] =
28 S_IFMT,
29 #ifdef S_IFBLK /* missing on MSVC */
30 S_IFBLK,
31 #endif
32 S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG,
33 #ifdef S_IFLNK /* missing on native Windows and DJGPP */
34 S_IFLNK,
35 #endif
36 #ifdef S_IFSOCK /* missing on native Windows and DJGPP */
37 S_IFSOCK,
38 #endif
39 S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR,
40 S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP,
41 S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH,
42 S_ISUID, S_ISGID, S_ISVTX,
43 S_ISBLK (S_IFREG),
44 S_ISCHR (S_IFREG),
45 S_ISDIR (S_IFREG),
46 S_ISFIFO (S_IFREG),
47 S_ISREG (S_IFREG),
48 S_ISLNK (S_IFREG),
49 S_ISSOCK (S_IFREG),
50 S_ISDOOR (S_IFREG),
51 S_ISMPB (S_IFREG),
52 S_ISNAM (S_IFREG),
53 S_ISNWK (S_IFREG),
54 S_ISPORT (S_IFREG),
55 S_ISCTG (S_IFREG),
56 S_ISOFD (S_IFREG),
57 S_ISOFL (S_IFREG),
58 S_ISWHT (S_IFREG)
61 /* Sanity checks. */
63 verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR));
64 verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP));
65 verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH));
67 #ifdef S_IFBLK
68 verify (S_ISBLK (S_IFBLK));
69 #endif
70 verify (!S_ISBLK (S_IFCHR));
71 verify (!S_ISBLK (S_IFDIR));
72 verify (!S_ISBLK (S_IFIFO));
73 verify (!S_ISBLK (S_IFREG));
74 #ifdef S_IFLNK
75 verify (!S_ISBLK (S_IFLNK));
76 #endif
77 #ifdef S_IFSOCK
78 verify (!S_ISBLK (S_IFSOCK));
79 #endif
81 #ifdef S_IFBLK
82 verify (!S_ISCHR (S_IFBLK));
83 #endif
84 verify (S_ISCHR (S_IFCHR));
85 verify (!S_ISCHR (S_IFDIR));
86 verify (!S_ISCHR (S_IFIFO));
87 verify (!S_ISCHR (S_IFREG));
88 #ifdef S_IFLNK
89 verify (!S_ISCHR (S_IFLNK));
90 #endif
91 #ifdef S_IFSOCK
92 verify (!S_ISCHR (S_IFSOCK));
93 #endif
95 #ifdef S_IFBLK
96 verify (!S_ISDIR (S_IFBLK));
97 #endif
98 verify (!S_ISDIR (S_IFCHR));
99 verify (S_ISDIR (S_IFDIR));
100 verify (!S_ISDIR (S_IFIFO));
101 verify (!S_ISDIR (S_IFREG));
102 #ifdef S_IFLNK
103 verify (!S_ISDIR (S_IFLNK));
104 #endif
105 #ifdef S_IFSOCK
106 verify (!S_ISDIR (S_IFSOCK));
107 #endif
109 #ifdef S_IFBLK
110 verify (!S_ISFIFO (S_IFBLK));
111 #endif
112 verify (!S_ISFIFO (S_IFCHR));
113 verify (!S_ISFIFO (S_IFDIR));
114 verify (S_ISFIFO (S_IFIFO));
115 verify (!S_ISFIFO (S_IFREG));
116 #ifdef S_IFLNK
117 verify (!S_ISFIFO (S_IFLNK));
118 #endif
119 #ifdef S_IFSOCK
120 verify (!S_ISFIFO (S_IFSOCK));
121 #endif
123 #ifdef S_IFBLK
124 verify (!S_ISREG (S_IFBLK));
125 #endif
126 verify (!S_ISREG (S_IFCHR));
127 verify (!S_ISREG (S_IFDIR));
128 verify (!S_ISREG (S_IFIFO));
129 verify (S_ISREG (S_IFREG));
130 #ifdef S_IFLNK
131 verify (!S_ISREG (S_IFLNK));
132 #endif
133 #ifdef S_IFSOCK
134 verify (!S_ISREG (S_IFSOCK));
135 #endif
137 #ifdef S_IFBLK
138 verify (!S_ISLNK (S_IFBLK));
139 #endif
140 verify (!S_ISLNK (S_IFCHR));
141 verify (!S_ISLNK (S_IFDIR));
142 verify (!S_ISLNK (S_IFIFO));
143 verify (!S_ISLNK (S_IFREG));
144 #ifdef S_IFLNK
145 verify (S_ISLNK (S_IFLNK));
146 #endif
147 #ifdef S_IFSOCK
148 verify (!S_ISLNK (S_IFSOCK));
149 #endif
151 #ifdef S_IFBLK
152 verify (!S_ISSOCK (S_IFBLK));
153 #endif
154 verify (!S_ISSOCK (S_IFCHR));
155 verify (!S_ISSOCK (S_IFDIR));
156 verify (!S_ISSOCK (S_IFIFO));
157 verify (!S_ISSOCK (S_IFREG));
158 #ifdef S_IFLNK
159 verify (!S_ISSOCK (S_IFLNK));
160 #endif
161 #ifdef S_IFSOCK
162 verify (S_ISSOCK (S_IFSOCK));
163 #endif
165 #ifdef S_IFBLK
166 verify (!S_ISDOOR (S_IFBLK));
167 #endif
168 verify (!S_ISDOOR (S_IFCHR));
169 verify (!S_ISDOOR (S_IFDIR));
170 verify (!S_ISDOOR (S_IFIFO));
171 verify (!S_ISDOOR (S_IFREG));
172 #ifdef S_IFLNK
173 verify (!S_ISDOOR (S_IFLNK));
174 #endif
175 #ifdef S_IFSOCK
176 verify (!S_ISDOOR (S_IFSOCK));
177 #endif
179 #ifdef S_IFBLK
180 verify (!S_ISMPB (S_IFBLK));
181 #endif
182 verify (!S_ISMPB (S_IFCHR));
183 verify (!S_ISMPB (S_IFDIR));
184 verify (!S_ISMPB (S_IFIFO));
185 verify (!S_ISMPB (S_IFREG));
186 #ifdef S_IFLNK
187 verify (!S_ISMPB (S_IFLNK));
188 #endif
189 #ifdef S_IFSOCK
190 verify (!S_ISMPB (S_IFSOCK));
191 #endif
193 #ifdef S_IFBLK
194 verify (!S_ISNAM (S_IFBLK));
195 #endif
196 verify (!S_ISNAM (S_IFCHR));
197 verify (!S_ISNAM (S_IFDIR));
198 verify (!S_ISNAM (S_IFIFO));
199 verify (!S_ISNAM (S_IFREG));
200 #ifdef S_IFLNK
201 verify (!S_ISNAM (S_IFLNK));
202 #endif
203 #ifdef S_IFSOCK
204 verify (!S_ISNAM (S_IFSOCK));
205 #endif
207 #ifdef S_IFBLK
208 verify (!S_ISNWK (S_IFBLK));
209 #endif
210 verify (!S_ISNWK (S_IFCHR));
211 verify (!S_ISNWK (S_IFDIR));
212 verify (!S_ISNWK (S_IFIFO));
213 verify (!S_ISNWK (S_IFREG));
214 #ifdef S_IFLNK
215 verify (!S_ISNWK (S_IFLNK));
216 #endif
217 #ifdef S_IFSOCK
218 verify (!S_ISNWK (S_IFSOCK));
219 #endif
221 #ifdef S_IFBLK
222 verify (!S_ISPORT (S_IFBLK));
223 #endif
224 verify (!S_ISPORT (S_IFCHR));
225 verify (!S_ISPORT (S_IFDIR));
226 verify (!S_ISPORT (S_IFIFO));
227 verify (!S_ISPORT (S_IFREG));
228 #ifdef S_IFLNK
229 verify (!S_ISPORT (S_IFLNK));
230 #endif
231 #ifdef S_IFSOCK
232 verify (!S_ISPORT (S_IFSOCK));
233 #endif
235 #ifdef S_IFBLK
236 verify (!S_ISCTG (S_IFBLK));
237 #endif
238 verify (!S_ISCTG (S_IFCHR));
239 verify (!S_ISCTG (S_IFDIR));
240 verify (!S_ISCTG (S_IFIFO));
241 verify (!S_ISCTG (S_IFREG));
242 #ifdef S_IFLNK
243 verify (!S_ISCTG (S_IFLNK));
244 #endif
245 #ifdef S_IFSOCK
246 verify (!S_ISCTG (S_IFSOCK));
247 #endif
249 #ifdef S_IFBLK
250 verify (!S_ISOFD (S_IFBLK));
251 #endif
252 verify (!S_ISOFD (S_IFCHR));
253 verify (!S_ISOFD (S_IFDIR));
254 verify (!S_ISOFD (S_IFIFO));
255 verify (!S_ISOFD (S_IFREG));
256 #ifdef S_IFLNK
257 verify (!S_ISOFD (S_IFLNK));
258 #endif
259 #ifdef S_IFSOCK
260 verify (!S_ISOFD (S_IFSOCK));
261 #endif
263 #ifdef S_IFBLK
264 verify (!S_ISOFL (S_IFBLK));
265 #endif
266 verify (!S_ISOFL (S_IFCHR));
267 verify (!S_ISOFL (S_IFDIR));
268 verify (!S_ISOFL (S_IFIFO));
269 verify (!S_ISOFL (S_IFREG));
270 #ifdef S_IFLNK
271 verify (!S_ISOFL (S_IFLNK));
272 #endif
273 #ifdef S_IFSOCK
274 verify (!S_ISOFL (S_IFSOCK));
275 #endif
277 #ifdef S_IFBLK
278 verify (!S_ISWHT (S_IFBLK));
279 #endif
280 verify (!S_ISWHT (S_IFCHR));
281 verify (!S_ISWHT (S_IFDIR));
282 verify (!S_ISWHT (S_IFIFO));
283 verify (!S_ISWHT (S_IFREG));
284 #ifdef S_IFLNK
285 verify (!S_ISWHT (S_IFLNK));
286 #endif
287 #ifdef S_IFSOCK
288 verify (!S_ISWHT (S_IFSOCK));
289 #endif
291 /* POSIX 2008 requires traditional encoding of permission constants. */
292 verify (S_IRWXU == 00700);
293 verify (S_IRUSR == 00400);
294 verify (S_IWUSR == 00200);
295 verify (S_IXUSR == 00100);
296 verify (S_IRWXG == 00070);
297 verify (S_IRGRP == 00040);
298 verify (S_IWGRP == 00020);
299 verify (S_IXGRP == 00010);
300 verify (S_IRWXO == 00007);
301 verify (S_IROTH == 00004);
302 verify (S_IWOTH == 00002);
303 verify (S_IXOTH == 00001);
304 verify (S_ISUID == 04000);
305 verify (S_ISGID == 02000);
306 verify (S_ISVTX == 01000);
308 #if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \
309 || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \
310 || UTIME_NOW == UTIME_OMIT)
311 invalid UTIME macros
312 #endif
314 /* Check the existence of some types. */
315 nlink_t t1;
316 off_t t2;
317 mode_t t3;
319 struct timespec st;
322 main (void)
324 return 0;