diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-11-04 06:23:41 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-11-04 06:23:41 -0400 |
commit | b5776014890258fd5865917d2e2f7ea90d89d574 (patch) | |
tree | 10ca59a97f0cb52f83c546c00d1f35b2cd762d7f | |
parent | eltpatch: allow ELT_patchdir to be overridden via env (diff) | |
download | elt-patches-b5776014890258fd5865917d2e2f7ea90d89d574.tar.gz elt-patches-b5776014890258fd5865917d2e2f7ea90d89d574.tar.bz2 elt-patches-b5776014890258fd5865917d2e2f7ea90d89d574.zip |
tests: start basic framework for ad-hoc testing
It's not automated (i.e. no `make check`), but it's enough for local
ad-hoc testing to check patches work against libtool-2.4.6 at least.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | tests/.gitignore | 8 | ||||
-rw-r--r-- | tests/2.4.6/configure.ac | 4 | ||||
-rw-r--r-- | tests/README.md | 7 | ||||
-rwxr-xr-x | tests/run.sh | 31 | ||||
-rwxr-xr-x | tests/setup.sh | 62 |
5 files changed, 112 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..0cff469 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,8 @@ +/libtools/ +/*.tmp/ +aclocal.m4 +autom4te.cache/ +config.guess +config.sub +configure +ltmain.sh diff --git a/tests/2.4.6/configure.ac b/tests/2.4.6/configure.ac new file mode 100644 index 0000000..764d8df --- /dev/null +++ b/tests/2.4.6/configure.ac @@ -0,0 +1,4 @@ +AC_PREREQ([2.69]) +AC_INIT([elt-patches], [ver]) +LT_INIT +AC_OUTPUT diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..ccfd78f --- /dev/null +++ b/tests/README.md @@ -0,0 +1,7 @@ +To run the tests, first initialize the environment: +$ ./setup.sh + +Then run the tests: +$ ./run.sh + +Logs will be stored in the tmp dir for checking. diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 0000000..5424085 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Copyright 1999-2021 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Run eltpatch against copies of libtool for quick testing. + +set -e +cd "$(dirname "$(realpath "$0")")" + +export LD=ld +export CHOST=x86_64-gentoo-linux-gnu +export ELT_patchdir="${PWD}/../patches" +eltpatch=${PWD}/../eltpatch + +test() { + local PV="$1" + + rm -rf "${PV}.tmp" + cp -a "${PV}" "${PV}.tmp" + export S="${PWD}/${PV}.tmp" + export TMPDIR=${S} + "${eltpatch}" +} + +mkdir -p libtools +for f in *.*/configure.ac ; do + v=${f%/*} + [[ ${v} == *.tmp ]] && continue + echo "### ${v}" + test "${v}" +done diff --git a/tests/setup.sh b/tests/setup.sh new file mode 100755 index 0000000..6b2022d --- /dev/null +++ b/tests/setup.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright 1999-2021 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Setup local copies of pristine libtool for testing against. + +set -e +cd "$(dirname "$(realpath "$0")")" + +: "${DISTDIR:=/var/cache/distfiles}" +URI_BASE="https://ftpmirror.gnu.org/libtool/" + +setup() { + local PV="$1" + local P="libtool-${PV}" + local A="${P}.tar.xz" + + script="libtools/${P}/destdir/bin/libtool" + if [[ -e ${script} ]] ; then + return + fi + + pushd libtools >/dev/null + rm -rf "${P}" + if [[ -e ${DISTDIR}/${A} ]] ; then + printf "unpack " + tar xf "${DISTDIR}/${A}" + else + if [[ ! -e ${A} ]] ; then + printf "fetch " + wget -nv "${URI_BASE}/${A}" + fi + printf "unpack " + tar xf "${A}" + fi + + printf "compile " + cd "${P}" + ./configure --prefix="${PWD}/destdir" -q >/dev/null + make install -j -s >/dev/null + + popd >/dev/null +} + +build() { + local PV="$1" + + pushd "${PV}" >/dev/null + PATH="${PWD}/../libtools/libtool-${PV}/destdir/bin:${PATH}" + autoreconf -i + popd >/dev/null +} + +mkdir -p libtools +for f in *.*/configure.ac ; do + v=${f%/*} + [[ ${v} == *.tmp ]] && continue + printf "${v}: " + setup "${v}" + build "${v}" + echo "done" +done |