~ubuntu-branches/ubuntu/raring/libcaca/raring

« back to all changes in this revision

Viewing changes to debian/tests/build

  • Committer: Martin Pitt
  • Date: 2013-02-12 14:53:12 UTC
  • mfrom: (26.1.1 libcaca)
  • Revision ID: martin@piware.de-20130212145312-i5m282a8pmkkqdt6
Add simple autopkgtest to the package. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# autopkgtest check: Build and run a program against libcaca, to verify that 
 
3
# the headers and pkg-config file are installed correctly
 
4
# (C) 2013 Canonical Ltd.
 
5
# Author: Vibhav Pant <vibhavp@ubuntu.com>
 
6
 
 
7
set -e
 
8
 
 
9
WORKDIR=$(mktemp -d)
 
10
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 
11
cd $WORKDIR
 
12
cat <<EOF > caca_test.c
 
13
#include <caca.h>
 
14
#include <stdio.h>
 
15
#include <assert.h>
 
16
 
 
17
int main(void) 
 
18
{
 
19
        caca_canvas_t *c;
 
20
        printf("Testing libcaca version %s \n", caca_get_version());
 
21
 
 
22
        c = caca_create_canvas(20,30);
 
23
        assert(c != NULL);
 
24
 
 
25
        assert(caca_free_canvas(c) != -1);
 
26
 
 
27
        return 0;
 
28
}
 
29
EOF
 
30
 
 
31
gcc -o caca_test caca_test.c `pkg-config --cflags --libs caca` -Wall -Werror
 
32
echo "build: OK"
 
33
[ -x caca_test ]
 
34
export TERM=linux
 
35
./caca_test
 
36
echo "run: OK"