[ostree] Install tests
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] Install tests
- Date: Wed, 1 May 2013 19:40:02 +0000 (UTC)
commit e9a181c67d7d9bccc4aafd172b14996ae4dc5d43
Author: Colin Walters <walters verbum org>
Date: Wed May 1 15:26:21 2013 -0400
Install tests
Matching https://live.gnome.org/GnomeGoals/InstalledTests
Makefile-tests.am | 49 +++++++++++++++++++++++++++++++++++++++++
Makefile.am | 2 +
configure.ac | 6 +++++
tests/libtest.sh | 23 ++++---------------
tests/t0000-basic.sh | 3 +-
tests/t0001-archive.sh | 2 +-
tests/t0002-archivez.sh | 2 +-
tests/t0003-log.sh | 2 +-
tests/t0004-remote-add.sh | 2 +-
tests/t0005-corruption.sh | 2 +-
tests/t0006-libarchive.sh | 2 +-
tests/t0011-pull-archive-z.sh | 6 ++--
12 files changed, 72 insertions(+), 29 deletions(-)
---
diff --git a/Makefile-tests.am b/Makefile-tests.am
new file mode 100644
index 0000000..cd22ab2
--- /dev/null
+++ b/Makefile-tests.am
@@ -0,0 +1,49 @@
+# Makefile for tests code
+#
+# Copyright (C) 2013 Colin Walters <walters verbum org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+
+if BUILDOPT_INSTALL_TESTS
+insttestdir=$(pkglibexecdir)/installed-tests
+testfiles = t0000-basic \
+ t0001-archive \
+ t0002-archivez \
+ t0003-log \
+ t0004-remote-add \
+ t0005-corruption \
+ t0006-libarchive \
+ t0011-pull-archive-z \
+ $(NULL)
+insttest_SCRIPTS = $(addprefix tests/,$(testfiles:=.sh))
+
+insttest_DATA = tests/archive-test.sh \
+ tests/pull-test.sh \
+ tests/libtest.sh \
+ $(NULL)
+
+%.test: tests/%.sh Makefile
+ $(AM_V_GEN) (echo '[Test]' > $ tmp; \
+ echo 'Exec=$(pkglibexecdir)/installed-tests/$(notdir $<)' >> $ tmp; \
+ echo 'Type=session' >> $ tmp; \
+ echo 'Output=TAP' >> $ tmp; \
+ mv $ tmp $@)
+
+testmetadir = $(datadir)/installed-tests/$(PACKAGE)
+testmeta_DATA = $(testfiles:=.test)
+
+endif
diff --git a/Makefile.am b/Makefile.am
index e73c988..e3ce06c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,8 @@ include Makefile-libostree.am
include Makefile-ostree.am
include Makefile-switchroot.am
include Makefile-triggers.am
+include Makefile-tests.am
+
# Docbook generation copied from systemd/Makefile.am
#
diff --git a/configure.ac b/configure.ac
index a81dead..d95f5d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,12 @@ AC_ARG_ENABLE(triggers-only,
enable_triggers_only=no)
AM_CONDITIONAL(TRIGGERS_ONLY, test x$enable_triggers_only != xno)
+AC_ARG_ENABLE(installed_tests,
+ AS_HELP_STRING([--enable-installed-tests],
+ [Install test programs (default: no)]),,
+ [enable_installed_tests=no])
+AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
+
AC_CHECK_HEADER([attr/xattr.h],,[AC_MSG_ERROR([You must have attr/xattr.h from libattr])])
PKG_PROG_PKG_CONFIG
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 93f8a7d..e4518f1 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -17,14 +17,8 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-cd `dirname $0`
-SRCDIR=`pwd`
-cd -
-TMPDIR=${TMPDIR:-/tmp}
-export TMPDIR
-test_tmpdir=`mktemp -d "$TMPDIR/ostree-tests.XXXXXXXXXX"`
-cd "$test_tmpdir"
-touch "$test_tmpdir/.test$$"
+SRCDIR=$(dirname $0)
+test_tmpdir=$(pwd)
export G_DEBUG=fatal-warnings
@@ -36,14 +30,6 @@ if test -n "$OT_TESTS_VALGRIND"; then
CMD_PREFIX="env G_SLICE=always-malloc valgrind -q --leak-check=full --num-callers=30
--suppressions=${SRCDIR}/ostree-valgrind.supp"
fi
-die () {
- if test -z "$OT_TESTS_DEBUG"; then
- test -f "$test_tmpdir/.test$$" && rm -rf "$test_tmpdir"
- else
- echo "Temporary files saved in $test_tmpdir"
- fi
-}
-
assert_streq () {
test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
}
@@ -110,6 +96,9 @@ setup_test_repository () {
}
setup_fake_remote_repo1() {
+ if ! test -x ${SRCDIR}/run-apache; then
+ exit 77
+ fi
mode=$1
shift
oldpwd=`pwd`
@@ -170,5 +159,3 @@ EOF
export OSTREE="ostree --repo=repo"
}
-
-trap 'die' EXIT
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 60c20a6..a55c748 100755
--- a/tests/t0000-basic.sh
+++ b/tests/t0000-basic.sh
@@ -21,7 +21,7 @@ set -e
echo "1..30"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
echo "ok setup"
@@ -218,4 +218,3 @@ echo "ok subdir enoent"
cd ${test_tmpdir}
$OSTREE checkout test2 --allow-noent --subpath /enoent 2>/dev/null
echo "ok subdir noent"
-
diff --git a/tests/t0001-archive.sh b/tests/t0001-archive.sh
index 642cdf9..c9f934c 100755
--- a/tests/t0001-archive.sh
+++ b/tests/t0001-archive.sh
@@ -19,7 +19,7 @@
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..11'
diff --git a/tests/t0002-archivez.sh b/tests/t0002-archivez.sh
index 0844816..b9f4191 100755
--- a/tests/t0002-archivez.sh
+++ b/tests/t0002-archivez.sh
@@ -19,7 +19,7 @@
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..11'
diff --git a/tests/t0003-log.sh b/tests/t0003-log.sh
index 2fb5ea8..7c415ff 100755
--- a/tests/t0003-log.sh
+++ b/tests/t0003-log.sh
@@ -19,7 +19,7 @@
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo "1..1"
diff --git a/tests/t0004-remote-add.sh b/tests/t0004-remote-add.sh
index ffab0fa..252090b 100755
--- a/tests/t0004-remote-add.sh
+++ b/tests/t0004-remote-add.sh
@@ -19,7 +19,7 @@
set -e
-. libtest.sh
+. $(dirname $0)/libtest.sh
echo '1..2'
diff --git a/tests/t0005-corruption.sh b/tests/t0005-corruption.sh
index 3961d46..258e0bd 100755
--- a/tests/t0005-corruption.sh
+++ b/tests/t0005-corruption.sh
@@ -21,7 +21,7 @@ set -e
echo "1..1"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
$OSTREE checkout test2 checkout-test2
diff --git a/tests/t0006-libarchive.sh b/tests/t0006-libarchive.sh
index d941f47..4936389 100755
--- a/tests/t0006-libarchive.sh
+++ b/tests/t0006-libarchive.sh
@@ -21,7 +21,7 @@ set -e
echo "1..7"
-. libtest.sh
+. $(dirname $0)/libtest.sh
setup_test_repository "bare"
cd ${test_tmpdir}
diff --git a/tests/t0011-pull-archive-z.sh b/tests/t0011-pull-archive-z.sh
index c06003f..0d20852 100755
--- a/tests/t0011-pull-archive-z.sh
+++ b/tests/t0011-pull-archive-z.sh
@@ -19,10 +19,10 @@
set -e
-. libtest.sh
-
-echo '1..2'
+. $(dirname $0)/libtest.sh
setup_fake_remote_repo1 "archive-z2"
+echo '1..2'
+
. ${SRCDIR}/pull-test.sh
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]