File: test-build

package info (click to toggle)
liburing 0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, bullseye-backports
  • size: 856 kB
  • sloc: ansic: 15,645; sh: 477; makefile: 241; cpp: 32
file content (53 lines) | stat: -rwxr-xr-x 1,045 bytes parent folder | download | duplicates (4)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

set -e
exec 2>&1
set -u
set -x

if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
  CC="$DEB_HOST_GNU_TYPE-gcc"
  PKG_CONFIG="$DEB_HOST_GNU_TYPE-pkg-config"
else
  CC=gcc
  PKG_CONFIG=pkg-config
fi

exdir=/usr/share/doc/liburing-dev/examples

if ! [ -d $exdir ]; then
  echo "SKIP: examples directory is missing."
  exit 77
fi

CFLAGS="-Wall -g -O2 -D_GNU_SOURCE"
LIBS=$($PKG_CONFIG --libs liburing)
LIBS_STATIC=$($PKG_CONFIG --static --libs liburing)

cd "$AUTOPKGTEST_TMP"

## Test building example code against the installed library.
for t in io_uring-test io_uring-cp link-cp ucontext-cp; do
  $CC $CFLAGS -o $t $exdir/$t.c $LIBS
  test -x ./$t

  $CC $CFLAGS -static -o $t-static $exdir/$t.c $LIBS_STATIC
  test -x ./$t-static
done

## Test running the example code.

# One argument tests.
for t in io_uring-test; do
  ./$t        $t
  ./$t-static $t-static
done

# Two argument tests.
for t in io_uring-cp link-cp ucontext-cp; do
  ./$t $t $t.new
  cmp $t $t.new

  ./$t-static $t-static $t-static.new
  cmp $t-static $t-static.new
done