~ubuntu-branches/ubuntu/utopic/binutils-arm64-cross/utopic

« back to all changes in this revision

Viewing changes to binutils-2.23.52.20130611/debian/tests/shlib-build

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-06-20 17:38:09 UTC
  • Revision ID: package-import@ubuntu.com-20130620173809-app8lzgvymy5fg6c
Tags: 0.7
Build-depend on binutils-source (>= 2.23.52.20130620-1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# autopkgtest check: Build and link against a simple shared library, to test
 
3
# basic binutils compile-time and run-time linking functionality.
 
4
#
 
5
# (C) 2012 Canonical Ltd.
 
6
# Author: Martin Pitt <martin.pitt@ubuntu.com>
 
7
 
 
8
set -e
 
9
 
 
10
WORKDIR=$(mktemp -d)
 
11
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 
12
cd $WORKDIR
 
13
cat <<EOF > testlib.c
 
14
 
 
15
int ultimate_answer()
 
16
{
 
17
    return 42;
 
18
}
 
19
EOF
 
20
 
 
21
gcc -Wall -Werror -shared -o libultimate.so testlib.c
 
22
echo "library build: OK"
 
23
 
 
24
# should export the symbol
 
25
nm -D libultimate.so | grep -q 'T ultimate_answer'
 
26
 
 
27
# link it against a program
 
28
cat <<EOF > testprog.c
 
29
#include <assert.h>
 
30
 
 
31
int ultimate_answer();
 
32
 
 
33
int main()
 
34
{
 
35
    assert (ultimate_answer() == 42);
 
36
    return 0;
 
37
}
 
38
EOF
 
39
 
 
40
gcc -Wall -Werror -L . -o testprog testprog.c -lultimate
 
41
echo "program build: OK"
 
42
[ -x testprog ]
 
43
LD_LIBRARY_PATH=. ./testprog
 
44
echo "run: OK"