xref: /freebsd/contrib/netbsd-tests/include/t_errno.c (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1 /*	$NetBSD: t_errno.c,v 1.1 2011/05/01 17:07:05 jruoho Exp $ */
2 
3 /*-
4  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jukka Ruohonen.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 #include <sys/cdefs.h>
32 __RCSID("$NetBSD: t_errno.c,v 1.1 2011/05/01 17:07:05 jruoho Exp $");
33 
34 #include <atf-c.h>
35 #include <errno.h>
36 
37 ATF_TC(errno_constants);
38 ATF_TC_HEAD(errno_constants, tc)
39 {
40 	atf_tc_set_md_var(tc, "descr", "Test POSIX constants in <errno.h>");
41 }
42 
43 ATF_TC_BODY(errno_constants, tc)
44 {
45 	bool fail;
46 
47 	/*
48 	 * The following definitions should be available
49 	 * according to IEEE Std 1003.1-2008, issue 7.
50 	 */
51 	atf_tc_expect_fail("PR standards/44921");
52 
53 	fail = true;
54 
55 #ifdef E2BIG
56 	fail = false;
57 #endif
58 	if (fail != false)
59 		atf_tc_fail_nonfatal("E2BIG not defined");
60 
61 	fail = true;
62 
63 #ifdef EACCES
64 	fail = false;
65 #endif
66 	if (fail != false)
67 		atf_tc_fail_nonfatal("EACCES not defined");
68 
69 	fail = true;
70 
71 #ifdef EADDRINUSE
72 	fail = false;
73 #endif
74 	if (fail != false)
75 		atf_tc_fail_nonfatal("EADDRINUSE not defined");
76 
77 	fail = true;
78 
79 #ifdef EADDRNOTAVAIL
80 	fail = false;
81 #endif
82 	if (fail != false)
83 		atf_tc_fail_nonfatal("EADDRNOTAVAIL not defined");
84 
85 	fail = true;
86 
87 #ifdef EAFNOSUPPORT
88 	fail = false;
89 #endif
90 	if (fail != false)
91 		atf_tc_fail_nonfatal("EAFNOSUPPORT not defined");
92 
93 	fail = true;
94 
95 #ifdef EAGAIN
96 	fail = false;
97 #endif
98 	if (fail != false)
99 		atf_tc_fail_nonfatal("EAGAIN not defined");
100 
101 	fail = true;
102 
103 #ifdef EALREADY
104 	fail = false;
105 #endif
106 	if (fail != false)
107 		atf_tc_fail_nonfatal("EALREADY not defined");
108 
109 	fail = true;
110 
111 #ifdef EBADF
112 	fail = false;
113 #endif
114 	if (fail != false)
115 		atf_tc_fail_nonfatal("EBADF not defined");
116 
117 	fail = true;
118 
119 #ifdef EBADMSG
120 	fail = false;
121 #endif
122 	if (fail != false)
123 		atf_tc_fail_nonfatal("EBADMSG not defined");
124 
125 	fail = true;
126 
127 #ifdef EBUSY
128 	fail = false;
129 #endif
130 	if (fail != false)
131 		atf_tc_fail_nonfatal("EBUSY not defined");
132 
133 	fail = true;
134 
135 #ifdef ECANCELED
136 	fail = false;
137 #endif
138 	if (fail != false)
139 		atf_tc_fail_nonfatal("ECANCELED not defined");
140 
141 	fail = true;
142 
143 #ifdef ECHILD
144 	fail = false;
145 #endif
146 	if (fail != false)
147 		atf_tc_fail_nonfatal("ECHILD not defined");
148 
149 	fail = true;
150 
151 #ifdef ECONNABORTED
152 	fail = false;
153 #endif
154 	if (fail != false)
155 		atf_tc_fail_nonfatal("ECONNABORTED not defined");
156 
157 	fail = true;
158 
159 #ifdef ECONNREFUSED
160 	fail = false;
161 #endif
162 	if (fail != false)
163 		atf_tc_fail_nonfatal("ECONNREFUSED not defined");
164 
165 	fail = true;
166 
167 #ifdef ECONNRESET
168 	fail = false;
169 #endif
170 	if (fail != false)
171 		atf_tc_fail_nonfatal("ECONNRESET not defined");
172 
173 	fail = true;
174 
175 #ifdef EDEADLK
176 	fail = false;
177 #endif
178 	if (fail != false)
179 		atf_tc_fail_nonfatal("EDEADLK not defined");
180 
181 	fail = true;
182 
183 #ifdef EDESTADDRREQ
184 	fail = false;
185 #endif
186 	if (fail != false)
187 		atf_tc_fail_nonfatal("EDESTADDRREQ not defined");
188 
189 	fail = true;
190 
191 #ifdef EDOM
192 	fail = false;
193 #endif
194 	if (fail != false)
195 		atf_tc_fail_nonfatal("EDOM not defined");
196 
197 	fail = true;
198 
199 #ifdef EDQUOT
200 	fail = false;
201 #endif
202 	if (fail != false)
203 		atf_tc_fail_nonfatal("EDQUOT not defined");
204 
205 	fail = true;
206 
207 #ifdef EEXIST
208 	fail = false;
209 #endif
210 	if (fail != false)
211 		atf_tc_fail_nonfatal("EEXIST not defined");
212 
213 	fail = true;
214 
215 #ifdef EFAULT
216 	fail = false;
217 #endif
218 	if (fail != false)
219 		atf_tc_fail_nonfatal("EFAULT not defined");
220 
221 	fail = true;
222 
223 #ifdef EFBIG
224 	fail = false;
225 #endif
226 	if (fail != false)
227 		atf_tc_fail_nonfatal("EFBIG not defined");
228 
229 	fail = true;
230 
231 #ifdef EHOSTUNREACH
232 	fail = false;
233 #endif
234 	if (fail != false)
235 		atf_tc_fail_nonfatal("EHOSTUNREACH not defined");
236 
237 	fail = true;
238 
239 #ifdef EIDRM
240 	fail = false;
241 #endif
242 	if (fail != false)
243 		atf_tc_fail_nonfatal("EIDRM not defined");
244 
245 	fail = true;
246 
247 #ifdef EILSEQ
248 	fail = false;
249 #endif
250 
251 	if (fail != false)
252 		atf_tc_fail_nonfatal("EILSEQ not defined");
253 
254 	fail = true;
255 
256 #ifdef EINPROGRESS
257 	fail = false;
258 #endif
259 
260 	if (fail != false)
261 		atf_tc_fail_nonfatal("EINPROGRESS not defined");
262 
263 	fail = true;
264 
265 #ifdef EINTR
266 	fail = false;
267 #endif
268 
269 	if (fail != false)
270 		atf_tc_fail_nonfatal("EINTR not defined");
271 
272 	fail = true;
273 
274 #ifdef EINVAL
275 	fail = false;
276 #endif
277 
278 	if (fail != false)
279 		atf_tc_fail_nonfatal("EINVAL not defined");
280 
281 	fail = true;
282 
283 #ifdef EIO
284 	fail = false;
285 #endif
286 
287 	if (fail != false)
288 		atf_tc_fail_nonfatal("EIO not defined");
289 
290 	fail = true;
291 
292 #ifdef EISCONN
293 	fail = false;
294 #endif
295 
296 	if (fail != false)
297 		atf_tc_fail_nonfatal("EISCONN not defined");
298 
299 	fail = true;
300 
301 #ifdef EISDIR
302 	fail = false;
303 #endif
304 
305 	if (fail != false)
306 		atf_tc_fail_nonfatal("EISDIR not defined");
307 
308 	fail = true;
309 
310 #ifdef ELOOP
311 	fail = false;
312 #endif
313 
314 	if (fail != false)
315 		atf_tc_fail_nonfatal("ELOOP not defined");
316 
317 	fail = true;
318 
319 #ifdef EMFILE
320 	fail = false;
321 #endif
322 
323 	if (fail != false)
324 		atf_tc_fail_nonfatal("EMFILE not defined");
325 
326 	fail = true;
327 
328 #ifdef EMLINK
329 	fail = false;
330 #endif
331 
332 	if (fail != false)
333 		atf_tc_fail_nonfatal("EMLINK not defined");
334 
335 	fail = true;
336 
337 #ifdef EMSGSIZE
338 	fail = false;
339 #endif
340 
341 	if (fail != false)
342 		atf_tc_fail_nonfatal("EMSGSIZE not defined");
343 
344 	fail = true;
345 
346 #ifdef EMULTIHOP
347 	fail = false;
348 #endif
349 
350 	if (fail != false)
351 		atf_tc_fail_nonfatal("EMULTIHOP not defined");
352 
353 	fail = true;
354 
355 #ifdef ENAMETOOLONG
356 	fail = false;
357 #endif
358 
359 	if (fail != false)
360 		atf_tc_fail_nonfatal("ENAMETOOLONG not defined");
361 
362 	fail = true;
363 
364 #ifdef ENETDOWN
365 	fail = false;
366 #endif
367 
368 	if (fail != false)
369 		atf_tc_fail_nonfatal("ENETDOWN not defined");
370 
371 	fail = true;
372 
373 #ifdef ENETRESET
374 	fail = false;
375 #endif
376 
377 	if (fail != false)
378 		atf_tc_fail_nonfatal("ENETRESET not defined");
379 
380 	fail = true;
381 
382 #ifdef ENETUNREACH
383 	fail = false;
384 #endif
385 
386 	if (fail != false)
387 		atf_tc_fail_nonfatal("ENETUNREACH not defined");
388 
389 	fail = true;
390 
391 #ifdef ENFILE
392 	fail = false;
393 #endif
394 
395 	if (fail != false)
396 		atf_tc_fail_nonfatal("ENFILE not defined");
397 
398 	fail = true;
399 
400 #ifdef ENOBUFS
401 	fail = false;
402 #endif
403 
404 	if (fail != false)
405 		atf_tc_fail_nonfatal("ENOBUFS not defined");
406 
407 	fail = true;
408 
409 #ifdef ENODATA
410 	fail = false;
411 #endif
412 
413 	if (fail != false)
414 		atf_tc_fail_nonfatal("ENODATA not defined");
415 
416 	fail = true;
417 
418 #ifdef ENODEV
419 	fail = false;
420 #endif
421 
422 	if (fail != false)
423 		atf_tc_fail_nonfatal("ENODEV not defined");
424 
425 	fail = true;
426 
427 #ifdef ENOENT
428 	fail = false;
429 #endif
430 
431 	if (fail != false)
432 		atf_tc_fail_nonfatal("ENOENT not defined");
433 
434 	fail = true;
435 
436 #ifdef ENOEXEC
437 	fail = false;
438 #endif
439 
440 	if (fail != false)
441 		atf_tc_fail_nonfatal("ENOEXEC not defined");
442 
443 	fail = true;
444 
445 #ifdef ENOLCK
446 	fail = false;
447 #endif
448 
449 	if (fail != false)
450 		atf_tc_fail_nonfatal("ENOLCK not defined");
451 
452 	fail = true;
453 
454 #ifdef ENOLINK
455 	fail = false;
456 #endif
457 
458 	if (fail != false)
459 		atf_tc_fail_nonfatal("ENOLINK not defined");
460 
461 	fail = true;
462 
463 #ifdef ENOMEM
464 	fail = false;
465 #endif
466 
467 	if (fail != false)
468 		atf_tc_fail_nonfatal("ENOMEM not defined");
469 
470 	fail = true;
471 
472 #ifdef ENOMSG
473 	fail = false;
474 #endif
475 
476 	if (fail != false)
477 		atf_tc_fail_nonfatal("ENOMSG not defined");
478 
479 	fail = true;
480 
481 #ifdef ENOPROTOOPT
482 	fail = false;
483 #endif
484 
485 	if (fail != false)
486 		atf_tc_fail_nonfatal("ENOPROTOOPT not defined");
487 
488 	fail = true;
489 
490 #ifdef ENOSPC
491 	fail = false;
492 #endif
493 
494 	if (fail != false)
495 		atf_tc_fail_nonfatal("ENOSPC not defined");
496 
497 	fail = true;
498 
499 #ifdef ENOSR
500 	fail = false;
501 #endif
502 
503 	if (fail != false)
504 		atf_tc_fail_nonfatal("ENOSR not defined");
505 
506 	fail = true;
507 
508 #ifdef ENOSTR
509 	fail = false;
510 #endif
511 
512 	if (fail != false)
513 		atf_tc_fail_nonfatal("ENOSTR not defined");
514 
515 	fail = true;
516 
517 #ifdef ENOSYS
518 	fail = false;
519 #endif
520 
521 	if (fail != false)
522 		atf_tc_fail_nonfatal("ENOSYS not defined");
523 
524 	fail = true;
525 
526 #ifdef ENOTCONN
527 	fail = false;
528 #endif
529 
530 	if (fail != false)
531 		atf_tc_fail_nonfatal("ENOTCONN not defined");
532 
533 	fail = true;
534 
535 #ifdef ENOTDIR
536 	fail = false;
537 #endif
538 
539 	if (fail != false)
540 		atf_tc_fail_nonfatal("ENOTDIR not defined");
541 
542 	fail = true;
543 
544 #ifdef ENOTEMPTY
545 	fail = false;
546 #endif
547 
548 	if (fail != false)
549 		atf_tc_fail_nonfatal("ENOTEMPTY not defined");
550 
551 	fail = true;
552 
553 #ifdef ENOTRECOVERABLE
554 	fail = false;
555 #endif
556 
557 	if (fail != false)
558 		atf_tc_fail_nonfatal("ENOTRECOVERABLE not defined");
559 
560 	fail = true;
561 
562 #ifdef ENOTSOCK
563 	fail = false;
564 #endif
565 
566 	if (fail != false)
567 		atf_tc_fail_nonfatal("ENOTSOCK not defined");
568 
569 	fail = true;
570 
571 #ifdef ENOTSUP
572 	fail = false;
573 #endif
574 
575 	if (fail != false)
576 		atf_tc_fail_nonfatal("ENOTSUP not defined");
577 
578 	fail = true;
579 
580 #ifdef ENOTTY
581 	fail = false;
582 #endif
583 
584 	if (fail != false)
585 		atf_tc_fail_nonfatal("ENOTTY not defined");
586 
587 	fail = true;
588 
589 #ifdef ENXIO
590 	fail = false;
591 #endif
592 
593 	if (fail != false)
594 		atf_tc_fail_nonfatal("ENXIO not defined");
595 
596 	fail = true;
597 
598 #ifdef EOPNOTSUPP
599 	fail = false;
600 #endif
601 
602 	if (fail != false)
603 		atf_tc_fail_nonfatal("EOPNOTSUPP not defined");
604 
605 	fail = true;
606 
607 #ifdef EOVERFLOW
608 	fail = false;
609 #endif
610 
611 	if (fail != false)
612 		atf_tc_fail_nonfatal("EOVERFLOW not defined");
613 
614 	fail = true;
615 
616 #ifdef EOWNERDEAD
617 	fail = false;
618 #endif
619 
620 	if (fail != false)
621 		atf_tc_fail_nonfatal("EOWNERDEAD not defined");
622 
623 	fail = true;
624 
625 #ifdef EPERM
626 	fail = false;
627 #endif
628 
629 	if (fail != false)
630 		atf_tc_fail_nonfatal("EPERM not defined");
631 
632 	fail = true;
633 
634 #ifdef EPIPE
635 	fail = false;
636 #endif
637 
638 	if (fail != false)
639 		atf_tc_fail_nonfatal("EPIPE not defined");
640 
641 	fail = true;
642 
643 #ifdef EPROTO
644 	fail = false;
645 #endif
646 
647 	if (fail != false)
648 		atf_tc_fail_nonfatal("EPROTO not defined");
649 
650 	fail = true;
651 
652 #ifdef EPROTONOSUPPORT
653 	fail = false;
654 #endif
655 
656 	if (fail != false)
657 		atf_tc_fail_nonfatal("EPROTONOSUPPORT not defined");
658 
659 	fail = true;
660 
661 #ifdef EPROTOTYPE
662 	fail = false;
663 #endif
664 
665 	if (fail != false)
666 		atf_tc_fail_nonfatal("EPROTOTYPE not defined");
667 
668 	fail = true;
669 
670 #ifdef ERANGE
671 	fail = false;
672 #endif
673 
674 	if (fail != false)
675 		atf_tc_fail_nonfatal("ERANGE not defined");
676 
677 	fail = true;
678 
679 #ifdef EROFS
680 	fail = false;
681 #endif
682 
683 	if (fail != false)
684 		atf_tc_fail_nonfatal("EROFS not defined");
685 
686 	fail = true;
687 
688 #ifdef ESPIPE
689 	fail = false;
690 #endif
691 
692 	if (fail != false)
693 		atf_tc_fail_nonfatal("ESPIPE not defined");
694 
695 	fail = true;
696 
697 #ifdef ESRCH
698 	fail = false;
699 #endif
700 
701 	if (fail != false)
702 		atf_tc_fail_nonfatal("ESRCH not defined");
703 
704 	fail = true;
705 
706 #ifdef ESTALE
707 	fail = false;
708 #endif
709 
710 	if (fail != false)
711 		atf_tc_fail_nonfatal("ESTALE not defined");
712 
713 	fail = true;
714 
715 #ifdef ETIME
716 	fail = false;
717 #endif
718 
719 	if (fail != false)
720 		atf_tc_fail_nonfatal("ETIME not defined");
721 
722 	fail = true;
723 
724 #ifdef ETIMEDOUT
725 	fail = false;
726 #endif
727 
728 	if (fail != false)
729 		atf_tc_fail_nonfatal("ETIMEDOUT not defined");
730 
731 	fail = true;
732 
733 #ifdef ETXTBSY
734 	fail = false;
735 #endif
736 
737 	if (fail != false)
738 		atf_tc_fail_nonfatal("ETXTBSY not defined");
739 
740 	fail = true;
741 
742 #ifdef EWOULDBLOCK
743 	fail = false;
744 #endif
745 
746 	if (fail != false)
747 		atf_tc_fail_nonfatal("EWOULDBLOCK not defined");
748 
749 	fail = true;
750 
751 #ifdef EXDEV
752 	fail = false;
753 #endif
754 
755 	if (fail != false)
756 		atf_tc_fail_nonfatal("EXDEV not defined");
757 }
758 
759 ATF_TP_ADD_TCS(tp)
760 {
761 
762 	ATF_TP_ADD_TC(tp, errno_constants);
763 
764 	return atf_no_error();
765 }
766