Blob


1 #if TEST__MMD
2 int
3 main(void)
4 {
5 return 0;
6 }
7 #endif /* TEST_NOOP */
8 #if TEST___PROGNAME
9 int
10 main(void)
11 {
12 extern char *__progname;
14 return !__progname;
15 }
16 #endif /* TEST___PROGNAME */
17 #if TEST_ARC4RANDOM
18 #include <stdlib.h>
20 int
21 main(void)
22 {
23 return (arc4random() + 1) ? 0 : 1;
24 }
25 #endif /* TEST_ARC4RANDOM */
26 #if TEST_B64_NTOP
27 #include <netinet/in.h>
28 #include <resolv.h>
30 int
31 main(void)
32 {
33 const char *src = "hello world";
34 char output[1024];
36 return b64_ntop((const unsigned char *)src, 11, output, sizeof(output)) > 0 ? 0 : 1;
37 }
38 #endif /* TEST_B64_NTOP */
39 #if TEST_CAPSICUM
40 #include <sys/capsicum.h>
42 int
43 main(void)
44 {
45 cap_enter();
46 return(0);
47 }
48 #endif /* TEST_CAPSICUM */
49 #if TEST_CRYPT
50 #if defined(__linux__)
51 # define _GNU_SOURCE /* old glibc */
52 # define _DEFAULT_SOURCE /* new glibc */
53 #endif
54 #if defined(__sun)
55 # ifndef _XOPEN_SOURCE /* SunOS already defines */
56 # define _XOPEN_SOURCE /* XPGx */
57 # endif
58 # define _XOPEN_SOURCE_EXTENDED 1 /* XPG4v2 */
59 # ifndef __EXTENSIONS__ /* SunOS already defines */
60 # define __EXTENSIONS__ /* reallocarray, etc. */
61 # endif
62 #endif
63 #include <unistd.h>
65 int main(void)
66 {
67 char *v;
69 v = crypt("this_is_a_key", "123455");
70 return v == NULL;
71 }
72 #endif /* TEST_CRYPT */
73 #if TEST_CRYPT_NEWHASH
74 #include <pwd.h> /* _PASSWORD_LEN */
75 #include <unistd.h>
77 int
78 main(void)
79 {
80 const char *v = "password";
81 char hash[_PASSWORD_LEN];
83 if (crypt_newhash(v, "bcrypt,a", hash, sizeof(hash)) == -1)
84 return 1;
85 if (crypt_checkpass(v, hash) == -1)
86 return 1;
88 return 0;
89 }
90 #endif /* TEST_CRYPT_NEWHASH */
91 #if TEST_ENDIAN_H
92 #ifdef __linux__
93 # define _DEFAULT_SOURCE
94 #endif
95 #include <endian.h>
97 int
98 main(void)
99 {
100 return !htole32(23);
102 #endif /* TEST_ENDIAN_H */
103 #if TEST_ERR
104 /*
105 * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
107 * Permission to use, copy, modify, and distribute this software for any
108 * purpose with or without fee is hereby granted, provided that the above
109 * copyright notice and this permission notice appear in all copies.
111 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
112 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
113 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
114 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
115 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
116 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
117 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
118 */
120 #include <err.h>
121 #include <errno.h>
123 int
124 main(void)
126 warnx("%d. warnx", 1);
127 warnc(ENOENT, "%d. warn", ENOENT);
128 warn("%d. warn", 2);
129 err(0, "%d. err", 3);
130 errx(0, "%d. err", 3);
131 errc(0, ENOENT, "%d. err", 3);
132 /* NOTREACHED */
133 return 1;
135 #endif /* TEST_ERR */
136 #if TEST_EXPLICIT_BZERO
137 #include <string.h>
139 int
140 main(void)
142 char foo[10];
144 explicit_bzero(foo, sizeof(foo));
145 return(0);
147 #endif /* TEST_EXPLICIT_BZERO */
148 #if TEST_FLOCK
149 #include <fcntl.h>
151 int
152 main(void)
154 flock(0, LOCK_SH|LOCK_NB);
155 return 0;
157 #endif /* TEST_FLOCK */
158 #if TEST_FREEZERO
159 #include <stdlib.h>
161 int
162 main(void)
164 freezero(NULL, 0);
165 return 0;
167 #endif /* TEST_FREEZERO */
168 #if TEST_FTS
169 #include <stddef.h>
170 #include <sys/types.h>
171 #include <sys/stat.h>
172 #include <fts.h>
174 int
175 main(void)
177 const char *argv[2];
178 FTS *ftsp;
179 FTSENT *entry;
181 argv[0] = ".";
182 argv[1] = (char *)NULL;
184 ftsp = fts_open((char * const *)argv,
185 FTS_PHYSICAL | FTS_NOCHDIR, NULL);
187 if (ftsp == NULL)
188 return 1;
190 entry = fts_read(ftsp);
192 if (entry == NULL)
193 return 1;
195 if (fts_set(ftsp, entry, FTS_SKIP) != 0)
196 return 1;
198 if (fts_close(ftsp) != 0)
199 return 1;
201 return 0;
203 #endif /* TEST_FTS */
204 #if TEST_GETEXECNAME
205 #include <stdlib.h>
207 int
208 main(void)
210 const char * progname;
212 progname = getexecname();
213 return progname == NULL;
215 #endif /* TEST_GETEXECNAME */
216 #if TEST_GETPROGNAME
217 #include <stdlib.h>
219 int
220 main(void)
222 const char * progname;
224 progname = getprogname();
225 return progname == NULL;
227 #endif /* TEST_GETPROGNAME */
228 #if TEST_IMSG
229 #include <sys/types.h>
230 #include <sys/queue.h>
231 #include <sys/uio.h>
232 #include <stdint.h>
233 #include <imsg.h>
235 int
236 main(void)
238 struct imsgbuf ibuf;
240 imsg_init(&ibuf, 3);
241 imsg_clear(&ibuf);
242 return 0;
244 #endif /* TEST_IMSG */
245 #if TEST_INFTIM
246 /*
247 * Linux doesn't (always?) have this.
248 */
250 #include <poll.h>
251 #include <stdio.h>
253 int
254 main(void)
256 printf("INFTIM is defined to be %ld\n", (long)INFTIM);
257 return 0;
259 #endif /* TEST_INFTIM */
260 #if TEST_LANDLOCK
261 #include <linux/landlock.h>
262 #include <stdlib.h>
263 #include <sys/prctl.h>
264 #include <sys/syscall.h>
265 #include <unistd.h>
266 #include <stdint.h>
268 #ifndef landlock_create_ruleset
269 static inline int landlock_create_ruleset(const struct landlock_ruleset_attr *const attr,
270 const size_t size, const __u32 flags)
272 return syscall(__NR_landlock_create_ruleset, attr, size, flags);
274 #endif
276 #ifndef landlock_restrict_self
277 static inline int landlock_restrict_self(const int ruleset_fd,
278 const __u32 flags)
280 return syscall(__NR_landlock_restrict_self, ruleset_fd, flags);
282 #endif
284 int
285 main(void)
287 uint64_t mask = LANDLOCK_ACCESS_FS_READ_FILE | LANDLOCK_ACCESS_FS_WRITE_FILE;
288 struct landlock_ruleset_attr rules = {
289 .handled_access_fs = mask
290 };
291 int fd = landlock_create_ruleset(&rules, sizeof(rules), 0);
293 if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
294 return 1;
295 return landlock_restrict_self(fd, 0) ? 1 : 0;
297 #endif /* TEST_LANDLOCK */
298 #if TEST_LIB_SOCKET
299 #include <sys/socket.h>
301 int
302 main(void)
304 int fds[2], c;
306 c = socketpair(AF_UNIX, SOCK_STREAM, 0, fds);
307 return c == -1;
309 #endif /* TEST_LIB_SOCKET */
310 #if TEST_MD5
311 #include <sys/types.h>
312 #include <md5.h>
314 int main(void)
316 MD5_CTX ctx;
317 char result[MD5_DIGEST_STRING_LENGTH];
319 MD5Init(&ctx);
320 MD5Update(&ctx, (const unsigned char *)"abcd", 4);
321 MD5End(&ctx, result);
323 return 0;
325 #endif /* TEST_MD5 */
326 #if TEST_MEMMEM
327 #define _GNU_SOURCE
328 #include <string.h>
330 int
331 main(void)
333 char *a = memmem("hello, world", strlen("hello, world"), "world", strlen("world"));
334 return(NULL == a);
336 #endif /* TEST_MEMMEM */
337 #if TEST_MEMRCHR
338 #if defined(__linux__) || defined(__MINT__)
339 #define _GNU_SOURCE /* See test-*.c what needs this. */
340 #endif
341 #include <string.h>
343 int
344 main(void)
346 const char *buf = "abcdef";
347 void *res;
349 res = memrchr(buf, 'a', strlen(buf));
350 return(NULL == res ? 1 : 0);
352 #endif /* TEST_MEMRCHR */
353 #if TEST_MEMSET_S
354 #include <string.h>
356 int main(void)
358 char buf[10];
359 memset_s(buf, 0, 'c', sizeof(buf));
360 return 0;
362 #endif /* TEST_MEMSET_S */
363 #if TEST_MKFIFOAT
364 #include <sys/stat.h>
365 #include <fcntl.h>
367 int main(void) {
368 mkfifoat(AT_FDCWD, "this/path/should/not/exist", 0600);
369 return 0;
371 #endif /* TEST_MKFIFOAT */
372 #if TEST_MKNODAT
373 #include <sys/stat.h>
374 #include <fcntl.h>
376 int main(void) {
377 mknodat(AT_FDCWD, "this/path/should/not/exist", S_IFIFO | 0600, 0);
378 return 0;
380 #endif /* TEST_MKNODAT */
381 #if TEST_OPTRESET
382 #include <unistd.h>
384 int
385 main(int argc, char **argv)
387 optreset = 1;
388 getopt(argc, argv, "");
389 return 0;
391 #endif /* TEST_OPTRESET */
392 #if TEST_OSBYTEORDER_H
393 #include <libkern/OSByteOrder.h>
395 int
396 main(void)
398 return !OSSwapHostToLittleInt32(23);
400 #endif /* TEST_OSBYTEORDER_H */
401 #if TEST_PATH_MAX
402 /*
403 * POSIX allows PATH_MAX to not be defined, see
404 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html;
405 * the GNU Hurd is an example of a system not having it.
407 * Arguably, it would be better to test sysconf(_SC_PATH_MAX),
408 * but since the individual *.c files include "config.h" before
409 * <limits.h>, overriding an excessive value of PATH_MAX from
410 * "config.h" is impossible anyway, so for now, the simplest
411 * fix is to provide a value only on systems not having any.
412 * So far, we encountered no system defining PATH_MAX to an
413 * impractically large value, even though POSIX explicitly
414 * allows that.
416 * The real fix would be to replace all static buffers of size
417 * PATH_MAX by dynamically allocated buffers. But that is
418 * somewhat intrusive because it touches several files and
419 * because it requires changing struct mlink in mandocdb.c.
420 * So i'm postponing that for now.
421 */
423 #include <limits.h>
424 #include <stdio.h>
426 int
427 main(void)
429 printf("PATH_MAX is defined to be %ld\n", (long)PATH_MAX);
430 return 0;
432 #endif /* TEST_PATH_MAX */
433 #if TEST_PLEDGE
434 #include <unistd.h>
436 int
437 main(void)
439 return !!pledge("stdio", NULL);
441 #endif /* TEST_PLEDGE */
442 #if TEST_PROGRAM_INVOCATION_SHORT_NAME
443 #define _GNU_SOURCE /* See feature_test_macros(7) */
444 #include <errno.h>
446 int
447 main(void)
450 return !program_invocation_short_name;
452 #endif /* TEST_PROGRAM_INVOCATION_SHORT_NAME */
453 #if TEST_PR_SET_NAME
454 #include <sys/prctl.h>
456 int
457 main(void)
459 prctl(PR_SET_NAME, "foo");
460 return 0;
462 #endif /* TEST_PR_SET_NAME */
463 #if TEST_READPASSPHRASE
464 #include <stddef.h>
465 #include <readpassphrase.h>
467 int
468 main(void)
470 return !!readpassphrase("prompt: ", NULL, 0, 0);
472 #endif /* TEST_READPASSPHRASE */
473 #if TEST_REALLOCARRAY
474 #ifdef __NetBSD__
475 # define _OPENBSD_SOURCE
476 #endif
477 #include <stdlib.h>
479 int
480 main(void)
482 return !reallocarray(NULL, 2, 2);
484 #endif /* TEST_REALLOCARRAY */
485 #if TEST_RECALLOCARRAY
486 #include <stdlib.h>
488 int
489 main(void)
491 return !recallocarray(NULL, 0, 2, 2);
493 #endif /* TEST_RECALLOCARRAY */
494 #if TEST_SANDBOX_INIT
495 #include <sandbox.h>
497 int
498 main(void)
500 char *ep;
501 int rc;
503 rc = sandbox_init(kSBXProfileNoInternet, SANDBOX_NAMED, &ep);
504 if (-1 == rc)
505 sandbox_free_error(ep);
506 return(-1 == rc);
508 #endif /* TEST_SANDBOX_INIT */
509 #if TEST_SETPROCTITLE
510 #include <stdlib.h>
512 int
513 main(void)
515 setproctitle("#%d test program", 7);
516 return 0;
518 #endif
519 #if TEST_SIO_FLUSH
520 #include <sndio.h>
522 int
523 main(void)
525 struct sio_hdl *hdl;
526 hdl = sio_open(SIO_DEVANY, SIO_PLAY, 1);
527 sio_flush(hdl);
528 sio_close(hdl);
530 #endif /* TEST_SIO_FLUSH */
531 #if TEST_SCAN_SCALED
532 #include <util.h>
534 int
535 main(void)
537 char *cinput = (char *)"1.5K", buf[FMT_SCALED_STRSIZE];
538 long long ninput = 10483892, result;
539 return scan_scaled(cinput, &result) == 0;
541 #endif /* TEST_SCAN_SCALED */
542 #if TEST_SECCOMP_FILTER
543 #include <sys/prctl.h>
544 #include <linux/seccomp.h>
545 #include <errno.h>
547 int
548 main(void)
551 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
552 return(EFAULT == errno ? 0 : 1);
554 #endif /* TEST_SECCOMP_FILTER */
555 #if TEST_SETRESGID
556 #define _GNU_SOURCE /* linux */
557 #include <sys/types.h>
558 #include <unistd.h>
560 int
561 main(void)
563 return setresgid(-1, -1, -1) == -1;
565 #endif /* TEST_SETRESGID */
566 #if TEST_SETRESUID
567 #define _GNU_SOURCE /* linux */
568 #include <sys/types.h>
569 #include <unistd.h>
571 int
572 main(void)
574 return setresuid(-1, -1, -1) == -1;
576 #endif /* TEST_SETRESUID */
577 #if TEST_SHA2
578 #include <sys/types.h>
579 #include <sha2.h>
581 int main(void)
583 SHA2_CTX ctx;
584 char result[SHA256_DIGEST_STRING_LENGTH];
586 SHA256Init(&ctx);
587 SHA256Update(&ctx, (const unsigned char *)"abcd", 4);
588 SHA256End(&ctx, result);
590 return 0;
592 #endif /* TEST_SHA2 */
593 #if TEST_SOCK_NONBLOCK
594 /*
595 * Linux doesn't (always?) have this.
596 */
598 #include <sys/socket.h>
600 int
601 main(void)
603 int fd[2];
604 socketpair(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0, fd);
605 return 0;
607 #endif /* TEST_SOCK_NONBLOCK */
608 #if TEST_STATIC
609 int
610 main(void)
612 return 0; /* not meant to do anything */
614 #endif /* TEST_STATIC */
615 #if TEST_STRLCAT
616 #include <string.h>
618 int
619 main(void)
621 char buf[3] = "a";
622 return ! (strlcat(buf, "b", sizeof(buf)) == 2 &&
623 buf[0] == 'a' && buf[1] == 'b' && buf[2] == '\0');
625 #endif /* TEST_STRLCAT */
626 #if TEST_STRLCPY
627 #include <string.h>
629 int
630 main(void)
632 char buf[2] = "";
633 return ! (strlcpy(buf, "a", sizeof(buf)) == 1 &&
634 buf[0] == 'a' && buf[1] == '\0');
636 #endif /* TEST_STRLCPY */
637 #if TEST_STRNDUP
638 #include <string.h>
640 int
641 main(void)
643 const char *foo = "bar";
644 char *baz;
646 baz = strndup(foo, 1);
647 return(0 != strcmp(baz, "b"));
649 #endif /* TEST_STRNDUP */
650 #if TEST_STRNLEN
651 #include <string.h>
653 int
654 main(void)
656 const char *foo = "bar";
657 size_t sz;
659 sz = strnlen(foo, 1);
660 return(1 != sz);
662 #endif /* TEST_STRNLEN */
663 #if TEST_STRTONUM
664 /*
665 * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
667 * Permission to use, copy, modify, and distribute this software for any
668 * purpose with or without fee is hereby granted, provided that the above
669 * copyright notice and this permission notice appear in all copies.
671 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
672 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
673 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
674 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
675 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
676 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
677 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
678 */
679 #ifdef __NetBSD__
680 # define _OPENBSD_SOURCE
681 #endif
682 #include <stdlib.h>
684 int
685 main(void)
687 const char *errstr;
689 if (strtonum("1", 0, 2, &errstr) != 1)
690 return 1;
691 if (errstr != NULL)
692 return 2;
693 if (strtonum("1x", 0, 2, &errstr) != 0)
694 return 3;
695 if (errstr == NULL)
696 return 4;
697 if (strtonum("2", 0, 1, &errstr) != 0)
698 return 5;
699 if (errstr == NULL)
700 return 6;
701 if (strtonum("0", 1, 2, &errstr) != 0)
702 return 7;
703 if (errstr == NULL)
704 return 8;
705 return 0;
707 #endif /* TEST_STRTONUM */
708 #if TEST_SYS_BYTEORDER_H
709 #include <sys/byteorder.h>
711 int
712 main(void)
714 return !LE_32(23);
716 #endif /* TEST_SYS_BYTEORDER_H */
717 #if TEST_SYS_ENDIAN_H
718 #include <sys/endian.h>
720 int
721 main(void)
723 return !htole32(23);
725 #endif /* TEST_SYS_ENDIAN_H */
726 #if TEST_SYS_MKDEV_H
727 #include <sys/types.h>
728 #include <sys/mkdev.h>
730 int
731 main(void)
733 return !minor(0);
735 #endif /* TEST_SYS_MKDEV_H */
736 #if TEST_SYS_FILE
737 #include <sys/file.h>
739 int
740 main(void)
742 flock(0, LOCK_SH|LOCK_NB);
743 return 0;
745 #endif /* TEST_SYS_FILE */
746 #if TEST_SYS_QUEUE
747 #include <sys/queue.h>
748 #include <stddef.h>
750 struct foo {
751 int bar;
752 TAILQ_ENTRY(foo) entries;
753 };
755 TAILQ_HEAD(fooq, foo);
757 int
758 main(void)
760 struct fooq foo_q, bar_q;
761 struct foo *p, *tmp;
762 int i = 0;
764 TAILQ_INIT(&foo_q);
765 TAILQ_INIT(&bar_q);
767 /*
768 * Use TAILQ_FOREACH_SAFE because some systems (e.g., Linux)
769 * have TAILQ_FOREACH but not the safe variant.
770 */
772 TAILQ_FOREACH_SAFE(p, &foo_q, entries, tmp)
773 p->bar = i++;
775 /* Test for newer macros as well. */
777 TAILQ_CONCAT(&foo_q, &bar_q, entries);
778 return 0;
780 #endif /* TEST_SYS_QUEUE */
781 #if TEST_SYS_SYSMACROS_H
782 #include <sys/sysmacros.h>
784 int
785 main(void)
787 return !minor(0);
789 #endif /* TEST_SYS_SYSMACROS_H */
790 #if TEST_SYS_TREE
791 #include <sys/tree.h>
792 #include <stdlib.h>
794 struct node {
795 RB_ENTRY(node) entry;
796 int i;
797 };
799 static int
800 intcmp(struct node *e1, struct node *e2)
802 return (e1->i < e2->i ? -1 : e1->i > e2->i);
805 RB_HEAD(inttree, node) head = RB_INITIALIZER(&head);
806 RB_PROTOTYPE(inttree, node, entry, intcmp)
807 RB_GENERATE(inttree, node, entry, intcmp)
809 int testdata[] = {
810 20, 16, 17, 13, 3, 6, 1, 8, 2, 4
811 };
813 int
814 main(void)
816 size_t i;
817 struct node *n;
819 for (i = 0; i < sizeof(testdata) / sizeof(testdata[0]); i++) {
820 if ((n = malloc(sizeof(struct node))) == NULL)
821 return 1;
822 n->i = testdata[i];
823 RB_INSERT(inttree, &head, n);
826 return 0;
829 #endif /* TEST_SYS_TREE */
830 #if TEST_UNVEIL
831 #include <unistd.h>
833 int
834 main(void)
836 return -1 != unveil(NULL, NULL);
838 #endif /* TEST_UNVEIL */
839 #if TEST_WAIT_ANY
840 #include <sys/wait.h>
842 int
843 main(void)
845 int st;
847 return waitpid(WAIT_ANY, &st, WNOHANG) != -1;
849 #endif /* TEST_WAIT_ANY */
850 #if TEST_LIBEVENT
851 #include <event.h>
853 int
854 main(void)
856 struct event ev;
858 event_set(&ev, 0, EV_READ, NULL, NULL);
859 event_add(&ev, NULL);
860 event_del(&ev);
861 return 0;
863 #endif /* TEST_LIBEVENT */
864 #if TEST_LIBEVENT2
865 #include <event2/event.h>
866 #include <event2/event_compat.h>
867 #include <event2/event_struct.h>
868 #include <event2/buffer.h>
869 #include <event2/buffer_compat.h>
870 #include <event2/bufferevent.h>
871 #include <event2/bufferevent_struct.h>
872 #include <event2/bufferevent_compat.h>
874 int
875 main(void)
877 struct event ev;
879 event_set(&ev, 0, EV_READ, NULL, NULL);
880 event_add(&ev, NULL);
881 event_del(&ev);
882 return 0;
884 #endif /* TEST_LIBEVENT2 */
885 #if TEST_LIB_FLAC
886 #include <FLAC/stream_decoder.h>
888 int
889 main(void)
891 FLAC__StreamDecoder *decoder = NULL;
892 FLAC__StreamDecoderInitStatus init_status;
894 decoder = FLAC__stream_decoder_new();
895 FLAC__stream_decoder_delete(decoder);
896 return 0;
898 #endif /* TEST_LIB_FLAC */
899 #if TEST_LIB_MPG123
900 #include <mpg123.h>
902 int
903 main(void)
905 mpg123_handle *mh;
907 mh = mpg123_new(NULL, NULL);
908 mpg123_delete(mh);
909 return 0;
911 #endif/* TEST_LIB_MPG123 */
912 #if TEST_LIB_OPUSFILE
913 #include <stdio.h>
914 #include <opusfile.h>
916 int
917 main(void)
919 FILE *f;
920 OggOpusFile *of;
921 OpusFileCallbacks cb = {NULL, NULL, NULL, NULL};
922 int r;
924 f = op_fdopen(&cb, 0, "r");
925 of = op_open_callbacks(f, &cb, NULL, 0, &r);
926 op_free(of);
927 return 0;
929 #endif /* TEST_LIB_OPUSFILE */
930 #if TEST_LIB_VORBISFILE
931 #include <stdio.h>
932 #include <vorbis/vorbisfile.h>
934 int
935 main(void)
937 OggVorbis_File vf;
939 ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE);
940 ov_clear(&vf);
941 return 0;
943 #endif /* TEST_LIB_VORBISFILE */
944 #if TEST_LIB_SNDIO
945 #include <sndio.h>
947 int
948 main(void)
950 struct sio_hdl *hdl;
951 hdl = sio_open(SIO_DEVANY, SIO_PLAY, 1);
952 sio_close(hdl);
954 #endif /* TEST_LIB_SNDIO */