From 715d6376bf87e102fd8a46af2f18dcc83ca913e0 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 15 Apr 2018 14:29:09 -0700 Subject: First stab at docker-based test framework Signed-off-by: Alexey Neyman diff --git a/.gitignore b/.gitignore index 0f5d8a9..aecaf7f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ config/versions/ verbatim-data.mk maintainer/package-versions +*.tar.xz +*.tar.bz2 + # Temporaries .*.swp build.log diff --git a/testing/docker/archlinux/Dockerfile b/testing/docker/archlinux/Dockerfile new file mode 100644 index 0000000..eee2f47 --- /dev/null +++ b/testing/docker/archlinux/Dockerfile @@ -0,0 +1,3 @@ +FROM hoverbear/archlinux +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm base-devel git help2man python diff --git a/testing/docker/common-scripts/ctng-build-all b/testing/docker/common-scripts/ctng-build-all new file mode 100755 index 0000000..f29093a --- /dev/null +++ b/testing/docker/common-scripts/ctng-build-all @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e +cd +rm -rf bld-ctng +mkdir bld-ctng +cd bld-ctng +/crosstool-ng/configure --prefix=$HOME/inst-ctng +make +make install diff --git a/testing/docker/common-scripts/ctng-install b/testing/docker/common-scripts/ctng-install new file mode 100755 index 0000000..f29093a --- /dev/null +++ b/testing/docker/common-scripts/ctng-install @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e +cd +rm -rf bld-ctng +mkdir bld-ctng +cd bld-ctng +/crosstool-ng/configure --prefix=$HOME/inst-ctng +make +make install diff --git a/testing/docker/common-scripts/su-as-user b/testing/docker/common-scripts/su-as-user new file mode 100755 index 0000000..7f262ac --- /dev/null +++ b/testing/docker/common-scripts/su-as-user @@ -0,0 +1,15 @@ +#!/bin/bash + +usr=$1 +uid=$2 +grp=$3 +gid=$4 +shift 4 + +groupadd -g ${gid} ${grp} +useradd -d /home/${usr} -m -g ${gid} -u ${uid} ${usr} +if [ -z "$*" ]; then + exec su -l ${usr} +else + exec su -l -c "/bin/bash -c '$*'" +fi diff --git a/testing/docker/dmgr.sh b/testing/docker/dmgr.sh new file mode 100755 index 0000000..6d88d51 --- /dev/null +++ b/testing/docker/dmgr.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# Run from the directory containing this script +cd `dirname $0` + +msg() +{ + echo "INFO :: $*" >&2 +} + +error() +{ + echo "ERROR :: $*" >&2 + exit 1 +} + +usage() +{ + cat >&2 < Date: Sun, 15 Apr 2018 14:29:37 -0700 Subject: Require libtool be present Signed-off-by: Alexey Neyman diff --git a/configure.ac b/configure.ac index 5cb82a8..765eae1 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,7 @@ CTNG_PROG_VERSION_REQ_ANY([MAKE], [make_3_81_or_newer]) # Check other companion tools that we may or may not build. -CTNG_PROG_VERSION([LIBTOOL], +CTNG_PROG_VERSION_REQ_STRICT([LIBTOOL], [GNU libtool >= 2.4], [libtool], [glibtool libtool], -- cgit v0.10.2-6-g49f6 From 345dc4161d937c302248ea34ea55a9abc4bf343d Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 15 Apr 2018 20:23:33 -0700 Subject: Testing works for archlinux docker Signed-off-by: Alexey Neyman diff --git a/.gitignore b/.gitignore index aecaf7f..f96b59b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ build.log temp.* stamp-h1 +# Testing +testing/docker/build-* + # This is the place where toolchains are built .build/ # .. and log for 'build-all' diff --git a/testing/docker/common-scripts/ctng-build-all b/testing/docker/common-scripts/ctng-build-all deleted file mode 100755 index f29093a..0000000 --- a/testing/docker/common-scripts/ctng-build-all +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -e -cd -rm -rf bld-ctng -mkdir bld-ctng -cd bld-ctng -/crosstool-ng/configure --prefix=$HOME/inst-ctng -make -make install diff --git a/testing/docker/common-scripts/ctng-test-all b/testing/docker/common-scripts/ctng-test-all new file mode 100755 index 0000000..f0ba266 --- /dev/null +++ b/testing/docker/common-scripts/ctng-test-all @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e +cd +rm -rf bld-samples +mkdir bld-samples +cd bld-samples +export PATH=$HOME/inst-ctng/bin:$PATH +ct-ng help +ct-ng list-samples +ct-ng list-steps +ct-ng build-all diff --git a/testing/docker/common-scripts/su-as-user b/testing/docker/common-scripts/su-as-user index 7f262ac..99246f2 100755 --- a/testing/docker/common-scripts/su-as-user +++ b/testing/docker/common-scripts/su-as-user @@ -8,8 +8,9 @@ shift 4 groupadd -g ${gid} ${grp} useradd -d /home/${usr} -m -g ${gid} -u ${uid} ${usr} +ln -sf /src /home/${usr}/src if [ -z "$*" ]; then exec su -l ${usr} else - exec su -l -c "/bin/bash -c '$*'" + exec su -l -c "/bin/bash -c '$*'" ${usr} fi diff --git a/testing/docker/dmgr.sh b/testing/docker/dmgr.sh index 6d88d51..5dbb8b2 100755 --- a/testing/docker/dmgr.sh +++ b/testing/docker/dmgr.sh @@ -51,6 +51,7 @@ _dckr() -v `pwd`/common-scripts:/setup-scripts:ro \ -v ${topdir}:/crosstool-ng:ro \ -v `pwd`/build-${cntr}:/home \ + -v $HOME/src:/src:ro \ ctng-${cntr} \ /setup-scripts/su-as-user `id -un` `id -u` `id -gn` `id -g` "$@" } @@ -64,7 +65,7 @@ action_test() msg "Setting up crosstool-NG in ${cntr}" _dckr "${cntr}" /setup-scripts/ctng-install msg "Running build-all in ${cntr}" - _dckr "${cntr}" /setup-scripts/ctng-build-all + _dckr "${cntr}" /setup-scripts/ctng-test-all } # Enter the container using the same user account/environment as for testing. -- cgit v0.10.2-6-g49f6