diff options
Diffstat (limited to '')
-rw-r--r-- | debian/tests/control | 31 | ||||
-rwxr-xr-x | debian/tests/libc-link | 30 | ||||
-rwxr-xr-x | debian/tests/libgfortran-link | 22 | ||||
-rwxr-xr-x | debian/tests/libgm2-link | 26 | ||||
-rwxr-xr-x | debian/tests/libgnat-link | 24 | ||||
-rwxr-xr-x | debian/tests/libgo-link | 25 | ||||
-rwxr-xr-x | debian/tests/libgomp-link | 76 | ||||
-rwxr-xr-x | debian/tests/libgphobos-link | 32 | ||||
-rwxr-xr-x | debian/tests/libstdcxx-link | 26 | ||||
-rwxr-xr-x | debian/tests/runtime-libs | 29 | ||||
-rwxr-xr-x | debian/tests/shlib-build | 45 |
11 files changed, 366 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..2602301 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,31 @@ +Tests: runtime-libs +Depends: apt, python3-minimal +Restrictions: allow-stderr + +Tests: libc-link +Depends: gcc-13, libc6-dev | libc-dev + +Tests: libstdcxx-link +Depends: g++-13 + +Tests: libgfortran-link +Depends: gfortran-13 + +Tests: libgo-link +Depends: gccgo-13 + +Tests: libgomp-link +Depends: gfortran-13, gcc-13 + +Tests: libgm2-link +Depends: gm2-13 + +Tests: libgnat-link +Depends: gnat-13 + +Tests: libgphobos-link +Depends: gdc-13 +Architecture: !powerpc !ppc64 !ppc64el + +Tests: shlib-build +Depends: gcc-13, libc6-dev | libc-dev diff --git a/debian/tests/libc-link b/debian/tests/libc-link new file mode 100755 index 0000000..fbe4224 --- /dev/null +++ b/debian/tests/libc-link @@ -0,0 +1,30 @@ +#!/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 + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +CC=gcc-$BV + +cd "$AUTOPKGTEST_TMP" +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..70bf6b2 --- /dev/null +++ b/debian/tests/libgfortran-link @@ -0,0 +1,22 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgfortran, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +F95=gfortran-$BV + +cd "$AUTOPKGTEST_TMP" +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/libgm2-link b/debian/tests/libgm2-link new file mode 100755 index 0000000..2f975c3 --- /dev/null +++ b/debian/tests/libgm2-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 + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +GM2=gm2-$BV + +cd "$AUTOPKGTEST_TMP" +cat <<EOF > hello.mod +MODULE hello ; + +FROM StrIO IMPORT WriteString, WriteLn ; + +BEGIN + WriteString ('hello world') ; WriteLn +END hello. +EOF + +$GM2 -g -o hello hello.mod +echo "build: OK" +ldd hello +[ -x hello ] +./hello +echo "run: OK" diff --git a/debian/tests/libgnat-link b/debian/tests/libgnat-link new file mode 100755 index 0000000..c357a55 --- /dev/null +++ b/debian/tests/libgnat-link @@ -0,0 +1,24 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgnat, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +GNATMAKE=gnatmake-$BV + +cd "$AUTOPKGTEST_TMP" +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..76a3f2a --- /dev/null +++ b/debian/tests/libgo-link @@ -0,0 +1,25 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgo, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +GO=go-$BV + +cd "$AUTOPKGTEST_TMP" +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..ec7dbc4 --- /dev/null +++ b/debian/tests/libgomp-link @@ -0,0 +1,76 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgfortran, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +CC=gcc-$BV +F95=gfortran-$BV + +cd "$AUTOPKGTEST_TMP" +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/libgphobos-link b/debian/tests/libgphobos-link new file mode 100755 index 0000000..8c1fe26 --- /dev/null +++ b/debian/tests/libgphobos-link @@ -0,0 +1,32 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libgphobos, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +GDC=gdc-$BV + +if ! dpkg -l libgphobos-$BV-dev >/dev/null 2>&1; then + echo "skip test on architecture without libgphobos-dev" + exit 0 +fi + +cd "$AUTOPKGTEST_TMP" +cat <<EOF > libgphobos.d +immutable str = "Hello, World!"; + +void main() +{ + // Scoped and selective imports can be used. + import std.stdio : writeln; + writeln(str); +} +EOF + +$GDC -o dtest libgphobos.d +echo "build: OK" +ldd dtest +[ -x dtest ] +./dtest +echo "run: OK" diff --git a/debian/tests/libstdcxx-link b/debian/tests/libstdcxx-link new file mode 100755 index 0000000..ca39928 --- /dev/null +++ b/debian/tests/libstdcxx-link @@ -0,0 +1,26 @@ +#!/bin/sh +# autopkgtest check: Build and run a simple program against libstdc++, +# to verify basic compile-time and run-time linking functionality. + +set -e + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +CXX=g++-$BV + +cd "$AUTOPKGTEST_TMP" +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..b849ae1 --- /dev/null +++ b/debian/tests/runtime-libs @@ -0,0 +1,29 @@ +#!/bin/sh +# autopkgtest check: start a "simple" program and check that +# dynamic loading of modules works + +set -e + + +cd "$AUTOPKGTEST_TMP" + +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 libgcc-s1 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..751fadf --- /dev/null +++ b/debian/tests/shlib-build @@ -0,0 +1,45 @@ +#!/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 + +BV=$(sed '/^Depends: gcc-\([0-9.]\+\).*/!d;s//\1/;q' debian/tests/control) +CC=gcc-$BV + +cd "$AUTOPKGTEST_TMP" +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" |