| 1 |
#! /bin/sh |
| 2 |
# autopkgtest check: Build and run a program against libpipeline, to verify |
| 3 |
# that 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 |
CROSS_COMPILE="${DEB_HOST_GNU_TYPE:+$DEB_HOST_GNU_TYPE-}" |
| 10 |
|
| 11 |
WORKDIR="$(mktemp -d)" |
| 12 |
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM |
| 13 |
cd "$WORKDIR" |
| 14 |
cat <<EOF > libpipeline_test.c |
| 15 |
#include <pipeline.h> |
| 16 |
#include <assert.h> |
| 17 |
|
| 18 |
int main (int argc, char **argv) |
| 19 |
{ |
| 20 |
pipeline *p; |
| 21 |
p = pipeline_new (); |
| 22 |
pipeline_command_args (p, "true", NULL); |
| 23 |
assert (pipeline_run (p) == 0); |
| 24 |
return 0; |
| 25 |
} |
| 26 |
|
| 27 |
EOF |
| 28 |
|
| 29 |
${CROSS_COMPILE}gcc -o libpipeline_test libpipeline_test.c \ |
| 30 |
$(${CROSS_COMPILE}pkg-config --cflags --libs libpipeline) -Wall -Werror |
| 31 |
echo "build: OK" |
| 32 |
[ -x libpipeline_test ] |
| 33 |
./libpipeline_test |
| 34 |
echo "run: OK" |