| 1 | #!/bin/sh |
| 2 | # autopkgtest check: Build and run a program against libiptcdata, to verify that |
| 3 | # the headers and pkg-config file are installed correctly |
| 4 | # (C) 2013 Vibhav Pant |
| 5 | # Author: Vibhav Pant <[email protected]> |
| 6 | |
| 7 | set -e |
| 8 | |
| 9 | MYDIR=$(dirname $(readlink -f $0)) |
| 10 | WORKDIR=$(mktemp -d) |
| 11 | trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM |
| 12 | cd $WORKDIR |
| 13 | cat <<EOF > libiptcdata_test.c |
| 14 | #include <libiptcdata/iptc-jpeg.h> |
| 15 | #include <stdio.h> |
| 16 | #include <assert.h> |
| 17 | |
| 18 | int main(void) |
| 19 | { |
| 20 | unsigned char buf[256*256]; |
| 21 | FILE *file; |
| 22 | |
| 23 | file = fopen("$WORKDIR/sample.jpeg", "r"); |
| 24 | assert(iptc_jpeg_read_ps3(file, buf, sizeof(buf)) == 0); |
| 25 | assert(buf != NULL); |
| 26 | return 0; |
| 27 | } |
| 28 | EOF |
| 29 | |
| 30 | gcc -o libiptcdata_test libiptcdata_test.c -liptcdata -Wall -Werror |
| 31 | echo "build: OK" |
| 32 | uudecode -o $WORKDIR/sample.jpeg $MYDIR/sample.jpeg.base64 |
| 33 | [ -x libiptcdata_test ] |
| 34 | ./libiptcdata_test |
| 35 | echo "run: OK" |