summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/aux/setup.sh30
-rwxr-xr-xtests/exe/ob-buildenv.sh12
-rw-r--r--tests/local.mk1
3 files changed, 31 insertions, 12 deletions
diff --git a/tests/aux/setup.sh b/tests/aux/setup.sh
new file mode 100644
index 0000000..a2b7170
--- /dev/null
+++ b/tests/aux/setup.sh
@@ -0,0 +1,30 @@
+# Test package setup
+#
+# Copyright (C) 2019 Patrick McDermott
+#
+# This file is part of opkbuild.
+#
+# opkbuild is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# opkbuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with opkbuild. If not, see <http://www.gnu.org/licenses/>.
+
+set -eu
+
+rm -Rf 'pkg/'
+mkdir -p 'pkg/tmp/'
+cd 'pkg/'
+printf '2.0\n' >'format'
+printf 'Maintainer: "J. Random Hacker" <jrandom@example.com>\n' >'control'
+printf 'foo (1.0) trunk\n * Initial release.\n -- %s %s\n' \
+ '"J. Random Hacker" <jrandom@example.com>' \
+ 'Thu, 01 Jan 1970 00:00:00 +0000' >'changelog'
+cd 'tmp/'
diff --git a/tests/exe/ob-buildenv.sh b/tests/exe/ob-buildenv.sh
index 0fab5a2..4440fd2 100755
--- a/tests/exe/ob-buildenv.sh
+++ b/tests/exe/ob-buildenv.sh
@@ -24,15 +24,6 @@ set -eu
plan_ 1
-mkdir -p 'pkg/tmp/'
-cd 'pkg/'
-printf '2.0\n' >'format'
-printf 'Maintainer: "J. Random Hacker" <jrandom@example.com>\n' >'control'
-printf 'foo (1.0) trunk\n * Initial release.\n -- %s %s\n' \
- '"J. Random Hacker" <jrandom@example.com>' \
- 'Thu, 01 Jan 1970 00:00:00 +0000' >'changelog'
-cd 'tmp/'
-
OPK_BUILD_ARCH='amd64-linux-glibc' OPK_HOST_ARCH='i686-linux-glibc' \
cmd_is 'ob-buildenv' ob-buildenv <<-EOF
PATH='${PATH}'
@@ -52,6 +43,3 @@ OPK_BUILD_ARCH='amd64-linux-glibc' OPK_HOST_ARCH='i686-linux-glibc' \
STRIP='i686-linux-glibc-strip'
OPK_TOOL_PREFIX='i686-linux-glibc-'
EOF
-
-cd '../../'
-rm -Rf 'pkg/'
diff --git a/tests/local.mk b/tests/local.mk
index 3f78473..f3a5772 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -9,6 +9,7 @@ TESTS = \
%reldir%/exe/ob-buildenv.sh
TEST_EXTENSIONS = .sh
SH_LOG_DRIVER = \
+ $(SHELL) $(top_srcdir)/tests/aux/setup.sh && \
AM_TAP_AWK='$(AWK)' \
TOP_SRCDIR="$(top_srcdir)" \
TOP_BUILDDIR="$(top_builddir)" \