diff options
Diffstat (limited to 'debian/tests')
-rw-r--r-- | debian/tests/control | 24 | ||||
-rwxr-xr-x | debian/tests/libc-link | 31 | ||||
-rwxr-xr-x | debian/tests/libgfortran-link | 23 | ||||
-rwxr-xr-x | debian/tests/libgnat-link | 25 | ||||
-rwxr-xr-x | debian/tests/libgo-link | 26 | ||||
-rwxr-xr-x | debian/tests/libgomp-link | 77 | ||||
-rwxr-xr-x | debian/tests/libstdcxx-link | 27 | ||||
-rwxr-xr-x | debian/tests/runtime-libs | 31 | ||||
-rwxr-xr-x | debian/tests/shlib-build | 46 |
9 files changed, 310 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..95c77af --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,24 @@ +Tests: runtime-libs +Depends: apt, python3-minimal +Restrictions: allow-stderr + +Tests: libc-link +Depends: gcc-9, libc6-dev | libc-dev + +Tests: libstdcxx-link +Depends: g++-9 + +Tests: libgfortran-link +Depends: gfortran-9 + +Tests: libgo-link +Depends: gccgo-9 + +Tests: libgomp-link +Depends: gfortran-9, gcc-9 + +Tests: libgnat-link +Depends: gnat-9 + +Tests: shlib-build +Depends: gcc-9, libc6-dev | libc-dev diff --git a/debian/tests/libc-link b/debian/tests/libc-link new file mode 100755 index 0000000..e224a31 --- /dev/null +++ b/debian/tests/libc-link @@ -0,0 +1,31 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libc, to verify +# basic compile-time and run-time linking functionality. +# +# (C) 2012 Canonical Ltd. +# Author: Martin Pitt <martin.pitt@ubuntu.com> + +set -e + +CC=gcc-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > libctest.c +#include <string.h> +#include <assert.h> + +int main() +{ + assert (1 > 0); + assert (strcmp ("hello", "hello") == 0); + return 0; +} +EOF + +$CC -o libctest libctest.c +echo "build: OK" +[ -x libctest ] +./libctest +echo "run: OK" diff --git a/debian/tests/libgfortran-link b/debian/tests/libgfortran-link new file mode 100755 index 0000000..cc217bb --- /dev/null +++ b/debian/tests/libgfortran-link @@ -0,0 +1,23 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgfortran, +# to verify basic compile-time and run-time linking functionality. + +set -e + +F95=gfortran-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > libgfortran.f + program hello + print *, "Hello World!" + end program hello +EOF + +$F95 -o ftest libgfortran.f +echo "build: OK" +ldd ftest +[ -x ftest ] +./ftest +echo "run: OK" diff --git a/debian/tests/libgnat-link b/debian/tests/libgnat-link new file mode 100755 index 0000000..d741759 --- /dev/null +++ b/debian/tests/libgnat-link @@ -0,0 +1,25 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgnat, +# to verify basic compile-time and run-time linking functionality. + +set -e + +GNATMAKE=gnatmake-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > hello.adb +with Ada.Text_IO; use Ada.Text_IO; +procedure Hello is +begin + Put_Line("Hello gnatmake."); +end Hello; +EOF + +$GNATMAKE -eS -vm -o adatest hello.adb +echo "build: OK" +ldd adatest +[ -x adatest ] +./adatest +echo "run: OK" diff --git a/debian/tests/libgo-link b/debian/tests/libgo-link new file mode 100755 index 0000000..e83076f --- /dev/null +++ b/debian/tests/libgo-link @@ -0,0 +1,26 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgo, +# to verify basic compile-time and run-time linking functionality. + +set -e + +GO=go-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > hello.go +package main +import "fmt" +func main() { + fmt.Println("hello world") +} +EOF + +$GO run hello.go +$GO build hello.go +echo "build: OK" +ldd hello +[ -x hello ] +./hello +echo "run: OK" diff --git a/debian/tests/libgomp-link b/debian/tests/libgomp-link new file mode 100755 index 0000000..2dad551 --- /dev/null +++ b/debian/tests/libgomp-link @@ -0,0 +1,77 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgfortran, +# to verify basic compile-time and run-time linking functionality. + +set -e + +CC=gcc-9 +F95=gfortran-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > hello-gomp.c +#include <omp.h> +#include <stdio.h> +#include <stdlib.h> +int main (int argc, char *argv[]) { + +int nthreads, tid; + +/* Fork a team of threads giving them their own copies of variables */ +#pragma omp parallel private(nthreads, tid) + { + + /* Obtain thread number */ + tid = omp_get_thread_num(); + printf("Hello World from thread = %d\n", tid); + + /* Only master thread does this */ + if (tid == 0) + { + nthreads = omp_get_num_threads(); + printf("Number of threads = %d\n", nthreads); + } + + } /* All threads join master thread and disband */ +} +EOF + +$CC -fopenmp -o gctest hello-gomp.c +echo "build: OK" +ldd gctest +[ -x gctest ] +./gctest +echo "run: OK" + +cat <<EOF > hello-gomp.f + program omp_par_do + implicit none + + integer, parameter :: n = 100 + real, dimension(n) :: dat, result + integer :: i + + !$OMP PARALLEL DO + do i = 1, n + result(i) = my_function(dat(i)) + end do + !$OMP END PARALLEL DO + + contains + + function my_function(d) result(y) + real, intent(in) :: d + real :: y + + ! do something complex with data to calculate y + end function my_function + end program omp_par_do +EOF + +$F95 -fopenmp -o gftest hello-gomp.f +echo "build: OK" +ldd gftest +[ -x gftest ] +./gftest +echo "run: OK" diff --git a/debian/tests/libstdcxx-link b/debian/tests/libstdcxx-link new file mode 100755 index 0000000..7718974 --- /dev/null +++ b/debian/tests/libstdcxx-link @@ -0,0 +1,27 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libstdc++, +# to verify basic compile-time and run-time linking functionality. + +set -e + +CXX=g++-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > libstdcxx.cc +#include <iostream> +using namespace std; + +int main() { + cout << "Hello! World!\n"; + return 0; +} +EOF + +$CXX -o cxxtest libstdcxx.cc +echo "build: OK" +ldd cxxtest +[ -x cxxtest ] +./cxxtest +echo "run: OK" diff --git a/debian/tests/runtime-libs b/debian/tests/runtime-libs new file mode 100755 index 0000000..e4e9fc6 --- /dev/null +++ b/debian/tests/runtime-libs @@ -0,0 +1,31 @@ +#!/bin/sh +# autopkgtest check: start a "simple" program and check that +# dynamic loading of modules works + +set -e + + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR + +echo "Running exexutable linked with libgcc and libstdc++ (apt)..." +if [ -x /usr/bin/apt ]; then + apt=/usr/bin/apt +elif [ -x /bin/apt ]; then + apt=/bin/apt +else + echo "apt not found" + exit 1 +fi + +ldd $apt +apt show libgcc1 libstdc++6 + +echo "Running dynamically linked executable (python3)..." +python3 -c 'print("Hello World!")' +echo "OK" + +echo "Loading extension module..." +python3 -c 'import _hashlib; print(_hashlib.__dict__)' +echo "OK" diff --git a/debian/tests/shlib-build b/debian/tests/shlib-build new file mode 100755 index 0000000..eb16453 --- /dev/null +++ b/debian/tests/shlib-build @@ -0,0 +1,46 @@ +#!/bin/sh +# autopkgtest check: Build and link against a simple shared library, to test +# basic binutils compile-time and run-time linking functionality. +# +# (C) 2012 Canonical Ltd. +# Author: Martin Pitt <martin.pitt@ubuntu.com> + +set -e + +CC=gcc-9 + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat <<EOF > testlib.c + +int ultimate_answer() +{ + return 42; +} +EOF + +$CC -Wall -Werror -shared -o libultimate.so testlib.c +echo "library build: OK" + +# should export the symbol +nm -D libultimate.so | grep -q 'T ultimate_answer' + +# link it against a program +cat <<EOF > testprog.c +#include <assert.h> + +int ultimate_answer(); + +int main() +{ + assert (ultimate_answer() == 42); + return 0; +} +EOF + +$CC -Wall -Werror -L . -o testprog testprog.c -lultimate +echo "program build: OK" +[ -x testprog ] +LD_LIBRARY_PATH=. ./testprog +echo "run: OK" |