From b5776014890258fd5865917d2e2f7ea90d89d574 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 4 Nov 2021 06:23:41 -0400 Subject: 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 --- tests/.gitignore | 8 +++++++ tests/2.4.6/configure.ac | 4 ++++ tests/README.md | 7 ++++++ tests/run.sh | 31 ++++++++++++++++++++++++ tests/setup.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+) create mode 100644 tests/.gitignore create mode 100644 tests/2.4.6/configure.ac create mode 100644 tests/README.md create mode 100755 tests/run.sh create mode 100755 tests/setup.sh 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 -- cgit v1.2.3-65-gdbad