Debian Codegraph @

debian/tests/build

raw
1 #!/bin/sh
2 # autopkgtest check: Build and run a program against libmysqlclient, to verify that the
3 # headers and pkg-config file are installed correctly
4 # (C) 2012 Canonical Ltd.
5 # Author: Daniel Kessel <[email protected]>
6
7 echo "test 'build' starting"
8 set -e
9
10 WORKDIR=$(mktemp -d)
11 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
12 cd $WORKDIR
13
14 cat <<EOF > libmysqltest.c
15 #include <stdio.h>
16 #include <mysql.h>
17
18 int main()
19 {
20 if (mysql_library_init(0, NULL, NULL)) {
21 fprintf(stderr, "failed to initialize mysql client library\n");
22 return 1;
23 }
24
25 mysql_library_end();
26 return 0;
27 }
28 EOF
29
30 echo "building..."
31 gcc -o libmysqltest libmysqltest.c `/usr/bin/mysql_config --cflags --libs` -Wall -Werror
32 echo "build: OK"
33 [ -x libmysqltest ]
34 ./libmysqltest
35 echo "run: OK"