| 1 | #!/bin/sh |
| 2 | # autopkgtest check: Build and run a simple program against libc, to verify |
| 3 | # basic binutils compile-time and run-time linking functionality. |
| 4 | # |
| 5 | # (C) 2012 Canonical Ltd. |
| 6 | # Author: Martin Pitt <[email protected]> |
| 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 > libctest.c |
| 14 | #include <string.h> |
| 15 | #include <assert.h> |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | assert (1 > 0); |
| 20 | assert (strcmp ("hello", "hello") == 0); |
| 21 | return 0; |
| 22 | } |
| 23 | EOF |
| 24 | |
| 25 | gcc -fuse-ld=gold -o libctest libctest.c |
| 26 | echo "build: OK" |
| 27 | [ -x libctest ] |
| 28 | ./libctest |
| 29 | echo "run: OK" |