File: build-login

package info (click to toggle)
systemd 232-25+deb9u11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 46,164 kB
  • sloc: ansic: 290,592; xml: 49,217; makefile: 5,503; sh: 4,031; python: 2,596; perl: 1,838
file content (38 lines) | stat: -rwxr-xr-x 836 bytes parent folder | download | duplicates (7)
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
36
37
38
#!/bin/sh
# autopkgtest check: Test build against libsystemd-login-dev
# (C) 2014 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > loginmonitor.c
#include <assert.h>
#include <stdio.h>
#include <systemd/sd-login.h>

int main(int argc, char **argv)
{
    sd_login_monitor* mon = NULL;
    int res;

    res = sd_login_monitor_new(NULL, &mon);
    if (res < 0) {
        fprintf(stderr, "sd_login_monitor_new failed with value %i\n", res);
        return 1;
    }

    assert(sd_login_monitor_get_fd(mon) > 0);
    sd_login_monitor_unref(mon);

    return 0;
}
EOF

gcc -Wall -Werror -o loginmonitor loginmonitor.c `pkg-config --cflags --libs libsystemd`
echo "build: OK"
[ -x loginmonitor ]
./loginmonitor
echo "run: OK"