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