Debian Codegraph @

debian/tests/test-simple-build-link

raw
1 #!/bin/sh
2
3 set -e
4 at_exit() {
5 set +x
6 echo "info: test exiting, removing temp files"
7 rm -f test-simple-build-link.ogg test-simple-build-link.c \
8 test-simple-build-link-prog
9 }
10 trap at_exit INT TERM EXIT
11 set -x
12
13 cd $AUTOPKGTEST_TMP
14
15 if type xvalgrind >/dev/null 2>&1 ; then
16 VALGRIND=valgrind
17 fi
18
19 head -c 500000 /dev/zero | oggenc -Q -r -o test-simple-build-link.ogg -
20
21 # This is just a simple code example to compile to verify the headers
22 # exist, are includable and the library is linkable. It should be
23 # extended to really use the library to test a bit more of the
24 # package.
25 cat > test-simple-build-link.c <<EOF
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <oggz/oggz.h>
30 int
31 main (int argc, char ** argv)
32 {
33 OGGZ * reader;
34
35 /* quiet down compiler about unused arguments */
36 if (1 < argc)
37 return (strlen(argv[1]) != 0);
38
39 reader = oggz_open("test-simple-build-link.ogg", OGGZ_READ);
40 if ( oggz_run (reader) != 0 ) {
41 fprintf(stderr, "error: oggz_run did not complete");
42 exit (1);
43 }
44 if ( oggz_close (reader) != 0 ) {
45 fprintf(stderr, "error: oggz_close did not complete");
46 exit (1);
47 }
48 printf("info: program ran as it should\n");
49
50 exit (0);
51 }
52 EOF
53
54 gcc -o test-simple-build-link-prog -Wall -Wextra test-simple-build-link.c -loggz
55
56 ${VALGRIND} ./test-simple-build-link-prog