Debian Codegraph @

debian/tests/build-login

raw
1 #!/bin/sh
2 # autopkgtest check: Test build against libsystemd-login-dev
3 # (C) 2014 Canonical Ltd.
4 # Author: Martin Pitt <[email protected]>
5
6 set -e
7
8 WORKDIR=$(mktemp -d)
9 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
10 cd $WORKDIR
11 cat <<EOF > loginmonitor.c
12 #include <assert.h>
13 #include <stdio.h>
14 #include <systemd/sd-login.h>
15
16 int main(int argc, char **argv)
17 {
18 sd_login_monitor* mon = NULL;
19 int res;
20
21 res = sd_login_monitor_new(NULL, &mon);
22 if (res < 0) {
23 fprintf(stderr, "sd_login_monitor_new failed with value %i\n", res);
24 return 1;
25 }
26
27 assert(sd_login_monitor_get_fd(mon) > 0);
28 sd_login_monitor_unref(mon);
29
30 return 0;
31 }
32 EOF
33
34 gcc -Wall -Werror -o loginmonitor loginmonitor.c `pkg-config --cflags --libs libsystemd`
35 echo "build: OK"
36 [ -x loginmonitor ]
37 ./loginmonitor
38 echo "run: OK"