aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-08 02:32:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-08 02:32:38 +0000
commitfc06c987699d025b6828bc07b9ece67d4c610e5e (patch)
treeccd14d606c15002f5f1b0313142750c1827322dc
parent4c476459a63129a45844e9e37a29241028d0440a (diff)
downloadpaludis-fc06c987699d025b6828bc07b9ece67d4c610e5e.tar.gz
paludis-fc06c987699d025b6828bc07b9ece67d4c610e5e.tar.xz
Add PAULDIS_NO_GLOBAL_HOOKS env var, for test cases. Do a full package install as part of the test cases.
-rw-r--r--paludis/default_environment.cc7
-rw-r--r--src/Makefile.am30
-rwxr-xr-xsrc/install_TEST_cleanup.sh11
-rwxr-xr-xsrc/install_TEST_setup.sh89
4 files changed, 128 insertions, 9 deletions
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 6f14744..699df23 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -362,8 +362,11 @@ namespace
if (! done_hooks)
{
add_one_hook(DefaultConfig::get_instance()->config_dir() + "/hooks", result);
- add_one_hook(LIBEXECDIR "/paludis/hooks", result);
- add_one_hook(DATADIR "/paludis/hooks", result);
+ if (getenv_with_default("PALUDIS_NO_GLOBAL_HOOKS", "").empty())
+ {
+ add_one_hook(LIBEXECDIR "/paludis/hooks", result);
+ add_one_hook(DATADIR "/paludis/hooks", result);
+ }
done_hooks = true;
}
return result;
diff --git a/src/Makefile.am b/src/Makefile.am
index 6734acf..2eabf8d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,27 +28,43 @@ paludis_LDADD = \
TESTS_ENVIRONMENT = env \
TEST_SCRIPT_DIR="$(srcdir)/" \
- PALUDIS_SKIP_CONFIG="yes" \
+ PALUDIS_NO_GLOBAL_HOOKS="yes" \
+ PALUDIS_EBUILD_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_srcdir)/ebuild/`" \
+ SYSCONFDIR="$(sysconfdir)" \
bash $(top_srcdir)/test/run_test.sh bash
TESTS = version_TEST help_TEST list_sync_formats_TEST \
- list_repository_formats_TEST list_dep_tag_categories_TEST
+ list_repository_formats_TEST list_dep_tag_categories_TEST \
+ exception_TEST install_TEST
+
+EXTRA_DIST = install_TEST_setup.sh install_TEST_cleanup.sh
CLEANFILES = *~ $(TESTS) gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in
version_TEST : paludis
- echo -e "#!/bin/sh\n./paludis --version" > $@
+ echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --version" > $@
help_TEST : paludis
- echo -e "#!/bin/sh\n./paludis --help" > $@
+ echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --help" > $@
+
+exception_TEST : paludis
+ echo -e "#!/bin/sh\nenv PALUDIS_HOME=./ \\" > $@
+ echo -e " ./paludis --config-suffix paludis-build-test -pi asdf 2>&1 \\" >> $@
+ echo -e " | grep 'Default configuration error' >/dev/null" >> $@
list_sync_formats_TEST : paludis
- echo -e "#!/bin/sh\n./paludis --list-sync-protocols" > $@
+ echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-sync-protocols" > $@
list_repository_formats_TEST : paludis
- echo -e "#!/bin/sh\n./paludis --list-repository-formats" > $@
+ echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-repository-formats" > $@
list_dep_tag_categories_TEST : paludis
- echo -e "#!/bin/sh\n./paludis --list-dep-tag-categories" > $@
+ echo -e "#!/bin/sh\nenv PALUDIS_SKIP_CONFIG=yes ./paludis --list-dep-tag-categories" > $@
+
+install_TEST : paludis
+ echo -e "#!/bin/sh\nenv \\" > $@
+ echo -e " PALUDIS_HOME=./install_TEST_dir/config/ \\" >> $@
+ echo -e " ./paludis --config-suffix install-test --install target" >> $@
+ echo -e "./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null" >> $@
diff --git a/src/install_TEST_cleanup.sh b/src/install_TEST_cleanup.sh
new file mode 100755
index 0000000..92bb92a
--- /dev/null
+++ b/src/install_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d install_TEST_dir ] ; then
+ rm -fr install_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/src/install_TEST_setup.sh b/src/install_TEST_setup.sh
new file mode 100755
index 0000000..20416cb
--- /dev/null
+++ b/src/install_TEST_setup.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir install_TEST_dir || exit 1
+cd install_TEST_dir || exit 1
+
+mkdir -p config/.paludis-install-test
+cat <<END > config/.paludis-install-test/specpath
+root = `pwd`/root
+config-suffix =
+END
+
+mkdir -p root/${SYSCONFDIR}/paludis/repositories
+cat <<END > root/${SYSCONFDIR}/paludis/use.conf
+* foo
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf
+* *
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf
+* test
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/bashrc
+export CHOST="my-chost"
+export USER_BASHRC_WAS_USED=yes
+END
+
+cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf
+location = `pwd`/repo1
+cache = /var/empty
+format = portage
+profile = \${location}/profiles/testprofile
+buildroot = `pwd`/build
+END
+
+mkdir -p root/tmp
+touch root/${SYSCONFDIR}/ld.so.conf
+
+mkdir -p repo1/{eclass,distfiles,profiles/testprofile,test-category/target/files} || exit 1
+
+mkdir -p src/target-2
+cat <<"END" > src/target-2/testbin
+#!/bin/bash
+echo "Test was a success"
+END
+chmod +x src/target-2/testbin
+cd src
+tar zcf target-2.tar.gz target-2/
+mv target-2.tar.gz ../repo1/distfiles/
+cd ..
+rm -fr src
+
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+test-category
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+
+cat <<"END" > test-category/target/target-2.ebuild || exit 1
+DESCRIPTION="Test target"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI="http://invalid.domain/${P}.tar.gz"
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -z "${USER_BASHRC_WAS_USED}" ]] && die "bad env"
+}
+
+src_test() {
+ ./testbin | grep success || die "failure"
+}
+
+src_install() {
+ dobin testbin
+}
+END
+cd ..
+